Skip to content

Instantly share code, notes, and snippets.

View surferxo3's full-sized avatar

Mohammad Sharaf Ali surferxo3

View GitHub Profile
@surferxo3
surferxo3 / video_track.html
Last active July 26, 2020 11:46
A YouTube video tracker for tracking Play/Paused/Ended events via Google Analytics.
<!DOCTYPE html>
<html>
<body>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
@surferxo3
surferxo3 / MTracker.php
Last active October 30, 2016 17:32
A class to track campaign and visitors source via session.
<?php
/*
* Developer: Mohammad Sharaf Ali
* Version: 1.0
* Description: Class to track visitor registration source
* Dated: 23-04-2016
*/
namespace MSharaf;
@surferxo3
surferxo3 / equivalence.php
Last active October 30, 2016 18:18
Script to calculate O and A levels Equivalence.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
##################### CONSTANTS #####################
// grade equivalence constants
@surferxo3
surferxo3 / export.php
Last active October 30, 2016 18:17
Script to export data from MySQL in Excel.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
function exportToExcel($host, $user, $pass, $db, $query) {
$conn = mysql_connect($host, $user, $pass);
@surferxo3
surferxo3 / notorm_demo.php
Last active July 26, 2020 11:45
NotORM demo of printing sql queries, handling notorm objects, and casting from objects to associative arrays in NotORM framework.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
// LIBRARIES
require_once 'db/NotORM.php';
@surferxo3
surferxo3 / gold_silver_rates.php
Last active May 1, 2024 18:46
Gold and Silver Rates API to fetch updated rates with their respective currency and price.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
const RATES_API_URL = 'http://goldprice.org/NewCharts/gold/images/goldsilverpricesforcalculators.txt';
@surferxo3
surferxo3 / MEmarsys.php
Last active October 30, 2016 17:40
A class to consume Emarsys API. Demonstrates the use of Web Services Security (WS-Security, WSS).
<?php
/*
* Developer: Mohammad Sharaf Ali
* Version: 1.0
* Description: Class to consume Emarsys Api. Documentation: http://documentation.emarsys.com/resource/developers/endpoints/
* Dated: 30-10-2016
*/
namespace MSharaf;
@surferxo3
surferxo3 / MEvvnt.php
Last active October 30, 2016 17:47
A class to consume Evvnt API. Demonstrates the use of HTTP Basic Authentication.
<?php
/*
* Developer: Mohammad Sharaf Ali
* Version: 1.0
* Description: Class to consume Evvnt Api. Documentation: https://api.sandbox.evvnt.com/
* Dated: 30-10-2016
*/
namespace MSharaf;
@surferxo3
surferxo3 / sendpush.php
Last active October 30, 2016 18:15
Script to send iOS and Android Push Notifications.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
#function to send push notification
function sendPush($deviceToken, $body, $type, $params) {
@surferxo3
surferxo3 / slim_demo.php
Last active July 26, 2020 11:44
Do some work Before and After the Slim route is executed. Demonstrates the use of Middleware in Slim instead of Hooks.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;