Skip to content

Instantly share code, notes, and snippets.

@hcliff
hcliff / externalLinks.js
Created April 28, 2013 15:26
Open external tumblr links in a new tab
@hcliff
hcliff / time
Created April 25, 2013 22:08
An example of time/timend
console.time('expensive-function');
setTimeout(function(){
console.timeEnd('expensive-function');
}, 2000);
>>> expensive-function: 2001.000ms
@hcliff
hcliff / gist:5397965
Last active December 16, 2015 07:19
Discovery embed code
<script type='text/javascript' id='spling-script'>
window.SPLING_URL = 'http://spling.com/widget-hero/user/ManVsWild/splingboards/most-watched';
</script>
<script type="text/javascript" src="http://spling.com/s/g/widget.js"></script>
<script type='text/javascript' id='spling-script'>
window.SPLING_URL = 'http://spling.com/widget-hero/user/CashCab/splingboards/most-watched';
</script>
<script type="text/javascript" src="http://spling.com/s/g/widget.js"></script>
@hcliff
hcliff / gist:5247762
Last active December 15, 2015 10:39 — forked from anonymous/gist:5165248
<script type='text/javascript' id='spling-script'>
window.SPLING_URL = 'http://spling.com/app/user/DanceMoms/splingboards-widget/dancemoms';
</script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jquery/1.7/jquery.min.js'></script>
<script type="text/javascript" src="http://spling.com/s/g/widget.js"></script>
<script type='text/javascript' id='spling-script'>
window.SPLING_URL = 'http://spling.com/app/user/DanceMoms/splingboards-widget/dancemoms';
</script>
<script type="text/javascript" src="http://spling.com/s/g/widget.js"></script>
@hcliff
hcliff / nest.coffee
Created February 23, 2013 22:04
Clojure methods in coffeescript for dealing with nested data
###
Walkers, used in the mixins walk, preWalk and postWalk
Note: against underscore argument convention due to
issues with _.partial
Shamelessly copied from bit.ly/X3tk8A
###
preWalk = (f, c)->
_.walk f(c), _.partial(preWalk, f), _.identity
@hcliff
hcliff / gist:5007872
Created February 21, 2013 20:22
get-in, set-in, update-in, nested group-by for underscore
# Extend underscore
_.mixin
lookupIterator: (v)->
if _.isFunction(v)
return v
return (o)-> o[v]
<iframe id="dit-video-embed" width="640" height="360" src="http://static.discoverymedia.com/videos/components/dsc/effaa16e409c5d299de52b5877810aca2ee0aecf/snag-it-player.html?auto=yes" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
<iframe id="dit-video-embed" width="100%" height="100%" src="http://static.discoverymedia.com/videos/components/dsc/effaa16e409c5d299de52b5877810aca2ee0aecf/snag-it-player.html?auto=yes" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
<html>
<head>
<title>The Grammy Awards Nominees</title>
<style type='text/css'>
body{
@hcliff
hcliff / asyncmacros.clj
Created September 27, 2012 15:05
Clojure macro for async callbacks
(ns async.macros
"Macros to avoid callback soup, act as defer/await "
(:use [taoensso.timbre :as timbre :only (trace debug info warn error fatal spy)]))
(defmacro let-async [bindings & body]