Skip to content

Instantly share code, notes, and snippets.

def before_password_verification method_sym, options={}, &block
puts "Called before_password_verification: #{method_sym}, #{options.inspect}"
if block_given?
before :before_password_verification, method_sym, &block
else
before :before_password_verification do
if options[:if]
return false unless send(options[:if])
end
<button class="create" data-implied="{\"milestone[project_id]\":2}" data-uri="milestone/create">Create New Milestone</button>
module Orbited
module Transport
Map = {
'xhrstream' => XHRStreaming,
'htmlfile' => HTMLFile,
'sse' => SSE,
'longpoll' => LongPolling,
'poll' => Polling
}
[Videos]
Intentional Software Demo: http://msdn.microsoft.com/en-us/oslo/dd727740.aspx
Older Intentional Software Demo: http://www.youtube.com/watch?v=tSnnfUj1XCQ
Subtext demo: http://subtextual.org/subtext2.html
Alan Kay "Doing With Images Makes Symbols": http://video.google.com/videoplay?docid=-533537336174204822
[Books]
Your Brain is (Almost) Perfect: http://www.amazon.com/Your-Brain-Almost-Perfect-Decisions/dp/0452288843
What the Dormouse Said: http://www.amazon.com/What-Dormouse-Said-Counterculture-Personal/dp/0670033820
# This is really boring. Only shown for completeness.
# This loads up the application layout for the staticmatic app
# And renders it's layout.
# It is expected that "content" is an html string.
def wrap_with_layout content
engine = Haml::Engine.new File.read("src/layouts/application.haml")
@staticmatic = StaticMatic::Base.new(File.dirname(__FILE__))
engine.render { Hpricot(content)/"#content").to_s }
end
class Rack::Request
def forward_to target, &block
curl = Curl::Easy.new(target)
case
when get?
curl.http_get
when post?
curl.http_post body
when put?
class Rack::ProxyPass
def initialize src, target, &block
@src, @target, @block = src, target, (block || lambda {|echo|echo})
end
def call env
request = Rack::Request.new(env)
response = request.forward_to(request.fullpath.sub(@src, @target), &@block)
end
end
class Rack::Builder
def proxy_pass target, source, &block
run Rack::ProxyPass.new(target, source, &block)
end
end
proxy_pass '/blog/', 'http://whattech_wp/index.php/' do |doc|
@staticmatic = StaticMatic::Base.new(File.dirname(__FILE__))
doc = Hpricot(doc)
Engine.render self do
"#{doc/'head'}#{doc/'#content'}"
end
end
jetpack.future.import("pageMods");
function callback(document) {
jQuery(document).bind('DOMNodeInserted', function(event) {
var node = jQuery(event.target);
console.log(node.html())
if(node.is(':not(.message)')) return;
if(node.find('.body').text().match(/collin|colin/i))
jetpack.notifications.show({
title: node.find('.person').text(),