Skip to content

Instantly share code, notes, and snippets.

View zspencer's full-sized avatar

Zee zspencer

View GitHub Profile
@zspencer
zspencer / PageLoadHandler.js
Created January 27, 2011 20:04
this allows you to actually test drive executing something at page load. It's pretty much just a wrapper around jQuery's page Load functionality
var PageLoadHandler = (function() {
PageLoadHandlerObject = function() {};
PageLoadHandlerObject.prototype = {
callBackList: [],
execute: function(callBack) {
jQuery(callBack);
this.callBackList.push(callBack);
},
executed: function(functionToVerify) {
for(functionIndex in this.callBackList) {
@zspencer
zspencer / sinatra_base.rb
Created June 9, 2011 06:26
Code Review of sinatra/base.rb
# external dependencies
require 'rack'
require 'tilt'
# stdlib dependencies
require 'thread'
require 'time'
require 'uri'
# other files we need
@dchelimsky
dchelimsky / pending_and_before_examples.rb
Created December 11, 2011 15:24
Interaction between pending and before hooks in RSpec
describe Something do
before(:each) do
do_something_before
end
it "does one thing" do
# before will run for this example because rspec doesn't know it is pending
# until the example is eval'd
pending
end
@benjaminws
benjaminws / bounce_shoes.rb
Created January 22, 2012 21:24
Learning ruby with shoes!
# KBounce clone
# Setup a basic canvas, 600x400, not resizable
Shoes.app :width => 600, :height => 400, :resizable => false do
background black
# Put our vertical and horizontal baracades in a list
@linesv = []
@linesh = []
@zspencer
zspencer / pong.rb
Created February 4, 2012 23:48
Possible implementation of Pong with an imaginary API I need to just build
Shoes.app width: 800, height: 600 do
tick 60 do
stop_ticking if @right_player.won? or @left_player.won?
alert "Right Player Wins!" if @right_player.won?
alert "Left Player Wins!" if @left_player.won?
end
moving_element :ball do
location top: 400, left: 300
@wilkie
wilkie / put_in_address_bar
Last active December 11, 2015 23:49
Some people really linked the browser notepad in one line thing... well have some syntax highlighting... still in one line. Ok, fine. A really long line. And I cheated so hard that the caret doesn't show up, but that's ok, right? :) Oh, and you can't copy and paste in HTML because contenteditable is really broken for pre tags, jeez.
data:text/html, <style>@import url(http://fonts.googleapis.com/css?family=Inconsolata);html,body{background-color:%233f3f3f}%23f,%23d{background-color:rgba(0,0,0,0);margin:0;padding:3px;font-size:14px;font-family:'Inconsolata';display:block}pre .nocode {background-color:none;color:%23000}pre .str{color:%23cc9393}pre .kwd{color:%23f0dfaf}pre .com{color:%237f9f7f}pre .typ {color:%23dfdfbf}pre .lit{color:%238cd0d3}pre .pun{color:%23fff}pre .pln{color:%23dcdccc}pre .tag{color:%23e89393;font-weight:bold}pre .atn{color:%23dfdfbf;font-weight:bold}pre .atv{color:%23dca3a3}pre .dec{color:%23efdcbc}ol.linenums{margin-top:0;margin-bottom:0;color:%23AEAEAE}li.L1,li.L3,li.L5,li.L7,li.L9{}%23m{position:relative;z-index:1;color:rgba(0,0,0,0);border:1px solid %23888}%23d{z-index:0;position:absolute;left:0px;top:0px}%23p{position:relative}</style><script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"></script><div id="p"><pre id="m"><code id="f" oninput='d=document.getElement