Skip to content

Instantly share code, notes, and snippets.

@th3d0g
th3d0g / comment-example.js
Created April 21, 2022 10:49 — forked from brandongoode/comment-example.js
Dynamoose range and hash key example
var commentSchema = new Schema({
postId: {
type: String,
hashKey: true
},
id: {
type: String,
rangeKey: true,
default: shortId.generate
@th3d0g
th3d0g / GenerateEnum.cs
Created January 27, 2022 17:06
Generate enum from editor
#if UNITY_EDITOR
using UnityEditor;
using System.IO;
public class GenerateEnum
{
[MenuItem( "Tools/GenerateEnum" )]
public static void Go()
{
string enumName = "MyEnum";
@th3d0g
th3d0g / FileWatcher.cs
Created October 21, 2021 21:32 — forked from elringus/FileWatcher.cs
Allows executing an editor behaviour in response to file modificatons, even when editor application is not in focus.
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
/// <summary>
/// Uses file system watcher to track changes to specific files in the project directory.
@th3d0g
th3d0g / BuildDisplayer.cs
Created October 11, 2021 20:57 — forked from llamacademy/BuildDisplayer.cs
Build Incrementor Scripts from https://www.youtube.com/watch?v=PbFE0m9UMtE. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TextMeshProUGUI))]
public class BuildDisplayer : MonoBehaviour
{
private TextMeshProUGUI Text;
private void Awake()
{
@th3d0g
th3d0g / Events.cs
Created August 12, 2021 20:19 — forked from wmiller/Events.cs
Unity3D Event System
using System.Collections;
using System.Collections.Generic;
public class GameEvent
{
}
public class Events
{
static Events instanceInternal = null;
@th3d0g
th3d0g / multiple_ssh_setting.md
Created April 1, 2019 11:42 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@th3d0g
th3d0g / awr_api.php
Created February 16, 2019 10:21
AWR API PHP
<?php
// AWR Functions //////////////
function awr_get( $action, $params = [] ){
$token = env('AWR_KEY');
$awr_url = env('AWR_URL');
$paramsString = "";
if( count($params) > 0 ){
@th3d0g
th3d0g / RoundToHalf.js
Created January 22, 2019 00:20
Created with Copy to Gist
function roundToHalf(value) {
   var converted = parseFloat(value); // Make sure we have a number
   var decimal = (converted - parseInt(converted, 10));
   decimal = Math.round(decimal * 10);
   if (decimal == 5) { return (parseInt(converted, 10)+0.5); }
   if ( (decimal < 3) || (decimal > 7) ) {
      return Math.round(converted);
   } else {
      return (parseInt(converted, 10)+0.5);
   }
@th3d0g
th3d0g / typescript_enum_flag.ts
Last active November 18, 2018 12:37
Example of using Enum Flags in TypeScript.
// They're a way to efficiently store and represent a collection of boolean values. -->
//For example, taking this flags enum:
enum Traits {
None = 0,
Friendly = 1 << 0, // 0001 -- the bitshift is unnecessary, but done for consistency
Mean = 1 << 1, // 0010
Funny = 1 << 2, // 0100
Boring = 1 << 3, // 1000
@th3d0g
th3d0g / gist:8067fb45ec6429dd92c554274f4670b2
Created March 6, 2018 01:14 — forked from snowman-repos/gist:3825198
JavaScript: Detect Orientation Change on Mobile Devices
// Listen for orientation changes
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
alert(window.orientation);
}, false);
// Listen for resize changes
window.addEventListener("resize", function() {
// Get screen size (inner/outerWidth, inner/outerHeight)