Skip to content

Instantly share code, notes, and snippets.

View TSMMark's full-sized avatar
🐶

Mark Allen TSMMark

🐶
View GitHub Profile
@TSMMark
TSMMark / .zshrc
Last active March 30, 2018 14:29
ZSHRC - zsh profile
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/mark/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="avit"
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@TSMMark
TSMMark / pre-push
Created September 9, 2016 18:58
Prevent pushing to master in your git project!
# PUT THIS IN .git/hooks/pre-push IN YOUR PROJECT.
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
push_command=$(ps -ocommand= -p $PPID)
if [ $current_branch = $protected_branch ] || [[ $push_command =~ $protected_branch ]]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
@TSMMark
TSMMark / main.js
Created May 4, 2016 15:19
Chloe's javascript closure
function SecretHuman (name) {
this.getName = function () {
return name
}
}
var person = new SecretHuman("Chloe")
console.log("My name is " + person.getName()) // => My name is Chloe
@TSMMark
TSMMark / delete_local_branches.sh
Last active February 20, 2023 05:41
Delete local branches that don't exist on remote/origin !USE AT YOUR OWN RISK!
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
alias g-delete-all-branches-except-master="git branch | grep -v "master" | xargs git branch -D"
@TSMMark
TSMMark / .bash_profile
Created February 22, 2016 16:14
Vagrant .bash_profile
### http://git-prompt.sh/
source ~/.git-prompt.sh
### Set PS1
export PS1="[\[\033[32m\]\w\[\033[0m\]]\$(__git_ps1)\n\[\033[1;36m\]\u@vagrant\[\033[32m\]$ \[\\033[0m\]"
export PATH=/usr/local/bin:~/bin:$PATH
@TSMMark
TSMMark / .bash_profile
Last active March 7, 2016 21:22
.bash_profile
### http://git-prompt.sh/
source ~/.git-prompt.sh
### Set PS1
export PS1="[\[\033[32m\]\w\[\033[0m\]]\$(__git_ps1)\n\[\033[1;36m\]\u\[\033[32m\]$ \[\\033[0m\]"
export PATH=/usr/local/bin:~/bin:$PATH
### Set SublimeText as default editor
ln -sf "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
@TSMMark
TSMMark / main.rb
Created December 14, 2015 21:58
Ruby Object send
class Person
def call_mom!
puts "I just called mom."
end
def wash_car!
puts "I just washed my car."
end
@TSMMark
TSMMark / Preferences.sublime-settings
Created October 27, 2015 16:27
SublimeText 3 settings
{
"auto_find_in_selection": true,
"enable_tab_scrolling": false,
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"ignored_packages":
[
"Vintage"
],
"margin": 4,