Skip to content

Instantly share code, notes, and snippets.

@garethrees
garethrees / gist:1363960
Created November 14, 2011 13:34
HTML5 Sections and Subsections
<section id="portfolio">
<h1>Portfolio</h1>
<section id="work">
<h2>Work</h2>
<!-- work goes here -->
</section>
<section id="open-source">
@garethrees
garethrees / .profile
Created December 2, 2011 12:05
Set git branch in bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\u:\W \$(parse_git_branch)$ "
@garethrees
garethrees / tumblr.scss
Created January 17, 2012 11:26
Tumblr embed code styling hooks (SCSS)
.tumblr_posts {
.tumblr_post {
.tumblr_title {}
.tumblr_body img {}
.read_more_container {}
.read_more_container a.read_more {}
}
.tumblr_text_post {
@garethrees
garethrees / application.html.erb
Created January 26, 2012 14:40
Boilerplate HTML <head> Section
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Make a DNS handshake with a foreign domain, so the connection goes faster when the user eventually needs to access it. This works well for loading in assets (like images) from another domain, or a JavaScript library from a CDN. -->
<link rel="dns-prefetch" href="//ajax.googleapis.com" />
<link rel="dns-prefetch" href="//s3.amazonaws.com" />
<!-- Make sure the latest version of IE is used -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@garethrees
garethrees / .bashrc
Created February 27, 2012 13:26
Set bash prompt colour
# You're on the production server dumbass!
export PS1="\e[0;31m[\u@\h \W]\$ \e[m"
@garethrees
garethrees / gist:1977788
Created March 5, 2012 10:33
Fixing YAML::Syck Error
gem update --system
gem pristine --all
@garethrees
garethrees / gist:2204347
Created March 26, 2012 10:28
How I got to automated html nav
require "pathname"
require 'set'
# @base_path = Pathname.new(File.dirname(__FILE__))
# def collect_paths(path)
# result = Set.new
# result.add?(path)
# puts "entering method"
# paths = []
@garethrees
garethrees / gfm.rb
Created March 28, 2012 23:33 — forked from mojombo/gfm.rb
Github Flavoured Markdown
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@garethrees
garethrees / _notice_display.html.haml
Created April 5, 2012 08:38
Flash outputs random 0
= if notice
#notice
%p
= notice
@garethrees
garethrees / hack.sh
Last active December 30, 2018 18:49 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2470157/hack.sh | sh
#