Skip to content

Instantly share code, notes, and snippets.

View AlexParamonov's full-sized avatar

Alexander Paramonov AlexParamonov

View GitHub Profile
# Get collection
# vars: resource, respond_with
shared_examples_for :get_collection_request do |name:|
before { resource }
before { do_request }
let(:respond_with) { {} }
it "has status :ok" do
expect(response).to have_http_status :ok
end
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@AlexParamonov
AlexParamonov / sketch.rb
Created September 24, 2012 18:24 — forked from mattwynne/sketch.rb
sketch for Matt Wynne
class Organization
def to_param
"42"
end
def saved?
rand > 0.5
end
end
@AlexParamonov
AlexParamonov / rspec_and_delegate.rb
Created April 5, 2012 13:45
Rspec and delegate
require "delegate"
class A < SimpleDelegator
def ex(foo)
end
end
@AlexParamonov
AlexParamonov / migrate.rb
Created February 13, 2012 15:24
file used to archive and restore code to/from cloud
#!/usr/bin/env ruby
require "rubygems" # ruby1.9 doesn't "require" it though
require "facets/string/unindent"
require "thor"
class Migrate < Thor
class Logger
def initialize(color, console)
@color = color
@console = console
@AlexParamonov
AlexParamonov / ruby 1.8 vs 1.9 alias_method + extend.rb
Created January 20, 2012 14:32
This gist will lich all your free time, so be warned!
class Q
def add
puts "added to Q"
end
end
queue = Q.new
notifier = Module.new do
def add(*args)
$ metrical
/home/ap/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/racc/parser.rb:349:in `on_error': (Racc::ParseError)
parse error on value "=>" (tASSOC)
from /home/ap/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/racc/parser.rb:99:in `_racc_do_parse_c'
from /home/ap/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/racc/parser.rb:99:in `do_parse'
from /home/ap/.rvm/gems/ruby-1.9.2-p136/gems/ruby_parser-2.0.5/lib/ruby_parser_extras.rb:749:in `process'
from /home/ap/.rvm/gems/ruby-1.9.2-p136/gems/flog-2.5.0/lib/flog.rb:241:in `block in flog'
from /home/ap/.rvm/gems/ruby-1.9.2-p136/gems/flog-2.5.0/lib/flog.rb:235:in `each'
from /home/ap/.rvm/gems/ruby-1.9.2-p136/gems/flog-2.5.0/lib/flog.rb:235:in `flog'
from /home/ap/.rvm/gems/ruby-1.9.2-p136/gems/metric_fu-2.0.1/lib/generators/flog.rb:20:in `emit'