Skip to content

Instantly share code, notes, and snippets.

Let's do Harold.

Harold is 20-30 minutes (or more) of unyielding improvisation.

We'll get some training wheels to help us out.

First training wheel is: Don't Think.

You may think you'll need to come up with lots of ideas to fill half an hour. You won't. Harold gets more difficult and less enjoyable once too many ideas start to come into play.

class AS.Model.Boolean
defs read: (value) ->
return value if isBoolean(value)
return true if value is "true"
return false if value is "false"
return false
defs write: (value) ->
return "true" if value is "true" or value is true
return "false" if value is "false" or value is false
@collin
collin / pathology-rake.rb
Created December 3, 2012 11:36
pathology-rakep gem
CLASS_FILTER = /^([ ]*?)class ([\w+\.?]+)([\s+<]+?([\w+\.?]+))?[ ]*?$/
MODULE_FILTER = /^([ ]*?)module ([\w+\.?]+)[ ]*?$/
SourceFiles = FileList[File.expand_path("./src/**/*.coffee")]
def rewrite_task(name, source_list=SourceFiles)
desc "upgrade syntax to newer ruby like syntax"
file :rewrite_alpha_simprini_ruby_modules, source_list do |t|
SourceFiles.each do |file|
./installMaglev.sh 1.0.0
[Info] Starting installation of MagLev-1.0.0 on collin.local
[Info] Downloading MagLev-1.0.0.tar.gz using /usr/local/bin/wget --quiet
[Info] Uncompressing MagLev-1.0.0.tar.gz in /Users/collin/Downloads/MagLev-installer
[Info] Installing GemStone-27184.Darwin-i386 on collin.local
[Info] Downloading GemStone-27184.Darwin-i386.tar.gz using /usr/local/bin/wget --quiet
[Info] Uncompressing GemStone-27184.Darwin-i386.tar.gz in /Users/collin/Downloads/MagLev-installer
tar: GemStone-27184.Darwin-i386/sys/example.key: Cannot open: Permission denied
tar: GemStone-27184.Darwin-i386/sys/gdbg.hlp: Cannot open: Permission denied
tar: GemStone-27184.Darwin-i386/sys/gem: Cannot open: Permission denied
@collin
collin / who_knows.rb
Created October 4, 2012 17:15
might be a bad thing
def index
observe_scopes Comparison.active, Run.all
end
def observe_scopes(*scopes)
stream_events do |stream|
scopes.each do |scope|
observable = ScopeObserver.new(scope)
streamer = "#{scope.model.name}Streamer".constantize.new
@collin
collin / socket.rb
Created August 14, 2012 18:17
rack/websocket + rails
# gem 'websocket-rack'
# gem 'thin'
# config.threadsafe! == true
# or whatever Rails4 wants me to do.
require "rack/websocket"
class MyApp < Rack::WebSocket::Application
def on_message(env, msg)
module Views
class Page < Erector::Widget
def content
text :doctype_html
html do
head do
csrf_meta_tag
title :application_title
assets
end
FactoryScenarios::Mail.register "Org Membership Invitation (no login)" do
mailer MembershipMailer
message :approval_message
message_args { Factory.create(:membership) }
end
FactoryScenarios::Mail.register "Org Membership Invitation (correct login)" do
mailer MembershipMailer
message :approval_message
message_args { Factory.create(:membership) }
class Pasteup.Models.StyleComponent.Values.Color extends Pasteup.Models.StyleComponent.Value
@extended()
AS.Model.Share.extends(this, "Pasteup.Models.StyleComponent.Values.Color")
@field 'red'
@field 'green'
@field 'blue'
@field 'alpha', default: 0
@virtual_properties "red", "green", "blue", "alpha",
AS.Collection = AS.Object.extend ({def, include, delegate}) ->
include Taxi.Mixin
delegate AS.COLLECTION_DELEGATES, to: "models"
def initialize: (@models=[], options = {}) ->
extend this, options
@length = 0
@byId = {}
@byCid = {}
@models = chain([])