Skip to content

Instantly share code, notes, and snippets.

View thomaswhyyou's full-sized avatar

Thomas thomaswhyyou

View GitHub Profile
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;
}
# 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
{
"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://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
// 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,

Postgres Cheatsheet

connect to postgres

$ psql

list databases

# _ _ __ _ _
# | |__ __ _ ___| |__ _ __ _ __ ___ / _(_) | ___
# | '_ \ / _` / __| '_ \ | '_ \| '__/ _ \| |_| | |/ _ \
# | |_) | (_| \__ \ | | | | |_) | | | (_) | _| | | __/
# |_.__/ \__,_|___/_| |_| | .__/|_| \___/|_| |_|_|\___|
# |_|
# 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)
@thomaswhyyou
thomaswhyyou / My bash_profile
Last active August 9, 2019 17:45
My bash_profile
# Reference:
# http://natelandau.com/my-mac-osx-bash_profile/ (mostly copied from here)
# https://gist.github.com/phlco/6670713 (..and here)
# http://www.linuxquestions.org/questions/linux-general-1/ultimate-prompt-and-bashrc-file-4175518169/
# https://gist.github.com/thomaswhyyou/8907953
# http://www.ibm.com/developerworks/linux/library/l-tip-prompt/
# http://cli.learncodethehardway.org/bash_cheat_sheet.pdf
# http://ss64.com/bash/syntax-prompt.html
# https://dougbarton.us/Bash/Bash-prompts.html
# http://jilles.me/badassify-your-terminal-and-shell/ (zsh)
// Place your settings in the file "User/Preferences.sublime-settings", which
// overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
[
{ "keys": ["ctrl+pageup"], "command": "prev_view" },
{ "keys": ["ctrl+pagedown"], "command": "next_view" },
{ "keys": ["super+ctrl+r"], "command": "reveal_in_side_bar"},
]