This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteRule ^gradients\/(\d+)\-([a-fA-F\d]{6})-([a-fA-F\d]{6})\.gif$ gradient.php?height=$1&from=$2&to=$3 [L,NC] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Validate inputs. | |
if ( | |
!array_key_exists('from', $_GET) || | |
!preg_match('/^[a-fA-F\d]{6}$/', $_GET['from']) || | |
!array_key_exists('to', $_GET) || | |
!preg_match('/^[a-fA-F\d]{6}$/', $_GET['to']) || | |
!array_key_exists('height', $_GET) || | |
!is_numeric($_GET['height']) || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
#my-site-header { | |
background-color: #FFFFFF; | |
/* gradient: 16px height, #ffffff start, #404080 end */ | |
background-image: url("http://i.imgur.com/4L3aj.gif"); | |
background-position: left bottom; | |
background-repeat: repeat-x; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// gradient with 10px height | |
$height = 10; | |
// start color is #fa0000 | |
$start = Array(250, 0, 0); | |
// end color is #00c864 | |
$end = Array(0, 200, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// You may replace this with a static height. | |
$height = $_GET['height']; | |
// You may replace this with a static start color. | |
// RGB goes here, e.g. Array(255, 0, 0) for red | |
$start = Array(); | |
// You may replace this with a static end color. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// provide a generic 404 error if... | |
if ( | |
// FROM/START color does not exist | |
!array_key_exists('from', $_GET) || | |
// FROM/START color is not valid hex | |
!preg_match('/^[a-fA-F\d]{6}$/', $_GET['from']) || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Tell the browser it's a GIF image. | |
header('Content-Type: image/gif'); | |
/* | |
Create an image with a width of 1 and height of $height. | |
Width only needs to be 1px because it will presumably | |
be tiled horizontally. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var characters = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + | |
"0123456789`~!@#$%^&*()_-+=[{]}|;:,.<>/?"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Valid characters. | |
var characters = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + | |
"0123456789`~!@#$%^&*()_-+=[{]}|;:,.<>/?"; | |
// password(X) will return a password of length X. | |
// password() will return a password of length 12. | |
var password = function(size) { | |
// Placeholder string, where our final password will end up. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$characters = | |
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' . | |
'0123456789`~!@#$%^&*()_-+=[{]}|;:,.<>/?'; | |
$strlen_characters = strlen($characters); | |
function password($length) { | |
$temp = ""; |
OlderNewer