Skip to content

Instantly share code, notes, and snippets.

@senmu
senmu / gist:5c49c4f3138bce85701e
Created April 30, 2015 19:18
Alias to open current repo on GitHub in a browser
alias gho="git config --get remote.origin.url | ruby -ne 'puts %{https://github.com/#{\$_.split(/.com[\:\/]/)[-1].gsub(\".git\",\"\")}}' | xargs open"

Keybase proof

I hereby claim:

  • I am senmu on github.
  • I am senmu (https://keybase.io/senmu) on keybase.
  • I have a public key whose fingerprint is D449 4559 4141 2538 E5C4 69A7 D6B5 39E8 09BD 0C33

To claim this, I am signing this object:

@senmu
senmu / gist:dc7c5aecd3aeed904b95
Created November 3, 2014 01:23
Print out elements in an alternating fashion from two arrays
<?php
// Sample arrays
$dribbble = array("dribbble item 1", "dribbble item 2", "dribbble item 3");
$instagram = array("instagram 1", "instagram 2", "instagram 3", "instagram 4", "instagram 5");
// Determine maximum size to iterate to
$maxSize = max(count($dribbble), count($instagram));
for ($i = 0; $i < $maxSize; $i++) {
@senmu
senmu / gist:1277486
Created October 11, 2011 07:06
A makefile for simple java projects
JC = javac
.SUFFIXES: .java .class
.java.class:
$(JC) *.java
default: .java.class
clean:
$(RM) *.class
@senmu
senmu / gist:1201985
Created September 7, 2011 22:25
Recursively convert Windows CR+LF to Unix LF in bash
# The following command can be entered in the terminal to convert files in the current directory
# to Unix LF which comes in handy when trying to add code to a git repo and you are faced with
# the error: fatal: CRLF would be replaced by LF
find . -name *.* -exec perl -pi -e 's/\r\n/\n/g' {} \;