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 / keygen.php
Created December 24, 2018 06:12 — forked from AndrewChamp/keygen.php
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;
}
@grim-reapper
grim-reapper / hashing.php
Created December 24, 2018 06:12 — forked from AndrewChamp/hashing.php
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());
?>
@grim-reapper
grim-reapper / strip html comments.php
Created December 24, 2018 06:13 — forked from AndrewChamp/strip html comments.php
Regex for stripping HTML comments
<!--(?!<!)[^\[>].*?-->
<?php
$codes = Array(
100 => 'Continue',
101 => 'Switching Protocols',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
<?php
function seoName($title) {
return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($title))));
}
?>
<?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
@grim-reapper
grim-reapper / replace-illegal-characters.php
Created December 24, 2018 06:15 — forked from AndrewChamp/replace-illegal-characters.php
Replace illegal characters from file upload name.php
<?php
$bad = array_merge(array_map('chr', range(0,31)), array("<", ">", ":", '"', "/", "\\", "|", "?", "*", " "));
$result = str_replace($bad, "-", $filename);
?>
@grim-reapper
grim-reapper / Download website (scrapping)
Created December 24, 2018 06:15 — forked from AndrewChamp/Download website (scrapping)
# BASH -> Linux command prompt
wget -nc -nH -E -r -k -P /home/you/example.com -np http://example.com/
@grim-reapper
grim-reapper / mobile-navigation.html
Created December 24, 2018 06:16 — forked from AndrewChamp/mobile-navigation.html
# http://css-tricks.com/convert-menu-to-dropdown/ Convert navigation into form Select for better usability on mobile devices.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style>
nav select{display:none;}
@media (max-width: 960px){
nav ul{display:none;}
nav select{display:inline-block;}
}
</style>
<?php
$i=0;
while($c = $db->getNextSet(true)):
print '<li class="'.($i++%2==0 ? 'odd' : 'even').'">Zebras yo!</li>';
endwhile;
?>