Skip to content

Instantly share code, notes, and snippets.

@farukcan
farukcan / AdvancedTag.cs
Created January 14, 2022 20:05
Advanced Multiple Tagging instead of Unity's
// Author : github.com/farukcan
// Usage : AdvancedTag.GetTagList("Player")
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdvancedTag : MonoBehaviour
{
private static Dictionary<string, List<GameObject>> dictionary = new Dictionary<string, List<GameObject>>();
@farukcan
farukcan / AxisExtension.cs
Created January 14, 2022 20:13
Axis Extension For Unity Engine To Handle Axises Quickly
// Author: github.com/farukcan
// Usage:
// Get vector - AxisExtension.GetVector(Axis.LEFT)
// Get direction vector relative to the object - AxisExtension.GetVector(transform,Axis.LEFT)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class AxisExtension
@farukcan
farukcan / ChildSelector.cs
Created January 15, 2022 16:00
Unity GameObject Child Selector
// Author: github.com/farukcan
// Usage :
// selector.Select("Object 1");
// selector.SelectRandom();
// selector.OpenSelfAndSelect("Object 1");
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@farukcan
farukcan / NextBackList.cs
Created January 15, 2022 16:07
Unity Code for enable next one of child of the game object
// Author: github.com/farukcan
// Depends to Child Selector : https://gist.github.com/farukcan/cb7865963f59d4e3e6451a11dfcc0f3a
// Usage :
// list.Next()
// list.Back();
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@farukcan
farukcan / ChildSelectorSync.cs
Created January 16, 2022 20:01
Unity, Sync children of two objects with same name
// Author: github.com/farukcan
// Usage :
// Add 'Child Selector' to objects these you want to sync
// childSelectorSync.Sync();
// This command will sync children of two objects with same name
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@farukcan
farukcan / Delay.cs
Created January 16, 2022 20:09
Delay UnityEvent : Delayed Execution Of UnityEvents
// Author: github.com/farukcan
// Requires: RunB83 - https://github.com/farukcan/unity-utilities
// delay.Invoke(1f);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class Delay : MonoBehaviour
@farukcan
farukcan / Explosion.cs
Created January 17, 2022 21:06
Unity Physical Explosion Script
// Author : github.com/farukcan
// Usage :
// explosion.Explode();
// or enable explodeOnStart before instantiation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Explosion : MonoBehaviour
@farukcan
farukcan / command.sh
Created January 24, 2022 12:32
Clean up docker disk space
# WARNING! This will remove:
# - all stopped containers
# - all networks not used by at least one container
# - all images without at least one container associated to them
# - all build cache
docker system prune -a
@farukcan
farukcan / Pool.cs
Created January 26, 2022 11:14
Object Pooling Optimization System For Unity3D
// Author : github.com/farukcan
// Pooling Optimization System For Unity3D
// Requires: OdinInspector (But you can remove odin codes if you don't use it)
// Usage : Pool.GetPool("poolName");
// Usage : Pool.GetPool("poolName").GetPoolObject();
// Note: You can also use it in editor edit mode
// Spec: use expandable=true for increase amount of objects
// when there is no enought object in pool
// Spec: Pooled Objects are defaulty not active (Check: defaultActive)
@farukcan
farukcan / counts.sql
Created January 28, 2022 22:59
Daily, Weekly, Total Row Count in Multiple Columns
SELECT
SUM(CASE WHEN KY='daily' THEN COUNT ELSE 0 END) "daily",
SUM(CASE WHEN KY='weekly' THEN count ELSE 0 END) "weekly",
SUM(CASE WHEN KY='total' THEN count ELSE 0 END) "total"
FROM
(
SELECT 'daily' AS KY ,COUNT(*) FROM PUBLIC."Articles" WHERE "Articles"."createdAt" >= NOW() - '1 day'::INTERVAL
UNION
SELECT 'weekly' AS KY ,COUNT(*) FROM PUBLIC."Articles" WHERE "Articles"."createdAt" >= NOW() - '1 week'::INTERVAL
UNION