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 / 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:3408661
Created August 20, 2012 22:32
git log in tree like fashion
git log --graph --pretty=format:'%C(yellow)%h%Creset%C(blue)%d%Creset %C(white bold)%s%Creset %C(white dim)(by %an %ar)%Creset' --all
@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 you@yourdomain.example.com

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

@lgmkr
lgmkr / patterns.js
Created August 21, 2012 12:43 — forked from jcleveley-zz/patterns.js
Javascript patterns
// namespace - single global variable for all news JS
var news = news || {};
// Example of a singleton as a revealing module
// When you only need one of something
news.preferences = (function (app, global) {
// Private variables
var persistent = true;
@lgmkr
lgmkr / patterns.js
Created August 21, 2012 12:49
JavaScript Patterns
/**
* @memberOf __module
* @type module
*/
var module = (/** @constructor */ function() {
function privateMethod() {
...
}