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
function select_text(element) { | |
var start = 0; | |
var end = element.value.length; | |
if (element.createTextRange) { | |
var selRange = element.createTextRange(); | |
selRange.collapse(true); | |
selRange.moveStart('character', start); | |
selRange.moveEnd('character', end - start); | |
selRange.select(); |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule .* /passgen/index.php [L,QSA] | |
</IfModule> |
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
#!/usr/bin/env php | |
<?php | |
$help = <<<'HELP' | |
EXAMPLES | |
./project-phpunit-skelgen.php -s <dir> -o <dir> -b <file> | |
DESCRIPTION | |
Recursively find PHP files and run phpunit-skelgen to create unit test skeleton files. |
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
/** | |
* Extract a fully qualfied (namespaced) classname from a php file. | |
* This function assumes PSR-0 compliance. | |
* | |
* @param string $filePath Path to the php file. | |
* @return string|false The resulting classname | |
*/ | |
function extractFullClassNameFromFile($filePath) | |
{ | |
if (!file_exists($filePath)) { |
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
/** | |
* Conert to boolean by using normal PHP falsey equivalencies with | |
* the addition of string 'false' which PHP usually considers truthy. | |
* | |
* @param mixed $val Value to convert to boolean | |
* @return boolean Boolean equivalent | |
*/ | |
function bool($val) | |
{ | |
if ( |
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
/** | |
* Extract an option from the results of getopt specifying the | |
* keys in order of preference. | |
* | |
* @param array $options Result from getopt('ab:c::', array('add', 'bacon', 'create')) | |
* @param string $key1 First key to look for e.g. 'add' | |
* @param string $key2 Second key to look for e.g. 'a' | |
* @param string $keyn Other possible aliases... | |
* @return mixed The value from options array or null otherwise | |
*/ |
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>CSS3 Flexible Box Layout</title> | |
</head> | |
<body> | |
<div id="container1"> | |
<div id="box1"></div> | |
<div id="box2"></div> | |
</div> | |
<div id="container2"> |
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
# Create a test.pid file containing the pid of the sh process. | |
# Run the main command. Example: Sleep for 15 seconds. | |
# Then remove the pid file once the main command process is ended or killed. | |
$ nohup sh -c "sleep 15; rm test.pid" >/dev/null 2>&1 & echo $! > test.pid |
NewerOlder