Skip to content

Instantly share code, notes, and snippets.

View olivernn's full-sized avatar

Oliver Nightingale olivernn

View GitHub Profile
@olivernn
olivernn / projlog
Created January 11, 2013 12:42
Display some graphs based on git log output.
#!/usr/bin/env ruby
require 'date'
class Commit
attr_reader :sha, :author, :date
def initialize(attributes = {})
@sha = attributes[:sha]
@olivernn
olivernn / app.html
Created October 19, 2012 11:19
Davis.js Modifier Keys Fix
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="https://raw.github.com/olivernn/davis.js/modifier-keys/davis.js"></script>
<a href="/foo">Foo</a>
<a href="/bar">Bar</a>
<script>
Davis(function () {
this.get('/foo', $.noop)
this.get('/bar', $.noop)
@olivernn
olivernn / gem
Created July 31, 2012 20:42
tlux configs
window :editor do
command "vim ."
end
window :shell
window :console do
command "irb"
end
@olivernn
olivernn / davis.hash.js
Last active October 7, 2015 17:18
New Davis Hash Routing
Davis.hash = function () {
var handlers = [],
lastPolledLocation
var triggerHandlers = function (request) {
Davis.utils.forEach(handlers, function (handler) {
handler(request)
})
}
@olivernn
olivernn / gist:3121642
Created July 16, 2012 08:51
tlux dsl
name "rails"
description "rails development environment"
window "editor", selected: true do
command "vim ."
split :horizontal, height: 20
split :vertical do
dir "~/code/hotrod"
@olivernn
olivernn / app.js
Created June 26, 2012 09:18
davis with hash routing
Davis.extend(Davis.hashRouting({ forceHashRouting: true }))
app = Davis(function () {
this.settings.handleRouteNotFound = true
this.get('#/foo', function () {
console.log('foo')
})
var app = Davis(function () {
this.configure(function () {
this.linkSelector = 'nav a'
this.formSelector = 'nav form'
})
this.get('/', function (req) {
showHomePage()
})
@olivernn
olivernn / app.js
Created June 25, 2012 09:21
Simple Davis.js Example
var app = Davis(function () {
this.get('/foo', function () {
alert('you clicked on foo!')
})
})
@olivernn
olivernn / cart_app.js
Created May 2, 2012 21:34
multiple 'apps' within one davis app
var cartApp = function () {
this.scope('/cart', function () {
this.post('/items', function (req) {
// create an item
})
this.del('/items/:id', function (req) {
// delete a specific item from your cart
})
@olivernn
olivernn / gist:1640750
Created January 19, 2012 15:59
ajaz setup yo
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
}
});