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
current_class = nil | |
classes = open(ARGV[0]).read.split("\n").inject({}) do |classes, line| | |
if line =~ /^var (\w+) = function.*/ | |
current_class = $1 | |
elsif line =~ /^[\s\t]*$/ | |
skip = true | |
end | |
(classes[current_class] ||= []) << line unless skip | |
classes | |
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
history | awk '{$words[$2]++} END { for(w in words) print words[w], w }' | sort -k 1,2 -nr |
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
#!/usr/bin/ruby | |
js_path = 'public/javascripts' | |
problems = `grep -rP "\}[\s\n]*,[\s\n]*\}" #{js_path}` | |
if problems.length > 1 | |
puts "Woops, Internet Explorer HATES it when you use too many commas. Fix this or you'll be sad:" | |
puts problems | |
exit 1 | |
else | |
exit 0 | |
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
var dojo = d = {} | |
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA | |
dojo.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/){ | |
// summary: | |
// Returns a function that will only ever execute in the a given scope. | |
// This allows for easy use of object member functions | |
// in callbacks and other places in which the "this" keyword may | |
// otherwise not reference the expected scope. | |
// Any number of default positional arguments may be passed as parameters |
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
#!/usr/bin/ruby | |
require 'pathname' | |
proj_dir = Pathname.new(ENV['TM_PROJECT_DIRECTORY']) | |
file_path = Pathname.new(ENV['TM_FILEPATH']) | |
path = file_path.relative_path_from(proj_dir).to_s | |
module_name = path.gsub(/\.js$/,'') | |
class_name = (module_name.split('/').last.capitalize.gsub(/_(\w)/) {|str| $1.upcase}) | |
puts "define('#{module_name}',[],function() { | |
var #{class_name} = function() { | |
$1 |
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
#!/usr/bin/ruby | |
require 'pathname' | |
proj_dir = Pathname.new(ENV['TM_PROJECT_DIRECTORY']) | |
file_path = Pathname.new(ENV['TM_FILEPATH']) | |
path = file_path.relative_path_from(proj_dir).to_s | |
module_name = path.gsub(/\.js$/,'') | |
moddy = module_name.split('/').last | |
class_name = (moddy.capitalize.gsub(/_(\w)/) {|str| $1.upcase}) | |
puts "define('#{module_name}',[],function() { | |
var #{class_name} = Backbone.View.extend({ |
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
Files: | |
!(?:.*/\.(?!gitignore)|\.css$) | |
Folders: | |
!(?:\.|game-client) |
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
realGameSub: function(el, body) { | |
var oldPlayer = this.players[body.playerOff.id]; | |
// TODO refactor this - why is the application making players for RealTeam? | |
var newPlayer = new Player({ | |
'id': body.player.id, | |
'pos': oldPlayer.position, | |
'no': body.player.number, | |
'name': body.player.name, | |
'st': 'playing' | |
}); |
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
before: | |
def process_message message | |
logger.debug "Started #{message.headers["message-id"]}" | |
event = JSON.parse message.body | |
logger.debug "Action: #{event['action']}" | |
match_id = event['matchID'] | |
active_entries = PassingGame::Entry.count_active_for match_id | |
logger.info "#{active_entries} active entries for match_id = #{match_id}" | |
if fail_on? event |
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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
</head> | |
<body> | |
<h3 class="title">Picklive buzz</h3> | |
<script type="text/javascript"> | |
var rotater = function(selector) { | |
var item, lastItem; |