Skip to content

Instantly share code, notes, and snippets.

View dmamills's full-sized avatar
💭
ya yr smart but you'll never b dolphin smart

dmamills

💭
ya yr smart but you'll never b dolphin smart
View GitHub Profile
@dmamills
dmamills / export_func.js
Created February 5, 2014 23:40
JS library exports for node/amd/browser
(function(root) {
function exportFunctions () {
if (typeof define === 'function' && define.amd) {
define(function () {
return functions;
});
} else if (typeof module !== 'undefined' && module !== null) {
module.exports = functions;
} else {
root.vagueTime = functions;
@dmamills
dmamills / gist:9262671
Created February 28, 2014 00:23
heroku hipchat errr
2014-02-28T00:07:04.807171+00:00 app[web.1]: [Fri Feb 28 2014 00:07:04 GMT+0000 (UTC)] INFO Disconnected from hipchat.com
2014-02-28T00:07:04.809473+00:00 app[web.1]: [Fri Feb 28 2014 00:07:04 GMT+0000 (UTC)] ERROR 'plan-change', '0', { name: 'stream:error',
2014-02-28T00:07:04.809473+00:00 app[web.1]: parent: [Circular],
2014-02-28T00:07:04.809473+00:00 app[web.1]: attrs: { xmlns: 'urn:ietf:params:xml:ns:xmpp-streams' },
2014-02-28T00:07:04.809473+00:00 app[web.1]: children:
2014-02-28T00:07:04.809473+00:00 app[web.1]: attrs: { 'xmlns:stream': 'http://etherx.jabber.org/streams' },
2014-02-28T00:07:04.809473+00:00 app[web.1]: { name: 'text',
2014-02-28T00:07:04.809473+00:00 app[web.1]: parent: null,
2014-02-28T00:07:04.809473+00:00 app[web.1]: [ { name: 'plan-change',
2014-02-28T00:07:04.809473+00:00 app[web.1]: children: [] },
@dmamills
dmamills / User.js
Created April 20, 2014 00:59
Basic mongoose User model
var mongoose = require('mongoose'),
bcrypt = require('bcrypt'),
SALTINESS = 10;
var UserSchema = new mongoose.Schema({
username: { type:String,require:true,index:{unique:true} },
password: { type:String,require:true }
});
@dmamills
dmamills / p.js
Last active August 29, 2015 14:00
var i = j = 0,a=[];
setInterval(function() {
process.stdout.clearLine();
process.stdout.cursorTo(0);
if(++i>20) i=0;
for(j=0;j<i;j++) a.push('x');
for(;j<20;j++)a.push(' ');
process.stdout.write('['+ a.join('')+ '] ' + i +'/20');
@dmamills
dmamills / sequence.js
Created May 6, 2014 12:06
shitty sequence
function sequence() {
var args = arguments;
return function(n) {
for(var i =0;i < args.length;i++) {
n = args[i](n)
}
return n;
}
}
git config --global grep.lineNumber true
# Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
@dmamills
dmamills / config.md
Created May 12, 2014 13:27
irssi config

Auto connect to server /server add -auto -network Freenode irc.freenode.org 6667

Save nick /network add -nick dmamills Freenode

Save channels /channel add -auto ##javascript Freenode

Auto identify

@dmamills
dmamills / zsh_stats
Last active August 29, 2015 14:01
top shell commands in zsh
1 473 23.1296% git
2 366 17.8973% ls
3 366 17.8973% cd
4 60 2.93399% vim
5 60 2.93399% sudo
6 49 2.39609% clear
7 45 2.20049% exit
8 40 1.95599% ll
9 38 1.85819% rm
10 35 1.71149% brew

Rule of Modularity: Write simple parts connected by clean interfaces.

Rule of Clarity: Clarity is better than cleverness.

Rule of Composition: Design programs to be connected to other programs.

Rule of Separation: Separate policy from mechanism; separate interfaces from engines.

Rule of Simplicity: Design for simplicity; add complexity only where you must.