Skip to content

Instantly share code, notes, and snippets.

View daytonn's full-sized avatar
💀
Trying to figure out why I would care to add a status to github

Dayton Nolan daytonn

💀
Trying to figure out why I would care to add a status to github
View GitHub Profile
@daytonn
daytonn / fake-api-server.js
Created April 11, 2014 14:55
OpenBadges Fake API
(function() {
FakeAPI = {
users: [
{
id: 1,
user: "user@example.com",
badges: _.times(5, function(i) {
var id = i + 1;
return {
id: id,
@daytonn
daytonn / readline_fixes.json
Last active August 29, 2015 14:05
Readline fixes for sublime
// Readline style toggle comment
{ "keys": ["ctrl+forward_slash"], "command": "toggle_comment", "args": { "block": false } },
// Readline fix select line up
{ "keys": ["ctrl+shift+p"], "command": "move", "args": { "by": "lines", "forward": false, "extend": true } },
// Readline fix by word ends
{ "keys": ["alt+f"], "command": "move", "args": { "by": "word_ends", "forward": true } },
{ "keys": ["alt+b"], "command": "move", "args": { "by": "word_ends", "forward": false } },
// Readline fix select by word ends
{ "keys": ["shift+alt+b"], "command": "move", "args": { "by": "word_ends", "forward": false, "extend": true } },
{ "keys": ["shift+alt+f"], "command": "move", "args": { "by": "word_ends", "forward": true, "extend": true } },
@daytonn
daytonn / Default (OSX).sublime-keymap
Last active August 29, 2015 14:05
Sublime Keymap
[
// Cursor Movement
// ⌃F Forward by words
{ "keys": ["alt+f"], "command": "move", "args": { "by": "wordends", "forward": true } },
// ⌃B Backward by words
{ "keys": ["alt+b"], "command": "move", "args": { "by": "words", "forward": false } },
// ⌃A Beginning of line (soft)
{ "keys": ["ctrl+a"], "command": "move_to", "args": { "to": "bol" } },
@daytonn
daytonn / teaspoon-spec_helper.js
Created November 22, 2014 16:31
Teaspoon spec_helper.js example
//= require jquery
//= require support/expect
//= require support/sinon
//= require support/chai
//= require support/chai-jquery
//= require support/sinon-chai
//= require magic_lamp
//= require lodash
//= require application
//= require_self
@daytonn
daytonn / naive-jskit-autocomplete.js
Created November 24, 2014 02:23
JSKit autocomplete (naive)
/* jshint esnext: true */
var _ = require("lodash");
App.createController("Friends", {
actions: ["index"],
all: function() {
this.cacheElements();
this.registerEvents();
},
var myFunction = function() {
console.log("Hello World");
};
var myObject = {
myMethod: function() {
console.log("I'm a property of an object");
}
};
@daytonn
daytonn / callback.js
Created February 19, 2015 16:58
CWCPOOJS - callbacks
var myFunction = function() {
console.log("Hello World");
};
var callAnotherFunction = function(anotherFunction) {
anotherFunction();
};
callAnotherFunction(myFunction); // logs "Hello World"
var myFunction = function() {
console.log("Hello World");
};
myFunction.someProperty = "WTF!? a function with a property?";
console.log(myFunction.someProperty);
@daytonn
daytonn / dynamic-function-assignment.js
Last active August 29, 2015 14:15
CWCPOOJS - dynamic function assignment
var greeterCreator = function(greeting) {
return function(name) {
console.log(greeting + " " + name);
};
};
var helloGreeter = greeterCreator("Hello");
helloGreeter("Chicago Web Conf");
@daytonn
daytonn / closure.js
Last active August 29, 2015 14:15
CWCPOOJS - closure
var tellSecrets = function() {
var secret = "shh, don’t tell anyone";
return function() {
console.log(secret);
};
}();
tellSecrets();
console.log(secret); // undefined