Skip to content

Instantly share code, notes, and snippets.

View fractastical's full-sized avatar

Joel Dietz fractastical

View GitHub Profile
; Calculate lines of code contained in a given directory
; -ignores empty lines
; -ignores comment-only lines
; -does *not* ignore block comments
;
; David Andrzejewski (andrzeje@cs.wisc.edu)
;
; Command-line arguments
; 0 Code root directory
;
@fractastical
fractastical / client.js
Created June 3, 2012 15:21 — forked from matteoagosti/client.js
Twitter OAUTH using Meteorjs
var ClientRouter = Backbone.Router.extend({
routes: {
'404': 'notfound',
'500': 'error',
'auth': 'auth',
'authCallback?oauth_token=:oauth_token&oauth_verifier=:oauth_verifier': 'authCallback',
'': 'defaultRoute'
},
defaultRoute: function() {
@fractastical
fractastical / jquery.oauth.js
Created March 16, 2012 15:33 — forked from andyedinborough/jquery.oauth.js
Introduces $.oauth() to make using OAuth from jQuery as easy as using $.ajax()
(function (window, document, $, undefined) {
if (!$.Deferred) throw 'jQuery 1.5 is required to use the jQuery.oauth script!';
function require(name, url) {
if (window[name] === undefined)
return $.ajax({ type: 'GET', cache: true, dataType: 'script', url: url });
}
$.oauth = function (options) {
var d = $.Deferred();
@fractastical
fractastical / spark.rb
Created November 16, 2011 07:51 — forked from jcromartie/spark.rb
Sparklines in Ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# prints a sparkline in the terminal using the supplied list of numbers
# examples:
# spark.rb 10 20 30 100 90 80
# spark.rb 1 2 0.4 0.1 1.3 0.7
@ticks = %w[ ]
values = ARGV.map { |x| x.to_f }
@fractastical
fractastical / barrel_bookmarklet.js
Created November 3, 2011 22:31 — forked from bengl/barrel_bookmarklet.js
A bookmarklet to replicate Google's "do a barrel roll" on any arbitrary page.
javascript:(function(a,k,t,n,u,i,m,o,w){document.head.innerHTML+=['<style>@-',m,k,m,t,'@-',o,k,o,t,'@-',w,k,w,t,'body{-',m,a,n,m,a,u,m,a,i,'-',o,a,n,o,a,u,o,a,i,'-',w,a,n,w,a,u,w,a,i,'}</style>'].join('');})("-animation","-keyframes roll { 100% { -","-transform:rotate(360deg); } }","-name:roll;-","-duration:4s;-","-iteration-count:1;","moz",'o','webkit');
@fractastical
fractastical / sinatra_jquery_test.rb
Created October 22, 2011 20:13 — forked from mr-rock/sinatra_jquery_test.rb
An example of Sinatra working with Ajaxified JQuery based on some pieces of code published by Rafael George on the Sinatra Google Group.
require 'sinatra'
require 'dm-core'
require 'haml'
DataMapper.setup(:default, 'sqlite3::memory:')
class Message
include DataMapper::Resource
property :id, Serial