Skip to content

Instantly share code, notes, and snippets.

@pheuter
pheuter / sc-dl.js
Created March 5, 2012 20:44
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@pheuter
pheuter / serve.go
Created July 31, 2011 18:34
go http streaming
package main
import (
"fmt"
"io"
"io/ioutil"
"strings"
"exec"
"http"
)
@pheuter
pheuter / gist:3515945
Created August 29, 2012 17:33
Handlebars.js equality check in #if conditional

Handlebars.js is a template framework for Javascript environments. It allows the construction of HTML elements using HTML and expressions wrapped in {{ }}

Limitations of {{if}}

One of the conditional block helpers Handlebars offers is the {{#if}}.

For example:

<div class="entry">
@pheuter
pheuter / yo
Created September 9, 2017 04:24
0x94b830d74b649bbe82c44ba13201db4b63703f0f
0xcd480AcE2ab78C48131BE418eCad556EEC56741e
0x93DD32a66BCFF2ccBC6F95336cAc34c242857402
@pheuter
pheuter / lisp.hs
Created May 1, 2011 03:34
Minimal Lisp in Haskell
{-# LANGUAGE OverloadedStrings #-}
{- To Run:
Load in ghci
:set -XOverloadedStrings (for convenience)
Execute repl expr -}
import Control.Applicative
import Data.Attoparsec hiding (Result)
import Data.Attoparsec.Char8 (char8, isDigit_w8, isSpace_w8)
@pheuter
pheuter / gist:7d37a6f011c0aa786912
Created January 8, 2016 16:48
On why the team is moving forward with the ava test runner over mocha
mark
Jan 8, 2016
----
[11:45 AM]
yeah, and then i realized im thinking too much about it, and i went with the faster tool whose assertion syntax covers everything our tests use so far and is a relatively simple port over.
[11:46]
honestly, both tools are close, and i just picked one i feel can service us more with the bleeding edge environment we’re on
[11:46]
class A
initialize: ->
@x = 1
a = new A
x: 1
log a
@pheuter
pheuter / test.js
Created November 21, 2012 19:32
backbone.computedfields marionette.collectionview unit test
describe('when ComputedFields initialized in Backbone.Model via Marionette.CollectionView', function () {
var model, collection, collectionView;
beforeEach(function () {
var Model = Backbone.Model.extend({
initialize: function () {
this.computedFields = new Backbone.ComputedFields(this);
},