Skip to content

Instantly share code, notes, and snippets.

@vincentopensourcetaiwan
vincentopensourcetaiwan / gist:3173994
Created July 25, 2012 02:18
An error occured while installing pg (0.13.2), and Bundler cannot continue. Make sure that `gem install pg -v '0.13.2'` succeeds before bundling.
$ sudo apt-get install postgresql
$ sudo apt-get install libpq-dev
$ gem install pg
@vincentopensourcetaiwan
vincentopensourcetaiwan / registrations_controller.rb
Created July 25, 2012 02:23
Devise before filter that prevents access to “new_user_registration_path” unless user is signed-in
#/ app / controllers / registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
before_filter :authenticate_user!
end
@vincentopensourcetaiwan
vincentopensourcetaiwan / gist.html
Created July 25, 2012 02:38
A simple way to embed gist into Blogger's dynamic view.
<div class="gistLoad" data-id="GistID" id="gist-GistID">Loading ....</div>
@vincentopensourcetaiwan
vincentopensourcetaiwan / production.rb
Created July 25, 2012 02:56
Rails 3.1 Asset pipeline - Why my images do not precompile for production?
#/config/environment/production.rb
config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif]
@vincentopensourcetaiwan
vincentopensourcetaiwan / require_tree.css
Created July 25, 2012 03:04
“require_tree argument must be a directory” rails 3.1.1 precompile assets
require_tree ./mobile
@vincentopensourcetaiwan
vincentopensourcetaiwan / application.rb
Created July 25, 2012 03:16
bundle exec rake assets:precompile - database configuration does not specify adapter
config.assets.initialize_on_precompile = false
@vincentopensourcetaiwan
vincentopensourcetaiwan / routes.rb
Created July 25, 2012 03:28
How To: Manage users through a CRUD interface
devise_for :users, :path_prefix => 'my'
resources :users
@vincentopensourcetaiwan
vincentopensourcetaiwan / .zshrc
Created July 25, 2012 05:07
Disable autocorrect in zsh
source $ZSH/oh-my-zsh.sh
unsetopt correct_all
@vincentopensourcetaiwan
vincentopensourcetaiwan / test.sh
Created July 25, 2012 05:15
copy id_rsa.pub from current directory to remote drive
$ scp id_rsa.pub vincent@192.168.1.5:/users/vincent/documents
#copy id_rsa.pub from current directory to remote drive
$ chmod a+rwx
# add permissions to all
$ touch file_name
# create a file
$ rm -rf letters/
@vincentopensourcetaiwan
vincentopensourcetaiwan / test.sh
Created July 25, 2012 05:26
Install OpenSSH Server
$ sudo apt-get install openssh-server
# Install OpenSSH Server