Skip to content

Instantly share code, notes, and snippets.

View thomaswhyyou's full-sized avatar

Thomas thomaswhyyou

View GitHub Profile
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
# _ _ __ _ _
# | |__ __ _ ___| |__ _ __ _ __ ___ / _(_) | ___
# | '_ \ / _` / __| '_ \ | '_ \| '__/ _ \| |_| | |/ _ \
# | |_) | (_| \__ \ | | | | |_) | | | (_) | _| | | __/
# |_.__/ \__,_|___/_| |_| | .__/|_| \___/|_| |_|_|\___|
# |_|
# When Bash starts, it executes the commands in this script
# http://en.wikipedia.org/wiki/Bash_(Unix_shell)
#
# Written by Phillip Lamplugh, Instructor General Assembly (2013)

Postgres Cheatsheet

connect to postgres

$ psql

list databases

// install package control
// http://wbond.net/sublime_packages/package_control/installation
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
// https://github.com/buymeasoda/soda-theme/
// "theme": "Soda Light.sublime-theme",
"highlight_line": true,
"highlight_modified_tabs": true,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
# https://github.com/tomislav/osx-terminal.app-colors-solarized
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Prefer US English and use UTF-8
export LC_ALL="en_US.UTF-8"
export LANG="en_US"
# Tab improvements
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_match_enabled": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"default_line_ending": "LF",
"detect_indentation": true,
"dictionary": "Packages/Language - English/en_US.dic",
"draw_minimap_border": true,
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized
# http://geoff.greer.fm/lscolors/
# Colors
# -------------
txtblk='\[\e[0;30m\]' # Black
txtred='\[\e[0;31m\]' # Red
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
function validateEmail(){
//testing regular expression
var a = $("#email").val();
// explination of symbols at: http://www.zparacha.com/validate-email-address-using-javascript-regular-expression/
var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
//if it's valid email
if(filter.test(a)){ //The test() method tests for a match in a string.
return true;
}