Skip to content

Instantly share code, notes, and snippets.

View DylanFM's full-sized avatar

Dylan Fogarty-MacDonald DylanFM

View GitHub Profile
@DylanFM
DylanFM / sydney.json
Created December 11, 2012 04:29
Swellcast Sydney API response
{ "id" : 6,
"latitude" : "-33.8683",
"longitude" : "151.2086",
"name" : "Sydney",
"slug" : "sydney-surf-report",
"three_hourly_forecasts" : [ { "local_day" : "Tuesday",
"local_hour" : " 3am",
"swell_direction_compass_point" : "SSE",
"swell_direction_degrees" : "143",
"swell_height_metres" : "1.9",
@DylanFM
DylanFM / quote.markdown
Created October 10, 2011 18:11
A quote from The Elements of Typographic Style by Robert Bringhurst

Use spaced en dashes – rather than em dashes or hyphens – to set off phrases.

Standard computer keyboards and typewriters include only one dash, but a normal font of roman or italic type includes as least three. These are the hyphen and two sizes of long dash: the en dash – which is one en (half an em, M/2) in width – and the em dash—which is one em (two ens) wide.

In typescript, a double hyphen (- -) is often used for a long dash. Double hyphens in a typeset document are a sure sign that the type was set by a typist, not a typographer. A typographer will use an em dash, three-quarter em, or en dash, depending on the contest or personal style. The em dash in the nineteenth-century standard, still prescribed in many editorial style books, but the em dash is too long for use with the best text faces. Like the oversized space between sentences, it belongs to the padded and corseted aesthetic of Victorian typography.

Used as a phrase marker – thus – the en dash is set with a normal word space either si

@DylanFM
DylanFM / bagman.diff
Created July 27, 2011 17:14
Serialized values for indexed columns and drying up the serializing part a little too
diff --git a/lib/bagman/bag.rb b/lib/bagman/bag.rb
index df32a92..cb6ee30 100644
--- a/lib/bagman/bag.rb
+++ b/lib/bagman/bag.rb
@@ -51,17 +51,13 @@ module Bagman
end
target_class.send :define_method, "#{name}=" do |value|
+ serialised_value = self.class.serialise_value(value, options)
+
@DylanFM
DylanFM / ST.maps.coffee
Created June 30, 2011 14:50
First foray into asynch JS loading, this is a little snippet of the Surftourist maps code
class ST.maps.Map
constructor: (el, title, opts) ->
@el = $(el)
@opts = $.extend true, {}, @defaults, opts
if @el.length
@title = title
@markers = []
# Load Google maps if it's not present
@DylanFM
DylanFM / embed_videos.coffee
Created June 9, 2011 00:52
On Surftourist.com we've had some people putting in a vimeo or youtube link in their descriptions. We want to support video properly, but this is a quick attempt at addressing the solution for the meantime.
# Search for video urls within an element and embed them if possible
embedVideos = (el) ->
el = $ el
if el.length
el.each ->
section = $ @
matches = section.html().match /http:\/\/(www\.)?(youtube|vimeo)\.com\/[^\s<]*/gmi
if matches?.length
# Vimeo or Youtube?
for match in matches
@DylanFM
DylanFM / gist:1002288
Created June 1, 2011 13:28 — forked from sabman/gist:1002167
Greggpollack Last night in Berlin
@DylanFM
DylanFM / jquery.paginate.coffee
Created February 28, 2011 04:26
Works with will_paginate. Requires innerShiv http://jdbartlett.github.com/innershiv/
$.fn.extend
paginate: (opts) ->
# If we are working on elements
if this.length
this.each ->
defaults =
pagination: '.pagination'
itemPlural: 'things'
<!doctype html>
<html lang="en">
<head>
<title>Test for jQuery clone bug</title>
</head>
<body>
<section>
<p>Here is a little paragraph.</p>
</section>
@@ -170,7 +170,8 @@
filteredSelector: 'tbody > tr',
afterRender: null,
beforeRender: null,
- activateOnSetup: true
+ activateOnSetup: true,
+ siblings: true
};
function setup () {
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function check_git_changes {
var=`git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l`
if [ $var -ne 1 ]; then
tput setaf 1 # red
else
tput setaf 2 # green
fi