Skip to content

Instantly share code, notes, and snippets.

View ranacseruet's full-sized avatar

Rana Md Ali Ahsan ranacseruet

View GitHub Profile
@ranacseruet
ranacseruet / lti_outcome_example.py
Created January 22, 2018 17:28
LTI Outcome Service Request from Tool Provider
from lti.outcome_request import OutcomeRequest
outcome_request = OutcomeRequest(
opts={
"consumer_key": "tophat-canvas",
"consumer_secret": "tophat123",
"lis_outcome_service_url": tool_provider.launch_params.get('lis_outcome_service_url'),
"lis_result_sourcedid": tool_provider.launch_params.get('lis_result_sourcedid'),
"operation": "replaceResult",
}
)
@ranacseruet
ranacseruet / queryStringToJS.js
Created February 22, 2017 15:03
Parse url search queries into js object
static searchQueries() {
const queryString = window.location.search.substring(1)
const pairs = queryString.split('&')
let queryObj = {}
for (let i=0; i<pairs.length; i++) {
const keyVal = pairs[i].split('=')
queryObj[keyVal[0]] = decodeURIComponent(keyVal[1])
}
return queryObj
}
@ranacseruet
ranacseruet / Tooltip
Created March 24, 2015 04:29
An Actionscript 3.0 Class To create custom tooltip(old code)
class Tooltip {
private var theTip:MovieClip;
private var tFormat:TextFormat;
function Tooltip(hex:Number,hex2:Number) {
this.theTip = _root.createEmptyMovieClip("tooltip", _root.getNextHighestDepth());
this.theTip.createTextField("theText",this.theTip.getNextHighestDepth(),3,1,95,20);
@ranacseruet
ranacseruet / pushNotifier
Last active September 30, 2016 15:16
A simple NodeJS script, to implement apple push notification service
var apn = require("apn")
var apnError = function(err){
console.log("APN Error:", err);
}
var options = {
"cert": "cert.pem",
"key": "key.pem",
"passphrase": null,
@ranacseruet
ranacseruet / PDAO.php
Last active October 21, 2023 16:31
PHP Dynamic Object With Array and Iterative access capability
<?php
class PDAO implements \ArrayAccess, \Iterator
{
/**
* @var array data
*/
protected $data = array();
/**
@ranacseruet
ranacseruet / VideoStream.php
Last active April 14, 2024 12:42
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@ranacseruet
ranacseruet / gist:9700579
Created March 22, 2014 03:17
Custom CodeIgnite Profiler Class For Doctrine
<?php
namespace Doctrine\DBAL\Logging;
class CIProfiler implements SQLLogger
{
public $start = null;
private $ci;
@ranacseruet
ranacseruet / MyS3Client.php
Last active July 28, 2022 19:58
Retrieve Multiple files from Amazon S3
<?php
namespace S3;
use Aws\S3\S3Client;
use \Aws\Common\Exception\TransferException;
/**
* Description of S3Client
* @author Rana
* @link http://codesamplez.com/programming/amazon-s3-get-multiple-objects-php
@ranacseruet
ranacseruet / gist:8412771
Created January 14, 2014 03:50
Benchmark for arrayaccess vs object access for PHP classes
//test.class.php
<?php
class Test implements ArrayAccess
{
private $data = array();
public function __set($key, $value){
$this->data[$key] = $value;
}
@ranacseruet
ranacseruet / gist:8233791
Created January 3, 2014 06:33
Go! AOP Test
<?php
use \Go\Core\AspectKernel;
use \Go\Core\AspectContainer;
/**
* Application Aspect Kernel
*/
class ApplicationAspectKernel extends AspectKernel
{