This file contains hidden or 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.calendarInput: (options) -> | |
defaults: { | |
active_class: "active" | |
calendar_id: "calendar_table" | |
calendar_class: "calendar_object" | |
calendar_container_id: "calendar_container" | |
controls_class: "calendar_controls" | |
custom_class: false | |
default_class: "calendar_input" | |
dont_allow_dates_from_the_past: true |
This file contains hidden or 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
# Pre-reqs | |
sudo apt-get -y install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline5-dev zlib1g-dev | |
# Install ruby 1.9.2 -p290 | |
sudo mkdir /usr/local/src | |
cd /usr/local/src | |
sudo curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz | |
sudo tar xzvf ruby-1.9.2-p290.tar.gz | |
cd ruby-1.9.2-p290 | |
sudo ./configure --prefix=/usr/local |
This file contains hidden or 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
# DataBinder is an object attached to the window. You can pass a JSON object | |
# and HTML node to the bind method to bind the JSON object data to the | |
# attributes mapped in the HTML node's data-bindings attribute. Providing | |
# an attribute data-template will cause the function to run recursively on child | |
# nodes. To prevent child nodes from being overwritten you can also set a | |
# data-preserve attribute on a given node. This will re-append a given elements | |
# children after updating it's content. | |
# | |
# Here's an example of a template in HTML: | |
# -------------------------------------------------------------------------------- |
This file contains hidden or 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
nodes = File.open("path/to/stylesheet.css").readlines.join("").gsub(/\n/,"").split("}").map do |chunk| | |
selectors = chunk.split("{")[0] | |
rules = chunk.split("{")[1] | |
chunk = { :selectors => selectors.split(','), :rules => rules.split(';').map{|r| [r.split(':')[0],r.split(':')[1]]} } unless rules.nil? or selectors.nil? | |
end | |
output = "" | |
nodes.each do |node| | |
unless node.nil? | |
output += node[:selectors].sort {|x,y| x.length <=> y.length }.join(",\n") + " {\n" | |
output += node[:rules].sort {|x,y| x[0] <=> y[0] }.map{|rule| " #{rule.join(": ")}"}.join(";\n") + "\n}\n\n" |
This file contains hidden or 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
# item.getDate() assumes you are returning a Date object from your model. | |
dateComparator: (item) -> | |
item.getDate().getTime() | |
reverseDateComparator: (item) -> | |
-item.getDate().getTime() |
This file contains hidden or 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
# Inspired and largely borrowed from Pixstatic | |
# http://www.pixastic.com/lib/git/pixastic/actions/noise.js | |
# https://github.com/jseidelin/pixastic | |
# And NetTuts tutorial: | |
# http://blip.tv/nettuts/how-to-generate-image-noise-with-canvas-4439977#EpisodeDescription | |
# http://net.tutsplus.com/tutorials/javascript-ajax/how-to-generate-noise-with-canvas/ | |
window.Noise = class Noise | |
constructor: -> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Apple nicely commented all of these transitions on their source file: | |
http://images.apple.com/global/styles/productbrowser.css --> | |
<style type="text/css" media="screen"> | |
/* Just some basic presentational CSS for the example */ | |
a { | |
background: #000; display: block; color: #fff; | |
font: 1.5em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; |
This file contains hidden or 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 hotSauce = new Sauce(); | |
hotSauce.addFlavor("chili",{ | |
equation: Easie.elasticOut, | |
from: -400, | |
to: 0, | |
period: 15 | |
}).addFlavor("pepper",{ | |
equation: Easie.circOut, | |
from: 0.5, | |
to: 1, |
This file contains hidden or 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: mergeObjects(obj1,obj2,obj3,etc) | |
mergeObjects = (objects...) -> | |
combinedObject = {} | |
for object in objects | |
combinedObject[key] = value for key,value of object | |
combinedObject |