Skip to content

Instantly share code, notes, and snippets.

View grim-reapper's full-sized avatar

Imran Ali grim-reapper

View GitHub Profile
@tylerhall
tylerhall / strong-passwords.php
Created August 12, 2010 21:38
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@BaylorRae
BaylorRae / flash_messages.php
Created May 21, 2011 05:18
Flash Messages for PHP
<?php
class FlashMessages {
private $messages = array();
private $now = false;
private static $instance = null;
private function __construct() {
// Save all messages
$this->messages = $_SESSION['flash_messages'];
@reinink
reinink / php-headers.php
Created April 27, 2012 00:36
PHP header examples
<?php
// Source: http://www.jonasjohn.de/snippets/php/headers.htm
// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');
// Page was not found:
header('HTTP/1.1 404 Not Found');
@cmarkle27
cmarkle27 / jquery.advanced-plugin.js
Created August 4, 2012 18:48
Advanced jQuery Plugin
// plug it in, plug it in
(function($) {
var paraCount = function() {
return {
options: {
itemClass: 'awesome',
baseUrl: "/",
@Darep
Darep / .htaccess
Last active April 23, 2024 07:16
PHP CSS&JS auto-versioning function.
# CSS/JS auto-versioning
RewriteEngine On
RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS drop-shadows without images</title>
<style>
body {
padding:20px 0 30px;
font:14px/1.5 Arial, sans-serif;
text-align:center;
<?php
$i=0;
while($c = $db->getNextSet(true)):
print '<li class="'.($i++%2==0 ? 'odd' : 'even').'">Zebras yo!</li>';
endwhile;
?>
@AndrewChamp
AndrewChamp / mobile-navigation.html
Last active December 24, 2018 06:16
# 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>
@AndrewChamp
AndrewChamp / Download website (scrapping)
Created June 25, 2013 16:10
# BASH -> Linux command prompt
wget -nc -nH -E -r -k -P /home/you/example.com -np http://example.com/
@AndrewChamp
AndrewChamp / replace-illegal-characters.php
Last active December 24, 2018 06:15
Replace illegal characters from file upload name.php
<?php
$bad = array_merge(array_map('chr', range(0,31)), array("<", ">", ":", '"', "/", "\\", "|", "?", "*", " "));
$result = str_replace($bad, "-", $filename);
?>