Skip to content

Instantly share code, notes, and snippets.

@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]
@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
<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 / 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>
@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 / 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 / externalLinks.js
Created April 28, 2013 15:26
Open external tumblr links in a new tab
(ns app.ui.views
(:require
[crate.core :as crate]
[crate.form :as form])
(:use-macros
[crate.def-macros :only [defpartial]]))
(defpartial share-modal [content]
[:form#create-form.modal-body.form-horizontal
[:div.control-group
@hcliff
hcliff / views.cljs
Last active December 17, 2015 14:28
Demo usage of dommy-crate
(ns app.ui.views
(:require [crate.form :as form])
(:use-macros [dommy.macros :only [deftemplate]]))
(defpartial share-modal [content]
[:form#create-form.modal-body.form-horizontal
[:div.control-group
(form/label {:class "control-label"} "link" "download link")
[:div.controls
(form/text-field {:class "input-xlarge"} "link" (content :url))]]])
@hcliff
hcliff / indexing.html
Created September 9, 2013 15:57
Spling indexing code
<script src='//spling.com/api/2/indexing/' defer async type='text/javascript'></script>