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 | |
// Get a unique ID for document | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:5984/_uuids'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-type: application/json', | |
'Accept: */*' | |
)); |
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 | |
$date = new DateTime('Europe/London'); | |
$date->sub(DateInterval::createFromDateString('12 days')); | |
echo $date->format('d-m-y'); |
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 | |
var_dump(DateTime::createFromFormat('d-m-Y','01-01-2013')->add(date_interval_create_from_date_string('2 years'))->format('d-m-Y')); | |
?> |
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
:g/^$/d | |
# @see http://stackoverflow.com/questions/706076/vim-delete-blank-lines |
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 | |
/** | |
* Prototype method for traversing large records in batches | |
* using the YII framework. | |
* | |
* Completed stepper method for restoration rollback solution. | |
* | |
* @todo Include this in main restoartion rollback solution | |
* @return [type] [description] | |
*/ |
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 | |
// Interesting legacy fix | |
// | |
// This works by replacing a collection of 10 blank spaces with a random character. | |
// However the \e modifier is deprecaited now, it needed replacing as it's hard to | |
// underststand without some notes. | |
// | |
// This line appears to come from http://php.net/manual/en/function.rand.php#86465 | |
// | |
// $f->checksum = preg_replace('/([ ])/e', 'chr(rand(97,122))', ' '); |
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 | |
/** | |
* Created by Chris Hardcastle to run cron jobs | |
* Based on the default kohana 2.3.4 index.php | |
* Note the required #! stated above | |
* CRON TAB USAGE (To run twice a day) | |
0 0,12 * * * /usr/bin/php [root][site]/cron.php --controller --method | |
* | |
* Use the shebang --> #!/usr/bin/php (should you need it, thanks @spolster) | |
*/ |
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(){ | |
$(".pagination") | |
.find("a") | |
.removeClass("selected") | |
.end() | |
.find("a[href="+$(this).attr("href")+"]") | |
.addClass("selected"); | |
})(jQuery) |
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
/* | |
* Written by Chris Hardcastle | |
* Pre-load an image using jQuery | |
* Example HTML layout | |
<div id="globalInner"> | |
<div id="loading"><!-- css loading gif --></div> | |
<div id="stage"></div> | |
</div> | |
*/ | |
/* |
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
find ./ -name "*.css" -print0 | xargs -0 -I xxx mv xxx css/ |
OlderNewer