Skip to content

Instantly share code, notes, and snippets.

View muratcorlu's full-sized avatar

Murat Çorlu muratcorlu

View GitHub Profile
@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) {
@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 / Readme.md
Last active January 16, 2023 08:38
Custom Element Serializer

Getting an HTML snapshot of current DOM including Custom Elements

This is an attempt to get HTML snapshot of current document in browser to report current state to server, to get a screenshot on the server without running JS

@muratcorlu
muratcorlu / README.md
Created March 10, 2022 20:18
Running self-hosting mail server with Poste.io and docker-compose
@muratcorlu
muratcorlu / default.js
Created July 11, 2012 19:42
lazyHandler examples
$('#header li a.clickable').click(function);
@muratcorlu
muratcorlu / README.md
Created February 9, 2020 20:12
Node Simple Logger

Simple logging utility for NodeJS v8+.

const { warn } = require('./logger');

warn('Something');

You can set log level via LOG_LEVEL env variable.

@muratcorlu
muratcorlu / gamespark-realtime.ts
Last active October 11, 2018 22:34
GameSpark SDK for TypeScript (for using with NativeScript)
const OpCodes = {
LOGIN_RESULT: -1,
PING_RESULT: -3,
UDP_CONNECT_MESSAGE: -5,
PLAYER_READY_MESSAGE: -7,
PLAYER_CONNECT_MESSAGE: -101,
PLAYER_DISCONNECT_MESSAGE: -103,
}
export class Connection {
@muratcorlu
muratcorlu / README.md
Last active December 11, 2017 12:17
Django Multisite User Model

This code is a sample for a question on Stackoverflow about making multisite user models with Django 1.7.

Usage:

Add these lines to your settings file:

AUTH_USER_MODEL='s1.Member'
SITE_ID = 1
AUTHENTICATION_BACKENDS = ( 'MyApp.MyModule.MyModelBackend',)
@muratcorlu
muratcorlu / nginx.conf
Created November 3, 2017 23:42
Serve static websites by dynamically mapping domain names and folders with nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/${host}/public;
index index.html;
server_name _;
gzip on;
@muratcorlu
muratcorlu / grunt-connect-rewrite.js
Last active May 14, 2016 01:29
Simple connect middleware for simulating url-rewriting for grunt connect servers.
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){