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 | |
function notModifiedCheck() | |
{ | |
//get the last-modified-date of this very file | |
$lastModified=filemtime(__FILE__); | |
//get a unique hash of this file (etag) | |
$etagFile = md5_file(__FILE__); | |
//get the HTTP_IF_MODIFIED_SINCE header if set | |
$ifModifiedSince=(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false); |
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
abstract class BasicEnum { | |
private static $constCacheArray = NULL; | |
private static function getConstants() { | |
if (self::$constCacheArray == NULL) { | |
self::$constCacheArray = []; | |
} | |
$calledClass = get_called_class(); | |
if (!array_key_exists($calledClass, self::$constCacheArray)) { | |
$reflect = new ReflectionClass($calledClass); |
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 | |
// Memory benchmark related to http://stackoverflow.com/questions/11657835/how-to-get-a-one-dimensional-scalar-array-as-a-doctrine-dql-query-result | |
// Build an array of 50 MiB | |
$data = []; | |
for ($i = 0; $i < 1024; $i++) { | |
$data[] = ['id' => str_repeat(' ', 1024 * 50)]; // store 50kb more | |
} |
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
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
// Allocate two-dimensioanl array. | |
a := make([][]uint8, dy) | |
for i := 0; i < dy; i++ { | |
a[i] = make([]uint8, dx) | |
} |
NewerOlder