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
use Apache2::SubProcess(); | |
$r = shift(); | |
print "Content-type: text/html\n\n"; | |
my($in, $out, $err) = $r->spawn_proc_prog("myprog"); | |
while (<$out>) { | |
print $_; # works fine |
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 getElementsByClassName(classname,root,tagname) { | |
root = root || document; | |
tagname = tagname || "*"; | |
classname = classname.split(/\s+/); | |
var els = root.getElementsByTagName(tagname), | |
ret=[], i,j=0,k,len = els.length, m, cn, klen=classname.length, reEdgeSpaces = /[\t\n\r\f]/g | |
; | |
for (i=0; i<len; i++) { | |
cn = ' '+els[i].className.replace(reEdgeSpaces,' ')+' '; | |
m = true; |
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
// this is a JSON file with comments | |
{ | |
"foo": "bar", // this is cool | |
"bar": [ | |
"baz", "bum", "zam" | |
], | |
/* the rest of this document is just fluff | |
in case you are interested. */ | |
"something": 10, | |
"else": 20 |
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 | |
// located at: http://another.tld/auth.php | |
$api_callback = $_REQUEST["callback"]; | |
if ($_COOKIE["token_1"] == "abcd1234" && $_GET["token_2"] == "efgh5678") { | |
$msg = "Yes, your API call was successful!"; | |
} | |
else { | |
$msg = "API call not authorized."; |
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
<html> | |
<head> | |
<script type="text/javascript" src="LAB.js"></script> | |
<script type="text/javascript"> | |
var _queue = ["script1.js",null], $L = $LAB; | |
</script> | |
... | |
</head> | |
<body> |
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
{$: "#main" | action=data.user.logged_in?"#logout":"#login" } | |
Hello, {$= data.name $} | |
{$= @action $} | |
{$} | |
{$: "#login" } |
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 blah() { | |
alert(blah); // works! | |
(function() { alert(blah); })(); // fails :( | |
})(); |
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
<script src="data:text/javascript,alert('hello world');"></script> | |
<script>alert("hello world");</script> |
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(){ | |
var abc = "123"; | |
abc = 123; | |
})(); |
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
// shorten/alias long canvas method names | |
// adapted from: http://marijn.haverbeke.nl/js1k.html | |
var Canv = document.body.children.c, | |
Gr = Canv.getContext("2d"), | |
prop | |
; | |
for (prop in Gr) { | |
Gr[ prop[0] + (prop[3]||"") + (prop[6]||"") ] = Gr[prop]; |