Skip to content

Instantly share code, notes, and snippets.

S. Tarık Çetin starikcetin

View GitHub Profile
@luke161
luke161 / AddressablesSceneLoader.cs
Last active May 8, 2025 06:49
Handles loading and unloading of Scenes using Unity's Addressable Assets system. Adds support for using LoadSceneParameters when loading a scene, which is currently missing in the official APIs.
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using System.Collections;
using System.Collections.Generic;
@lxlgarnett
lxlgarnett / take-screenrecord.sh
Created September 7, 2020 12:24
Records screen record of Android device by using adb command.
#!/bin/bash
date_string=`date +%F-%s`
# Creates Screenrecords directory if not exist.
mkdir -p Screenrecords
function finish() {
adb shell pkill -SIGINT screenrecord
adb pull /sdcard/screenrecord_"$date_string".mp4 ./Screenrecords/
adb shell rm /sdcard/screenrecord_"$date_string".mp4
@BrianOstrander
BrianOstrander / GetRekt.md
Last active March 27, 2025 23:23
How to lose your mind with the clashing design choices of C# 6.0 and Newtonsoft's deserialization

{ get; } = rekt

How to lose your mind with the clashing design choices of C# 6.0 and Newtonsoft's deserialization

Recently, I upgraded a personal Unity3D project to enjoy all the wonderful new C# features that have come out, such as the get only auto property. It looks like this:

public string SomeProperty { get; }

On first glance, it works a lot like C#'s readonly field, with the ability to set a default value, or set its value in a constructor.

public string SomeProperty { get; } = "a default value";

@ppoffice
ppoffice / README.md
Last active May 21, 2025 08:38
Install Visual Studio Code (actually code-server) on Android
  1. Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.

  2. Update system packages in Termux:

    $ pkg update -y
@bartvanandel
bartvanandel / yarn-sync.js
Last active November 24, 2024 20:48
Sync versions from yarn.lock back into package.json
const fs = require("fs");
/**
* Removes matching outer quotes from a string.
*
* @param {string} text - String to unquote
* @returns {string} - Unquoted string
*/
const unquote = text => /(["'])?(.*)\1/.exec(text)[2];
@liortal53
liortal53 / EmbedPackage.cs
Created October 25, 2019 07:19
Embed package into your Unity project to modify the code more easily :)
using System.IO;
using UnityEditor.PackageManager;
using UnityEngine;
namespace UnityEditor.Extensions
{
#if UNITY_2017_3_OR_NEWER
/// <summary>
/// Editor extension for embedding packages as a local copy in the project.
@FlaShG
FlaShG / GizmosColor.cs
Last active August 19, 2021 18:52
Temprarily set a color to be used for Gizmos and Handles.
using UnityEngine;
using System;
/// <summary>
/// Temporarily set a color to be used for Gizmos.
/// <example>
/// <code>
/// using (new GizmosColor(Color.red))
/// {
@palozano
palozano / rsync_usage.md
Last active June 13, 2023 15:50
Rsync usage

Notes on using rsync

First, install it, using apt, yum, pacman, etc.

Local usage

Imagine we want to back up files from Directory1 to Directory2, and both are on the same hard drive (this would work the same if the directories are on two different drives). There are several different ways to do this, depending on what kind of backups (i.e., options you want to give rsync) you want to configure. The most general, will be this:

$ rsync -av --delete /Directory1/ /Directory2/
@WrathChaos
WrathChaos / git-alias.md
Last active May 13, 2021 15:39
MacOS .zshrc Aliases

Git Aliases

alias status="artii 'Status' | nyan && git status | nyan"
alias add="git add . | artii "Staged" | nyan"
alias glocal="git checkout local | artii 'Local Branch' | nyan"
alias dev="git checkout dev | artii 'Dev Branch' | nyan"
alias master="git checkout master | artii 'Master Branch' | nyan"
alias log="artii 'Logs' | nyan  && git log | nyan"
alias branch="artii 'Branches' | nyan &amp;&amp; git branch | nyan"
@balbuf
balbuf / supports.scss
Created February 6, 2019 19:16
"supports" SASS mixin that provides minimal DRY benefits
@mixin supports($property-dec) {
// find position of colon in property declaration
$colon: str-index($property-dec, ':');
// extract the property
$property: str-slice($property-dec, 1, $colon - 1);
// extract the value
$value: str-slice($property-dec, $colon + 1);
// trim leading spaces
@while (str-slice($value, 1, 1) == ' ') {
$value: str-slice($value, 2);