Skip to content

Instantly share code, notes, and snippets.

View mmohiudd's full-sized avatar

Muntasir Mohiuddin mmohiudd

View GitHub Profile
@mmohiudd
mmohiudd / send_dialog.html
Last active December 12, 2015 06:58
send dialog test
<h1>feed</h1>
<p>
Publishing to the stream is easy, as all the fields are optional. Just specify
what you need, and leave the rest out.
</p>
<script>
var publish = {
method: 'send',
to: [120803038, 100002268364410], // comma separated friend ids
@mmohiudd
mmohiudd / authorize.js
Created November 1, 2012 18:18
FB JS auth
function authorize(){
FB.login(function(response) {
if(response.authResponse) { // user authorized
// do something
} else { // not authorized
// do something
}
},{
scope: '{{fb_permissions}}'
});
@mmohiudd
mmohiudd / csv_table_generator.php
Created September 17, 2012 16:18
MySQL table generator from CSV file
<?php
// GENERATE TABLE FROM FIRST LINE OF CSV FILE
$inputFile = 'csv/sample.csv'; // path to CSV file
$tableName = 'csv'; // table name
$fh = fopen($inputFile, 'r');
$contents = fread($fh, 5120); // 5KB
fclose($fh);
@mmohiudd
mmohiudd / ua-test-script.php
Created July 27, 2012 16:49
Urban Airship test script
<?php
send_push($_REQUEST['alert'], $_REQUEST['appkey'], $_REQUEST['appmaster']);
function send_push($alert, $appkey, $appmaster) {
$badge = 1; // default is 1
$auth = $appkey . ":" . $appmaster;
$url = "https://go.urbanairship.com/api/push/broadcast/";
@mmohiudd
mmohiudd / home.php
Created July 12, 2012 17:03
$_REQUEST variable for Kohana
class Controller_Home extends Controller {
protected $args; // store GET/POST variables
public function before() {
parent::before();
// if a GET request
if( $this->request->method() == "GET" ) {
$this->args = $this->request->query();
@mmohiudd
mmohiudd / code.js
Created June 26, 2012 21:52
Use batch request to grab and save Facebook test user information
args.batch.push({
method : "GET",
name : "get-users",
relative_url : "/"+app.id+"/accounts/test-users",
omit_response_on_success : false
});
args.batch.push({
method : "GET",
relative_url : "?ids={result=get-users:$.data.*.id}"
@mmohiudd
mmohiudd / change_password.py
Created June 16, 2012 04:07
change Facebook test user password
#!/usr/bin/env python
'''
Change Facebook test users password
'''
import urllib, urllib2, json
# makes a batch call to facebook
# access_token : facebook access token
@mmohiudd
mmohiudd / before.php
Created May 28, 2012 23:07
kohana before for open grabp
public function before(){
parent::before();
// this block provides header information for facebook send message popup
if( preg_match('/facebook/', $_SERVER['HTTP_USER_AGENT'])) {
$facebook_config = kohana::$config->load('facebook');
$share = $facebook_config['share'][$this->lang];
$item_id = $this->request->query('id');
$media = ORM::factory('Media', $item_id)->as_array();
@mmohiudd
mmohiudd / save.php
Created May 9, 2012 12:38
save Facebook test users to database
<?php
ini_set('precision', 20);
?>
<!-- Decreased Latency -->
<!-- Increased parallelism -->
<!-- Better caching -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="js/mustache.js" type="text/javascript"></script><!-- -->
<script>
@mmohiudd
mmohiudd / api.prototype.js
Created March 19, 2012 17:33
API prototype
/**
* API prototype class. Uses strict ECMA convention.
* This class requires jQuery.
*
* @category Prototype
* @author Muntasir Mohiuddin
*/
var API;