Skip to content

Instantly share code, notes, and snippets.

View muratcorlu's full-sized avatar

Murat Çorlu muratcorlu

View GitHub Profile
@muratcorlu
muratcorlu / tabmenu.css
Created September 29, 2010 11:34
A simple tabmenu implementation with jQuery
div.tabcontent {
display:none;
}
div.active {
display:block;
}
@muratcorlu
muratcorlu / jsonencode.php
Created September 29, 2010 13:33
JSON Encoder
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="tr" lang="tr">
<head>
<title> JSON Encoder </title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<?php
if($_POST) {
$unicodes = array('\u015f', '\u015e', '\u011f', '\u011e', '\u0130', '\u0131', '\u00fc', '\u00dc', '\u00d6', '\u00f6', '\u00c7', '\u00e7');
@muratcorlu
muratcorlu / simpletimer.js
Created October 10, 2010 03:24
Simple timer with javascript
var timer = {
started: 0,
end: 0,
now: function(){ return new Date(); },
start: function(){ return this.started = this.now(); },
since: function(){ this.end = this.now(); return this.now()-this.started; }
}
// Usage:
@muratcorlu
muratcorlu / flashEvent.js
Created October 19, 2010 14:14
Fire events that can listen by Javascript from Flash
/*
* Flash runs fireFlashEvent function with a event name parameter and
* several optional parameters. Javascript can listen these events by
* binding with addFlashEventListener function.
*
* Requires jQuery
*/
// Global Document object for caching $(document) selector
Document = null;
@muratcorlu
muratcorlu / json.py
Created January 26, 2012 17:39
Python command line script to JSON parse
#!/usr/bin python
"""
requires simplejson module (https://github.com/simplejson/simplejson)
Usage example:
tail -f /var/log/json.log | grep "muratcorlu.com" | python json.py log.date log.url
"2011.12.14 14:21" "http://muratcorlu.com/post/archieve/"
"2011.12.14 14:29" "http://muratcorlu.com/"
@muratcorlu
muratcorlu / tckimlik.py
Created March 11, 2012 20:44
Python ile TC Kimlik numara doğrulama
# coding=utf-8
"""
Kurallar:
* 11 hanelidir.
* Her hanesi rakamsal değer içerir.
* İlk hane 0 olamaz.
* 1. 3. 5. 7. ve 9. hanelerin toplamının 7 katından, 2. 4. 6. ve 8. hanelerin toplamı çıkartıldığında, elde edilen sonucun 10'a bölümünden kalan, yani Mod10'u bize 10. haneyi verir.
* 1. 2. 3. 4. 5. 6. 7. 8. 9. ve 10. hanelerin toplamından elde edilen sonucun 10'a bölümünden kalan, yani Mod10'u bize 11. haneyi verir.
Kurallar http://www.kodaman.org/yazi/t-c-kimlik-no-algoritmasi adresinden alınmıştır.
@muratcorlu
muratcorlu / jquery_disqus_lazyload.js
Created April 3, 2012 07:38
Load disqus comments when visitor scroll down page to comments
/**
* Load disqus comments when visitor scroll down page to comments
*
* Usage:
* Add a div with id "disqus_thread" and data attributes for every disqus parameter:
*
* <div id="disqus_thread" data-disqus-shortname="username" data-disqus-url="http://example.com/post/post-name/"></div>
*
* @author: Murat Corlu
* @link: https://gist.github.com/gists/2290198
SearchQuerySet().filter(user__iexact="murat").filter(content__startswith=request.GET.get('q'))[:10]
@muratcorlu
muratcorlu / default.js
Created July 11, 2012 19:42
lazyHandler examples
$('#header li a.clickable').click(function);
@muratcorlu
muratcorlu / slugify_tr.js
Created September 11, 2012 12:46
Javascript Türkçe karakter destekli slugify (url metni oluşturucu)
/**
* Metni url'de kullanılabilir hale çevirir. Boşluklar tireye çevrilir,
* alfanumerik olmayan katakterler silinir.
*
* Transform text into a URL path slug(with Turkish support).
* Spaces turned into dashes, remove non alnum
*
* @param string text
*/
slugify = function(text) {