Skip to content

Instantly share code, notes, and snippets.

Devrim Yasar devrim

Block or report user

Report or block devrim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@devrim
devrim / gist:628727
Created Oct 15, 2010
Mongo $exists problem
View gist:628727
$q = array("myKey" => array('$exists'=>true));
$cursor = $mongo->db->coll->find($q);
echo $cursor->count(); // this returns the number 51
while($cursor->hasNext()){
$v = $cursor->getNext();
print_r($v); // this returns nothing
View insert with correct types to mongo
/* use this function before inserting any array to mongo */
array_walk_recursive($array,"typeCast");
/* then do insert: $mongo->$db->$collection_name->insert($array); */
/* careful with & sign before the $item, dont remove it, */
View gist:447511
function get_4sq_venue_name($url){
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$url);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($curl_handle,CURLOPT_HEADER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
You can’t perform that action at this time.