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
curl -XPUT http://127.0.0.1:9200/test_bug/products/24 -d '{"product_id":"24","product_styles":[],"product_sizes":["Superking","Kingsize","Double","Single"]}' | |
curl -XPUT http://127.0.0.1:9200/test_bug/products/25 -d '{"product_id":"25","product_styles":[],"product_sizes":["Superking","Kingsize","Double","Single"]}' | |
curl -XPUT http://127.0.0.1:9200/test_bug/products/33 -d '{"product_id":"33","product_styles":[],"product_sizes":[]}' | |
curl -XPUT http://127.0.0.1:9200/test_bug/products/34 -d '{"product_id":"34","product_styles":[],"product_sizes":[]}' | |
curl -XPUT http://127.0.0.1:9200/test_bug/products/35 -d '{"product_id":"35","product_styles":[],"product_sizes":["Superking","Kingsize","Double","Single"]}' | |
curl -XPUT http://127.0.0.1:9200/test_bug/products/36 -d '{"product_id":"36","product_styles":[],"product_sizes":["Superking","Kingsize","Double","Single"]}' | |
curl -XPUT http://127.0.0.1:9200/test_bug/products/41 -d '{"product_id":"41","product_styles":[],"product_sizes":[]}' | |
curl -XPUT http://127.0.0.1:9200/test_ |
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
#!/usr/bin/env python | |
import sys | |
import os.path | |
import re | |
import subprocess | |
if( len(sys.argv) < 2 ): | |
print("Usage: %s filename" % sys.argv[0]) | |
sys.exit(1) |
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
import sys | |
f = open(sys.argv[1]) | |
files = f.read().split('-- --------------------------------------------------------') | |
files.pop(0) | |
for file in files: | |
# Find table name | |
name_index = file.index("for table `") + 11 | |
name_end = file.index("`", name_index) |
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
<?php | |
function Memoize($function) { | |
$cache = array(); | |
return function() use (&$cache, $function) { | |
$args = func_get_args(); | |
$serialized = serialize($args); | |
if( isset($cache[$serialized]) ) | |
return $cache[$serialized]; |
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
<?php | |
function luhnCheck($number) { | |
$digits = str_split($number); | |
for( $i = (count($digits) - 2); $i >= 0; $i -= 2 ) { | |
$digits[$i] *= 2; | |
} | |
$digits = str_split(implode($digits)); | |
return (array_sum($digits) % 10) === 0; | |
} |
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
-module (shttp). | |
-export ([bench_test_start/0, bench_test_stop/0, start/1, start/2]). | |
bench_test_start() -> | |
Pid = start(8000, fun handle_page/3), | |
register(http_server, Pid). | |
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
-module (beersong). | |
-author("Stuart Loxton"). | |
-export ([sing/1]). | |
-define(TEMPLATE_0, "~s of beer on the wall, ~s of beer.~n" | |
"Go to the store and buy some more," | |
). | |
-define(TEMPLATE_N, "~s of beer on the wall, ~s of beer.~n" | |
"Take one down and pass it around, ~s" | |
" of beer on the wall.~n~n"). | |
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
<?php | |
class ExampleClass { | |
private $bindings = array(); | |
public function __set($a, $b) { | |
$this->$a = $b; | |
if(is_array($this->bindings[$a])) { | |
foreach($this->bindings[$a] as $bind) { |