Skip to content

Instantly share code, notes, and snippets.

View phpnode's full-sized avatar

Charles Pick phpnode

View GitHub Profile
describe.only("Bug #56: process out of memory", function () {
before(function () {
this.db = TEST_SERVER.use('Security', 'plocal');
this.queryText = "select *, map( 'schoolLocations', $slocs, 'governingInstitutions', $gis, 'clbs', $clbs, 'schoolCommunities', $scs, 'mainStructures', $mss ) as relations from School let slocE = outE()[ @class = 'controls' ], giE = inE()[ @class = 'controls' ], scE = inE()[ @class = 'controls' ], clbE = inE()[ @class = 'provides_services_for' ], msE = outE()[ @class = 'has_property' ], locs = list( (select format( '/schoollocations/%s', in.key ) as href, startDate, endDate from $slocE where in.@class = 'SchoolLocation' ) ), gis = list( (select format( '/governinginstitutions/%s', out.key ) as href, startDate, endDate from $giE where out.@class = 'GoverningInstitution' ) ), scs = list( (select format( '/schoolcommunities/%s', out.institutionNumber ) as href, startDate, endDate from $scE where out.@class = 'SchoolCommunity' ) ), clbs = list( (select format( '/clbs/%s', ou
<x-element></x-element>
<x-another-element></x-another-element>
<!-- web components should not modify anything apart from their children -->
<x-another-element>
<p>lala</p>
</x-another-element>
var foo = {};
Object.defineProperty(foo, 'bar', {
value: 123,
anotherKey: "hello world",
extraKey: true
});
var descriptor = Object.getOwnPropertyDescriptor(foo, 'bar');
var jade = require('jade');
// compile
var fn = jade.compile('p string of jade');
console.log(fn());
@phpnode
phpnode / leaky-args.js
Created December 15, 2014 23:32
node --allow-natives-syntax leaky-args.js
'use strict';
function leakyArgs (item) {
var args = Array.prototype.slice.call(arguments, 1);
var total = item;
for (var i = 0, length = args.length; i < length; i++) {
total += args[i] + (300 * 234 * 234234 * 235 * 23433);
}
return total;
}
function demo (input: Array<number>): Array<number> {
return function blah () {
return function foo () {
return input.map(item => item + 1).map(item => item + 2);
};
};
}
<?php
if (!class_exists("Redis")) {
class Redis extends RedisPredis {
}
class RedisException extends RedisPredisException {
}
}
var nodeio = require('node.io');
var methods = {
input: false,
run: function(row) {
var self = this;
row = "elance.com http://investing.businessweek.com/research/stocks/snapshot/snapshot.asp?capId=101648 1248 517895";
var input = row.split("\t");
try {
this.getHtml(input[1], function(err, $) {
<?php
// Multiply each item in a list by 2
print_r(array_map(function($a) { return $a * 2; }, range(1,1000)));
// Sum a list of numbers
print_r(array_sum(range(1,1000))."\n");
// Verify if word exists in string
$wordList = array("register globals","magic quotes");
$text = "one of my favorite PHP features is magic quotes";
array_walk($wordList,function ($v) use (&$contains, $text) { if (!$contains) { $contains = (bool) strstr($text, $v); }}, $contains);
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) 16382
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200