Skip to content

Instantly share code, notes, and snippets.

View bigeasy's full-sized avatar

Alan Gutierrez bigeasy

  • New Orleans, LA
View GitHub Profile
@bigeasy
bigeasy / this.js
Created October 6, 2014 19:34
`this` manipulation in JavaScript
var slice = [].slice
var array = []
console.log(array.push)
var object = {
f: function (x, y) {
var vargs = slice.call(arguments)
console.log(this.i, x, y)
},
@bigeasy
bigeasy / profiling.irc
Last active August 29, 2015 14:07
Profiling discussion.
[12:38:59] <prettyrobots> Any nice blog posts on profiling Node.js?
[12:39:10] <prettyrobots> I've run a program with `--prof`, but I can't find a way to visualize it.
[12:40:40] kessler (~kessler@odap-199-203-61-108.bb.netvision.net.il) left IRC. (Ping timeout: 246 seconds)
[12:42:08] joates (~joates@host109-152-220-28.range109-152.btcentralplus.com) left IRC. (Quit: Leaving)
[12:43:15] Maciek416 (~Maciek@2601:7:2100:2c1:e4b2:2ee:277d:28d1) left IRC. (Ping timeout: 272 seconds)
[12:50:33] peutetre (~peutetre@ip18861980.dynamic.kabel-deutschland.de) left IRC. (Quit: peutetre)
[12:51:03] toddself_zz is now known as toddself
[12:56:17] kessler (~kessler@odap-199-203-61-108.bb.netvision.net.il) joined the channel.
[13:02:04] phated (~phated@ip72-208-140-83.ph.ph.cox.net) joined the channel.
[13:03:43] kumavis (~kumavis@107-219-148-42.lightspeed.sntcca.sbcglobal.net) joined the channel.
@bigeasy
bigeasy / id_rsa.pub
Created April 12, 2014 00:01
Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8MFjTKBo8r+bEVSHP12kHxe88ec9Nuk0YaTzoh+du9ZxytuZsjsA/1vxkA4w3gJbNJbrv20CRPChietSpTFMEVrbpbNjNDTYUwJxn+cIEwuA8xGFbURb0Ukq2jDlBBYqUv0WyQHTjTRK+jTVhodE1EB536r6bW4sNP2wKA7TtxQmGHalXAf+OhLtsgfGVvGQl0fHyYrDdPl04G6maGHDP3dtOKgr/UYgcj+ga4K/YCo8AjQovRE0fy/qqovYHvRhfrFA8GO5zQ/n0dIb+AdjMI2JYjsMVKgOprdZ3tDO1b6XYNfU2Mq3FmRoc8purItVbj2+XQ0vmLU6wN8Hs7uih alan
@bigeasy
bigeasy / versions.md
Last active January 1, 2016 16:49
Thoughts on designing interfaces to algorithms.

TL;DR

An interface to an algorithm is not an abstraction of a problem domain. It is an implementation. Understanding the algorithm is a requirement for applying it. It should expose the meaningful properties of the algorithm. If you black box it at too low a level, you frustrate the developer who understands the algorithm, forcing them to write their own.

  • Leak all the abstractions. Arrays, sets, maps and graphs are a valid level of abstraction.
  • Make decisions and turn them into rules. Fear not commitment.

The Problem In Need of Interface

I don't like to write about software, that is the first thought. The second

@bigeasy
bigeasy / Output on Fedora 16
Created November 4, 2012 05:41
Node.js Millisecond Timeout
[ [ 0, 1859987 ], [ 0, 1678600 ], [ 0, 1074869 ], [ 0, 1100038 ] ]
[ [ 0, 2997281 ], [ 0, 2231579 ], [ 0, 2200601 ], [ 0, 3107400 ] ]
[ [ 0, 2925 ], [ 0, 2907 ], [ 0, 2910 ], [ 0, 2860 ] ]
[ [ 0, 2869 ], [ 0, 2895 ], [ 0, 2800 ], [ 0, 2851 ] ]
[ [ 0, 1425 ], [ 0, 1925 ], [ 0, 1858 ], [ 0, 1383 ] ]
@bigeasy
bigeasy / javascript.vim.patch
Created October 17, 2012 00:07
Multi-line string syntax highlighting for Vim.
--- /usr/share/vim/vim73/syntax/javascript.vim 2012-10-16 19:57:21.000000000 -0400
+++ javascript.vim 2012-10-16 19:56:57.000000000 -0400
@@ -34,8 +34,8 @@
syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
syn match javaScriptSpecial "\\\d\d\d\|\\."
-syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"\|\\\n+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
-syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'\|\\\n+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
+syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
+syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
@bigeasy
bigeasy / README.md
Created October 9, 2012 05:42
US Median Age by County

US Median Age by County

A display of US median age by county using the census.ide.org API.

@bigeasy
bigeasy / rere.js
Created October 4, 2012 15:35
JavaScript regular expression to match regular expression special characters.
const REGEX = new RegExp('(\\' + '/ . * + ? | ( ) [ ] { } \\'.split(' ').join('|\\') + ')', 'g');
@bigeasy
bigeasy / gist:3267134
Created August 5, 2012 21:10
CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
include(BundleUtilities)
project(synapse)
if (UNIX)
set(gecko_defs "-DXP_UNIX")
if(APPLE)
set(gecko_defs "${gecko_defs} -DXP_MACOSX")
endif()
@bigeasy
bigeasy / decode.js
Created August 1, 2012 05:07
Decode XHR Send as UTF8
var fs = require('fs');
var file = new Buffer(fs.readFileSync('shapefile-filereader.zip', 'utf8'), 'binary');
console.log(file.length)
fs.writeFileSync('out.zip', file);