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-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 / 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-checkbox-all.js
Created Feb 19, 2014
A checkbox directive that selects/deselects all records that given for AngularJS
View ng-checkbox-all.js
/**
* @ngdoc directive
* @name safe.directive:checkboxAll
*
* @element input
*
* @description
*
* Bir listedeki tüm elemanları seçen bir checkbox kutusu yapmak için pratik bir directive.
*
@muratcorlu
muratcorlu / ng-incomplete-confirmation.js
Created Feb 19, 2014
Sayfada yarım kalmış bir form varken sayfadan çıkılmak istendiğinde uyarı vermeye yarayan AngularJS directive'i
View ng-incomplete-confirmation.js
/**
* @ngdoc directive
* @name safe.directive:incomplete-confirmation
*
* @element ANY
*
* @description
*
* `name` attribute'u olan bütün form elementlerinde çalışarak
* üzerinde değişiklik yapılmış ancak kaydedilmemiş bir form olduğunda
@muratcorlu
muratcorlu / similarity_score.py
Created Apr 6, 2014
Get similarity score of two words with python
View similarity_score.py
def get_score(word1, word2):
shared_chars = [char for char in word1.lower() if char in word2.lower()]
return len(shared_chars)
# Usage
get_score('murat', 'burak')
# > 3
@muratcorlu
muratcorlu / restview.py
Created Dec 24, 2014
Simple Django RestView view class
View restview.py
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
View elevatorsaga.js
{
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 / tabmenu.css
Created Sep 29, 2010
A simple tabmenu implementation with jQuery
View tabmenu.css
div.tabcontent {
display:none;
}
div.active {
display:block;
}
View jsonencode.php
<!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 Oct 10, 2010
Simple timer with javascript
View simpletimer.js
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:
You can’t perform that action at this time.