Skip to content

Instantly share code, notes, and snippets.

View qapquiz's full-sized avatar
😀

armariya qapquiz

😀
View GitHub Profile
@qapquiz
qapquiz / ask.sh
Created April 1, 2023 12:06
ask.sh (ask ChatGPT in command line)
#!/bin/bash
function ask_gpt() {
PROMPT=$(gum input --width 80 --placeholder "prompt")
if [[ -z "$PROMPT" ]]; then
exit 0
fi
gum style --foreground 212 "> $PROMPT"
@qapquiz
qapquiz / pre-commit
Created January 28, 2020 12:18
Unity Git Hooks -> There are three files
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
ASSETS_DIR="$(git config --get unity3d.assets-dir || echo "Assets")"
@qapquiz
qapquiz / post-merge
Created January 28, 2020 12:18
Unity Git Hooks -> There are three files
#!/bin/sh
ASSETS_DIR="$(git config --get unity3d.assets-dir || echo "Assets")"
# Remove empty assets directory
find "$ASSETS_DIR" -depth -type d -empty -delete
@qapquiz
qapquiz / post-checkout
Created January 28, 2020 12:17
Unity Git Hooks -> There are three files
#!/bin/sh
ASSETS_DIR="$(git config --get unity3d.assets-dir || echo "Assets")"
# Remove empty assets directory
find "$ASSETS_DIR" -depth -type d -empty -delete
using System;
public static class Category {
public static T Identity<T>(T obj) {
return obj;
}
public static Func<T1, TFinal> Compose<T1, TResult, TFinal>(Func<TResult, TFinal> f, Func<T1, TResult> g) {
return (T1 t) => {
return f(g(t));
@qapquiz
qapquiz / GameDebug.cs
Last active May 28, 2019 10:04
use for assert some data and print log in Unity3d (extract from FPSSample)
using System;
public class ApplicationException : Exception {
public ApplicationException(string message) : base(message) { }
}
public static class GameDebug {
public static void Assert(bool condition) {
if (!condition)
throw new ApplicationException("GAME ASSERT FAILED");
@qapquiz
qapquiz / CoroutineHandler.cs
Created April 7, 2019 09:10
This class allows us to start Coroutines from non-Monobehaviour scripts
using UnityEngine;
using System.Collections;
/// <summary>
/// This class allows us to start Coroutines from non-Monobehaviour scripts
/// Create a GameObject it will use to launch the coroutine on
/// </summary>
public class CoroutineHandler : MonoBehaviour
{
static protected CoroutineHandler m_Instance;
@qapquiz
qapquiz / .gitmessage
Created March 28, 2019 07:16
This is git template for conventional commit style
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
#
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
#
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
@qapquiz
qapquiz / commit-msg
Last active March 27, 2019 11:14
commit-msg git hook that will use commitlint to enforce commit message to use conventional commit style
#!/bin/sh
temp_file_that_contain_commit_message=$1
commit_message=$(cat "$temp_file_that_contain_commit_message")
echo "$commit_message" | commitlint
commitlint_status=$?
if [ $commitlint_status -ne 0 ] ; then
echo "commit message should be in angular format"