Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Buchanan aaronbuchanan

View GitHub Profile
@aaronbuchanan
aaronbuchanan / geojson_us.js
Created Jun 30, 2017 — forked from adamawolf/geojson_us.js
GeoJSON Multipolygon for the United States
View geojson_us.js
{
"type": "MultiPolygon",
"coordinates":
[
[
[
[ -123.123779, 48.227039 ], // contig. u.s.
[ -123.318787, 49.000042 ],
[ -121.742592, 49.000267 ],
[ -95.157394, 49.000493 ],
View Better Git Commit Messages
https://news.ycombinator.com/item?id=13889155
7 git rules:
1. Separate subject from body with a blank line
2. Limit the subject line to 50 characters
3. Capitalize the subject line
4. Do not end the subject line with a period
5. Use the imperative mood in the subject line
6. Wrap the body at 72 characters
View ArcadeControl.js
let noop = function() {
};
export default class ArcadeController {
static factory(moveStartCallback, moveCallback, fireCallback, cbContext) {
return new Phaser.ArcadeController(this.game, moveStartCallback, moveCallback, fireCallback, cbContext)
}
constructor(game, moveStartCallback = noop, moveCallback = noop, fireCallback = noop, callbackContext) {
game.input.holdRate = 150;
game.input.touch.consumeDocumentTouches();
@ddprrt
ddprrt / Gulpfile.js
Last active May 8, 2020
Gulp: Grabbing JavaScript assets from a CDN to add to your build pipeline
View Gulpfile.js
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var request = require('request');
var merge = require('merge2');
var concat = require('gulp-concat');
var buffer = require('gulp-buffer');
/**
* 1. We request the latest jQuery version from the jQuery CDN. The
* request package allows for streaming. What we get in return
@simevidas
simevidas / es6-numbers-summary.md
Last active Sep 21, 2015
A summary of Nicolas Bevacqua’s post on ES6 Number improvements
View es6-numbers-summary.md

ES6 Number improvements

  • use the 0b prefix for binary, and the 0o prefix for octal integer literals
  • Number.isNaN and Number.isFinite are like their global namesakes, except that they don’t coerce the argument to Number
  • Number.parseInt and Number.parseFloat are exactly the same as their global namesakes
  • use Number.isInteger to check if the argument is a Number value that doesn’t have a decimal part
  • use Number.EPSILON to check if the difference between two Number values is negligible (e.g. the difference between 0.1 + 0.2 and 0.3 is negligible)
  • Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER are the largest and smallest integers that can be safely and precisely represented in JavaScript
  • use Number.isSafeInteger to check if an integer is within those bounds
View Good-CONTRIBUTING.md-template.md

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
View gist:68b41fa7f2c5aa74e0ac
@implementation InterfaceController
{
SRWebSocket *_webSocket;
}
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
}
- (IBAction)didOpen {
@nolanlawson
nolanlawson / couchdb_changes.md
Last active Apr 11, 2020
Anatomy of the CouchDB changes feed
View couchdb_changes.md

Anatomy of the CouchDB changes feed

I just spent a lot of time finally understanding CouchDB's changes feed, so I thought I'd do a short writeup here.

The mystery

Let's imagine the following changes to the database. There are two documents, A and B:

_id seq rev winner?
@mjackson
mjackson / FirebaseStateMixin.js
Last active Feb 5, 2016
A simple mixin for React components that need to bind state to a Firebase ref
View FirebaseStateMixin.js
var Firebase = require('firebase');
var baseRef = new Firebase('https://my-firebase.firebaseio.com');
function getSnapshotValue(snapshot) {
return snapshot.val();
}
/**
* A mixin for components that want to bind the value of a state variable
* to the value at a Firebase ref.
You can’t perform that action at this time.