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 schema = new Schema({ | |
name: { type : String, default : '', trim : true }, | |
description: { | |
body: { type : String, default : '', trim : true }, | |
updated_at: { type : Date, default : Date.now }, | |
updated_by: { type : Schema.ObjectId, ref : 'User' } | |
}, | |
report: { |
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
// club routes | |
var clubs = require('../app/controllers/clubs') | |
app.get('/:kitchen_name/clubs', auth.requiresLogin, auth.kitchen.canView, clubs.index) | |
app.get('/:kitchen_name/clubs/new', auth.requiresLogin, auth.kitchen.canView, clubs.new) | |
app.post('/:kitchen_name/clubs', auth.requiresLogin, auth.kitchen.canView, clubs.create) | |
app.get('/:kitchen_name/clubs/:club_id/edit', auth.requiresLogin, auth.club.canManage, clubs.edit) | |
app.put('/:kitchen_name/clubs/:club_id', auth.requiresLogin, auth.club.canManage, clubs.update) | |
app.del('/:kitchen_name/clubs/:club_id', auth.requiresLogin, auth.club.canManage, clubs.destroy) | |
app.get('/:kitchen_name/clubs/:club_id', auth.requiresLogin, auth.kitchen.canView, clubs.show) | |
// Club items |
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
pickup trash 1 pickup trash 2 house click | |
Data exchanges socket ajax socket ajax socket ajax | |
10 1.82 0.11 2.08 0.11 2.38 0.11 | |
100 6.45 0.05 6.90 0.05 7.94 0.05 | |
1000 11.59 2.34* 12.47 2.26* 13.30 1.93* |
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
c1 = 0; | |
for (var i = 0; i < count; i++) { | |
var start_time = new Date(); | |
var time = 0; | |
$.ajax({ | |
type: "POST", | |
url: "/ajax", | |
data: { first: {id: i, x: i, y: i}, second: {}, third: true }, | |
timeout : 10000, | |
success : function (data) { |
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 getRandomRepresentation(number, stats) { | |
var std = 2; | |
// We need 3 games to make stats | |
if (stats.length < 5) { | |
log("Not enough data to determine random representation", 'debug'); | |
// We dont have all the data | |
// If largestPrimeFactor(number) > 15, avoid tables? | |
if (number == 1) { | |
// 1 will cause fractions if used for x*y format | |
return rand(1,2); |
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 createHouses() { | |
$tries = 0; | |
$max_tries = 3; | |
$timeout = 500; | |
$time_start = microtime(true); | |
$start = | |
$use = 'timeout'; | |
while($house_count > 0) { | |
if ($use == 'timeout') { | |
if (microtime(true) - $time_start > $timeout) { |
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
<script> | |
move: function(path) { | |
if (path.length > 0) { | |
log("Path found: " + path.length + " steps"); | |
var i = 0; | |
var car_id = getCurrentCar().id; | |
getCarById(car_id).interval = setInterval(function () { | |
if (i >= path.length) | |
clearInterval(this.length); | |
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
\DB::delete('transactions') | |
->where('updated_at', '=', $foodclub->closed_at->get_timestamp()) | |
->where('type', 'in', array(\Accounting\Model_Transaction::$TYPE_DINNER_EAT,\Accounting\Model_Transaction::$TYPE_DINNER_CHEF)) | |
->execute(); | |
foreach($foodclub->participants as $p) | |
{ | |
$trans = \Accounting\Model_Transaction::find('first', array( | |
'where' => array( | |
'user_id' => $p->user_id, |
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
protected static $tax_cache = array(); | |
public function get_tax($start,$end) | |
{ | |
if (!isset(self::$tax_cache[$start->get_timestamp()][$end->get_timestamp()])) { | |
// This should account for multiple users, kitchen->tax_interval and temporal edits | |
$days = \Date::range_to_array($start, $end, "+1 day"); | |
$tax_days = 0; | |
foreach($days as $d) { |
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
/** Controller_Base **/ | |
public function set_pagination($url, $segment, $total_items, $per_page = 20) | |
{ | |
Pagination::set_config(array( | |
'pagination_url' => $url, | |
'uri_segment' => $segment, | |
'total_items' => $total_items, | |
'per_page' => $per_page, | |
'template' => array( | |
'wrapper_start' => '<ul class="pager">', |