Skip to content

Instantly share code, notes, and snippets.

View chrisabrams's full-sized avatar

Chris Abrams chrisabrams

  • Austin, TX
View GitHub Profile
@chrisabrams
chrisabrams / foo.js
Created November 18, 2015 20:22
something like this
{
"author": {
"name"
"image"
}
"items": [
{
"caption": "im a caption",
"image": {
"src": "something.jpg"
@chrisabrams
chrisabrams / foo.js
Created September 16, 2015 04:16
How do I get `this.foo` to be assigned to class B's prototype instead of class A's prototype?
/*
How do I get `this.foo` to be assigned to class B's prototype instead of class A's prototype?
*/
class A {
constructor(options = {}) {
this.foo = options.foo

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

// Declarations
function getUser(id, cb) {
api.get('http://url/user/' + id, function(data) {
cb(data)
})
}
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var livereload = require('gulp-livereload');
var hbsfy = require("hbsfy").configure({
extensions: ["html"]
});
gulp.task('watch', function() {
@chrisabrams
chrisabrams / Gruntfile.coffee
Last active August 29, 2015 14:01
Chaplin + Browserify
glob = require 'glob'
grunt = require 'grunt'
util = require 'util'
aliasMappingsToAliasArray = (aliasMappings) ->
aliasArray = []
aliases = (if util.isArray(aliasMappings) then aliasMappings else [aliasMappings])
@chrisabrams
chrisabrams / sample.js
Created April 17, 2014 21:17
Q deferred promises chain
Q = require('q')
var A = function() {
var d = Q.defer()
var result = 'A is done'
console.log(result)
d.resolve(result);
@chrisabrams
chrisabrams / sample.js
Created April 17, 2014 21:11
Bluebird promise chain example
Promise = require('bluebird')
var A = function() {
return new Promise(function(resolve, reject) {
var result = 'A is done'
console.log(result)
resolve(result);
})
@chrisabrams
chrisabrams / test.js
Created April 10, 2014 00:40
Promises with stubs in Mocha
chai = require('chai')
sinonChai = require('sinon-chai')
chai.use(sinonChai)
sinon = require('sinon')
expect = chai.expect
Q = require('q')
var db = {
query: function(sql) {
@chrisabrams
chrisabrams / gist:9283069
Created March 1, 2014 00:57
boot2docker forward port
b2dforwardport() {
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$1,tcp,,$1,,$1";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$1,udp,,$1,,$1";
}