function Shape(x,y) {
this.x = x;
this.y = y;
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable } from 'rxjs/Observable'; | |
// then patch import only needed operators: | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/observable/from'; | |
const foo = Observable.from([1, 2, 3]); | |
foo.map(x => x * 2).subscribe(n => console.log(n)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { expect } from 'chai'; | |
import jsdom from 'jsdom'; | |
describe('JSDOM', () => { | |
it('should communicate with inner iframes', done => { | |
jsdom.env({ | |
url: "http://bar.com/", | |
done (err, window) { | |
var frame = window.document.createElement('iframe'); | |
window.document.body.appendChild(frame); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
LINE_BREAK="======================================" | |
REQUEST_HEADERS="Content-Type" | |
REQUEST_METHOD="GET" | |
function exitError { | |
echo "Error: $1" >&2 |
An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.
Where:
REGION
: AWS region.ACCOUNT_ID
: AWS account ID.APPLICATION_NAME
: Desired target Elastic Beanstalk application name(space).IAM_INSTANCE_PROFILE_ROLE
: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function CustomError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
require('util').inherits(module.exports, Error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first paint in chrome from https://github.com/addyosmani/timing.js | |
var hasFirstPaint = 0; | |
if (window.chrome && window.chrome.loadTimes) { | |
var paint = window.chrome.loadTimes().firstPaintTime * 1000; | |
var firstPaint = paint - (window.chrome.loadTimes().startLoadTime*1000); | |
var firstPaintLeft = (firstPaint / loaded)*100; | |
hasFirstPaint = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash |
I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.
I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 4; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
NewerOlder