This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date -d "-14 day" "+%F" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# logger.sh | |
# Log everything you do in Terminal. | |
#* Formatted date & time string. | |
FORMATTED_DATE=`/bin/date "+%Y-%m-%d%H%M%S"` | |
#* Archive the previous file | |
/bin/cp -f ~/Terminal.log ~/Terminal.log{,.$FORMATTED_DATE.txt} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#find the current git branch (this could be done differently through git status) | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
GREEN="\[\033[0;32m\]" | |
WHITE="\[\e[1;0m\]" | |
#update the shell prompt line | |
PS1="$WHITE\$(date +%H:%M) \w$GREEN \$(parse_git_branch)$WHITE\$ " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# To enable this hook, rename this file to "pre-commit". | |
grep -r --include "*.rb" pry . | |
if [ $? == 0 ]; then | |
echo "You have a binding.pry" | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
markup = <<-eom | |
<!DOCTYPE html> | |
<html> | |
<body> | |
<header> | |
<h1>HTML5</h1> | |
</header> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseHexColor(c) { | |
var j = {}; | |
var s = c.replace(/^#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/, function(_, r, g, b) { | |
j.red = parseInt(r, 16); | |
j.green = parseInt(g, 16); | |
j.blue = parseInt(b, 16); | |
return ""; | |
}); |
NewerOlder