Skip to content

Instantly share code, notes, and snippets.


Milovan Zogovic assembler

View GitHub Profile
paulirish /
Created Jan 4, 2010
imagesLoaded() jquery plugin
vlado / gist:1877457
Last active Apr 3, 2018
Postgres on macos or OSX - Fix
View gist:1877457
# ** ERROR 1 **
# FATAL: lock file "" already exists
# HINT: Is another postmaster (PID 4646) running in data directory "/usr/local/var/postgres"?
# ** ERROR 2 **
# Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
# To fix one of this errors:
cat /usr/local/var/postgres/ # pid is the number on first line
CristinaSolana / gist:1885435
Created Feb 22, 2012
Keeping a fork up to date
View gist:1885435

1. Clone your fork:

git clone

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://
git fetch upstream
View gist:1975644
class PostsController < ActionController::Base
def create
def update
assembler / simple_form.rb
Created Mar 30, 2012
defining default form options in simple_form
View simple_form.rb
module SimpleForm::ActionViewExtensions::FormHelper
def simple_form_for_with_defaults(record, options={}, &block)
# define defaults here
simple_form_for_without_defaults(record, options, &block)
alias_method_chain :simple_form_for, :defaults
panthomakos / benchmark.rb
Created May 3, 2012
Benchmark Your Bundle
View benchmark.rb
#!/usr/bin/env ruby
require 'benchmark'
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
zenkay / gist:3237860
Created Aug 2, 2012
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion
View gist:3237860

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

adamico / simple_form_bootstrap.rb
Created Aug 30, 2013
Twitter Bootstrap 3 initializer for Simple Form
View simple_form_bootstrap.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# you need an updated simple_form gem for this to work, I'm referring to the git repo in my Gemfile
config.input_class = "form-control"
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.use :input
You can’t perform that action at this time.