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
// 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
// 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
$.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
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
## Automate FTP uploads | |
## Go to destination | |
cd C:\Test | |
$location = Get-Location | |
"We are here: $location" | |
## Get files | |
$files = Get-ChildItem -recurse | |
## Get ftp object | |
$ftp_client = New-Object System.Net.WebClient | |
$ftp_address = "ftp://user:pass@adress:/home/chardcastle/test" |
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
/* | |
* Read the Homepage XML file and get the snippets | |
* from file | |
*/ | |
public List<string> get_homepage_snippets() | |
{ | |
List<string> snippets = new List<string>(); | |
XmlTextReader reader = new XmlTextReader(Server.MapPath("~/Data/homepage.xml")); | |
while (reader.Read()) |
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
// from http://thefinerstuff.posterous.com/git-saved-my-day-restore-accid | |
git ls-files -d | xargs git checkout -- |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Site name</title> | |
</head> | |
<body></body> | |
</html> |