Skip to content

Instantly share code, notes, and snippets.


Melvin Tercan melvinmt

View GitHub Profile
View gist:849461
// construct upload url
$upload_url = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
View gist:849455
// first, save medium image
$ch = curl_init($medium['source']);
$medium_local_path = UPLOAD_DIR.'/'.time().'_'.basename($medium['source']);
$parse = parse_url($medium_local_path);
$medium_local_path = $parse['path']; // clean up dirty query strings from file name
$fh = fopen($medium_local_path, "w");
View gist:849454
$f = new tinyFlickr($flickr_api_key, $flickr_api_secret);
$request = $f->photos_getSizes($photo['id']);
// assume that largest size comes last:
$large = $request[count($request)-1];
View gist:849351
$t = new Tinypayme($mashape_api_key);
$code = $_GET['code'];
$request = $t->getOAuthAccessToken(YOUR_ACCESS_TOKEN, $code);
View gist:849349
$t = new Tinypayme($mashape_api_key);
$redirect_uri = '';
$permission = 'create_items';
$request = $t->getOAuthPermission($marketplace_id, $redirect_uri, $permission);
View gist:849348
$t = new Tinypayme($mashape_api_key);
$request = $t->getCurrencies();
foreach ($request->result as $currency){
View gist:849345
$f = new tinyFlickr($flickr_api_key, $flickr_api_secret);
$request = $f->people_getPhotos($user_id);
foreach ($request['photos']['photo'] as $photo){
melvinmt / Geo::bounds
Created Nov 15, 2010
PHP class to calculate south-west and north-east bounds given a longitude, latitude and distance edit
View Geo::bounds
* @author Melvin Tercan
* @link
class Geo{
public static function bounds($mylat, $mylon, $dist = 100, $unit = 'km', $pyth_invert = true){
melvinmt / MoneyMedic Kassa Voorbeeld
Created Nov 11, 2010
In dit voorbeeld wordt er veilig in PHP een Kassa URL gegenereerd, zodat deze gegevens niet te zien zijn in de broncode
View MoneyMedic Kassa Voorbeeld
$ch = curl_init();
$post = array(
'pay_amount' => 100,
'description' => 'Test Betaling',
'return_url' => '', // secret return URL
'kassa_secret' => 'MIJN_KASSA_SECRET', // you can find this in the advanced section
'no_redirect' => 1 // doesn't redirect to the kassa page, but prints the URL instead
You can’t perform that action at this time.