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
class Label extends google.maps.OverlayView | |
constructor : (options) -> | |
@setValues options | |
@span = document.createElement "span" | |
@div = document.createElement "div" | |
@div.appendChild @span | |
# helpful for styling later | |
$(@div).addClass "label" |
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
$ -> | |
new ScatterGraph "scattergraph" | |
class ScatterGraph | |
constructor : (target) -> | |
@paper = Raphael target | |
bg = @paper.rect 0, 0, 500, 500 | |
bg.attr |
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
-- adapted from <http://johnmacfarlane.net/pandoc/scripting.html> | |
import Text.Pandoc | |
import Text.Pandoc.Shared (stringify) | |
extractURL :: Inline -> [String] | |
extractURL (Link txt (u,_)) = [stringify txt ++ " : <" ++ u ++ ">"] | |
extractURL (Image _ (u,_)) = [u] | |
extractURL _ = [] | |
extractURLs :: Pandoc -> [String] |
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
class ApplicationBase | |
constructor : (arg1, arg2) -> | |
# do something with arg1, arg2 | |
@init() | |
init : => # override this |
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 | |
# The secret is to use the word boundary in the regex so it doesn't | |
# return the grep process too. | |
# Then use awk to extricate the second column of the match. | |
# Capture that as $PID and kill -9 it (if it exists). | |
PID=`ps auxww | grep -E "\\bsearchterm" | awk '{ print $2 }'` | |
if [ $PID ]; then |
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
// Because I always forget... | |
// | |
// In general: | |
// | |
// 1) Search for "<symbol you want> html unicode" or similar. | |
// 2) Replace u+ with a \ | |
// 3) Profit. | |
// | |
// Example (a · before a link): |
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
$("dl.mini-accordion dt").on "click", -> | |
$(@).parent().find("dt, dd").removeClass("is-open") | |
$.each [ $(@), $(@).next() ], (i, e) -> $(e).addClass("is-open") |
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
carousel = (sel) -> | |
[$car, ci, ia] = [ $(sel), ".carousel-item", "is-active" ] | |
[$inner, len] = [ $car.find("> div"), $car.find(ci).length ] | |
[cur, blobs] = [ 0, [] ] | |
$inner.css "width" : len * (width = parseInt($car.find(ci) \ | |
.first().addClass(ia).css("width"), 10)) | |
rotate = -> | |
move.apply blobs[if ++cur <= len - 1 then cur else cur = 0], [false] |
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
article, | |
aside, | |
details, | |
figcaption, | |
figure, | |
footer, | |
header, | |
hgroup, | |
nav, | |
section, |
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
# I needed to handle CSV files exported from Excel. The following madness ensued. | |
# (I actually thought this would be easier than handling it on the server. | |
# How wrong I was.) | |
# | |
# Summary: | |
# Most of the FileReader.read* methods will - in Chrome at least - give you a string | |
# without line-breaks. This is basically useless when you're working with a CSV file. | |
# However, if you read the data as an ArrayBuffer, you can actually see the line-breaks | |
# and create lines that way. | |
# |