Skip to content

Instantly share code, notes, and snippets.

View phpnode's full-sized avatar

Charles Pick phpnode

View GitHub Profile
<?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);
var http = require('http'), urlParser = require('url');
http.createServer(function(req, res) {
var query, q, elastic, data = '', agent;
console.log("Connected: " +req.connection.remoteAddress);
q = urlParser.parse(req.url, true).query.q;
if (q === undefined) {
console.log("WTF");
return;
}
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
top - 09:18:34 up 44 days, 23:49, 6 users, load average: 0.24, 0.20, 0.13
Tasks: 180 total, 2 running, 176 sleeping, 0 stopped, 2 zombie
Cpu(s): 67.0%us, 4.6%sy, 0.0%ni, 28.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4021708k total, 3255700k used, 766008k free, 226312k buffers
Swap: 11780092k total, 328204k used, 11451888k free, 926240k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5355 root 20 0 1645m 485m 11m S 109 12.4 13:30.96 java
8509 root 20 0 200m 32m 13m S 14 0.8 4634:46 Xorg
8676 charles 20 0 707m 101m 13m S 14 2.6 10324:01 compiz
{
"fields":["id","name","title","description","url","domain"],
"query": {
"custom_score": {
"query": {
"match_all":{}
},
"filter": {
"terms":{
"tags":["twitter"]
{
"fields": [
"id",
"name",
"title",
"description",
"url",
"domain"
],
"query": {
{
"_index":"main",
"_type":"Webapp",
"_id":"34",
"_version":13,
"_source":{
"id":"34",
"name":"Seriesly!",
"title":"Seriesly!",
"description":"Seriesly provides you with torrent\/streaming links for your favorite TV shows.",
{
"Webapp":{
"properties":{
"tags":{
"index_name":"tag",
"type":"string"
},
"id":{
"type":"integer"
},