Skip to content

Instantly share code, notes, and snippets.

View CSaratakij's full-sized avatar
🎯
Focusing

Chatchai Saratakij CSaratakij

🎯
Focusing
View GitHub Profile
using UnityEngine;
public class Example : MonoBehavoiur
{
[SerializeField]
GameObject prefab;
bool isTrigger = false;
void OnTriggerEnter(Collider col)
@CSaratakij
CSaratakij / utils.cs
Created February 27, 2020 10:47
Shuffle sample (Generic)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Utils : MonoBehaviour
{
int[] numbers = new int[] {
1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0
};
@CSaratakij
CSaratakij / TriggerContainerEditor.cs
Last active May 18, 2019 09:21 — forked from bzgeb/TriggerContainerEditor.cs
Example Drag & Drop area in a custom inspector for the Unity editor
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor (typeof(TriggerContainer))]
public class TriggerContainerEditor : Editor
{
private SerializedObject obj;
@CSaratakij
CSaratakij / health.gd
Last active April 15, 2019 21:50
GDScript - Health script with no if-else statement (man...I should have used clamp method for a long long time..^^)
extends Node
const MIN_HEALTH = 0
const MAX_HEALTH = 100
export var current_health = MAX_HEALTH
func _ready():
current_health = clamp(current_health, MIN_HEALTH, MAX_HEALTH)
@CSaratakij
CSaratakij / PDF_To_JPG
Last active April 10, 2019 05:36
Nautilus convert .pdf to .jpg script intregation (multiple select files support)
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
COUNTER=0
echo -e "Start converting files..."
notify-send "Start converting files..."
for path in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
@CSaratakij
CSaratakij / reverse_array.py
Created November 14, 2018 09:14
Reverse array
def main():
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print("Before reverse : ")
print(numbers)
numbers = reverse_array(numbers)
print("")
import random
def main():
random.seed()
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print("Before shuffle : " + str(numbers))
numbers = shuffle(numbers)
print("After shuffle : " + str(numbers))
@CSaratakij
CSaratakij / CustomCollision.cs
Created September 26, 2018 14:49
Custom Collision
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class CustomCollision : MonoBehaviour
@CSaratakij
CSaratakij / work.cpp
Last active July 25, 2018 09:31
Result
#include <iostream>
#include <string>
#include <vector>
#include <stdbool.h>
struct OrderInfo
{
int price = 0;
std::string customerName;
@CSaratakij
CSaratakij / .fdirrc
Created July 15, 2018 18:48
Fdir junk keys.
alias fd-WWW="cd /home/csaratakij/TTT"
alias fd-git="cd /home/csaratakij/@GitRepository"
alias fd-fdir="cd /home/csaratakij/@GitRepository/FDir"
alias fd-music="cd /home/csaratakij/Music"
alias fd-download="cd /home/csaratakij/Downloads"
alias fd-video="cd /home/csaratakij/Videos"
alias fd-tools="cd /home/csaratakij/Tools"
alias fd-prototypeA="cd /home/csaratakij/@GitRepository/PrototypeA"
alias fd-picture="cd /home/csaratakij/Pictures"
alias fd-godot-custom="cd /home/csaratakij/Tools/Utils/Godot/Custom"