Xcrun Error Invalid Active Developer Path After Upgrading to Mac Os Sierra
Error:
After upgrading to mac os Sierra, started getting the following error in terminal:
1 | xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun |
How to fix?
Run the following in terminal:
xcode-select --install
Why?
The problem is git related. On Mac, git is attached to xcode’s command line tools. The above command will download and install xcode developer tools and fix the problem that is one needs to explicity agree to the license agreement.
In Mocha, How to Make Async Setup Complete Before Test Run?
In mocha framework, you can setup/arrange preconditions by using before() beforeEach(), in describe and before it.
The sequence of these hooks are: all before() run once, then beforeEach(), tests, afterEach90, and finally after() run once.
If you want your asynchronous arrange to be completed before everything else happens, you need to use the done parameter in your before request, and call it in the callback.
Mocha will then wait until done is called to start processing the following blocks.
1 | before(function (done) { |
using async/await
1 | before(async () => { |
一生所爱
导演找到他作曲,说影片讲的是一个500年都没有结果的爱情故事,他回去一晚上就写好了,他夫人唐书琛做的词,这些本来就是他们心中的东西,刚好拿出来给了大话西游。中间的二胡太配这个调调了.
本来用的是下面youku版本,无奈片头广告太长,只好换成上面的YouTube,国内的朋友见谅了,翻墙吧少年不听李宗盛,听懂已是不惑年
人生没有白走的路,每一步都算数
How to Use Custom Authorizer for Aws Api Gateway
The customer authoriser is a lambda you created. API gateway use it to authorize the client requests for the configured APIs. Which accepts token, verify it and return IAM policy.
For a valid policy, API Gateway caches the returned policy, associated with the incoming token and used for the current and subsequent requests, over a pre-configured time-to-live (TTL) period of up to 3600 seconds. You can set the TTL period to zero seconds to disable the policy caching. The default TTL value is 300 seconds. Currently, the maximum TTL value of 3600 seconds cannot be increased.
Serverless framework supports this feature by setting resultTtlInSeconds in authorizer.
1 | - http: |
ref:
https://aws.amazon.com/blogs/compute/introducing-custom-authorizers-in-amazon-api-gateway/
https://github.com/awslabs/aws-apigateway-lambda-authorizer-blueprints
http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html
Use Lodash to Simplify Your Javascript Code
Recall the following code? You need to retrieve a property value deep in an object. It smells, doesn’t it?
How can we write it better?
1 | const extractFirstErrorDetails = (errorResponse) => { |
using lodash
_.get(errorResponse, 'data.errors[0].detail', '')
this is the lodash get method
_.get(object, path, [defaultValue])
Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
Post From Mobile
Just to test posting from mobile.
custome authoriser for aws lambda
context.succeed and .fail vs callback()
module load error because of wrong location in config
==highlight==
曾经的你
曾梦想仗剑走天涯,看一看世界的繁华,年少的心总有些轻狂,如今已四海为家