This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
{ | |
"Core": { | |
"socket": "/tmp/diaptoval.sock" | |
}, | |
"IRC": { | |
"quit_message": "bbye!", | |
"profiles": [ | |
{ | |
"host": "irc.freenode.net", | |
"nick": ["devyn", "devyn_", "devyn__", "devyn___"], |
This file contains hidden or 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 darkf_dix = module.exports = function (hub) { | |
var self = this; | |
this.hub = hub; | |
// We register ourself as darkf_dix and are returned a handle that | |
// allows us to subscribe to or unsubscribe from events. | |
hub.register (this, "darkf_dix", function (handle) { | |
// The first argument specifies what item to subscribe to events from. | |
// If null or undefined, the default is "*". The second argument | |
// specifies what kind of events to accept. If left null or undefined, |
This file contains hidden or 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.exports = function (hub, name) { | |
// We register ourself as darkf_dix and are returned a handle that | |
// allows us to subscribe to or unsubscribe from events. | |
hub.register (name || "darkf_dix", function (handle) { | |
// The first argument specifies what item to subscribe to events from. | |
// If null or undefined, the default is "*". The second argument | |
// specifies what kind of events to accept. If left null or undefined, | |
// it defaults to the special event kind "*", which matches any kind of | |
// event. | |
handle.subscribe ("irc/*", "message", function (e) { |
This file contains hidden or 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
example = ['banana', 'elephant', 'apple', 'friday', 'cocaine', 'damage'] | |
parray = example.map { |str| str.each_byte.to_a } | |
puts parray |
This file contains hidden or 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
#ifdef WINDOWS | |
typedef SAL_Thread HANDLE; | |
#elif POSIX | |
typedef SAL_Thread pthread_t; | |
#endif | |
SAL_Thread SAL_Thread_Create(SAL_Thread_StartAddress startAddress, void* startParameter) { | |
#ifdef WINDOWS | |
return CreateThread(null, 0, startAddress, startParameter, null, null); | |
#elif POSIX |
OlderNewer