This file contains hidden or 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 control = require('../control'); | |
var checkbox = control.checkbox; | |
var text = control.text; | |
var select = control.select; | |
// Adds cabriolet properties to the vehicle. | |
exports.mixin = function(vehicle) { |
This file contains hidden or 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 flatten = (a, r, cb) => { | |
if (typeof a.length === 'undefined') { | |
r.push(a); | |
return cb; | |
} else if (a.length === 0) { | |
return cb; | |
} else { | |
return flatten(a[0], r, () => flatten(a.slice(1), r, cb)); | |
} | |
}; |
This file contains hidden or 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
app.get('/matches', function(req, res, next) { | |
fixture.withTip().then(function(matches) { | |
res.render('matches', { matches: matches }); | |
}).catch(next); | |
}); | |
// database.js | |
exports.withTip = function() { | |
var sql = 'SELECT * FROM `fixture`'; |
This file contains hidden or 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 mysql = require('mysql'); | |
var config = require('../config.json'); | |
var pool = mysql.createPool(config.mysql); | |
// Runs MySQL query. | |
// Returns a promise. | |
exports.query = function(query, params) { | |
return new Promise(function(resolve, reject) { |
This file contains hidden or 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 create_warehouse(t, account_id) { | |
var warehouse = { | |
account_id: account_id, | |
name: 'Default warehouse', | |
type: 'local', | |
is_default: true | |
}; | |
var sql = 'insert into warehouse(account_id, name, type, is_default)' + | |
' values (${account_id}, ${name}, ${type}, ${is_default}) returning id'; | |
return t.one(sql, warehouse); |
This file contains hidden or 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 _eee = (function() { | |
// Guard against Prototype manipulations. | |
// Later this needs proper workaround for some | |
// libraries that override native objects. | |
if (window.Prototype) { | |
delete Object.prototype.toJSON; | |
delete Array.prototype.toJSON; |
This file contains hidden or 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
{ | |
"questions": [ | |
{ | |
"title":"binary search tree in prolog", | |
"url":"/questions/35714742/binary-search-tree-in-prolog" | |
}, | |
{ | |
"title":"Just can't import files to my Racket program", | |
"url":"/questions/35704143/just-cant-import-files-to-my-racket-program" | |
}, |
This file contains hidden or 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
// Moves step upwards. | |
model.click.up = function(step) { | |
move(step, -1); | |
}; | |
// Moves step downwards. | |
model.click.down = function(step) { |
This file contains hidden or 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
posts(GroupUrl, Posts):- | |
Query = _{ | |
wait: 5300, | |
url: GroupUrl, | |
extract: _{ | |
posts: _{ | |
type: collection, | |
selector: '.userContentWrapper', | |
extract: _{ | |
title: _{ selector: 'h5' }, |
This file contains hidden or 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
prolog_questions(Questions):- | |
Query = _{ | |
url: 'http://stackoverflow.com/questions/tagged/prolog', | |
extract: _{ | |
questions: _{ | |
type: collection, | |
selector: '#questions > div', | |
extract: _{ | |
url: _{ selector: 'h3 > a', attribute: 'href' }, | |
title: _{ selector: 'h3 > a' } |