Skip to content

Instantly share code, notes, and snippets.

View grim-reapper's full-sized avatar

Imran Ali grim-reapper

View GitHub Profile
@grim-reapper
grim-reapper / .htaccess
Created December 3, 2015 12:25 — forked from johnmorris/.htaccess
Create a custom 404 page not found error page
<Files .htaccess>
order allow,deny
deny from all
</Files>
ErrorDocument 403 /errors/error.php
ErrorDocument 404 /errors/error.php
ErrorDocument 405 /errors/error.php
ErrorDocument 408 /errors/error.php
ErrorDocument 500 /errors/error.php
@grim-reapper
grim-reapper / ci-bootstrap-pagination-config.php
Created December 13, 2015 18:36 — forked from edomaru/ci-bootstrap-pagination-config.php
Codeigniter Pagination config to apply bootstrap style
<?php
$config["full_tag_open"] = '<ul class="pagination">';
$config["full_tag_close"] = '</ul>';
$config["first_link"] = "&laquo;";
$config["first_tag_open"] = "<li>";
$config["first_tag_close"] = "</li>";
$config["last_link"] = "&raquo;";
$config["last_tag_open"] = "<li>";
@grim-reapper
grim-reapper / web.config
Created February 22, 2016 14:02 — forked from jonahvsweb/web.config
How to Setup WordPress Permalinks on Windows IIS ======================================= Place this file into the base directory of your WordPress installation to allow permalinks (or "pretty URLs") on Windows IIS.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
@grim-reapper
grim-reapper / crawluniq.js
Created March 4, 2016 06:32 — forked from martincharlesworth/crawluniq.js
PhantomJS crawler written to detect Mixed Content
var uniqUrls = [];
var urlsToBrowse = [];
var browsedUrls = [];
function open(url, callback) {
var page = require('webpage').create();
page.settings.loadImages = true;
page.onResourceReceived = function (response) {
if (response.stage == "start" && response.url.substr(0, 4) === "http" && uniqUrls.indexOf(response.url) === -1) {
@grim-reapper
grim-reapper / PHPExcel_Basics.md
Last active April 26, 2016 12:02 — forked from r-sal/PHPExcel_Basics.md
PHPExcel Notes and code snippets

Basics

Creating a new PHPExcel Object.

    $this->PHPExcel = new PHPExcel();

Working with sheets

Creating a new sheet:

@grim-reapper
grim-reapper / Sublime Text 3 Build 3103 License Key - CRACK
Created May 18, 2016 07:52
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@grim-reapper
grim-reapper / array_flatten.php
Created June 2, 2016 12:25 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
<?php
/**
* Convert a multi-dimensional array into a single-dimensional array.
* @author Sean Cannon, LitmusBox.com | [email protected]
* @param array $array The multi-dimensional array.
* @return array
*/
function array_flatten($array) {
if (!is_array($array)) {
@grim-reapper
grim-reapper / gist:33b76945759b68fdb3c330b04105220b
Created August 31, 2016 06:12 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@grim-reapper
grim-reapper / gist:e8baef7bd6e04b31afd3fe5248ca5772
Created December 9, 2016 13:07 — forked from dcblogdev/gist:8067095
Use Google finance calculator to convert currency with php
<?php
function convertCurrency($amount, $from, $to){
$data = file_get_contents("https://www.google.com/finance/converter?a=$amount&from=$from&to=$to");
preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted);
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
return number_format(round($converted, 3),2);
}
echo convertCurrency("10.00", "GBP", "USD");
@grim-reapper
grim-reapper / Excel.php
Created January 30, 2017 18:11 — forked from ihumanable/Excel.php
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {