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
$.fn.html5_placeholder = function() { | |
var input = $(this); | |
input.focus(function() { | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); | |
if (input.val() == '' || input.val() == input.attr('placeholder')) { |
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 | |
# This is a basic deploy script for Heroku apps. | |
# It provides a structure you can use to expand on | |
# and add your own prereqs and deploy tasks. | |
# | |
# It basically ensures that: | |
# 1. There are no uncommited files | |
# 2. You can ssh to github | |
# 3. You can connect to heroku |
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 PubSub = { | |
subscribe: function(ev, callback) { | |
// Create _callbacks object, unless it already exists | |
var calls = this._callbacks || (this._callbacks = {}); | |
// Create an array for the given event key, unless it exists, then | |
// append the callback to the array | |
(this._callbacks[ev] || (this._callbacks[ev] = [])).push(callback); | |
return this; | |
}, | |
publish: function() { |
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
/*! | |
* jQuery Tiny Pub/Sub - v0.3 - 11/4/2010 | |
* http://benalman.com/ * | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ */ | |
(function($){ | |
var o = $({}); | |
$.subscribe = function() { o.bind.apply( o, arguments );}; | |
$.unsubscribe = function() { o.unbind.apply( o, arguments );}; |
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
jQuery.fn.tabs = function(control){ | |
var element = $(this); | |
control = $(control); | |
element.delegate("li", "click", function(){ | |
// Retrieve tab name | |
var tabName = $(this).attr("data-tab"); | |
// Fire custom event on tab click | |
element.trigger("change.tabs", tabName); | |
}); | |
// Bind to custom event |
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
// helper.js | |
var helper = {}; | |
helper.autoLink = function(data){ | |
var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g; | |
return(data.replace(re, '<a target="_blank" href="$1">$1</a> ') ); | |
}; | |
// template.html | |
<div> | |
${ helper.autoLink(this.data) } |
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
$(document).ready(function() { | |
// Create, show, and hide grid toggle | |
$('body').append('<div id="grid"></div>'); | |
$('body').append('<a href="#" class="toggle-grid"><span class="show">Show Grid</span><span class="hide">Hide Grid</span></a>'); | |
$('a.toggle-grid').toggle(function() { | |
$('#grid').slideDown('fast'); | |
$('.toggle-grid .hide').show(); | |
$('.toggle-grid .show').hide(); | |
}, function() { |
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 | |
# coding: utf-8 | |
require 'sinatra' | |
set :server, 'thin' | |
set :sessions, true | |
streams = Hash.new {|k, v| k[v] = [] } | |
helpers do | |
def session_id |
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
# Usage: redis-cli publish message.achannel hello | |
require 'sinatra' | |
require 'redis' | |
conns = Hash.new {|h, k| h[k] = [] } | |
Thread.abort_on_exception = true | |
get '/' do |
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
/* See http://cl.ly/8KmQ for an example */ | |
hr { | |
margin: 15px 0; | |
position: relative; | |
border: 1px solid transparent; | |
.box-shadow(0, 1px, 2px, rgba(0,0,0,0.3)); | |
&:before, &:after { | |
content: ""; |
OlderNewer