Skip to content

Instantly share code, notes, and snippets.

Piotr Chmolowski pch

Block or report user

Report or block pch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:837658
module Devise
module Controllers
module ScopedViews
# Monkey path for generating proper templates path when dealing with
# namespaced resources and custom views.
def render_with_scope(action, options={})
controller_name = options.delete(:controller) || self.controller_name
if self.class.scoped_views?
pch / watermark.rb
Created Jan 18, 2011
Paperclip Watermark processor
View watermark.rb
class User
has_attached_file :photo,
:processors => [:watermark],
:styles => {
:medium => {
:geometry => "300x300>",
:watermark_path => "#{Rails.root}/public/images/watermark.png"
:thumb => "100x100>",
View gist:771063
class String
def to_slug
s = self.gsub(/&/, 'and') # replace ampersand chars with 'and' before stripping HTML
s.gsub!(/<.*?>/, '') # strip HTML
s.gsub!(/&/, 'and') # replace ampersand chars with 'and'
s = Iconv.iconv('ascii//ignore//translit', 'utf-8', s).to_s # Borrowed partially from Technoweenie's PermalinkFu
s.gsub!(/\W+/, ' ') # all non-word chars to spaces
s.gsub!(/[\W^-_]+/, '-') # replace non-word chars with dashes
View gist:766349
NOW=$(date +"%Y-%m-%d_%H")
View mac-ssh-copy-id
cat ~/.ssh/ | ssh 'cat >>.ssh/authorized_keys'
View gist:577258
# source:
# file: .irbrc
require 'irb/completion'
IRB.conf[:AUTO_INDENT] = true
# Session History
View .bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
alias cdd='cd ~/Development'
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
You can’t perform that action at this time.