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 / 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 / gamespark-realtime.ts
Last active Oct 11, 2018
GameSpark SDK for TypeScript (for using with NativeScript)
View gamespark-realtime.ts
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 Dec 11, 2017
Django Multisite User Model
View README.md

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 Nov 3, 2017
Serve static websites by dynamically mapping domain names and folders with nginx
View nginx.conf
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
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 / install.sh
Last active Apr 14, 2016
Prerender Installation to Debian with Nginx Proxy and Caching
View install.sh
# Prerender kurulumu
sudo locale-gen UTF-8
sudo apt-get update
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs build-essential libfontconfig nginx-extras
sudo npm install -g phantomjs
sudo npm install -g prerender
sudo npm install -g pm2
@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 / detay.html
Created Oct 24, 2015
Synaps Seçim sistemi embed kodları
View detay.html
<div synaps-secim></div>
@muratcorlu
muratcorlu / default.js
Created Jul 11, 2012
lazyHandler examples
View default.js
$('#header li a.clickable').click(function);
You can’t perform that action at this time.