Skip to content

Instantly share code, notes, and snippets.

View lgmkr's full-sized avatar
🏠
Working from home

Oleh Makarov lgmkr

🏠
Working from home
View GitHub Profile
@lgmkr
lgmkr / ruby_constant.rb
Created September 1, 2011 11:40 — forked from marshluca/ruby_constant.rb
constant in Rails
Loading development environment (Rails 2.3.8)
>> Rails.env
=> "development"
>> RAILS_ENV
=> "development"
>> RUBY_VERSION
=> "1.8.7"
@lgmkr
lgmkr / ruby-1.9-tips.rb
Created July 7, 2012 12:42 — forked from igrigorik/ruby-1.9-tips.rb
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@lgmkr
lgmkr / gist:3082258
Created July 10, 2012 09:22
ruby 1.9.3-p194 with performance patches built into a .deb package with fpm
# AMI: ubuntu/images/ebs/ubuntu-precise-12.04-amd64-server-20120424 (ami-a29943cb)
#
# Part 1: Make a deb package of ruby:
# Get our deps
sudo apt-get install python-setuptools python-dev build-essential dpkg-dev libopenssl-ruby ruby1.8-dev rubygems bison autoconf zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl0.9.8 libssl-dev
# Get ruby
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -zxvf ruby-1.9.3-p194.tar.gz
@lgmkr
lgmkr / gist-1.sh
Created July 25, 2012 10:00 — forked from rondale-sc/gist-1.sh
give-it-a-pry
# In a rails app
pry(main)>.ls
Capfile Gemfile.lock Rakefile config db lib public test vendor
Gemfile README.md app config.ru doc log script tmp
@lgmkr
lgmkr / .pryrc
Created July 25, 2012 10:00 — forked from carlesso/.pryrc
Pry configuration
# Load plugins (only those I whitelist)
Pry.config.should_load_plugins = false
# Pry.plugins["doc"].activate!
# Launch Pry with access to the entire Rails stack.
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead.
# If you don't, you can load it through the lines below :)
rails = File.join Dir.getwd, 'config', 'environment.rb'
if File.exist?(rails) && ENV['SKIP_RAILS'].nil?
@lgmkr
lgmkr / Procfile
Created August 14, 2012 21:01 — forked from jayzes/Procfile
Thinking Sphinx and Foreman
sphinx: bundle exec rake ts:run_in_foreground
@lgmkr
lgmkr / modules_mockup.rb
Created August 18, 2012 11:54 — forked from ehlyzov/modules_mockup.rb
Модульная структура
module PB::SocialNetwork::Base
def self.included base
@networks << base
base.extend ClassMethods
base.include InstanceMethods
# другая инициализация
end
module PB
module SocialNetwork
class Twitter
include PB::SocialNetwork::Base
def initialize(token)
@token = token
end
def update_profile(params = {})
@lgmkr
lgmkr / rspec-syntax-cheat-sheet.rb
Created August 20, 2012 20:44 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@lgmkr
lgmkr / gist:3413668
Created August 21, 2012 08:48 — forked from dmexe/gist:1508019
Git workflow

После установки

Указываем свое имя и почту

git config --global user.name "Your Name Comes Here"
git config --global user.email [email protected]

Делаем алиасы на команды