Skip to content

Instantly share code, notes, and snippets.

@bigs
bigs / defer.js
Last active December 22, 2017 09:46
a very quickly hacked implementation of go's defer in javascript
var deferWrap = function (f) {
return function () {
var cbs = [];
var d = function (cb) {
cbs.push(cb);
};
var args = Array.prototype.slice.call(arguments);
args.push(d);
f.apply(this, args);
@bigs
bigs / one_of_us.rb
Last active December 18, 2015 04:19
form conformity. wouldn't it be cool if forms just fit in?
# even with form helpers, creating forms is a pain in the butt
# for web developers every where. so... tedious...
#
# what if there was a better way?
#
# what if forms could... FIT... IN?
#
# what if forms conformed to the rest of your elegant rails workflow?
# that would be pretty nice is what i am thinking.
#
$data['trackList'] = array(
(object) array(
'track_num' => 1,
'track_title' => 'You\'re No Good (feat. Santigold, Vybz Kartel, Danielle Haim & Yasmin)',
'track_time' => '4:32'
),
(object) array(
'track_num' => 2,
'track_title' => 'You\'re No Good (feat. Santigold, Vybz Kartel, Danielle Haim & Yasmin)',
'track_time' => '5:35'
@bigs
bigs / paperclip-rackspace.rb
Last active October 10, 2017 17:55
Uploading files to Rackspace in a Rails app using Paperclip + Fog
# config/initializers/paperclip.rb
#######################################
RACKSPACE_CONFIG = {
'production' => {
path: '',
storage: :fog,
fog_credentials: {
provider: 'Rackspace',
rackspace_username: ENV['RACKSPACE_USERNAME'],
@bigs
bigs / curry.js
Last active December 13, 2015 17:38
A cute currying function written in pure JavaScript for FUNZIES.
var curry = function (f, args, binding) {
if (typeof f !== 'function' ||
toString.call(args) !== '[object Array]') {
throw new Error('Invalid parameters');
return;
}
if (typeof binding !== 'object') {
binding = this;
}