Skip to content

Instantly share code, notes, and snippets.

mmohiudd / geo_update_trigger.sql
Created Sep 30, 2015
Update geometry and geography data with a trigger for PostgreSQL(PostGIS)
View geo_update_trigger.sql
CREATE TABLE test_table(
id bigserial NOT NULL,
latitude double precision,
longitude double precision,
geom geometry,
geog geography,
updated_ts double precision,
CONSTRAINT test_table_unique_key UNIQUE (id)
mmohiudd /
Last active Aug 29, 2015 — forked from iros/


<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

View gist:1c04702b965d309c2027
The text file data.txt contains the following
ZADD myzset 1 a
ZADD myzset 1 b
ZADD myzset 1 c
Run this command to read from data file and insert to redis:
cat data.txt|xargs -n 4 redis-cli
mmohiudd / facebook-batchcall.php
Created May 8, 2014
Batch call with facebook-php-sdk-v4
View facebook-batchcall.php
use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
// Use one of the helper classes to get a FacebookSession object.
// FacebookRedirectLoginHelper
mmohiudd / falatten_array.php
Created Nov 14, 2013
Flatten a multidimensional array with keys separated by _
View falatten_array.php
* Flatten a multi dimension array. For an associative array the child keys are separated by underscore(_).
* @author Muntasir Mohiuddin
* @param array $a multidimensional array to flatten
* @param array $a multidimensional array to save values
* @param string $p previous parents separated by underscore(_)
* @return array all flattened keys
function flatten_array($a, &$r, $p=NULL){
foreach($a as $k => $v) {
mmohiudd / circusd.ini
Created Sep 5, 2013
testing SIGNALs with circusd
View circusd.ini
check_delay = 5
endpoint = tcp://
pubsub_endpoint = tcp://
;stats_endpoint = tcp://
httpd = False
debug = False
use = circus.plugins.flapping.Flapping
mmohiudd / fork.php
Created Jul 31, 2013
sample fork with shared memory
View fork.php
printf("%s MAIN %s\n\n", getmypid(), date("H:i:s"));
$shm_id = shm_attach(1);
$main_process_id = getmypid();
mmohiudd / csv_parser.php
Last active Oct 7, 2018
Basic CSV parse function
View csv_parser.php
function getCSVData($file){
$info = pathinfo($file);
$fp = @fopen($file, "r");
$data = array();
$line = fgets($fp, 4096); // read the first line, headers
// use /[ "\']+/ to remove white spaces as well
$fields = preg_replace('/[ "\']+/', '', explode(",", trim($line)));
mmohiudd / send_dialog.html
Last active Dec 12, 2015
send dialog test
View send_dialog.html
Publishing to the stream is easy, as all the fields are optional. Just specify
what you need, and leave the rest out.
var publish = {
method: 'send',
to: [120803038, 100002268364410], // comma separated friend ids
View authorize.js
function authorize(){
FB.login(function(response) {
if(response.authResponse) { // user authorized
// do something
} else { // not authorized
// do something
scope: '{{fb_permissions}}'