This is just a little script, which can tell you if your hoster/php verion supports namespaces. Upload to your htdocs/webroot and naviagte your browser to the page. It might tell you "Namespaces seem to work!" or something like "Parse error: syntax error, unexpected T_STRING in /var/www/httpdocs/nst.php on line 1"
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 | |
/** | |
* One-pointer Circular Buffer | |
* | |
* This comes without any overwrite | |
* checks or FIFO functionality. | |
* You'll need SPL. | |
* | |
* @author Bernhard Häussner | |
* @date 2011-09-07 |
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
02:16 bernhard@horst:~> time for i in {1..10000}; do sed -n -e '1p' edt.txt > /dev/null;done | |
real 1m23.424s | |
user 0m44.611s | |
sys 0m8.801s | |
02:18 bernhard@horst:~> time for i in {1..10000}; do sed -e '1!d' edt.txt > /dev/null;done | |
real 1m23.036s | |
user 0m45.827s | |
sys 0m10.609s |
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
int a[1]; | |
a[0]=1; | |
if(0[a]==a[0]==1); | |
// a[b] == *(a+b) == *(b+a) == b[a] |
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
/* | |
* Just for fun :) AND, OR and XOR with only "+ * - 2", plus "( ) 1" for NOT | |
*/ | |
function not(a) { | |
return (a-1)*(a-1); | |
return a*(a-1)+(a+1)-2*a; | |
return (a-2)*a+1; | |
return and(a-1,a-1); | |
} |
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
int barWidth=50; | |
GradientI[] grads=new GradientI[4]; | |
void setup() { | |
size(1600, 300); | |
colorMode(HSB, 360, 100, 1.0); | |
noStroke(); | |
background(0); | |
grads[0]=new LiearGradient(); /* lin */ | |
grads[1]=new LiearGradient(1.1); /* clip_a */ |
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
var tableRows=$("tr").detach(); | |
Array.prototype.sort.call(tableRows,function(a,b){ | |
// Compare two table rows by the numeric value of their first <td> | |
return a.firstChild.firstChild.nodeValue*1 < b.firstChild.firstChild.nodeValue*1 | |
}); | |
$("table").append(tableRows); | |
// Tested in Firefox 4 |
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
for i in {1..61}; do echo rframe $i; time blender -b rotation1-mats.blend -f $i -o //rotation1_####.png -F PNG; done | |
# render frames 1 to 61, echo time for each frame and save them with specified filename |
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 | |
namespace bxt\Util; | |
class ArrayObject implements \ArrayAccess, \Iterator, \Countable { | |
private $object; | |
private $iterator=0; | |
private $offsetMethodMap=array(); | |
private $offsetMethodMapSetters=array(); | |
public function __construct($obj) { | |
$this->object=$obj; |