Skip to content

Instantly share code, notes, and snippets.

Joshua Mervine jmervine

Block or report user

Report or block jmervine

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View boot2dockerrc.sh
#############################################################
# Function -- Boot2Docker
#############################################################
if test "$(which boot2docker 2> /dev/null)"; then
function docker_shellinit {
local _shellinit="$(boot2docker shellinit)"
eval "$(echo ${_shellinit})"
echo "${_shellinit}" > ~/.boot2dockerrc
}
View Makefile
###
# Usage:
#
# Download this file and start by running 'make'. Then run
# each target listed, 'make lesson_one', 'make lesson_two',
# etc.
#
introduction:
# Introduction:
@jmervine
jmervine / 1results.md
Last active Aug 29, 2015
Pythagorean Triplet - run time of go vs. java vs. node vs. ruby vs. python vs. perl vs. php vs. c++
View 1results.md

Pythagorean Triplet

Note: The method used below is very slow, with 1bb iterations when trying to find 1000. For a faster method see: https://gist.github.com/jmervine/b5d985398b3ca7ba16aa (~125k iterations)


A Pythagorean triplet is a set of three natural numbers, a b c, for which,

a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52.

View FormattedDate.js
/*
Author: Joshua P. Mervine <joshua@mervine.net> [github.com/jmervine]
See: http://jsfiddle.net/jmervine/dqA9r/5/
Use:
<script src="http://cdn.mervine.net/FormattedDate.js" />
<script src="http://cdn.mervine.net/FormattedDate.min.js" />
@jmervine
jmervine / goinst.sh
Last active Jul 31, 2016
Installing GoLang - Ubuntu 12.04.3 LTS \n \l
View goinst.sh
#!/usr/bin/env bash
#
# Example usage:
#
# $ VERSION=1.3 sudo ./goinst.sh
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@wookimiii
wookimiii / grco.bash
Last active Jan 1, 2016
Check out a branch using grep
View grco.bash
#!/bin/bash
BRANCHES=$(git branch -ra | grep $1)
NUM=$(echo "$BRANCHES" | wc -l)
# check for empty
if [ "X$BRANCHES" = "X" ]
then
echo "No branch matches $1"
fi
@igrigorik
igrigorik / github.bash
Last active May 15, 2020
Open GitHub URL for current directory/repo...
View github.bash
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
View gist:6232984
# "Install" (I use that term loosely)
#
# - Paste the function below in your .bashrc / .profile / .zshrc / etc.
#
# Usage: find /usr/local -type [m|g] -name [KEYWORD]
#
# -type m : google maps search
# -type g : google search
#
# all other types pass through to find
@jmervine
jmervine / test_helper.sh
Last active Dec 19, 2015
Simple Bash Test Framework
View test_helper.sh
################################################################################
# Simple CLI Testing Psudo-Framework
# > http://mervine.net/simple-cli-testing-framework
#
# Assertions:
# - assert "CMD" "FAIL MESSAGE"
# - refute "CMD" "FAIL MESSAGE"
# - assert_equal "FIRST" "SECOND" "FAIL MESSAGE"
# - refute_equal "FIRST" "SECOND" "FAIL MESSAGE"
# - assert_numeq "FIRST" "SECOND" "FAIL MESSAGE"
View install_node.sh
#!/usr/bin/env bash
set -x
cd /tmp
rm -rf node
set -ue
git clone git://github.com/joyent/node.git
cd node
You can’t perform that action at this time.