Skip to content

Instantly share code, notes, and snippets.

View gartenfeld's full-sized avatar

David Rosson gartenfeld

View GitHub Profile
@gartenfeld
gartenfeld / introrx.md
Created April 21, 2016 00:40 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@gartenfeld
gartenfeld / yql_cors.js
Last active April 22, 2016 22:32
YQL CORS jQuery Plugin
// http://james.padolsey.com/snippets/cross-domain-requests-with-jquery/
// enableCORS();
var enableCORS = function() {
jQuery.ajax = (function(_ajax){
var api = 'http://query.yahooapis.com/v1/public/yql',
query = 'select * from html where url="{URL}"';
return function(o) {
var q = query.replace('{URL}', o.url);
o.url = api;
o.dataType = 'json';
@gartenfeld
gartenfeld / app.js
Last active April 27, 2016 03:16
Maze Explorer Draft
var app = require('express')();
var puzzle = require('./flipboard/maze');
app.get('/maze/new', puzzle.init);
app.get('/maze/update/:id', puzzle.update);
app.listen(3000, 'localhost');
@gartenfeld
gartenfeld / syllable_frequency.txt
Created June 16, 2016 19:24
Frequency of Syllables in English
ðə 23038047
ə 18735224
ˈtu 12418461
ˈænd 11260533
ˈʌv 10968008
ɪn 10738928
li 5689929
ˈðæt 5416929
ˈaɪ 4683241
ˈfɔr 4678692
@gartenfeld
gartenfeld / batch_convert.sh
Last active June 19, 2016 16:06
Batch Convert Script
for file in <DIR>/*.ogg; do
dest="converted/${file[@]/%ogg/mp3}"
ffmpeg -hide_banner -i "$file" -qscale:a 4 -acodec libmp3lame $dest
done
@gartenfeld
gartenfeld / pubsub.js
Created September 9, 2016 19:18
A minimal PubSub
(function($) {
if (!$ || typeof $.extend !== 'function') {
console.info("No jQuery found. Plugin did not mount.");
return;
}
var _cache = {};
/**
@gartenfeld
gartenfeld / fallback.sh
Created September 9, 2016 21:10
Shell Fallback with Error-Muting
# 2 represents stderr
# 2> redirects stderr (to /dev/null mutes error output)
# || runs the second command only if the first one fails
alias gcm='git checkout maybe 2> /dev/null || git checkout master'
@gartenfeld
gartenfeld / centering.css
Created September 27, 2016 01:00
Centering without Flexbox
// Add full screen wrapper
.box {
top: 50%;
left: 50%;
margin: 0;
position: absolute;
transform: translate(-50%, -50%);
}
@gartenfeld
gartenfeld / drag_and_drop_files.js
Created October 21, 2016 22:10
Drag and Drop Files
var element = $('#drop-area')[0];
var callback = function onFileDrop() {
var filenames = event.target.result;
};
function droppable(element, callback) {
element.addEventListener('dragover', function onDrag(event) {
event.stopPropagation();
event.preventDefault();

Install MacPorts

Optionally update MacPorts sudo port selfupdate

Download the port tree of HFST

  • Unpack the port tree
  • Add the port tree dir file:///.../hfst-macport/ to /opt/local/etc/macports/sources.conf
  • sudo port install hfst