Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
$foo = "alert ('foo');";
open(FH, "| java -jar yuicompressor-2.4.2.jar --type js");
print FH $foo;
while(<FH>){
print $_;
}
print "\n";
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<HelloWorldResponse xmlns="http://www.guru4.net/">
<HelloWorldResult>Hello World!</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
</soap:Envelope>
$input = "some text";
$query = "select centroid.latitude, centroid.longitude from geo.places where text='$input'";
$url = "http://query.yahooapis.com/v1/public/yql?q=" . urlencode($query) . "&format=json&callback=";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$ch = curl_init();
$query = 'select * from search.web where query="pizza"';
$url = "http://query.yahooapis.com/v1/public/yql?q=" . urlencode($query) . "&diagnostics=false&env=store://datatables.org/alltableswithkeys&format=json";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$response = curl_exec($ch);
This script updates to Chromium nightly. You can run it manually, but I run it using cron.
If you run it using cron remember that it _will quit_ your running Chromium so make sure you have it set to save tabs if you want them.
In order to install it with cron run:
crontab -e
Add the line:
var bignum = 1e300;
var ∞ = 1e400; //Infinity
alert(∞ - bignum); //Infinity
var data = "";
for (p in parameterMap) {
data += p + "=" + encodeURIComponent(parameterMap[p]) + "&";
}
//kill the trailing &
data = data.slice(0,-1);
var data = [];
for (p in parameterMap) {
data.push(p + "=" + encodeURIComponent(parameterMap[p]));
}
data = data.join("&");
var httpClient = http.createClient(80, host);
var request = httpClient.request("POST", urlpath, {"host": host, "Content-Length": data.length, "Content-Type": "applicaiton/x-www-form-urlencoded"});
request.write(data);
request.addListener('response', function (response) {
sys.puts("STATUS: " + response.statusCode);
sys.puts("HEADERS: " + JSON.stringify(response.headers));
response.setBodyEncoding("utf8");
response.addListener("data", function (chunk) {
sys.puts("BODY: " + chunk);
});
var msgStr = msg.slice(0,5);
console.log(sys.inspect(msgStr));
var a = msgStr.toString('ascii', 0, msgStr.length);
console.log(sys.inspect(a));
for (i=0;i<a.length;i++) {
console.log(a.charCodeAt(i));