This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REMOTE REQUESTS: | |
com.sadun.airflick | |
RequestType := show-photo | play-media | screenshot | |
MediaLocation := | |
<url string> | <local file path string> | <array of local file path strings for slideshow> | |
Rotation := 0 | 1 | 2 | 3 (0 ^, 1 <, 2 v, 3 >) | |
Transition := SlideRight | Dissolve | |
SlideDuration := 2 | 3 | 5 | 8 | 10 (Use strings. Incorrect durations default to 5) | |
// Single Slide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert an array of nested key parts into a nested Hash and convert the | |
# value to a proper Ruby object. | |
# | |
# keyparts - An Array of String parts of the nested Hash. For instance, the | |
# list ['a', 'b', 'c'] would lead to a nested hash that looks like | |
# {'a' => {'b' => {'c' => X}}}. | |
# val - The String value that will be converted into the proper Boolean, | |
# Integer, or String. | |
# | |
# Returns the nested Hash. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Selectable | |
def recieve?; false; end | |
def send?; true; end | |
end | |
class Channel | |
include Selectable | |
def recieve | |
'hai' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener "DOMContentLoaded", -> | |
body = $ "body" | |
canvas = $ "#canvas" | |
chalkboard = $ "#chalkboard" | |
close = $ "#close" | |
ledge = $ "#ledge" | |
lightswitch = $ "#lightswitch" | |
output = $ "#output" | |
shade = $ "#shade" | |
share = $ "#share" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load balancing | |
# send incoming requests to one of 10 backends running on ports 5000-5009 | |
HttpProxyMachine.start do | |
{ :host => 'localhost', :port => 5000 + rand(10) } | |
end | |
# host based routing | |
# send requests for media.server/file to localhost:3000/media/file | |
# all other requests are unmodified | |
HttpProxyMachine.start do |request| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In Gitbox (gitboxapp.com) there is a stage view on the right where you can see | |
a list of all the changes in the working directory: untracked, modified, | |
added, deleted, renamed files. Each change has a checkbox which you can click | |
to stage or unstage the change ("git add", "git reset"). | |
When the change staging finishes, we run another task to load all the changes | |
("git status"). | |
When the loading task is completed we notify the UI to update the list of changes. | |
All tasks are asynchronous. |
With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)
Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
Processing by HomeController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)