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
javascript: | |
if( !window.goviasGrid ){ | |
window.goviasGrid = document.createElement("div"); | |
document.getElementsByTagName("body")[0].appendChild(window.goviasGrid); | |
window.goviasGrid.style.background = "url(http://tomlea.co.uk/assets/the-grid.png) repeat-y 50% 0"; | |
window.goviasGrid.style.width = "100%"; | |
window.goviasGrid.style.height = "100%"; | |
window.goviasGrid.style.position = "fixed"; | |
window.goviasGrid.style.top = "0"; | |
window.goviasGrid.style.bottom = "0"; |
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
module Rankable | |
extend ActiveSupport::Concern | |
included do | |
field :ratings_value_sum, :type => Integer, :default => 0 | |
field :ratings_count, :type => Integer, :default => 0 | |
embeds_many :ratings | |
end |
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 TextChange Plugin | |
* http://www.zurb.com/playground/jquery-text-change-custom-event | |
* | |
* Copyright 2010, ZURB | |
* Released under the MIT License | |
*/ | |
(function ($) { | |
$.event.special.textchange = { |
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
# checkout: http://github.com/igrigorik/async-rails/ | |
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001 | |
From: Ilya Grigorik <[email protected]> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ |
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
# TextMate dotfiles filter | |
# use this filter in Preferences -> Advanced -> Folder References -> File Pattern | |
# to show .gitignore, .gems (useful for Heroku), .bundle in your project | |
!(/\.(?!(htaccess|gitignore|gems|bundle))[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$ |
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
class User < ActiveRecord::Base | |
state_machine :initial => :pending do | |
# Event to call each time user proceeds to the next step | |
event :proceed do | |
transition :pending => :personal_info_registered | |
transition :personal_info_registered => :payment_info_registered | |
transition :payment_info_registered => :activated | |
end | |
# Attributes that must be present in at least Step 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
$$('a[data-remote=true]').each(function(a){ | |
a.onclick = function(){ | |
href = a.getAttribute('href'); | |
url = href.split('?')[0]; | |
params = href.split('?')[1]; | |
newParam = encodeURI(eval(a.getAttribute('data-with'))); | |
if(params){ | |
params = params.split('&'); |
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
require 'fiddle' | |
module FFI | |
module Library | |
def ffi_lib *libs | |
libs.each { |lib| Fiddle.dlopen lib } | |
end | |
def attach_function name, arg_types, return_type | |
f = Fiddle::Function.new( |
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
def gravatar_url(email,options = {}) | |
require 'digest/md5' | |
hash = Digest::MD5.hexdigest(email) | |
url = "http://www.gravatar.com/avatar/#{hash}" | |
options.each do |option| | |
option == options.first ? url+="?" : url+="&" | |
key = option[0].to_s | |
value = option[1].to_s | |
url+=key + "=" + value | |
end |
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
// Example: | |
JavaScript.load("/javascripts/something.js"); | |
// With callback (that’s the good thing): | |
JavaScript.load("http://www.someawesomedomain.com/api.js", function() { | |
API.use(); // or whatever api.js provides ... | |
}); |