Skip to content

Instantly share code, notes, and snippets.

💭
Set your status

Bryan English bengl

💭
Set your status
Block or report user

Report or block bengl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bengl
bengl / using.js
Created Mar 23, 2011
Because I got tired of var module = require('module');
View using.js
//using.js
var importThem = function(libs){
for (var i = 0; i < libs.length; i++) {
global[libs[i]] = require(libs[i]);
}
};
module.exports = function(){
if (arguments.length == 1
&& arguments[0].constructor.toString().indexOf("Array") != -1)
@bengl
bengl / music.coffee
Created Sep 27, 2011
A DSL for making music with CoffeeScript might look like this...
View music.coffee
bpm 120
# BootsNCatsNBootsNCatsNBootsNCatsNBootsNCatsNBootsNCatsNBootsNCatsN
# http://i.imgur.com/sqmHC.jpg
drums = new DrumMachine()
n = (s) ->
drums 'hihat', s
boots = (s) ->
@bengl
bengl / barrel_bookmarklet.js
Created Nov 3, 2011
A bookmarklet to replicate Google's "do a barrel roll" on any arbitrary page.
View barrel_bookmarklet.js
javascript:(function(a,k,t,m,o,w,s){document.head.innerHTML+='<'+s+'@-'+m+k+m+t+'@-'+o+k+o+t+'@-'+w+k+w+t+'body{-'+m+a+'-'+o+a+'-'+w+a+'}</'+s})("-animation:r 4s 1;","-keyframes r{to{-","-transform:rotate(360deg)}}","moz","o","webkit","style>")
@bengl
bengl / .vimrc
Created Feb 28, 2012
auto-updating .vimrc
View .vimrc
" ~/.vimrc
"
" Remote vimrc. Updates each time vim is started. This adds a bit of time to
" your vim startup, but I haven't found it to be a big deal.
"
" The bit.ly URL is the vimrc file from my dotfiles on github, raw. Replace it
" with your own.
"
" Why not just save it to ~/.vimrc? This way I can just update it on github
" and it's good to go on all my machines.
@bengl
bengl / Makefile
Created Sep 19, 2012
A simple C program that emits QR codes as ANSI art
View Makefile
CFLAGS=-Wall
all:
$(CC) $(CFLAGS) qransi.c -lqrencode -o qransi
@bengl
bengl / LICENSE.txt
Created Dec 13, 2012 — forked from 140bytes/LICENSE.txt
Do A Barrel Roll!
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bengl
bengl / test.js
Last active Dec 10, 2015
domains don't really catch exceptions?
View test.js
// node >= 0.8.*
var domain = require('domain');
process.on('uncaughtException', function(error){
console.error('UNCAUGHT!', error);
});
var d = domain.create();
d.on('error', function(error) {
View stuff.js
var app = express();
app.get('/', function(req, res){
try{
if (someBoolean) {
res.send("all good!")
} else {
throw Error("shit's fucked, yo");
}
} catch (e){
res.send(e.toString(), 500);
@bengl
bengl / be.txt
Created Nov 6, 2013
I swear it's not the logo for Bugatti.
View be.txt
#################################
###################################
####################################
##### #### ####
##### #### ####
#### ####
#### ####
#### #### ####
##### #### ####
@bengl
bengl / README.md
Last active Dec 29, 2015
Can't use repl inside domain. Or can I? I'm not sure.
View README.md

It turns out that the node REPL doesn't seem to behave as expected inside a domain. (I'm using node v0.10.22)

Try running repltest.js, which is narrowed down from a much larger REPL-thing I'm working on. You'll get your REPL, but there is some weirdness. If you give it an empty line (i.e. just press Enter/Return), you'll get a syntax error, captured by the domain and ouput via line 6:

> 
SyntaxError: Unexpected token )
    at REPLServer.self.eval (repl.js:112:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
You can’t perform that action at this time.