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 / gist:1239367
Created September 24, 2011 14:16
magic_function in javascript
var foo = {
__noSuchMethod__ : function(id, args) {
console.log("id: "+id);
console.log("Arg: "+args);
},
bar:function(a,b){
console.log("OK!");
}
};
/*
* Usage
*
* $('#textarea_id').tweet_text_design("First part | Second Part");
*
*
*/
$.fn.tweet_text_design = (function(text){
text = text.split("|");
@hkulekci
hkulekci / gist:1269745
Created October 7, 2011 08:05
MacOSx memcached warning
$ memcached -u memcached -d -m 30 -l 127.0.0.1 -p 11211
@hkulekci
hkulekci / gist:1270945
Created October 7, 2011 18:00
js for beauty
var _$ = document.getElementById;
/// Usage
_$('element_id').value = "";
@hkulekci
hkulekci / first_example.py
Created October 29, 2011 19:02
my first python example to use 25 terms to evaulate two series.
def fak (x):
if x == 0:
return 1
else:
return x * fak(x-1)
i = 0
t = 8.3
result1 = 0
result2 = 0
@hkulekci
hkulekci / cos.py
Created October 29, 2011 19:53
cos(x) with approximation
#cos(x) approximation
def fak (x):
if x == 0:
return 1
else:
return x * fak(x-1)
import math
@hkulekci
hkulekci / gist:1416955
Created December 1, 2011 14:05
date translate
var dateConvert = { "Mon,":"Pazartesi", "Tue,":"Salı", "Wed,":"Çarşamba", "Thu,":"Perşembe",
"Fri,":"Cuma", "Sat,":"Cumartesi", "Sun,":"Pazar",
"Jan":"Ocak", "Feb":"Şubat", "Mar":"Mart", "Apr":"Nisan", "May":"Mayıs",
"Jun":"", "Jul":"", "Aug":"Ağustos", "Sep":"Eylül", "Oct":"Ekim",
"Nov":"Kasım", "Dec":"Aralık"};
// usage :
@hkulekci
hkulekci / navigationController.m
Created February 10, 2012 07:44
navigation Controller Notes
/* NavigationController nesnesi için kullanışlı olabilecek bir kaç methodu ve kullanımı */
// NavigationController'ın viewController dizisindeki iki önceki view'e ulaşmak :
[self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:0] animated:YES];
// Root view'e dönmek :
[self.navigationController popToRootViewControllerAnimated:NO];
// Yeni bir view push etmek :
@hkulekci
hkulekci / lines.cpp
Created March 21, 2012 12:41
This program draws points&lines placed with mouse clicks.
/*
* This program draws points placed with mouse clicks.
* Maximum number of points allowed is currently set at 16.
*
* Usage:
* Left click to place a control point.
* Press escape to exit.
*/
#include <stdlib.h>
#include <GL/glut.h>
@hkulekci
hkulekci / background.cpp
Created March 21, 2012 12:45
Use keyboard input to change background colour of screen.
/* Program 3-1
Use keyboard input to change background colour of screen.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <GL/glut.h>
#define KEY_ESC 27 /* GLUT doesn't supply this */
int myrandom(int m) {