$ ./node_modules/.bin/knex:migrate:latest -c db/config.js
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
Account.query(function (q) { | |
q.where('account.id', '=', 1); | |
q.distinct().innerJoin('account_accounts', function () { | |
this.on('account.id', '=', 'account_accounts.id'); | |
}); | |
}).fetch({ | |
withRelated: ['accounts'] | |
}).then(function (account) { | |
return account.related('accounts').query(function (qb) { | |
qb.where('account.id', '=', 1006); |
JSONP is not actually JSON with padding, it's Javascript code that's executed. JSON is not a real subset of Javascript and the way it is not is important to us: via UTFGrid, we are all UTF-8 masters.
JSONP is not safe: it's Javascript that's executed. It's trivial to XSS with JSONP, because JSONP is XSS. Just have a call like mapbox.load('foo.tilejson', …)
and if foo.tilejson
gets replaced with destroyYoursite()
, it gets run. Compare to JSON.parse, which is, on purpose, not eval.
JSONP is questionable in terms of performance. To be fast, you want to have the same callback all the time so that you can cache the response. But this leads to a page like
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
/** @jsx React.DOM */ | |
var MyRootComponent = React.createClass({ | |
getInitialState: function() { | |
return {perMinute: '-', perDay: '-'}; | |
}, | |
componentDidMount: function() { | |
var socket = io.connect(this.props.url); | |
socket.on('business.clickout', this.setState.bind(this)); | |
}, | |
render: 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
var p1 = { | |
x: 20, | |
y: 20 | |
}; | |
var p2 = { | |
x: 40, | |
y: 40 | |
}; |