Skip to content

Instantly share code, notes, and snippets.

View grim-reapper's full-sized avatar

Imran Ali grim-reapper

View GitHub Profile
<?php
/**
* No Image Options:
* 404 - do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response
* mm - (mystery-man) Simple, cartoon-style silhouetted outline of a person
* identicon - Geometric pattern based on an email hash
* monsterid - Generated 'monster' with different colors, faces, etc
* wavatar - Fenerated faces with differing features and backgrounds
* retro - 8-bit arcade-style pixelated faces
<?php
function seoName($title) {
return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($title))));
}
?>
/*
* jQuery Double Tap
* Developer: Sergey Margaritov (github.com/attenzione)
* License: MIT
* Date: 22.10.2013
* Based on jquery documentation http://learn.jquery.com/events/event-extensions/
*/
(function($){
@adhocore
adhocore / Obfuscator.php
Created December 31, 2013 16:06
Obfuscator - The naive and trivial PHP Code obfuscator | deobfuscator
<?php
/**
* Obfuscator - The naive and trivial PHP Code obfuscator | deobfuscator
*
* generate() Generates a obfuscated string of given code
* also gives the chunk value required by work()
* work() Reverses the obfuscated string using chunk value given by generate()
* to original code and then execute the code and returns response
*
<?php
$codes = Array(
100 => 'Continue',
101 => 'Switching Protocols',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
@RobertoNovelo
RobertoNovelo / Paypal Rest API Codeigniter
Last active July 28, 2020 12:59
CodeIgniter 3.x Paypal Rest API Authorize Capture Wrapper
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once(BASEPATH . '../application/libraries/PayPal-PHP-SDK/autoload.php');
use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Api\Capture;
use PayPal\Api\Authorization;
use PayPal\Api\Amount;
use PayPal\Exception\PayPalConnectionException;
@AndrewChamp
AndrewChamp / strip html comments.php
Created June 18, 2015 19:04
Regex for stripping HTML comments
<!--(?!<!)[^\[>].*?-->
@AndrewChamp
AndrewChamp / docx_editor.php
Created July 27, 2015 15:05
Edit a Microsoft Word .docx file using PHP and the zip extension.
<?php
/**
* Edit a Word 2007 and newer .docx file.
* Utilizes the zip extension http://php.net/manual/en/book.zip.php
* to access the document.xml file that holds the markup language for
* contents and formatting of a Word document.
*
* In this example we're replacing some token strings. Using
* the Office Open XML standard ( https://en.wikipedia.org/wiki/Office_Open_XML )
* you can add, modify, or remove content or structure of the document.
@AndrewChamp
AndrewChamp / hashing.php
Created September 29, 2015 02:50
Simple Hashing
<?php
function hasher($password, $salt){
$result = base64_encode(hash('md5', $password.$salt));
$result = substr($result, 5, -5);
return strrev($result);
}
//Example
print hasher('myPassword', time());
?>
@AndrewChamp
AndrewChamp / keygen.php
Created September 29, 2015 02:57
Random Keygen
<?php
function keygen($length='40'){
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen($chars);
for($i = 0; $i < $length; $i++):
$str .= $chars[ rand( 0, $size - 1 ) ];
endfor;
return $str;
}