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 | |
/** | |
* Fixes PHP's $argv array (or, rather, a list of filenames that is assumed to | |
* come from $argv) to expand glob strings on Windows, where the cmd.exe shell | |
* doesn't expand globs before passing arguments to called commands/programs. | |
* | |
* @link https://gist.github.com/aziraphale/edf8a1b1ad049f4e08ee | |
* @param array $argv | |
* @return array |
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 | |
// Definining these four classes is actually optional; the code functions fine | |
// without them, but IDEs obviously bitch about undefined classes. | |
// All have final-private constructors to prevent them ever being instantiated | |
// (or we could pass *actual objects* of these types to our type-hinted | |
// functions, where we'd have code that expected a string suddenly finding | |
// itself dealing with an object! | |
class string { final private function __construct(){} } | |
class boolean { final private function __construct(){} } |
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
javascript:var u; try { u=document.querySelector("link[rel=canonical]").href; } catch (e) {} if(u){ if(prompt("Canonical URL: - Press OK to navigate", u)) { window.location=u; } else { /* Chrome goes silly if I don't do something here */ u=null; } } else { prompt("No canonical URL found. Displaying current URL:", window.location.href); } |
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
// Disable panning around the page on touchscreen devices (as this is totally incompatible with ScrollPath) | |
$(document).one('touchstart', function(){ | |
$(document).on('touchmove', function(ev){ | |
ev.preventDefault(); | |
}); | |
// Also hide the scrollbar | |
$('.sp-scroll-bar').hide(); | |
}); |
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
To get an idea of the ideal number of bcrypt "rounds" to use for highest security without requiring | |
excessive CPU time, I wrote a little PHP script to hash a 9-character password with every possible | |
number of rounds (from 4 to 31), timing how long it takes to perform each hash. | |
This test was performed on an Intel Core i5-2500 CPU @ 3.3 GHz, running Windows 7 64-bit and | |
PHP 5.4.0 (x86; VC9; CLI). The machine was being used for general development work at the same | |
time, but the script was only single-threaded and the development work wasn't particularly heavy, | |
so the times should be fairly accurate. | |
RESULTS (times in seconds): |
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
<html> | |
<head> | |
<title>Test</title> | |
<link rel="stylesheet" media="all" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/start/jquery-ui.css"></link> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script> | |
<script src="jquery.myplugin.js"></script> | |
<script> | |
$(document).ready(function(){ | |
//call plugin |
NewerOlder