Skip to content

Instantly share code, notes, and snippets.

View n8io's full-sized avatar
💭
‾\_(ツ)_/‾

Nate Clark n8io

💭
‾\_(ツ)_/‾
View GitHub Profile
@n8io
n8io / .bashrc
Last active January 8, 2018 22:28
A .bashrc file configuration for local dev.
clear
# Grunt aliases
alias g="grunt"
alias gr="grunt"
alias gw="grunt watcher"
alias gwb="grunt watcher | node_modules/.bin/bunyan" # Runs grunt watcher with pretty formatted bunyan output
alias gcb="grunt concurrent | ./node_modules/.bin/bunyan" # Runs grunt concurrent task (usually nodemon and watch tasks bundled)
echo "Grunt aliases loaded."
# Nodemon aliases
@n8io
n8io / iframe-tomfoolery.html
Last active August 29, 2015 14:12
Provides a way to hide elements before the page is visible if in an iFrame.
<html>
<head>
</head>
<body>
<!-- The first element in the body -->
<script>
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
@n8io
n8io / .bash_profile
Last active August 29, 2015 14:17
Enhanced termial
#PROMPT STUFF
GREEN=$(tput setaf 2);
YELLOW=$(tput setaf 3);
WHITE=$(tput setaf 7)
function git_branch {
# Shows the current branch if in a git repository
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \(\1\)/';
}
@n8io
n8io / Atlassian Pull Request - Checkout.js
Last active August 29, 2015 14:19
A bookmarklet for easily copying the git commands to checkout a given pull request in Bitbucket and Stash.
javascript:function() {
var input;
var branch;
var anchorEl;
if(!window.jQuery){
return;
}
branch = jQuery('.aui-iconfont-devtools-branch-small:eq(0)').next().attr('title') || jQuery('.aui-iconfont-devtools-branch-small:eq(0)').next().text();
@n8io
n8io / config
Created May 12, 2015 17:48
Disable ssh host checking
Host *
StrictHostKeyChecking no
@n8io
n8io / ssh.sh
Last active August 29, 2015 14:21
Remote bash setup
#!/bin/bash
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
fi
echo Loading ssh keys...
for file in $(find ~/.ssh/id_rsa* ! -name '*.*');
do
ssh-add $file
done
@n8io
n8io / .bashrc.sh
Last active November 2, 2015 14:22
#!/bin/bash
BASHRC=http://git.io/vlaIW
echo Downloading .bashrc ...
curl -sL $BASHRC -o ~/.bashrc
echo ...done. Make sure to run "source ~/.bashrc" to add to this session.
#!/bin/bash
BASH_PROFILE=http://git.io/vntan
echo Downloading .bash_profile ...
curl -sL $BASH_PROFILE -o ~/.bash_profile
echo ...done.
rand() {
printf $(( $1 * RANDOM / 32767 ))
}
rand_element () {
local -a th=("$@")
unset th[0]
printf $'%s\n' "${th[$(($(rand "${#th[*]}")+1))]}"
}
#Default Prompt
PS1="${YELLOW}\w${GREEN}\$(git_branch)${WHITE}\n$(rand_element 🔥 🚀 👻 ⛄ 👾 🍔 😄 🍰 🐑 💩 😎 📛) $ ";
@n8io
n8io / terminal-setup.sh
Last active February 7, 2017 22:11
How to get your terminal 'a rockin'
bash <(curl -sL http://bit.ly/bash-setup) # Initializes bash shortcuts
bash <(curl -sL http://bit.ly/ssh-setup) # Registers your ssh keys
bash <(curl -sL http://bit.ly/bash-emoji) # Adds some flare to your default prompt