Skip to content

Instantly share code, notes, and snippets.

@mrgcohen
mrgcohen / strongpasswords.js
Created March 27, 2014 12:55
strong passwords
// strong password validation
jQuery.validator.addMethod("strongPassword", function(value, element) {
return value.match(/[a-z]/)
&& value.match(/[A-Z]/)
&& value.match(/[1-9]/)
&& value.match(/[^0-9a-zA-Z]/)
&& value.length >= 8;
}, "Password must be 8 characters long, contain at least one lowercase character (a-z), one uppercase character (A-Z), at least one digit (0-9), and at least one special character.");
@mrgcohen
mrgcohen / role.sql
Created March 10, 2014 20:59
add role postgres
create role myapp with createdb login password 'password1'
@mrgcohen
mrgcohen / a_rm_move_to_trash.bash
Created September 19, 2013 20:19
rm = move to trash
if [ $# -eq 0 ]; then
echo "usage: trashit <files...>" >&2
exit 2;
fi
for file in "$@"; do
# get just file name
destfile="`basename \"$file\"`"
suffix='';
i=0;
@mrgcohen
mrgcohen / current_tab_chrome.js
Created August 20, 2013 01:01
get current tab id chrome
chrome.tabs.query({active:true,windowType:"normal"},function(d){console.debug(d[0].id);})
@mrgcohen
mrgcohen / .emacs.lisp
Created August 19, 2013 18:58
emacs please switch tabs to spaces
;; if indent-tabs-mode is off, untabify before saving
(add-hook 'write-file-hooks
(lambda () (if (not indent-tabs-mode)
(untabify (point-min) (point-max)))
nil ))

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@mrgcohen
mrgcohen / ssh_authorized_keys_setup.md
Last active December 21, 2015 01:28
authorized keys linux...how have i not been doing this more ...also i love ssh-agent

[ Dana = Local Machine ]
[ Michael = remote machine ]

  1. cd into home .ssh directory on Dana
cd ~/.ssh
  1. On Dana Create a keypair and include a passphrase (we can have apple keychain save it and never have to remember it... thanks ssh-agent)
@mrgcohen
mrgcohen / .bash_history
Last active December 15, 2015 14:59
Coldfusion setup mac (FML)
export=$PATH:/Application/ColdFusion10/cfusion/bin
@mrgcohen
mrgcohen / Readme.md
Last active November 9, 2022 22:17
Twitter Bootstrap Typeahead autocomplete example

Requirements

  • bootstrap with typeahead
  • jquery

Explanation

This will use bootstrap with typeahead to create an autocomplete search.

@mrgcohen
mrgcohen / case_insenstive_mac_terminal.sh
Created February 21, 2013 00:40
case insensitive mac terminal - don't hate me
echo "linux users don't hate me but i love it"
echo "set completion-ignore-case On" >> ~/.inputrc