Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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

Nate Clark n8io

💭
‾\_(ツ)_/‾
View GitHub Profile
@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
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 / heroku-deployment.md
Last active August 29, 2015 14:25
How to deploy code from git local repo to Heroku app

Heroku deployment via command line

Example app: ione-navigation

  1. Download and install heroku toolbelt (https://toolbelt.heroku.com)
  2. Create a Heroku account (https://signup.heroku.com/login)
  3. From the command line cd to your local repo's directory
  4. heroku login
  5. heroku git:remote -a ione-navigation # adds remote server to current git repo
  6. git push heroku master # to push master branch to heroku
  7. OR git push heroku my-other:master # to push my-other branch to heroku
@n8io
n8io / Preferences.sublime-settings
Created July 26, 2015 15:50
Sublime Text 3 - User Settings
{
"auto_indent": true,
"auto_match_enabled": true,
"bold_folder_labels": true,
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"caret_style": "phase",
"detect_indentation": true,
"ensure_newline_at_eof_on_save": false,
@n8io
n8io / .jscsrc
Created August 10, 2015 17:56
A sample config file for the JSCS linter
{
"disallowEmptyBlocks": true,
"disallowKeywords": [ "with" ],
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowMultipleVarDecl": true,
"disallowMixedSpacesAndTabs": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowOperatorBeforeLineBreak": [
"+",
@n8io
n8io / .jshintrc
Created August 10, 2015 17:58
A sample config file for the JSHINT linter.
{
"laxbreak": true
}