Skip to content

Instantly share code, notes, and snippets.

@huyhong
huyhong / box_shadow.sass
Created June 25, 2009 19:28
box-shadow CSS3 Sass mixin
// box-shadow CSS3 Sass mixin
// http://www.w3.org/TR/css3-background/#the-box-shadow
= box-shadow(!horizontal_offset = 10px, !vertical_offset = 10px, !blur_radius = 5px, !box_color = #000)
:-webkit-box-shadow = !horizontal_offset !vertical_offset !blur_radius !box_color
:-moz-box-shadow = !horizontal_offset !vertical_offset !blur_radius !box_color
:box-shadow = !horizontal_offset !vertical_offset !blur_radius !box_color
@huyhong
huyhong / .bash_profile
Created August 2, 2013 18:37
Martin's colored git branch & RVM/gemset .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
bash_prompt() {
#git
local status=$(git status 2> /dev/null | grep 'working directory clean')
local dirty=''
if [ -z "$status" ]; then
local dirty='*'
fi
local branch=$(git branch 2> /dev/null | grep -e "\* " | sed "s/^..\(.*\)/\1/")
if [ -f "${rvm_path}/scripts/rvm" ]; then
source "${rvm_path}/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
elif [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
elif [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
@huyhong
huyhong / .powenv
Created August 18, 2013 12:18
.powenv inside rails projects
# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi
# load environment of current project ruby
if
@huyhong
huyhong / pangrams
Created September 7, 2013 00:56
List of Pangrams
Nymphs blitz quick vex dwarf jog. (27 letters)
DJs flock by when MTV ax quiz prog. (27 letters) (2 acronyms and a US spelling)
Big fjords vex quick waltz nymph. (27 letters)
Bawds jog, flick quartz, vex nymph. (27 letters)
Junk MTV quiz graced by fox whelps. (28 letters) (Includes proper noun)
Bawds jog, flick quartz, vex nymphs. (28 letters)
Waltz, bad nymph, for quick jigs vex! (28 letters)
Fox nymphs grab quick-jived waltz. (28 letters)
Brick quiz whangs jumpy veldt fox. (28 letters)
Glib jocks quiz nymph to vex dwarf. (28 letters)
@huyhong
huyhong / .slate
Last active December 24, 2015 22:39
.slate config for https://github.com/jigish/slate, replaces Divvy for me
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config orderScreensLeftToRight false
default color resolutions:1920x1200;1200x1920;1200x1920
# Old Divvy Setup
# bind 1:ctrl;cmd move 0;0 screenSizeX/1.75;screenSizeY
# bind 2:ctrl;cmd move (screenSizeX-(screenSizeX/1.75));0 screenSizeX/1.75;screenSizeY
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
@huyhong
huyhong / m2tech-hiface-1-mavericks
Last active January 2, 2016 15:29
Getting your M2Tech hiFace 1 working in Mavericks 10.9.x
# Following uninstalls older hiFace and previous async192/Northstar drivers
sudo kextunload -b 'com.m2tech.driver'
sudo kextunload -b 'com.async.driver.async192'
sudo rm -rf /System/Library/Extensions/Hiface.kext
sudo rm -rf /System/Library/Extensions/async192.kext
sudo pkgutil --forget com.m2tech.driver
sudo pkgutil --forget com.async.driver.async192
sudo touch /System/Library/Extensions
# Now go download and install the Wired 4 Sound DAC-2 async drivers: http://www.wyred4sound.com/uploads/74030/files/async_159r2_W4S.pkg.zip
# Rake task to copy local files to remote server via FTP
# required credentials.yml file, that contains keys:
# server, username, password
require "net/ftp"
require "yaml"
class FTPClient
attr_reader :remote_path
[
"https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xap1/t31.0-8/1492622_793008530741778_5001572426441309314_o.jpg",
"https://scontent-b-sea.xx.fbcdn.net/hphotos-xap1/t31.0-8/10669136_790715467637751_5014888847986707696_o.jpg",
"https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/10712542_787137031328928_6065770549473643086_o.jpg",
"https://scontent-a-sea.xx.fbcdn.net/hphotos-xaf1/t31.0-8/10700291_785304654845499_4430432684479576713_o.jpg",
"https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-xaf1/v/t1.0-9/10616066_782214548487843_3071510223817145555_n.jpg?oh=ee2b94076cdf0a15122fc7f5dff57764&oe=54F69CAF&__gda__=1422611998_ee42ade03956c881e62857c2aa9e2379",
"https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-xaf1/t31.0-8/10629453_778884362154195_5877912472267300922_o.jpg",
"https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xpa1/t31.0-8/10514193_776573405718624_6210020417955787752_o.jpg",
"https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xpa1/t31.0-8/10633304_774135589295739_1572734040