This file contains 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
require 'rubygems' | |
require 'bundler/setup' | |
require 'sinatra' | |
require 'omniauth' | |
require 'openid/store/filesystem' | |
use Rack::Session::Cookie | |
use OmniAuth::Builder do | |
provider :open_id, OpenID::Store::Filesystem.new('/tmp') |
This file contains 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
Sammy.Store = function(options) { | |
var store = this; | |
this.options = options || {}; | |
this.name = this.options.name || 'store'; | |
this.element = this.options.element || 'body'; | |
//this.$element = $(this.element); // <== *** Don't redefine $element here... do it below... | |
if ($.isArray(this.options.type)) { | |
$.each(this.options.type, function(i, type) { | |
if (Sammy.Store.isAvailable(type)) { | |
store.type = type; |
This file contains 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
Sammy.Store = function(options) { | |
var store = this; | |
this.options = options || {}; | |
this.name = this.options.name || 'store'; | |
this.element = this.options.element || 'body'; | |
this.$element = $(this.element); // <== *** Why is $element redefined in this plugin? *** | |
if ($.isArray(this.options.type)) { | |
$.each(this.options.type, function(i, type) { |
This file contains 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'fssm' | |
puts "*** Now watching JS files..." | |
FSSM.monitor(Dir.pwd, ['js/*.js', 'Jimfile']) do | |
update do |base, relative| | |
unless relative.include?('bundled.js') | |
puts "*** #{relative} changed!" |
This file contains 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
div.tweet-text a img { | |
max-width: 430px; | |
} | |
div.tweet.latest-tweet div div a img { | |
display: none; | |
} |
This file contains 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
// Here's a nice little shorthand I found recently: | |
new Date() | |
// will produce Fri Oct 22 2010 11:19:51 GMT-0700 (PDT), however, | |
+new Date() | |
// will produce 1287771628111 which is the number of milliseconds since midnight of January 1, 1970... | |
// which is equivalent to this: |
This file contains 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 both( val ){ | |
if(typeof val == 'object') { | |
return val; | |
} else if(typeof val == 'function') { | |
var val = val(); | |
return typeof val == 'object' ? val : { top: val, left:val }; | |
} else { | |
return typeof val == 'object' ? val : { top:val, left:val }; | |
} | |
}; |
This file contains 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 $w = function(){ | |
var $w = function(){ | |
return new $w.init; | |
} | |
$w.prototype = { | |
// add all of the methods/props you want accessible as $w().method() or $w().prop here: | |
init: function(){ | |
console.log('init called'); | |
}, |
This file contains 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
/* | |
* A more dynamic API for WebCenter | |
* Rich Manalang / @rmanalan | |
* | |
* This is an attempt to make a better Javascript wrapper for the WebCenter REST API. | |
* Goals: | |
* - Dynamic object creation | |
* - Callbacks receive proper objects from prior call | |
* - Concurrent request support | |
* - Beautiful API |
This file contains 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 wc = {}; | |
$.getJSON('http://wc/rest/api/resourceIndex',function(d){ | |
wc = JSON.parse(d); | |
}); | |
// based on @ded's async method chaining http://www.dustindiaz.com/async-method-queues/ | |
// will initiate an async req to get the current user and lazily populates the currentUser | |
// object. | |
> wc.currentUser | |
[object currentUser] |