Skip to content

Instantly share code, notes, and snippets.

View hkulekci's full-sized avatar
⛰️
Remote

Haydar KÜLEKCİ hkulekci

⛰️
Remote
View GitHub Profile
@hkulekci
hkulekci / usage.php
Last active August 29, 2015 14:06
Hierarchical Profiler - PHP Xhprof
<?php
// XHProf Usage
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
//....
// Some Codes
//....
! 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);
@hkulekci
hkulekci / test.php
Last active August 29, 2015 14:07
Some test about base64_encode, base64_decode and file sizes.
<?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);
@hkulekci
hkulekci / mysql_text.go
Created October 2, 2014 08:04
Mysql Test on GoLang
package main
import (
"fmt"
"github.com/ziutek/mymysql/mysql"
//_ "github.com/ziutek/mymysql/native"
_ "github.com/ziutek/mymysql/thrsafe"
//"reflect"
)
@hkulekci
hkulekci / obj-c.m
Last active August 29, 2015 14:09
Obj-C Variables Notes
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);
@hkulekci
hkulekci / Redis_Push_Pop_Results.txt
Last active August 29, 2015 14:10
Redis lpush and rpop test on my Macbook Pro for 1 Million Data insertion
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
-----------------------------
@hkulekci
hkulekci / php_short_tag_change
Last active August 29, 2015 14:11
PHP start tags changer
#!/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);
@hkulekci
hkulekci / Result.txt
Created December 28, 2014 17:17
NodeJS Example
MacBook Pro (Retina, 13-inch, Mid 2014)
3 GHz Intel Core i7
Result:
item1 = 0
item2 = 0
item1 = 1
item2 = 1
item1 = 2
@hkulekci
hkulekci / example.js
Created December 29, 2014 02:16
Binding on Javascript
// 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
@hkulekci
hkulekci / MysqlWrapper.js
Created December 30, 2014 22:51
Mysql Wrapper and Locking System. For only testing somethings.
var LockService = function() {
this.lock_state = 0;
}
LockService.prototype.lock = function() {
this.lock_state = 1;
};
LockService.prototype.unlock = function() {
this.lock_state = 0;