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 / basic-object.js
Created February 19, 2015 19:18
CWCPOOJS - basic object
var person = {
firstName: "Bob",
lastName: "Ject",
age: 33,
address: {
street: "123 Memory Ln",
apt: "0x7fff9575c05f",
zip: "01101",
city: "Browser Town",
state: "Mozilla"
@daytonn
daytonn / leaking-globals.js
Last active August 29, 2015 14:15
CWCPOOJS - leaking globals
var foo = 5;
var bar = 10;
function logFoo() {
foo = 15;
var bar = 20;
console.log("logFoo scope")
console.log(foo, bar);
}
@daytonn
daytonn / global-this.js
Created February 19, 2015 17:19
Global this (window)
function someFunction() {
console.log(this);
}
someFunction(); // window
@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
@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");
var myFunction = function() {
console.log("Hello World");
};
myFunction.someProperty = "WTF!? a function with a property?";
console.log(myFunction.someProperty);
@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");
};
var myObject = {
myMethod: function() {
console.log("I'm a property of an object");
}
};
@daytonn
daytonn / iTerm triggers.md
Last active March 15, 2018 11:13
iTerm triggers for ruby happiness

iTerm Triggers

  • ^diff.+$ -- Highlight Text (Whatever Background)
  • ^diff.+$ -- Highlight Text (Whatever Foreground)
  • uninitialized\sconstant\s([\w:]+) -- Highlight Text (White on Red)
  • undefined\slocal\svariable\sor\smethod\s(.+)'` -- Highlight Text (White on Red)
  • undefined\smethod\s(.+)'` -- Highlight Text (White on Red)
  • no\simplicit\sconversion\sof\s(\w+)\sinto\s(\w+) -- Highlight Text (White on Red)
  • \?(.+)?'?:?\swrong\snumber\sof\sarguments\s` -- Highlight Text (White on Red)
  • \(\d+\sfor\s\d[\.\+\d]?\) -- Highlight Text (Red on White)
@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();
},