Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
Hard working

Özer ozergul

🙃
Hard working
View GitHub Profile
@ozergul
ozergul / util.cr
Last active May 19, 2018
Seo friendly url for Turkish chars. Crystal/ruby
View util.cr
def to_param(title)
original = ["ş","Ş","ı","I","İ","ğ","Ğ","ü","Ü","ö","Ö","Ç","ç","(",")","/",":",","]
replacements = ["s","s","i","i","i","g","g","u","u","o","o","c","c","","","-","-",""]
new_text = title.downcase.tr(original.join, replacements.join)
new_text = new_text.downcase.gsub(/[^a-zA-Z0-9]+/, "-").gsub(/-{2,}/, "-")
if new_text[new_text.size - 1].to_s == "-"
new_text = new_text.chomp("-")
end
@ozergul
ozergul / human.cr
Created May 19, 2018
Human time for Crystal
View human.cr
def human_time(time)
time = time.gsub("T", " ")
time = Time.parse(time, "%F %T", Time::Kind::Utc)
now = Time.utc_now
diff = (now - time)
if diff < 5.minutes
"just now"
elsif diff < 1.hour
@ozergul
ozergul / Dragger.cs
Created Apr 19, 2020
Unity 2D Dragger Script
View Dragger.cs
using System;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class Dragger : MonoBehaviour, IDragHandler
{
public GameObject target;
public bool dragable = true;
View gist:7672b55cb7dade725bc404a915635528
[
{
"code": "TR",
"icaoCode": "TUR",
"name": "Turkish Republic",
"phoneCode": "90",
"schengen": false
},
{
"code": "CP",
@ozergul
ozergul / EventManager.cs
Last active Apr 24, 2021
Unity3d Event Manager
View EventManager.cs
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
public class EventManager : MonoBehaviour
{
private Dictionary<string, Action<EventParam>> eventDictionary;