Skip to content

Instantly share code, notes, and snippets.

View kahwee's full-sized avatar
🎯
Focusing

KahWee Teng kahwee

🎯
Focusing
  • Uber Technologies
  • San Francisco, CA
View GitHub Profile
@kahwee
kahwee / jquery.search-index
Created January 6, 2014 10:41
Building lucene search index
$.ajax({
url: 'http://vhn.internal.kw.sg:9080/vhs/rest/search/index',
type: 'POST',
headers: { 'X-VHS-networkId': 1 },
contentType: "application/json",
})
@kahwee
kahwee / postJSON
Last active January 2, 2016 06:38
Forcing jQuery to post in JSON format.
// Forcing jQuery to post in JSON format.
$.postJSON = function(url, data, callback) {
return $.ajax({
url: url,
contentType: "application/json",
type: "POST",
data: JSON.stringify(data),
success: callback
});
};
#!/usr/bin/env php
<?php
/*
* This file is part of the Symfony Standard Edition.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@kahwee
kahwee / gist:2688051
Created May 13, 2012 11:59 — forked from uzyn/gist:2688024
array_merge recursive
class CMap2 {
/**
* Merges two or more arrays into one recursively.
* If each array has an element with the same string key value, the latter
* will overwrite the former (different from array_merge_recursive).
* Recursive merging will be conducted if both arrays have an element of array
* type and are having the same key.
* For integer-keyed elements, the elements from the latter array will
* be appended to the former array.