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
function Flags(text) { | |
var m = text.match(/^-([^ ]+)( (.+))?/); | |
if (m) { | |
var s = m[1].split(""); | |
return {all: s, flags: s.reduce(function(o,i) { o[i] = true; return o; }, {}), args: m[2] ? m[3] : undefined}; | |
} else { | |
return null; | |
} | |
} |
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
this.queue = {}; | |
this.register_command("queue", function(context, text) { | |
var who = context.intent.name; | |
if (!this.queue[who]) this.queue[who] = []; | |
this.queue[who].push([context.sender, text]); | |
}); | |
this.register_command("dequeue", function(context, text) { | |
var who = context.intent.name; | |
if (!this.queue[who]) this.queue[who] = []; | |
var item = (text == "peek") ? this.queue[who][0] : this.queue[who].shift(); |
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
goombaAt: [start_left, start_top] | |
image := load: "goomba.png" | |
draw := drawSprite: image at: [left, top] | |
left, top := walkOn: owner startingAt: [start_left, start_top] | |
game: arguments | |
<= world: arguments | |
goomba => goombaAt: [400, 300] | |
floor => rectObject: [400, 350, 800, 400] colored: {red: 100} |
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
script/generate plugin HelloWorld | |
# vendor/plugins/hello_world/init.rb | |
Rails.configuration.gem "sinatra" | |
Rails.configuration.middleware.insert_before("ActionController::Failsafe", "HelloWorld") | |
# vendor/plugins/hello_world/lib/hello_world.rb | |
# your sinatra app goes here... | |
require 'sinatra/base' | |
class HelloWorld < Sinatra::Base |
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
# fast way to include too many stylesheets | |
def include_stylesheets | |
sheets = %w(dropdown style calendar/red/style facebox) | |
sheets.collect{|sheet|stylesheet_link_tag(sheet)}.join | |
end |
NewerOlder