This file contains hidden or 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 | |
function data_uri($file, $mime) { | |
$contents=file_get_contents($file); | |
$base64=base64_encode($contents); | |
echo "data:$mime;base64,$base64"; | |
} | |
?> |
This file contains hidden or 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
Tuckey URL Rewrite - Remove .html Extensions | |
<rule> | |
<note>Example: http://hostname/sample/loginhelp?cid=2 is masked from http://hostname/sample/loginhelp.html?cid=2</note> | |
<from>^(.*)?(.*)$</from> | |
<to>$1.html?$2</to> | |
</rule> | |
<outbound-rule> | |
<note>Example: http://hostname/sample/loginhelp.html?cid=2 is redirected to http://hostname/sample/loginhelp?cid=2</note> | |
<from>^(.*)(.html)(.*)$</from> | |
<to type="redirect">$1$2</to> |
This file contains hidden or 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
img.grayscale { | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ | |
filter: gray; /* IE6-9 */ | |
-webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */ | |
} | |
img.grayscale.disabled { | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale"); | |
-webkit-filter: grayscale(0%); | |
} |
This file contains hidden or 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 | |
$i = imagecreatefromjpeg("image.jpg"); | |
for ($x=0;$x<imagesx($i);$x++) { | |
for ($y=0;$y<imagesy($i);$y++) { | |
$rgb = imagecolorat($i,$x,$y); | |
$r = ($rgb >> 16) & 0xFF; | |
$g = ($rgb >> & 0xFF; | |
$b = $rgb & 0xFF; | |
This file contains hidden or 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
function getObjectType(obj) { | |
if(obj===null)return "[object Null]"; // special case | |
return Object.prototype.toString.call(obj); | |
} |
This file contains hidden or 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
<cfscript> | |
/* | |
Script: DataTables server-side script for ColdFusion (short script style) and MySQL | |
License: GPL v2 or BSD (3-point) | |
ReWrite: 12/12/2011 John Fournier | |
Notes: Adobe ColdFusion 9 + limited inline documentation used, see other long examples for explanation | |
*/ | |
datasource = 'jQueryDTable'; // set to your ColdFusion database | |
sTable = 'ajax'; // your table | |
aColumns = ['engine','browser','platform','version','grade']; // your columns |
This file contains hidden or 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 | |
// define the path and name of cached file | |
$cachefile = 'cached-files/'.date('M-d-Y').'.php'; | |
// define how long we want to keep the file in seconds. I set mine to 5 hours. | |
$cachetime = 18000; | |
// Check if the cached file is still fresh. If it is, serve it up and exit. | |
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) { | |
include($cachefile); | |
exit; | |
} |
This file contains hidden or 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
{ | |
"Version": "2008-10-17", | |
"Id": "http referer policy example", | |
"Statement": [ | |
{ | |
"Sid": "Allow get requests from certain domains (including local development)", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::bucket-name-here/*", |
This file contains hidden or 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
Show hidden characters
{ | |
"Seti_SB_bright": true, | |
"Seti_SB_med": true, | |
"Seti_no_bar_undertabs": true, | |
"Seti_tabs_small": true, | |
"always_show_minimap_viewport": true, | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJMIKOLP", |
This file contains hidden or 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
Math.round = (function() { | |
var originalRound = Math.round; | |
return function(number, precision) { | |
precision = Math.abs(parseInt(precision)) || 0; | |
var multiplier = Math.pow(10, precision); | |
return (originalRound(number * multiplier) / multiplier); | |
}; | |
})(); | |
/* | |
example usage: |