Skip to content

Instantly share code, notes, and snippets.

import os
from fabric.api import env, run, prompt, local, get
from fabric.state import output
env.environment = ""
env.hosts = ["example.com"]
env.user = "admin"
env.full = False
output['running'] = False

Django Enviroment Setup on Mac OSX 10.6.2 (Snow Leopard)

Install Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
brew install git
cd /usr/local
git init
@nguyenlocduy
nguyenlocduy / active_admin_views_pages_base.rb
Created June 12, 2012 05:53 — forked from jocubeit/active_admin_views_pages_base.rb
Override footer content in Active Admin gem
# lib/active_admin_views_pages_base.rb
class ActiveAdmin::Views::Pages::Base < Arbre::HTML::Document
private
# Renders the content for the footer
def build_footer
div :id => "footer" do
para "Copyright &copy; #{Date.today.year.to_s} #{link_to('Example.com', 'http://example.com')}. Powered by #{link_to('Active Admin', 'http://www.activeadmin.info')} #{ActiveAdmin::VERSION}".html_safe
class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :login, :password, :password_confirmation, :remember_me
attr_accessor :login
@nguyenlocduy
nguyenlocduy / gist:3020001
Created June 29, 2012 19:06 — forked from chebyte/gist:1154889
Guide for configure Tomcat6, Solr 1.4, Sunspot for Rails Application on Ubuntu 8.04 or 10.04

Guide for configure Tomcat6, Solr 1.4, Sunspot for Rails Application on Ubuntu 8.04 or 10.04

1. Install the Java JRE and Ant

for ubuntu 8.04

add the following sources to /etc/apt/sources.list

deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

@nguyenlocduy
nguyenlocduy / MountainLion-Python-Fix
Created July 30, 2012 03:47 — forked from netologist/MountainLion-Python-Fix
Fix Mountain Lion 10.8 Python IOError pyconfig.h Error
After upgrading to Mountain Lion : 10.8 I noticed that I was getting Python errors which prevented me from starting vim:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 565, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 547, in main
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278, in addusersitepackages
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253, in getusersitepackages
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getuserbase
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 523, in get_config_var
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 419, in get_config_vars
@nguyenlocduy
nguyenlocduy / mountain-lion-brew-setup.markdown
Created July 30, 2012 05:05 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@nguyenlocduy
nguyenlocduy / uninstall_homebrew.sh
Created July 31, 2012 12:03 — forked from mxcl/uninstall_homebrew.sh
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@nguyenlocduy
nguyenlocduy / gist:3277877
Created August 6, 2012 19:40 — forked from chebyte/gist:1154889
Guide for configure Tomcat6, Solr 1.4, Sunspot for Rails Application on Ubuntu 8.04 or 10.04

Guide for configure Tomcat6, Solr 1.4, Sunspot for Rails Application on Ubuntu 8.04 or 10.04

1. Install the Java JRE and Ant

for ubuntu 8.04

add the following sources to /etc/apt/sources.list

deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

$('.submittable').live('change', function() {
$(this).parents('form:first').submit();
});