Skip to content

Instantly share code, notes, and snippets.

View mymizan's full-sized avatar
🎯
Focusing

M Yakub Mizan mymizan

🎯
Focusing
View GitHub Profile
@mymizan
mymizan / gist:5551946
Created May 10, 2013 02:04
Phone number formatting and normalization class taken from OpenVBX project
<?php
/**
* "The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
@mymizan
mymizan / phantomjs_thumbnail.js
Created August 28, 2013 10:59
Generating thumbnail with PhantomJS
var page = require('webpage').create();
page.open('http://github.com/', function () {
page.render('github.png');
phantom.exit();
});
<?php
/**
* Calculate your life expectancy and
* send a notification email every day
*/
//set the default timezone to UTC
date_default_timezone_set('UTC');
/**
#!/usr/bin/php
<?php
# create a filename for the emlx file
list($ms, $time) = explode(' ', microtime());
//$filename = '/tmp/testmail/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx';
$filename = '/tmp/dummymail.txt';
# write the email contents to the file
$email_contents = fopen('php://stdin', 'r');
$fstat = fstat($email_contents);
<?php
session_start();
require_once __DIR__ . "/vendor/autoload.php";
require_once __DIR__ . "/config.php";
//retrieve images
if (!empty($_SESSION['data'])){
$token = $_SESSION['data']['access_token'];
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.instagram.com/v1/users/self/media/recent/', array(
// ==UserScript==
// @name Twilio Call & SMS - Zoho CRM
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://crm.zoho.com/*
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
<?php
/**
* In addition to fixing the syntax error, I have also formatted the code to follow PSR coding standards
**/
define("ID_SITE", preg_replace("[^0-9a-z]*", "", strtolower(explode("/", $SERVER['REQUEST_URI'])[1])));
function redirect($uri, $getvar=null)
{
if (substr($uri, 0, 1) == '/') {
@mymizan
mymizan / Vagrant-port-forward-to-host.md
Created September 29, 2018 09:58 — forked from radabass/Vagrant-port-forward-to-host.md
Vagrant port 80 443 forwarding to HOST machine OSX El Capitan

El Capitan OSX Vagrant port forwarding rules to use privileged ports 80 and 443

Due to the OSX limitations in ports below 1024, in order to use them without running as root the virtualbox headless you can do the following workaround, (remember the command ipfw is deprecated on El Capitan)

In the Vagrant file use ports over 1024, for instance change 80 and 443 to 8080 and 8043.

  # Apache
  config.vm.network "forwarded_port", guest: 80, host: 8080
@mymizan
mymizan / remove-shipping-row-method-1
Last active May 24, 2019 17:51
Remove shipping information from WooCommerce Email
/**
** Remove the shipping row from woocommerce_get_order_item_totals array
**/
function ymcode_remove_shipping_details_from_woocommerce_email($total_rows, $obj, $tax_display)
{
if ( isset($total_rows['shipping']) )
{
unset($total_rows['shipping']);
}