Skip to content

Instantly share code, notes, and snippets.

View colingourlay's full-sized avatar

Colin Gourlay colingourlay

View GitHub Profile
@simenbrekken
simenbrekken / Makefile
Created April 17, 2013 10:07
Basic JS/CSS Makefile
PATH := node_modules/.bin:bin:$(PATH)
HEAD = \
vendor/raven-1.0.*.js \
vendor/modernizr-2.6.*.js
VENDOR = \
vendor/jquery-1.9.*.js \
vendor/jquery.imagesloaded-2.1.*.js \
vendor/lodash-1.0.*.js \
@drzax
drzax / log.js
Created November 15, 2013 01:58
Re-emit a log file generated by Winston.
Tail = require('tail').Tail;
Winston = require('winston');
tail = new Tail('logs/default.log');
logger = new Winston.Logger();
logger.add(Winston.transports.Console, {colorize:true});
tail.on('line', function(data){
var json, date;
try {
var fs = require('fs'),
path = require('path'),
cancer = '.coffee',
body = './body',
totalCells,
cellsChecked;
function killCancerCell(cell) {
fs.unlinkSync(path.join(body, cell));
everything i write on medium is a lie
xoxo j$
@getify
getify / gist:8190952
Last active January 1, 2016 19:29
an actual JS wtf
var a = Array( 3 );
a; // []
a.length; // 3
a.map( function( v, idx ){ return idx; } ); // [ ] <-- WTF?
var b = Array.apply( null, Array(3) );
b; // [undefined,undefined,undefined]
b.length; // 3
b.map( function( v, idx ){ return idx; } ); // [0,1,2] <-- :)
@wrobstory
wrobstory / README.md
Last active February 6, 2016 19:02
d3.chart Choropleths

Choropleth charts built with the d3.chart framework. choropleth_chart.js is the chart type definition, which allows for rapid iteration of different quantize-scale domain/range, colors, and projections. The colors are based on color brewer, and you can pass any of the sequential scale abbreviations ('BuGn', 'PuBuGn', etc) to the range parameter to iterate on colors.

@mbostock
mbostock / .block
Last active February 20, 2016 05:53
Pie Multiples
license: gpl-3.0
@nickjevershed
nickjevershed / interests-disclosure-updates.csv
Created February 29, 2016 00:54
Disclosure Bot database export
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 7.
"interestsUrl","house","dateUpdated","dateScraped","politicianName"
"http://www.aph.gov.au//%7E/media/03%20Senators%20and%20Members/32%20Members/Register/44p/AB/ButlerTerri_44P.pdf","lower","17 July 2015","2015-07-22","Ms Terri Butler"
"http://www.aph.gov.au//%7E/media/03%20Senators%20and%20Members/32%20Members/Register/44p/GK/GambaroT_44P.pdf","lower","13 July 2015","2015-07-22","The Hon Teresa Gambaro"
"http://www.aph.gov.au//%7E/media/03%20Senators%20and%20Members/32%20Members/Register/44p/PS/RoyW_44P.pdf","lower","20 July 2015","2015-07-22","Mr Wyatt Roy"
"http://www.aph.gov.au/~/media/Committees/Senate/committee/interests_ctte/statements2014/BackC_Astat_150717.pdf?la=en","upper","17 July 2015","2015-07-23","Christopher John Back"
"http://www.aph.gov.au/~/media/Committees/Senate/committee/interests_ctte/statements2014/RhiannonL_Astat_140805.pdf?la=en","upper","22 July 2015","2015-07-23","Lee Rhiannon"
"http://www.aph.gov.au//%7E/media/03%20Senators%20and%20Members/32%20Members/Register/44p/AB/BandtA_44P.p
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const byExtension = (obj) => Object.keys(obj).map((k) => Object.assign({
test: new RegExp(`\.(${k})$`),
}, obj[k]));
if (process.env.NODE_ENV === 'production' && !process.env.API_URL) {
throw new Error('when NODE_ENV is "production", API_URL must be set');
@getify
getify / 1.js
Last active November 4, 2016 14:39
// All of the following are ways that template literals are *NOT* `strictly better` than " or ' delimited strings
// RE: https://ponyfoo.com/articles/template-literals-strictly-better-strings
// valid syntax, but doesn't turn on strict mode
`use strict`;
// invalid syntax
const x = { `hello world`: 42 };
// invalid syntax