Skip to content

Instantly share code, notes, and snippets.

View stevekinney's full-sized avatar

Steve Kinney stevekinney

View GitHub Profile
module.exports = {
drawRoutes: function(app) {
app.use(function(req, res) {
es.render('404');
});
}
};
enum Planet: Int {
case Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
}
Planet.Mercury.toRaw()
let possiblePlanet = Planet.fromRaw(7)
@stevekinney
stevekinney / z-index.js
Created June 5, 2014 17:05
Set to Top-Most Element Based on Time
$(this).css('z-index', parseInt((+new Date()).toString().slice(6), 10));
/*
Uses the system time to set the current element's z-index above other elements
on the page. This terrible hack allows me to not have to store the most recent
z-index anywhere. I can't wait to see how it bites me.
Context: I use it with draggables in jQuery UI.
.axis path, .axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
.axis text {
font-family: sans-serif;
font-size: 11px;
}
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" Vim Plugins via Vundle
@stevekinney
stevekinney / tutorial.md
Last active August 29, 2015 14:05
JavaScript Outside of the Browser (Draft)

JavaScript Outside of the Browser

What is Node?

Node.js is a server-side platform built on Chrome's V8 JavaScript runtime. It uses non-blocking I/O and asynchronous events. It's lightweight, efficient, and commonly used for real-time web applications.

History

Node.js was released by Ryan Dahl in 2009. Ryan didn't set out to create a server-side JavaScript implementation. It was the asynchronous, non-blocking part that he was interested in. Ryan originally tried to accomplish this using C, Lua, and Haskell. Ryan turned his attention to JavaScript when Google open-sourced its V8 JavaScript engine.

// The first thing I want to do is create a Bob constructor for instantiating
// new Bob objects. I don't need to do any initializing, so this is pretty much
// a empty constructor.
function Bob() {};
// I'm going to store all of the functionality in Bob's prototype. This way,
// all of my Bob instances will share the same set of methods.
// Theoretically, I could use a conditional or a switch statement here, but
@stevekinney
stevekinney / ember.md
Created August 20, 2014 17:02
Ember Tasting Notes

Notable features of Ember

The Router

Ember has a super powerful router and the framework strongly emphasizes the importance of URLs. Some other JavaScript frameworks don't update the URL to reflect the current state of the app, this means that the back button doesn't work.

The Object Model

Ember brings in it's own class-based inheritance system with support for super and other goodies.

// The first thing I want to do is create a Bob constructor for instantiating
// new Bob objects. I don't need to do any initializing, so this is pretty much
// a empty constructor.
function Bob() {};
// I'm going to store all of the functionality in Bob's prototype. This way,
// all of my Bob instances will share the same set of methods.
// Theoretically, I could use a conditional or a switch statement here, but