Skip to content

Instantly share code, notes, and snippets.

@dpfranklin
dpfranklin / pubsub.md
Created March 7, 2012 15:01 — forked from addyosmani/pubsub.md
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery 1.7 and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@dpfranklin
dpfranklin / middleman_sync_error
Created February 27, 2013 21:46
Middleman sync error with Middleman 3.0.12
$ middleman build
/Users/david/.rvm/gems/ruby-1.9.3-p392/gems/asset_sync-0.5.4/lib/asset_sync/config.rb:99:in `yml_path': undefined method `root' for Rails:Module (NoMethodError)
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/asset_sync-0.5.4/lib/asset_sync/config.rb:91:in `yml_exists?'
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/asset_sync-0.5.4/lib/asset_sync/config.rb:53:in `initialize'
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/asset_sync-0.5.4/lib/asset_sync/asset_sync.rb:15:in `new'
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/asset_sync-0.5.4/lib/asset_sync/asset_sync.rb:15:in `configure'
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/middleman-sync-3.0.9/lib/middleman-sync/extension.rb:31:in `block in registered'
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/middleman-core-3.0.12/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:53:in `instance_exec'
from /Users/david/.rvm/gems/ruby-1.9.3-p392/gems/middleman-core-3.0.12/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb:
@dpfranklin
dpfranklin / s3.thor
Created April 26, 2013 22:05
Thor task for deploying Middleman site to S3.
class Deploy < Thor
default_task :s3
desc "cleanS3test", "delete current
deploy"
def cleanS3test
puts "Deleting current deploy..."
system "s3cmd -r -f del s3://www.example.com/"
puts "Done"
@dpfranklin
dpfranklin / manifest
Created May 5, 2013 13:20
pdf2htmlEX manifest file
# pdf2htmlEX manifest
# by WangLu
# 2012.09.12
#
# Syntax
# The first char of each line is the command
# Empty lines are ignored
#
# # - comment
# @ - include a file from data dir