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
// OO-ish | |
function Car(manufacturer, model) { | |
this.manufacturer = manufacturer; | |
this.model = model; | |
} | |
var porsche = new Car('Porsche', 'Carrera'); | |
var ferrari = new Car('Ferrari', 'Enzo'); |
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
import hypermedia.video.Blob; | |
import java.awt.Rectangle; | |
public class BlobSizeComparator implements java.util.Comparator<Blob> { | |
public int compare(Blob a, Blob b) { | |
Rectangle boundingA = a.rectangle; | |
Rectangle boundingB = b.rectangle; | |
double areaA = boundingA.getHeight() * boundingA.getWidth(); | |
double areaB = boundingB.getHeight() * boundingB.getWidth(); |
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 ActiveRecord::Base | |
mattr_accessor :shared_connection | |
@@shared_connection = nil | |
def self.connection | |
@@shared_connection || retrieve_connection | |
end | |
end |
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
# fixtures/organizations.yml | |
my_organization: | |
name: My Organization | |
subdomain: myorganization | |
# spec | |
organization = organizations(:my_organization) | |
Factory(:site, :organization => organization) | |
# |
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
Module.class_eval do | |
def redefine_instance_method(name, &block) | |
old_instance_method = instance_method(name) | |
define_method(name) do | |
block.call(self, old_instance_method) | |
end | |
end | |
def redefine_class_method(name, &block) | |
old_method = method(name) |
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
# coding: utf-8 | |
FB_APP_ID = 'insert_me' | |
FB_APP_SECRET = 'insert_me' | |
class AuthApp < Sinatra::Base | |
use Rack::Session::Cookie | |
use OmniAuth::Builder do | |
provider :facebook, FB_APP_ID, FB_APP_SECRET |
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
# Index | |
http://www.call4paperz.com/events.json | |
# Show do evento | |
http://www.call4paperz.com/events/1.json | |
# Show da proposta | |
http://www.call4paperz.com/events/1/proposals/1.json | |
# Evento com JSONP (preste atenção no p no formato) |
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
#-- | |
# Copyright (C)2008 Ilya Grigorik | |
# You can redistribute this under the terms of the Ruby license | |
# | |
# Modifications by Vinicius B. Fuentes | |
#++ | |
require 'rubygems' | |
require 'optparse' | |
require 'ruport' |
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
Huge version with MacVim GUI. Features included (+) or not (-): | |
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent | |
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments | |
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con_gui +diff | |
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi | |
+file_in_path +find_in_path +float +folding -footer +fork() +fullscreen | |
-gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap | |
+libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession | |
+modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm | |
+mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme |
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
def sign_in_with(user = Factory(:user)) | |
visit '/users/sign_in' | |
fill_in "Email", :with => user.email | |
fill_in "Password", :with => user.password | |
click_button 'Sign in' | |
end |