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 | |
// XHProf Usage | |
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); | |
//.... | |
// Some Codes | |
//.... | |
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 Donut3D = {}; | |
function pieTop(d, rx, ry, ir) { | |
if (d.endAngle - d.startAngle == 0) return "M 0 0"; | |
var sx = rx * Math.cos(d.startAngle), | |
sy = ry * Math.sin(d.startAngle), | |
ex = rx * Math.cos(d.endAngle), | |
ey = ry * Math.sin(d.endAngle); |
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 | |
$filename = "google3.png"; | |
$tempfile = "google2.png"; | |
print_r(filesize($filename)); | |
$file_content = base64_encode(file_get_contents($filename)); | |
echo '<br>'; | |
$strlen = strlen($file_content); | |
print_r(ceil($strlen / 4) * 3); |
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 ( | |
"fmt" | |
"github.com/ziutek/mymysql/mysql" | |
//_ "github.com/ziutek/mymysql/native" | |
_ "github.com/ziutek/mymysql/thrsafe" | |
//"reflect" | |
) |
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 main() { | |
const char* convert = "hello"; | |
NSString *input = [[NSString alloc] initWithUTF8String:convert]; | |
NSString *str = @"Test"; | |
printf("Result : %s\n", [str UTF8String]); | |
NSUInteger intVal = 10; | |
int iInt1 = (int)intVal; | |
NSLog(@"value : %lu %d", (unsigned long)intVal, iInt1); |
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
Pushing and Poping on Redis For 1 Million Record | |
Machine information : | |
> Processor : 3 GHz Intel Core i7 | |
> Memory : 16 GB 1600 MHz DDR3 | |
Only printing datas to screen | |
----------------------------- |
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
#!/usr/bin/php | |
<?php | |
$arg = $argv[1]; | |
if (is_dir($arg)) { | |
foreach (glob($arg . "*.php") as $filename) { | |
$content = file_get_contents($filename); | |
$content = preg_replace(array("/<\?([^px])/", "/<\?php=/", "/<\?=/", "/mktime/"), array("<?php$1", "<?php echo ", "<?php echo ", "time"), $content); | |
file_put_contents($filename, $content); |
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
MacBook Pro (Retina, 13-inch, Mid 2014) | |
3 GHz Intel Core i7 | |
Result: | |
item1 = 0 | |
item2 = 0 | |
item1 = 1 | |
item2 = 1 | |
item1 = 2 |
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
// A dummy function that callback after 1 second (simulating some processing work) | |
function dummy(i, callback) { | |
setTimeout(function() { | |
// After 1 second, we callback with a result | |
callback('dumb result') | |
}, 1000); | |
} | |
// Incorrect version |
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 LockService = function() { | |
this.lock_state = 0; | |
} | |
LockService.prototype.lock = function() { | |
this.lock_state = 1; | |
}; | |
LockService.prototype.unlock = function() { | |
this.lock_state = 0; |