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 'haml' | |
get '/' do | |
haml :overview | |
end | |
__END__ | |
@@ overview | |
%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
module Helper | |
def create_product(name) | |
create_table name do | |
primary_key :id | |
String :name, :null => false | |
end | |
end | |
end | |
Sequel.migration do |
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 Laptop < Sequel::Model | |
end | |
l = Laptop.new | |
l.columns | |
[:id, :hdd, :display] | |
l.hdd | |
=> nil | |
l.display |
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
This is the default title: Това е по подразбиране | |
Project title: Име на проекта |
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
$(function() { | |
$('select[data-nested-select]').each(function() { | |
var select = $(this), | |
groupName = select.data('nested-select'), | |
optgroups = select.find('optgroup'), | |
options = select.find('optgroup option'), | |
groupSelect = $('<select>'), | |
promptOption = makeOption(groupName, null, false); | |
groupSelect.append(promptOption); |
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
SVG.draw do | |
group do | |
fill :red | |
nested do | |
circle ... | |
end | |
end | |
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
class Product < ActiveRecord::Base | |
belongs_to :product_type | |
has_many :product_attributes, :extend => FindersByAtrributeName | |
def initialize(attributes = nil) | |
super | |
define_dynamic_accessors | |
end | |
def define_dynamic_accessors |
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
*** LOCAL GEMS *** | |
abstract (1.0.0) | |
actionmailer (3.0.10) | |
actionpack (3.0.10) | |
activemodel (3.0.10) | |
activerecord (3.0.10) | |
activeresource (3.0.10) | |
activesupport (3.0.10) | |
arel (2.0.10) |
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 "thread" | |
$mutex = Mutex.new | |
$total = 0 | |
def incr | |
$mutex.synchronize { $total += 1 } | |
sleep | |
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
describe '#greets_maks_for_his_birthday' do | |
context 'on his birthday' do | |
it 'greets him on facebook' do | |
maks_birthday = Date.new(2011, 11, 22) | |
Date.stub(:now).and_return(maks_birthday) | |
greets_maks_for_his_birthday.should post_to_facebook('Хей, ЧРД, мен') | |
end | |
end | |
end |
OlderNewer