Skip to content

Instantly share code, notes, and snippets.

View MilanGrubnic70's full-sized avatar

Milan Grubnic MilanGrubnic70

View GitHub Profile
@MilanGrubnic70
MilanGrubnic70 / shell_profile.txt
Created November 7, 2015 18:08
Shell aliases.
type:
subl ~/.profile
enter
# set Aliases
alias gs='git status'
alias ga='git add'
alias gb='git branch'
alias gc='git commit'
alias gd='git diff'
@MilanGrubnic70
MilanGrubnic70 / git_config.txt
Created November 7, 2015 18:04
Git config with aliases.
type:
subl ~/.gitconfig
enter
[user]
email = MilanG@aol.com
name = Milan Grubnić
[color]
ui = true
[credential]
@MilanGrubnic70
MilanGrubnic70 / bash_profile.txt
Last active April 2, 2016 01:38
Set up bash profile with aliases.
Type:
nano ~/.profile_bash
ctrl + o
enter
ctrl + x
to use:
echo "Hello, Milan Grubnić!"
alias his="history"
alias hist="history"
@MilanGrubnic70
MilanGrubnic70 / prompt.md
Created October 23, 2015 16:40
Shorten Terminal Command Line

PS1='\u:\W$ '

@MilanGrubnic70
MilanGrubnic70 / console.log
Created July 18, 2015 23:54
console.log() Shortcut Keybinding
[
{ "keys": ["alt+c"],
"command": "insert_snippet",
"args": {
"contents": "console.log(${1:}$SELECTION);${0}"
}
}
]
// alt + c will get you console.log(_)

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

[
    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }
 }
@MilanGrubnic70
MilanGrubnic70 / regexpsnippets.js
Created April 11, 2015 20:29
RegExp Snippets
US Zip Code REGEX
var ZipCode = /\d{5}(-\d{4})?/;
if you want to make sure the string ONLY contains a Zip Code use the ^ and $ to match the beginning and ending of the string like this:
var ZipCode = /^\d{5}(-\d{4})?$/;
US Phone Number REGEX
var phoneNum = /\(?(\d{3})\)?[ -.](\d{3})[ -.](\d{4})/;
if you want to make sure the string ONLY contains a phone number use the ^ and $ to match the beginning and ending of the string like this:
var ZipCode = /^\(?(\d{3})\)?[ -.](\d{3})[ -.](\d{4})$/;
Terminal shortcuts go in .bashrc in the home directory.
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'
@MilanGrubnic70
MilanGrubnic70 / git_log_pretty
Last active August 29, 2015 14:18
Git Log Pretty
git log --pretty=oneline
git log --pretty=oneline --max-count=2
git log --pretty=oneline --since='5 minutes ago'
git log --pretty=oneline --until='5 minutes ago'
git log --pretty=oneline --author=<your name>
git log --pretty=oneline --all
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
@MilanGrubnic70
MilanGrubnic70 / preventDefault
Created March 22, 2015 20:26
preventDefault in JavaScript
$('a').click(function(evt){
// JavaScipt goes here
evt.preventDefault(); // don't follow link
});