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.body.onorientationchange = function(){ | |
document.body.className = orientation % 180 == 0 ? 'vertical' : 'horizontal'; | |
})(); |
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
namespace :svg2js do | |
%w(object array).each do |format| | |
desc "convert svg files to javascript #{format}, require :from and :to arguments" | |
task format do | |
unless ENV["from"] && ENV["to"] | |
puts "from and to params required" | |
else | |
Svg2JsConvertor.convert(ENV["from"], ENV["to"], format) | |
puts "#{ENV["to"]} generated succesfully" |
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
<!DOCTYPE html> | |
<!-- saved from url=(0035)http://mir.aculo.us/demos/flip.html --> | |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>HTML5 Mobile Pro Example: Flips</title> | |
<style type="text/css" media="screen"> | |
body { font-family: Arial;} | |
img { width: 100px; height: 100px;} | |
td { padding: 10px } | |
.flip-horizontal { -webkit-transform: matrix(-1, 0, 0, 1, 0, 0) } | |
.flip-vertical { -webkit-transform: matrix(1, 0, 0, -1, 0, 0) } |
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.RETURN_SELF = function(){ | |
return this; | |
} | |
var Widget = (function(UI){ | |
var Widget = function(){ | |
// initialize | |
} | |
Widget.prototype = { |
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 combinator(){ | |
var args = $A(arguments).reverse().map(function(v){ return v.split("") }); | |
function combine(len){ | |
if (len == 0){ | |
return args[len]; | |
} | |
return combine(len-1).inject([], function(memo, a){ | |
args[len].each(function(b){ |
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
class Accounts::ProjectsController < Accounts::BaseController | |
def show | |
@project = find_project | |
end | |
def update | |
@project = find_project | |
if @project.update_attributes(params[:project]) | |
redirect_to [@account, @project], :notice => 'Project updated!' |
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 t(s,d){ | |
return s.replace(/{([^}]*)}/g, function(_, p){ | |
return (typeof d[p])[0]=='f' ? d[p]() : d[p]; | |
}); | |
} |
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
brew search postgres | |
brew tap homebrew/versions | |
brew install postgresql8 |
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
// before | |
$(document).delegate("#login-form", "submit:successful", function(e) { | |
var subEvent = new jQuery.Event("login:success"); | |
$(this).trigger(subEvent); | |
if (subEvent.isDefaultPrevented()) { | |
e.preventDefault(); | |
} | |
}); |
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
<?php | |
class Loader { | |
private static $loadPaths = array(); | |
static function autoload($class){ | |
// assume its name is its path (ActiveRecord_Relation_BelongsTo is in ActiveRecord/Relation/BelongsTo.php) | |
$fileName = str_replace('_', '/', $class). '.php'; | |
foreach (self::$loadPaths as $path){ |