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
/** | |
* Example output | |
* | |
* # node user/jwt.js | |
* Generated JWT: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNjk5NjQ0MTczLCJleHAiOjE2OTk2NDc3NzMsImlzcyI6InVybjpleGFtcGxlOmlzc3VlciIsImF1ZCI6InVybjpleGFtcGxlOmF1ZGllbmNlIn0.qkYazhX0__WeBAjiW1MvXndqdBc4qsP-mX8vWIzCPwE | |
* Verified Payload: { | |
* sub: '1234567890', | |
* name: 'John Doe', | |
* iat: 1699644173, | |
* exp: 1699647773, |
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 | |
// 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 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 | |
/** | |
* 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 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
:g/^$/d | |
# @see http://stackoverflow.com/questions/706076/vim-delete-blank-lines |
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 | |
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 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 | |
$date = new DateTime('Europe/London'); | |
$date->sub(DateInterval::createFromDateString('12 days')); | |
echo $date->format('d-m-y'); |
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 | |
// 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 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
var imgs = document.getElementsByTagName("img"); | |
for (x in imgs){ | |
console.log('curl -O ' + imgs[x].src); | |
} | |
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
// Find foo in javascript files within a folder called www | |
grep 'foo' -rl --include=\*.{js,h} www/ | |
// Find bar in php files within a folder called www | |
grep 'bar' -rl --include=\*.{php,h} www/ |
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
-- SQL to reset user password on wordpress 3.5.1 to 'tacoseven' | |
update wp_users set user_pass = '$P$BsrjScKnteWABdcJxOPgd7EepP7QME1' where user_login = 'admin'; |
NewerOlder