This file contains 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
-- via https://stackoverflow.com/questions/5723154/truncate-a-string-in-the-middle-with-javascript | |
-- https://stackoverflow.com/questions/831552/ellipsis-in-the-middle-of-a-text-mac-style/36470401#36470401 | |
function truncateMiddle (str, maxLength, separator) | |
maxLength = maxLength or 30 | |
separator = separator or "…" | |
if (maxLength < 1) then return str end | |
if (string.len(str) <= maxLength) then return str end | |
if (maxLength == 1) then return string.sub(str, 0, 1) .. separator end |
This file contains 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
-- spout. | |
-- | |
-- key2 = sample A | |
-- key3 = sample B | |
-- enc2 = tempo | |
-- enc3 = rate selection | |
-- | |
engine.name = 'Ack' |
This file contains 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
require('regenerator-runtime/runtime') | |
import { forEach, map, pipe, fromEvent, scan } from 'callbag-basics' | |
import CAF from 'caf' | |
let source = pipe( | |
fromEvent(document, 'keydown'), | |
map(event => function * (signal) { | |
console.log('%cbegin', 'color:red') | |
yield CAF.delay(signal, 1000) |
This file contains 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
# space150 vine grabber | |
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it | |
# requires ruby, ffmpeg, and imagemagick | |
require 'open-uri' | |
require 'nokogiri' | |
id = ARGV[0] | |
# try to convert from URL to id. |
This file contains 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
# tiny hex to rgb | |
# via http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb/11508164#11508164 | |
def rgb(color) | |
[16, 8, 0].map { |n| color >> n & 255 } | |
end | |
rgb 0xfa029a | |
=> [250, 2, 154] |
This file contains 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
require 'tilt-mustache' | |
# Mustache Renderer | |
module Middleman::Renderers::Mustache | |
class << self | |
def registered(app) | |
# Mustache is not included in the default gems, | |
# but we'll support it if available. | |
begin | |
This file contains 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
# token.rb | |
# A minimal re-usable module for "token" slugs on ActiveRecord models (AKA shortcodes, tiny urls) | |
# | |
# USAGE | |
# | |
# class Project < ActiveRecord::Base | |
# include Token | |
# end | |
# | |
# see also: |
This file contains 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
# SuperCollider's SequenceableCollection blend, blendAt in CoffeeScript | |
# SEE ALSO: | |
# https://github.com/supercollider/supercollider/blob/master/SCClassLibrary/Common/Core/Object.sc | |
# http://danielnouri.org/docs/SuperColliderHelp/Collections/SequenceableCollection.html | |
# http://coleingraham.com/2012/12/31/notes-between-chromatic-just-intonation/ | |
# http://mohayonao.github.com/subcollider.js/ | |
class ArrayUtil | |
# via https://github.com/supercollider/supercollider/blob/master/SCClassLibrary/Common/Core/Object.sc | |
@blendAt: (array, index) -> |
This file contains 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
<html> | |
<head> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script src="https://raw.github.com/paulirish/matchMedia.js/master/matchMedia.js"></script> | |
<script src="https://raw.github.com/paulirish/matchMedia.js/master/matchMedia.addListener.js"></script> |