Skip to content

Instantly share code, notes, and snippets.

@bttmly
bttmly / generate_personal_podcast.rb
Created July 6, 2016 23:24 — forked from kelan/generate_personal_podcast.rb
A script for generating a personal podcast feed from mp3 files in a public Dropbox folder.
#!/usr/bin/env ruby -wKU
#
# by Kelan Champagne
# http://yeahrightkeller.com
#
# A script to generate a personal podcast feed, hosted on Dropbox
#
# Inspired by http://hints.macworld.com/article.php?story=20100421153627718
#
# Simply put this, and some .mp3 or .m4a files in a sub-dir under your Dropbox
/**
* Enable route to __noSuchMethod__ when unknown method calling.
*
* @param {Object} obj Target object.
* @return {Object}
*/
function enableMethodMissing(obj) {
var functionHandler = createBaseHandler({});
functionHandler.get = function(receiver, name) {
function toArray(args) {
return [].slice.call(args);
}
function autocurry(fn) {
var len = fn.length;
var args = [];
return function next() {
args = args.concat(toArray(arguments));
return (args.length >= len) ?
var createObservedObject = function(callback) {
var obj = {};
var args = [].slice.call(arguments, 1);
for(var i in args) {
var thisPropertyName = args[i];
(function(thisPropertyName) {
obj['_' + thisPropertyName] = undefined;
Object.defineProperty(obj, thisPropertyName, {
get: function() {
var first = (function() {
var chainNames = ["then", "andThen", "next"];
var endChainNames = ["finally", "andFinally", "last"];
var chain = function(fn) {
var f1 = function(g) {
var func = function() {return g.call(this, fn.apply(this, arguments));};
chain(func);
return func;
};
var f2 = function(g) {
var compose = function compose(f) {
var queue = f ? [f] : [];
var fn = function fn(g) {
if (arguments.length) {
queue.push(g);
return fn;
}
return function() {
var args = Array.prototype.slice.call(arguments);
queue.forEach(function(func) {
@bttmly
bttmly / nesting.js
Created January 19, 2014 04:36 — forked from geddski/nesting.js
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@bttmly
bttmly / aal.css
Created November 20, 2013 05:09 — forked from btbytes/aal.css
/*
aardvark.legs by Anatoli Papirovski - http://fecklessmind.com/
Licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php
URL: http://aardvark.fecklessmind.com/aal.css.txt
*/
/*
Reset first. Modified version of Eric Meyer and Paul Chaplin reset
from http://meyerweb.com/eric/tools/css/reset/
*/