Skip to content

Instantly share code, notes, and snippets.


Jamie Hamel‑Smith jamiehs

View GitHub Profile
View LoremText.sublime-settings
// The default number of parapraphs to be inserted
"default_paragraph_count": 1,
// The default number of words for each parapraph to be inserted
"default_word_count": 7,
// If true, the generated text will always starts with "Lorem ipsum"
"always_start_with_lorem_ipsum": false,
jamiehs / style.css
Created Dec 19, 2013
Trying to figure out how to scale the fonts globally on a dashboard at work, and I stumbled upon this great tip!
View style.css
/* Using this, a web page designed for a 720p screen can be simply scaled up to 1080p (or vice-versa) */
/* This works especially well when the graphics are SVG and or icon fonts */
body { zoom: 1.5;} /* 1280 * 1.5 = 1920
jamiehs / gist:7982801
Created Dec 16, 2013
Undocumented YouTube thumbnail size. It seems to include some sort of signature.
View gist:7982801
jamiehs / content.html
Created Nov 25, 2013
Fluid Video Embeds. Includes modest branding and other niceties in the embed URL.
View content.html
<div class="fve-video-wrapper">
<iframe width="100%" height="100%" src=";modestbranding=1&amp;autohide=1&amp;showinfo=0&amp;rel=0" frameborder="0" allowfullscreen></iframe>
jamiehs / svg.html
Created Nov 15, 2013
SVG/PNG Fallback for IE 8 and lower.
View svg.html
<!--[if lte IE 8]> <img src="../octopus.png"> <![endif]-->
<!--[if gt IE 8]><!--> <img src="../octopus.svg"> <!--<![endif]-->
View gist:7437652
ui = true
st = status
c = commit -m
a = add
aa= !git add -u && git add . && git status
co = checkout
cob = checkout -b
up = !git fetch origin && git rebase origin/master
jamiehs / gist:7415442
Created Nov 11, 2013
Find MySQL Log Location
View gist:7415442
$(ps auxww|sed -n '/sed -n/d;/mysqld /{s/.* \([^ ]*mysqld\) .*/\1/;p;}') --verbose --help|grep '^log'
jamiehs /
Created Sep 23, 2013
Here's a little trick for cloning into an existing directory. The long and short of it is that you're checking the project out into a temp folder, then moving the git directory, and then resetting to the head.
# From:
git clone --no-checkout repo-to-clone existing-dir/existing-dir.tmp
mv existing-dir/existing-dir.tmp/.git existing-dir/
rmdir existing-dir/existing-dir.tmp
cd existing-dir
git reset --hard HEAD # git thinks all files are deleted, this reverses that behaviour
# To calculate the average file size within a directory:
ls -l | gawk '{sum += $5; n++;} END {print sum/n;}'
# If you'd like to know the average size of some particular kind of file:
ls -l *.jpg | gawk '{sum += $5; n++;} END {print sum/n;}'
jamiehs /
Created Jul 2, 2013
Looping through a list of URLs in a text file and optionally stripping the schema.
for URL in $(cut -d, -f2 < url_list.txt)
URL=$(sed -e 's/^http\(\|s\):\/\///g' <<< "$URL" )
echo $URL