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
sed -e 's/searchString/replacementString/g' target.txt > destination.txt |
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
$.post(ENV.app_url+"/tab/answer", data, function(json){ | |
// create a deferred object | |
var dfd = $.Deferred(); | |
var action = { | |
add_response: function(json){ | |
console.log('added message'); | |
$("#question_response") | |
.html(json.message) | |
}, | |
refresh_cufon: function(){ |
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
// code yanked from the Yahoo media player. Thanks, Yahoo. | |
// via http://ajaxian.com/archives/graceful-degradation-of-firebug-console-object | |
if (! ("console" in window) || !("firebug" in console)) { | |
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group" | |
, "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; | |
window.console = {}; | |
for (var i = 0; i <names.length; ++i) window.console[names[i]] = function() {}; | |
} |
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
// Get current controller | |
Request::current()->controller(); | |
// Throw errors | |
throw new Http_Exception_404('File not found!'); | |
throw new Http_Exception_500('Server tantrum'); | |
// Last query | |
ORM::factory([MODEL_NAME])->last_query(); |
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 | |
// Decode the Crypt field and extract the results | |
$sagePay = new SagePay_Util(); | |
$strDecoded = $sagePay->decodeAndDecrypt($strCrypt); | |
$values = $sagePay->getToken($strDecoded); | |
// Fire a range of actions | |
$listeners = array( | |
"Application_Model_Order", // Add order to database | |
"SagePay_Order", // Update order with payment information |
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'; |
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
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
<?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
<?php | |
$date = new DateTime('Europe/London'); | |
$date->sub(DateInterval::createFromDateString('12 days')); | |
echo $date->format('d-m-y'); |