Skip to content

Instantly share code, notes, and snippets.

View chrisabrams's full-sized avatar

Chris Abrams chrisabrams

  • Austin, TX
View GitHub Profile

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.

@chrisabrams
chrisabrams / Nginx Proxy Pass
Created February 16, 2014 07:08
Simple reminder of how to proxy pass
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:4040/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@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";
}
@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 / 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 / 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])
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() {
// Declarations
function getUser(id, cb) {
api.get('http://url/user/' + id, function(data) {
cb(data)
})
}
@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
@chrisabrams
chrisabrams / anchor.js
Created January 9, 2012 18:52 — forked from draeton/anchor.js
Anchor - A URL parsing utility
/**
* Anchor - A URL parsing utility
*
* Copyright 2012, Matthew Cobbs
* MIT licensed
*
* Methods:
*
* getSearchVars - returns a key-value object with the parameters in the URL search
* setSearchVars(o) - sets parameters using a key-value object in the URL search