Skip to content

Instantly share code, notes, and snippets.

@raecoo
raecoo / buttons.css.scss
Created April 26, 2012 08:03
CSS3 Button Styles
@import "css3";
p.button {
margin: 0 0 2em;}
h1.button {
margin: 0;}
a.button {
text-decoration: none;}
# in routes.rb
devise_for :users, :controllers => { :registrations => "registrations" }
class RegistrationsController < Devise::RegistrationsController
protected
def after_sign_up_path_for(resource)
# anywhere you want to go
end
@raecoo
raecoo / rbenv-install-system-wide.sh
Created July 4, 2012 07:00 — forked from v1nc3ntlaw/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p194 on Debian 6 Squeeze
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@raecoo
raecoo / gist:3064396
Created July 7, 2012 03:45
merge upstream from fork repository
1. git remote add upstream <origin repo>
2. git fetch upstream
3. git merge upstream/master
4. git push
@raecoo
raecoo / gist:3121396
Created July 16, 2012 07:41
Nginx daemons script for mac os
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@raecoo
raecoo / before_filter
Created August 27, 2012 03:35
Simple Token Authentication for Devise
# before filter for api controller
def verify_authenticity_token
@current_user = User.find_by_authentication_token(params[:auth_token])
render status: 401, json: { message: '...' } and return unless @current_user
end
@raecoo
raecoo / openvpn-server.conf
Created September 17, 2012 14:56
openvpn + shorewall
local domain
port 7878
proto udp
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
ifconfig-pool-persist ipp.txt
@raecoo
raecoo / array_dupplicate_counter.js
Created December 7, 2012 02:42 — forked from ralphcrisostomo/array_dupplicate_counter.js
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/
@raecoo
raecoo / Upgrade Postgres 9.1 to 9.2
Created December 22, 2012 02:10
Upgrade Postgres 9.1 to 9.2
cd /usr/local/var
mkdir postgres9.2
# Initialize a the new postgres 9.2 database
initdb /usr/local/var/postgres9.2
# Tell postgres we are upgrading the existing postgres database to the new postgres9.2 location
pg_upgrade -d /usr/local/var/postgres/ -D /usr/local/var/postgres9.2 -b /usr/local/Cellar/postgresql/9.1.4/bin/ -B /usr/local/Cellar/postgresql/9.2.1/bin/ -v
# Swap the folders
@raecoo
raecoo / gist:4553687
Created January 17, 2013 04:35
Disables the select effects for jqTransform
function fix_select(selector) {
selectedVal = $(selector).children(':selected').val();
$(selector).children('option').removeAttr('selected');
$(selector).children('option[value="'+selectedVal+'"]').attr('selected','selected');
$(selector).removeClass('jqTransformHidden');
$(selector).css('display','block');
$(selector).prev('ul').remove();
$(selector).prev('div.selectWrapper').remove();