Skip to content

Instantly share code, notes, and snippets.

Murat Çorlu muratcorlu

Block or report user

Report or block muratcorlu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@muratcorlu
muratcorlu / ng-masked-input.js
Created Feb 18, 2014
Masked Input Directive trying for AngularJS (It's not working)
View ng-masked-input.js
/**
* 0 User must enter a digit (0 to 9).
* 9 User can enter a digit (0 to 9).
* # User can enter a digit, space, plus or minus sign. If skipped, enters a blank space.
* L User must enter a letter.
* ? User can enter a letter.
* A User must enter a letter or a digit.
* a User can enter a letter or a digit.
* & User must enter either a character or a space.
* C User can enter characters or spaces.
@muratcorlu
muratcorlu / ng-translate.js
Created Feb 18, 2014
Translation directive for AngularJS
View ng-translate.js
/**
* @ngdoc directive
* @name ng.directive:translate
*
* @element ANY
*
* @description
*
* Angular icin ceviri directive'i
*
@muratcorlu
muratcorlu / date_diff.js
Created Dec 18, 2013
Date difference with javascript
View date_diff.js
var date1 = new Date(2010, 6, 17);
var date2 = new Date(2013, 12, 18);
var diff = new Date(date2.getTime() - date1.getTime());
// diff is: Thu Jul 05 1973 04:00:00 GMT+0300 (EEST)
console.log(diff.getUTCFullYear() - 1970); // Gives difference as year
// 3
console.log(diff.getUTCMonth()); // Gives month count of difference
// 6
@muratcorlu
muratcorlu / connect-api-mocker.js
Created Jun 25, 2013
Connect middleware that creates mockes for rest apis.
View connect-api-mocker.js
var fs = require('fs');
module.exports = function (urlRoot, pathRoot) {
pathRoot = pathRoot.replace(urlRoot, '');
return function(req, res, next){
if (req.url.indexOf(urlRoot) === 0) {
// Ignore querystrings
url = req.url.split('?')[0];
@muratcorlu
muratcorlu / grunt-connect-rewrite.js
Last active May 14, 2016
Simple connect middleware for simulating url-rewriting for grunt connect servers.
View grunt-connect-rewrite.js
var fs = require('fs'),
url = require('url');
module.exports = function (rootDir, indexFile) {
indexFile = indexFile || "index.html";
return function(req, res, next){
var path = url.parse(req.url).pathname;
fs.readFile('./' + rootDir + path, function(err, buf){
@muratcorlu
muratcorlu / slugify_tr.js
Created Sep 11, 2012
Javascript Türkçe karakter destekli slugify (url metni oluşturucu)
View slugify_tr.js
/**
* 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) {
@muratcorlu
muratcorlu / default.js
Created Jul 11, 2012
lazyHandler examples
View default.js
$('#header li a.clickable').click(function);
View filter.py
SearchQuerySet().filter(user__iexact="murat").filter(content__startswith=request.GET.get('q'))[:10]
@muratcorlu
muratcorlu / jquery_disqus_lazyload.js
Created Apr 3, 2012
Load disqus comments when visitor scroll down page to comments
View jquery_disqus_lazyload.js
/**
* 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
@muratcorlu
muratcorlu / tckimlik.py
Created Mar 11, 2012
Python ile TC Kimlik numara doğrulama
View tckimlik.py
# 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.
You can’t perform that action at this time.