Skip to content

Instantly share code, notes, and snippets.

Andrew Shelton sheltonial

Block or report user

Report or block sheltonial

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericelliott
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]);
foo.map(x => x * 2).subscribe(n => console.log(n));
@dijs
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 => {
jsdom.env({
url: "http://bar.com/",
done (err, window) {
var frame = window.document.createElement('iframe');
window.document.body.appendChild(frame);
@magnetikonline
magnetikonline / README.md
Last active Dec 6, 2016
JavaScript OO class / object inheritance techniques.
View README.md

JavaScript object inheritance techniques

Via Object.create()

function Shape(x,y) {

	this.x = x;
	this.y = y;
}
@magnetikonline
magnetikonline / corstest.sh
Last active Aug 9, 2018
Simulate CORS GET web requests using curl.
View corstest.sh
#!/bin/bash -e
LINE_BREAK="======================================"
REQUEST_HEADERS="Content-Type"
REQUEST_METHOD="GET"
function exitError {
echo "Error: $1" >&2
@magnetikonline
magnetikonline / README.md
Last active Oct 2, 2019
AWS Elastic Beanstalk deploy user restricted IAM policy.
View README.md

AWS Elastic Beanstalk deploy user restricted IAM policy

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.
@justmoon
justmoon / custom-error.js
Last active Sep 21, 2019 — forked from subfuzion/error.md
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.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@macbre
macbre / chrome-first-paint.js
Created Oct 21, 2014
Chrome's first paint timing
View chrome-first-paint.js
// 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;
}
@d11wtq
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
dctrwatson / nginx.conf
Last active May 15, 2019
Caching NPM proxy using Nginx
View nginx.conf
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active Oct 18, 2019
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

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

Instructions

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

You can’t perform that action at this time.