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 limit = getLimit(query.limit) | |
const after = getAfter(query.after) | |
// after must be a unix timestamp number or Date string | |
function getAfter (after) { | |
after = new Date(/^([0-9]+)$/.test(after) ? Number(after) * 1000 : after) | |
return after.valueOf() ? after : new Date() | |
} | |
// limit must be a number between 0 and 100 |
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 fs = require('fs') | |
const _ = require('lodash') | |
const path = require('path') | |
const mmm = require('mmmagic') | |
const assert = require('assert') | |
const chance = require('chance').Chance() | |
const uploadBike = require('../../utils/upload-bike') | |
const fixtures = path.resolve(__dirname, '../fixtures') | |
const Magic = mmm.Magic |
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 fs = require('fs') | |
var Joi = require('joi') | |
var _ = require('lodash') | |
var Router = require('koa-router') | |
var middleware = require('../middleware') | |
var bodyParser = require('koa-better-body') | |
module.exports = BikeshedsController | |
function BikeshedsController () { | |
var auth = middleware.authenticate() |
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 cn = require('classnames'), | |
React = require('react/addons'), | |
hotkey = require('react-hotkey'), | |
PureRenderMixin = React.addons.PureRenderMixin | |
var Dialog = React.createClass({ | |
mixins: [ | |
PureRenderMixin, | |
hotkey.Mixin('_handleHotkey') | |
], |
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 React = require('react') | |
var Html = React.createClass({ | |
propTypes: { | |
assets: React.PropTypes.object.isRequired | |
}, | |
render () { | |
var {scripts, styles} = this.props.assets | |
return ( |
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 promises = require('./request.promisify'), | |
superagent = require('superagent'), | |
cookies = require('cookies-js'), | |
methods = require('methods'), | |
clientRequest = {} | |
methods.concat('del').forEach(method => { | |
if (superagent[method]) | |
clientRequest[method] = (...args) => { | |
return superagent[method].apply(superagent, args).use(xsrfToken).use(promises) |
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(n,c){ | |
if (c[n] === void 0) { | |
c[n] = function () { | |
c[n].clients.push(this); | |
this._init = [Array.prototype.slice.call(arguments)]; | |
}; | |
c[n].clients = []; | |
var action = function(method){ |
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
'use strict'; | |
var pg = require('co-pg')(require('pg')), | |
co = require('co'); | |
var env = process.env.NODE_ENV || 'development', | |
config = require('../config/database')[env], | |
database = config.database; | |
delete config.database; |
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
# Make sure you have the fakes3 gem installed | |
group :test do | |
gem 'fakes3' | |
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
# Good reminder that sometimes we overthink things | |
# First I tried this, obviously it doesn't work because it gets evaluated when you run the command | |
# alias gulp='node --harmony $(which gulp)' | |
# Then I tried this, which works but is sorta long... | |
# alias gulp='node --harmony $(for x ($(which -a gulp)); do; if [ -e $x ]; then echo $x; break; fi; done)' | |
# | |
# Expanded: | |
# for x ($(which -a gulp)) |