Skip to content

Instantly share code, notes, and snippets.

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

Yann Marquet StupidCodeFactory

🏠
Working from home
View GitHub Profile
# How Clearance / Hoptoad does it
module Clearance
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration)
end
@StupidCodeFactory
StupidCodeFactory / rubyprivate_protected_public_naming_conventions.rb
Last active January 3, 2016 08:29
Underscorize private, protected and methods names, class and instance variables
require 'monitor'
class Dog
@_lock = Monitor.new
@@_dog_count = 0
attr_reader :name, age
[user]
name = ...
email = ...
[alias]
st = status
df = diff
co = checkout
ci = commit
br = branch
[color]
@StupidCodeFactory
StupidCodeFactory / ubber_log_parswer
Created May 17, 2012 20:01
get campaign name and company id parsing log
def get val
@val[@col_names.index(val)]
end
@col_names = []
@val = []
while line = STDIN.gets do
line.match /INSERT INTO `contests` \((.*)\) VALUES \((.*)\)/