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
const sharp = require('sharp'); | |
const aws = require('aws-sdk'); | |
const s3 = new aws.S3(); | |
const Bucket = "BucketName"; | |
const transforms = [ | |
{ name: 'small', size: 85 }, | |
{ name: 'medium', size: 160 }, | |
{ name: 'large', size: 250 }, | |
]; |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
namespace :mongo do | |
def confirm(message) | |
print "\n#{message}\nAre you sure? [y/n] " | |
# STDIN is not supported on heroku :/ | |
raise 'Aborted' unless STDIN.gets.chomp == 'y' | |
end | |
desc "gets database" | |
task :db => :environment do |
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
(function ($) { | |
var matchers = { | |
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, | |
'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/ | |
}; | |
var defaults = { | |
x: 0, | |
y: 0, |
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
// Extends API with actions | |
const actionsMiddleware = fn => (set, get, api) => { | |
const _actions = {}; | |
api.actions = () => _actions; | |
const state = fn(set, get, api); | |
Object.keys(state).forEach(key => { | |
if (typeof state[key] === 'function') { |
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
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) ? |
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
// balancer node | |
var httpProxy = require('http-proxy'); | |
var uuid = require('node-uuid'); | |
var Cookies = require('cookies'); | |
var redis = require('redis'); | |
var connect = require('connect'); | |
var express = require('express'); | |
var RedisStore = require('connect-redis')(express); | |
var redisClient = redis.createClient(); | |
var port = 8000; |
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
//viewport for https://github.com/scttnlsn/backbone.viewkit | |
var NamedViewSelector = Backbone.ViewKit.ViewPort.extend({ | |
constructor: function (options) { | |
options || (options = {}); | |
this._views = options.views || {}; | |
_.each(this._views, function(view) { | |
view.viewSelector = this; | |
}, this); |
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
var memoizer = function (memo, formula) { | |
var recur = function (n) { | |
var result = memo[n]; | |
if (typeof result !== 'number') { | |
result = formula(recur, n); memo[n] = result; | |
} | |
return result; | |
}; | |
return recur; | |
}; |
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
$.fn.queueAnim = function (steps, callback) { | |
var $selector = this; | |
function iterator(step) { | |
step.push(iterate); | |
$selector.animate.apply($selector, step); | |
} | |
function iterate() { | |
if (!steps.length) return callback && callback(); |
NewerOlder