Skip to content

Instantly share code, notes, and snippets.

Avatar

Kerem Güneş k-gun

  • Istanbul, Turkey
View GitHub Profile
View fn_slug.py
def fn_slug(words):
import re
#global words
chrs = {'ı':'i', 'ö':'o', 'ü':'u', 'ç':'c', 'ğ':'g', 'ş':'s',
'İ':'I', 'Ö':'O', 'Ü':'U', 'Ç':'C', 'Ğ':'G', 'Ş':'S'}
def lower(word):
return word.replace('İ', 'i').replace('I', 'ı').lower()
@k-gun
k-gun / Preferences.sublime-settings
Last active Nov 2, 2019
Preferences.sublime-settings
View Preferences.sublime-settings
{
"added_words":
[
"uber",
"versioning"
],
"always_show_minimap_viewport": true,
"color_scheme": "Packages/Inspired GitHub Color Scheme/InspiredGitHub_2.tmTheme",
"default_line_ending": "unix",
"detect_indentation": false,
@k-gun
k-gun / Default (Linux).sublime-keymap
Last active Mar 11, 2020
Default (Linux).sublime-keymap
View Default (Linux).sublime-keymap
[
{ "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+shift+e"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["ctrl+shift+o"], "command": "prompt_open_folder" },
{ "keys": ["ctrl+shift+h"], "command": "goto_documentation" },
// { "keys": ["ctrl+1"], "command": "fold_all" },
@k-gun
k-gun / Default (Linux).sublime-mousemap
Last active Nov 2, 2019
Default (Linux).sublime-mousemap
View Default (Linux).sublime-mousemap
[
// Change font size with ctrl+scroll wheel
{ "button": "scroll_down", "modifiers": ["ctrl"], "command": "null" },
{ "button": "scroll_up", "modifiers": ["ctrl"], "command": "null" }
]
@k-gun
k-gun / copy_function.php
Last active Jan 20, 2019
PHP: copy_function()
View copy_function.php
<?php
function copy_function($name) {
$reflection = new ReflectionFunction($name);
return function(...$arguments) use($reflection) {
return call_user_func_array([$reflection, 'invoke'], $arguments);
};
}
$fn = copy_function('is_int');
@k-gun
k-gun / Number.prototype.toNumberFormat.js
Created Oct 8, 2017
PHP's number_format() implementation with JavaScript.
View Number.prototype.toNumberFormat.js
/**
* To number format.
* @param {Integer} decimals?
* @param {String} decimalsSeparator?
* @param {String} thousandsSeparator?
* @return {String}
* @links http://php.net/number_format, https://stackoverflow.com/q/2901102
*/
Number.prototype.toNumberFormat = function(decimals, decimalsSeparator, thousandsSeparator) {
decimalsSeparator = decimalsSeparator || '.';
@k-gun
k-gun / Element.prototype.classList.js
Last active Apr 12, 2019
Polyfill: Element.prototype.classList for IE8/9, Safari.
View Element.prototype.classList.js
/**
* Element.prototype.classList for IE8/9, Safari.
* @author Kerem Güneş <k-gun@mail.com>
* @copyright Released under the MIT License <https://opensource.org/licenses/MIT>
* @version 1.2
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
*/
;(function() {
// Helpers.
var trim = function(s) {
@k-gun
k-gun / date_time_stuff.php
Last active Mar 7, 2016
Date time stuff.
View date_time_stuff.php
<?php
function time_zone_offset_to_identifier(string $offset, int $offsetIndex = 0) {
static $timeZoneOffsets = [];
if (empty($timeZoneOffsets)) {
foreach(timezone_identifiers_list() as $timeZoneIdentifier) {
$dateTimeZone = new DateTimeZone($timeZoneIdentifier);
$dateTime = new DateTime('NOW', $dateTimeZone);
$timeZoneOffsets[$dateTimeZone->getOffset($dateTime)][] = $timeZoneIdentifier;
}
}
View InspiredGitHub.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
Inspired GitHub Color Scheme for Sublime Text 3
Copyright 2015 Seth Lopez
Released under the MIT License <http://opensource.org/licenses/MIT>
https://github.com/sethlopezme/InspiredGitHub.tmtheme
-->
<plist version="1.0">
<dict>
View InspiredGitHub_2.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
Inspired GitHub Color Scheme for Sublime Text 3
Copyright 2015 Seth Lopez
Released under the MIT License <http://opensource.org/licenses/MIT>
https://github.com/sethlopezme/InspiredGitHub.tmtheme
-->
<!--
ed6a43 > this
You can’t perform that action at this time.