Skip to content

Instantly share code, notes, and snippets.

View muratcorlu's full-sized avatar

Murat Çorlu muratcorlu

View GitHub Profile
@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 / 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 / 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 / install.sh
Last active April 14, 2016 09:47
Prerender Installation to Debian with Nginx Proxy and Caching
# 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 / detay.html
Created October 24, 2015 18:29
Synaps Seçim sistemi embed kodları
<div synaps-secim></div>
{
init: function(elevators, floors) {
var upWaiters = {},
downWaiters = {},
idleElevators = [],
floorCount = floors.length,
arrayUnique = function(a) {
return a.reduce(function(p, c) {
if (p.indexOf(c) < 0) p.push(c);
return p;
@muratcorlu
muratcorlu / restview.py
Created December 24, 2014 00:38
Simple Django RestView view class
from django.http import HttpResponse, JsonResponse, HttpResponseForbidden, HttpResponseNotAllowed, HttpResponseNotFound
from django.forms.models import model_to_dict
from django.db.models import Model
from django.db.models.query import QuerySet
from functools import wraps
from django.utils.decorators import available_attrs
from django.core import serializers
class PermissionError(Exception):
pass
@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',)