Skip to content

Instantly share code, notes, and snippets.

View voxxit's full-sized avatar

Josh Delsman voxxit

View GitHub Profile
Event.onDOMReady(function () {
var triggerIDs = ["trigger320", "trigger480", "trigger640"];
var HDMovieURL = "http://stream.qtv.apple.com/events/sep/1009qpeijrfn/1009oiubqherbfoteg_hd_ref.mov";
var HDTrigger = $('triggerHD');
var qt = null; /*snowLeopard url*/
var slURL = "http://qthttp.apple.com.edgesuite.net/1009qpeijrfn/sl.m3u8";
// http://qthttp.apple.com.edgesuite.net/1009qpeijrfn/sl.m3u8
// var slURL= 'http://qthttp.apple.com.edgesuite.net/100716iab73asc/sl_all_w.m3u8';
/* non-snowLeopard url*/
def each_even_element(array)
i = 0
while i < array.length
yield array[i] if i % 2 == 1
i += 1
end
end
# Takes a snapshot of the HTML on a page. Used for Google AJAX crawling. This script
# must be run with jruby 1.5.2 or higher. Please see this page for more details:
#
# http://code.google.com/web/ajaxcrawling/docs/getting-started.html
#
require 'rubygems'
require 'celerity'
browser = Celerity::Browser.new
ruby-1.9.2-p0 > Breakpoint.where(:latitude => 29.07, :longitude => -95.13)
=> []
ruby-1.9.2-p0 > Breakpoint.find(10)
=> #<Breakpoint id: 10, name: "San Luis Pass", latitude: 29.07, longitude: -95.13, sort_order: 10>
@voxxit
voxxit / nginx CentOS init file
Created April 8, 2011 17:54
/opt/local/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/local/nginx/conf/nginx.conf
# pidfile: /opt/local/nginx/logs/nginx.pid
@voxxit
voxxit / gist:1320792
Created October 27, 2011 20:37
Select all friends on Event creation page dialog on Facebook
var el = document.getElementsByName("checkableitems[]");
for (i = 0; i < el.length; i++) {
if(el[i].checked !== true){
var node = el[i].parentNode,
evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);
node.dispatchEvent(evt);
@voxxit
voxxit / Fraction.h
Created July 17, 2012 18:26
My first Objective-C program :)
//
// Fraction.h
//
#import <Foundation/Foundation.h>
@interface Fraction : NSObject
@property int numerator, denominator;
@voxxit
voxxit / gist:3131588
Created July 17, 2012 19:50
Objective-C app #2
// Implement a Calculator class
#import <Foundation/Foundation.h>
@interface Calculator : NSObject
// accumulator methods
-(void) setAccumulator: (double) value;
-(void) clear;
-(double) accumulator;
@voxxit
voxxit / README.md
Created March 9, 2013 00:11
ShoppingCart

Shopping Cart

In this example, we'll ask you to build a ShoppingCart class which contains multiple items, and provides a method of adding, removing and updating items belonging to a cart. The ShoppingCart class is a plain Ruby class, which should only use objects which belong to the standard Ruby library.

First, fork this example. Click 'Fork' above. Then, you'll clone, edit, add, commit and push your changes as necessary. Notify us with a link to your forked example when you're finished.

Please first develop tests (either using TDD or BDD libraries of your choice -- we like Test::Unit and RSpec, but you're free to use whatever method you're comfortable with) before you write actual code. We're a test-driven shop.

Acceptance Criteria

@voxxit
voxxit / pre-commit
Created July 25, 2013 18:16
Simple Git pre-commit hook for running specs on a Rails project before committing. Install by pasting into .git/hooks/pre-commit, then do "chmod g+x .git/hooks/pre-commit"
#!/bin/bash
# Stash unstaged changes before running tests
git stash -q --keep-index
# Run tests
NUM_FAILS=`bundle exec rspec --format=progress | grep "example" | grep "fail" | awk {'print $3'}`
# Unstash
git stash pop -q