Skip to content

Instantly share code, notes, and snippets.

View devyn's full-sized avatar
👨‍💻
Nushell is really cool

Devyn Cairns devyn

👨‍💻
Nushell is really cool
View GitHub Profile
@devyn
devyn / foo.rb
Created November 2, 2008 03:22 — forked from febuiles/foo.rb
# 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
@devyn
devyn / #
Created August 28, 2009 21:58 — forked from rmanalan/gist:161461
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
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.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();
@devyn
devyn / oftn-bot-sol.js
Created August 4, 2011 20:39
!sol command for oftn-bot
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;
}
}
@devyn
devyn / config.json
Created January 7, 2012 07:16 — forked from dsamarin/config.json
Example Diaptoval configuration file
{
"Core": {
"socket": "/tmp/diaptoval.sock"
},
"IRC": {
"quit_message": "bbye!",
"profiles": [
{
"host": "irc.freenode.net",
"nick": ["devyn", "devyn_", "devyn__", "devyn___"],
@devyn
devyn / darkf_dix.js
Created March 15, 2012 03:07
An example of a pink petal
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,
@devyn
devyn / darkf_dix.js
Created March 16, 2012 08:46
An example of a pink petal
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) {
example = ['banana', 'elephant', 'apple', 'friday', 'cocaine', 'damage']
parray = example.map { |str| str.each_byte.to_a }
puts parray
#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