Skip to content

Instantly share code, notes, and snippets.

View cbguder's full-sized avatar

Can Berk Güder cbguder

View GitHub Profile
function turkishUpperCase(s) {
s = s.replace(/ı/g, 'I');
s = s.replace(/i/g, 'İ');
return s.toUpperCase();
}
function fixSmallCaps(selector) {
$$(selector).each(function(e) {
var text = e.innerHTML;
var upper = turkishUpperCase(text);
def yaziyla(amount)
r = ''
if amount >= 2000
r += yaziyla_part(amount / 1000) + 'BİN'
elsif amount >= 1000
r += 'BİN'
end
r += yaziyla_part(amount % 1000) + ' TL'
kurus = (amount * 100) % 100
def age
age = Date.today.year - self.birthday.year
if Date.today < self.birthday.advance(:years => age)
age -= 1
end
return age
end
def random_password(len)
chars = ("a".."z").to_a + ("0".."9").to_a
result = ""
1.upto(len) { |i| result << chars[rand(chars.size-1)] }
return result
end
@cbguder
cbguder / verifyReceipt.py
Created September 23, 2010 21:42
Verify in-app purchase receipts
#!/usr/bin/env python
import sys
import json
import base64
import urllib2
liveURL = 'https://buy.itunes.apple.com/verifyReceipt'
sandboxURL = 'https://sandbox.itunes.apple.com/verifyReceipt'
@cbguder
cbguder / 960gs.jsx
Created December 22, 2010 13:32
960gs ExtendScript for Adobe Photoshop CS5
/*
* 960gs ExtendScript for Adobe Photoshop CS5
* Copyright (c) 2010 Can Berk Güder
*/
#target photoshop
var doc;
var w = new Window(
"dialog {\
@cbguder
cbguder / weibull.c
Created March 7, 2011 15:43
Weibull distribution
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float randomf() {
return (float)random() / (float)RAND_MAX;
}
float weibull(float alpha, float beta) {
float u = 1.0 - randomf();
@cbguder
cbguder / .rtorrent.rc
Created November 11, 2011 20:53
Growl notifier for rTorrent
system.method.set_key = event.download.finished,notify_finished,"execute=rtorrentNotify,--finished,$d.get_name="
system.method.set_key = event.download.inserted_new,notify_inserted_new,"execute=rtorrentNotify,--inserted-new,$d.get_name="
javascript:window.location=$("#left-stack img.artwork").attr("src").replace("170x170", "1200x1200")
@cbguder
cbguder / Rakefile
Last active December 18, 2015 05:29 — forked from avh4/Rakefile
PROJECT_NAME = "AwesomeThing"
APP_NAME = "AwesomeThing"
@configuration = "Debug"
@app_suffix = "-Dev"
@staging_developer_name = "iPhone Developer: <<FILL ME IN>>"
@staging_provisioning_profile = "Support/AwesomeThing.mobileprovision"
@production_developer_name = "iPhone Distribution"
@production_provisioning_profile = "Support/AwesomeThing.mobileprovision"
@appstore_developer_name = "iPhone Distribution"
@appstore_provisioning_profile = "Support/AwesomeThing.mobileprovision"