Skip to content

Instantly share code, notes, and snippets.

View RStankov's full-sized avatar
🤖
👨‍💻

Radoslav Stankov RStankov

🤖
👨‍💻
View GitHub Profile
(document.body.onorientationchange = function(){
document.body.className = orientation % 180 == 0 ? 'vertical' : 'horizontal';
})();
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"
<!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) }
Function.RETURN_SELF = function(){
return this;
}
var Widget = (function(UI){
var Widget = function(){
// initialize
}
Widget.prototype = {
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){
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!'
function t(s,d){
return s.replace(/{([^}]*)}/g, function(_, p){
return (typeof d[p])[0]=='f' ? d[p]() : d[p];
});
}
brew search postgres
brew tap homebrew/versions
brew install postgresql8
// before
$(document).delegate("#login-form", "submit:successful", function(e) {
var subEvent = new jQuery.Event("login:success");
$(this).trigger(subEvent);
if (subEvent.isDefaultPrevented()) {
e.preventDefault();
}
});
<?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){