Skip to content

Instantly share code, notes, and snippets.

View whatupdave's full-sized avatar

Dave Newman whatupdave

  • Twitter
  • Seattle, WA
View GitHub Profile
/*
example usage
=============
$('#target').machine({
stopped : {
enter : ['a.pause:hide', 'a.play:show'],
exit : ...,
'a.play:click' : 'playing'
},
9.0 Inception
8.9 Black Swan
8.8 Toy Story 3
8.8 The Way Back
8.6 127 Hours
8.4 The King's Speech
8.4 The Borrowers
8.3 The Social Network
8.2 How to Train Your Dragon
8.2 The Fighter
@whatupdave
whatupdave / imdb_ratings.rb
Created December 16, 2010 07:51
Gets the IMDB ratings for the films at http://filmography2010.blogspot.com/
#!/usr/bin/ruby
require 'rubygems'
require 'imdb_party'
require 'mechanize'
def movie_list_2010
page = Mechanize.new.get 'http://filmography2010.blogspot.com/'
results = page.search 'div.entry-content a[href*="imdb"]'
results.map {|r| r[:href] =~ /(tt\d+)/; $1 }
end
@whatupdave
whatupdave / index.html
Created December 17, 2010 01:37
Builds and packages an iOS app into dropbox for deployment
<!DOCTYPE html>
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-type' />
<title>iBots Beta</title>
<style type='text/css'>
body {
font-family: 'Helvetica Neue Light', HelveticaNeue-Light, Helvetica, Arial, sans-serif;
width: 600px;
margin: 0 auto;
@whatupdave
whatupdave / Rakefile.rb
Created May 22, 2011 12:11
Rakefile for spritesheet creation
SPRITESHEETS = File.expand_path "spritesheets" # This is where the source images are
# Extracts some useful information from the full_path
def path_info base_path, full_path
relative = full_path.gsub "#{base_path}/", ""
{
full_path: full_path,
relative_path: relative,
filename: File.basename(relative)
}
@whatupdave
whatupdave / Rakefile.rb
Created May 22, 2011 12:15
Rakefile to build and publish to testflight with wox
Wox::Tasks.create :info_plist => 'assets/Info.plist' do
build :release, :configuration => 'Release', :developer_certificate => 'iPhone Developer' do
ipa :adhoc, :provisioning_profile => 'Team Provisioning Profile' do
testflight :publish, :api_token => 'PUT_YOUR_API_TOKEN_HERE',
:team_token => 'PUT_YOUR_TEAM_TOKEN_HERE',
:notes => proc { File.read("CHANGELOG") },
:distribution_lists => %w[Internal],
:notify => true
end
@whatupdave
whatupdave / emhiredis.rb
Created August 23, 2011 22:20
emhiredis example
require 'em-hiredis'
module EMServer
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
redis = EM::Hiredis.connect
redis.callback do
multi = EventMachine::Multi.new
multi.add :query1, query1
multi.add :query2, query2
multi.callback do |results|
puts results
end
2012-05-27 11:34:09 Welcome to Minecraft Overviewer!
2012-05-27 11:34:09 Checking all tiles for updates manually.
2012-05-27 11:34:31 Rendered 0 of 22369621. 0% complete
*******************************************************************************
2012-05-27 11:34:35 E An error has occurred. This may be a bug. Please let us know!
See http://docs.overviewer.org/en/latest/index.html#help
This is the error that occurred:
Traceback (most recent call last):
File "overviewer/overviewer.py", line 493, in <module>
2012-05-27 11:59:06 Welcome to Minecraft Overviewer!
2012-05-27 11:59:06 Checking all tiles for updates manually.
*******************************************************************************
2012-05-27 11:59:06 E An error has occurred. This may be a bug. Please let us know!
See http://docs.overviewer.org/en/latest/index.html#help
This is the error that occurred:
Traceback (most recent call last):
File "overviewer/overviewer.py", line 493, in <module>
ret = main()