Skip to content

Instantly share code, notes, and snippets.

Note that the object option is applied to all of the roles you specify in the argument list. As such,
allow :devil, :son, :of => God
is equivalent to
allow :devil, :of => God
allow :son, :of => God
set nocompatible
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set mouse=a
syntax on
set hlsearch
class ListNode
attr_accessor :prev, :next, :value
def initialize(prev, next, value)
@prev = prev
@next = next
@value = value
end
end
class Purchase < ActiveRecord::Base
belongs_to :type,
:class_name => "PurchaseType"
# :foreign_key => "type_id"
validates_presence_of :expense, :amount, :type
end
describe List do
describe "#push" do
it "should push to empty list"
it "should push to non-empty list to tail"
end
describe "#pull" do
it "should return nil if empty list"
it "should return element from tail if non-empty list"
end
#include <stdlib.h>
int sort_buble(int *array, size_t size)
{
int *r = array + size - 1;
int *i;
while (array < r)
{
for(i = array; i < r; ++i)
["2009-01-27 18:17:59 UTC - cypok",
"2009-01-27 18:20:01 UTC - Сибирячка",
"2009-01-27 18:39:07 UTC - Nabira",
"2009-01-28 17:11:27 UTC - NIA",
"2009-02-02 17:49:36 UTC - ledy-ideal",
"2009-02-06 19:34:20 UTC - znakV",
"2009-02-07 08:14:22 UTC - Viveru",
"2009-02-07 20:29:53 UTC - Валентина",
"2009-02-07 20:54:46 UTC - людмила",
"2009-02-07 20:59:42 UTC - Almaz",
NoMethodError in GalleriesController#show
undefined method `base_class' for Hash:Class
/usr/lib/ruby/gems/1.8/gems/be9-acl9-0.9.3/lib/acl9/model_extensions/subject.rb:85:in `get_role'
/usr/lib/ruby/gems/1.8/gems/be9-acl9-0.9.3/lib/acl9/model_extensions/subject.rb:9:in `has_role?'
app/controllers/galleries_controller.rb:25:in `show'
class GalleriesController < ApplicationController
include GalleriesHelper
before_filter :find_gallery, :only => [:edit, :show, :update, :destroy]
before_filter :find_parent, :only => [:new_gallery, :new, :create]
access_control do
allow all, :to => [:index, :show]
allow :admin, :to => [:new_root, :new, :create, :edit, :update, :destroy]
#!/usr/bin/env ruby
# only for arrays with length equal to 16 :)
@arr = %w{17 7 27 1 43 3 56 2 29 4 40 32 5 8 28 6}.map &:to_i
def out(n)
a = @arr[0, n]
0.upto(5) do |l|
spacer = " " * (16 / 2**l - 1)