Skip to content

Instantly share code, notes, and snippets.

View ozergul's full-sized avatar
🙃
Hard working

Özer ozergul

🙃
Hard working
View GitHub Profile
@ozergul
ozergul / EventManager.cs
Last active April 24, 2021 15:08
Unity3d Event Manager
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
public class EventManager : MonoBehaviour
{
private Dictionary<string, Action<EventParam>> eventDictionary;
@ozergul
ozergul / gist:7672b55cb7dade725bc404a915635528
Created October 4, 2020 08:01
countries and phone codes
[
{
"code": "TR",
"icaoCode": "TUR",
"name": "Turkish Republic",
"phoneCode": "90",
"schengen": false
},
{
"code": "CP",
@ozergul
ozergul / Dragger.cs
Created April 19, 2020 18:38
Unity 2D Dragger Script
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;
@ozergul
ozergul / human.cr
Created May 19, 2018 15:01
Human time for Crystal
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 / util.cr
Last active May 19, 2018 10:08
Seo friendly url for Turkish chars. Crystal/ruby
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