Skip to content

Instantly share code, notes, and snippets.


Andrew Shelton sheltonial

View GitHub Profile
ericelliott / rxjs-patching.js
Created Dec 10, 2016
Reduce bundle size with RxJS patching
View rxjs-patching.js
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]); => x * 2).subscribe(n => console.log(n));
dijs / jsdom-iframe-test.js
Created Jul 20, 2016
Example of testing iframe messaging using jsdom
View jsdom-iframe-test.js
import { expect } from 'chai';
import jsdom from 'jsdom';
describe('JSDOM', () => {
it('should communicate with inner iframes', done => {
url: "",
done (err, window) {
var frame = window.document.createElement('iframe');
magnetikonline /
Last active Dec 6, 2016
JavaScript OO class / object inheritance techniques.

JavaScript object inheritance techniques

Via Object.create()

function Shape(x,y) {

	this.x = x;
	this.y = y;
magnetikonline /
Last active Aug 9, 2018
Simulate CORS GET web requests using curl.
#!/bin/bash -e
function exitError {
echo "Error: $1" >&2
magnetikonline /
Last active Oct 2, 2020
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.


  • 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.
justmoon / custom-error.js
Last active Nov 16, 2020 — forked from subfuzion/
Creating custom Error classes in Node.js
View custom-error.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor); =;
this.message = message;
this.extra = extra;
require('util').inherits(module.exports, Error);
macbre / chrome-first-paint.js
Created Oct 21, 2014
Chrome's first paint timing
View chrome-first-paint.js
// first paint in chrome from
var hasFirstPaint = 0;
if ( && {
var paint = * 1000;
var firstPaint = paint - (*1000);
var firstPaintLeft = (firstPaint / loaded)*100;
hasFirstPaint = 1;
d11wtq / docker-ssh-forward.bash
Created Jan 29, 2014
How to SSH agent forward into a docker container
View docker-ssh-forward.bash
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
dctrwatson / nginx.conf
Last active Aug 7, 2020
Caching NPM proxy using Nginx
View nginx.conf
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/;
events {
worker_connections 1024;
dergachev /
Last active Nov 23, 2020
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

You can’t perform that action at this time.