Skip to content

Instantly share code, notes, and snippets.

View Fishrock123's full-sized avatar
💭
#freepalestine #blacklivesmatter #acab drop ICE you cowards

Jeremiah Senkpiel Fishrock123

💭
#freepalestine #blacklivesmatter #acab drop ICE you cowards
View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / NetworkingTools.cs
Last active April 28, 2023 09:49
Since Unity 2018.3 we've had this cool new tool called [SettingsProvider] that we can use to add custom settings menu into Unitys settings screens. This short example shows how i use [SettingsProvider] and some [MenuItems] to help build and run test clients when im developing a multiplayer game. My usecase is that i want a quick way to build and…
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;
using Debug = UnityEngine.Debug;
public static class NetworkingTools
{
@krismuniz
krismuniz / 0.md
Last active September 1, 2021 23:10
How to add back-access syntax to JS Arrays and strings

This allows you to use back-access syntax to access items in an array or characters in a string.

In practical terms, it adds the negative integer in arr[-1] to the length of the array/string and tries to search for that property inside the object.

Examples

const arr = backAccess(['first', 'second', 'last'])
arr[-1] // => "last"
arr[-2] // => "second"
@lmammino
lmammino / README.md
Last active May 7, 2019 16:40
Compile and run rust programs

Allows to compile and run a Rust program under unix systems:

./rrun <rust_file_name> <runtime_arguments>

For instance:

./rrun args 1 2 3 4 5
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@LotteMakesStuff
LotteMakesStuff / AutohookAttribute.cs
Last active January 2, 2024 13:54
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
// NOTE DONT put in an editor folder!
using UnityEngine;
public class AutohookAttribute : PropertyAttribute
{
}
@getify
getify / 1.js
Created February 14, 2019 20:55
thenify()... turn an err-first callback into two functions that can suitably be passed to a promise.then(..) and/or .catch(..)
function somethingThatReturnsAPromise(x,y,z) { .. }
function myCallback(err,v) {
if (err) {
console.error(err);
}
else {
console.log(v);
}
}
@adamski11
adamski11 / FillBarGradientScript.cs
Last active July 3, 2020 11:12
Add this script to any game object with an image component you're using as a fill bar colour the bar based on the current fill amount and a gradient set by you. Works in the editor for testing as well.
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
[ExecuteInEditMode]
public class FillBarGradientScript : MonoBehaviour
{
public Gradient gradient;
Image fillImage;
@phosphoer
phosphoer / TexturePackDefinition.cs
Last active June 21, 2020 08:58
TexturePackDefinition.cs
// The MIT License (MIT)
// Copyright (c) 2019 David Evans @phosphoer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@rstecca
rstecca / DebugTriangleNormals.cs
Last active May 4, 2021 09:28
Unity Debug Mesh Normals in Editor
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class DebugTriangleNormals : MonoBehaviour {
#if UNITY_EDITOR
List<Vector3> trisCenters;
@LotteMakesStuff
LotteMakesStuff / PlayerLoop.cs
Last active March 25, 2024 02:38
Player Loop Visualizer: Built to explore the new PlayerLoopSystem api in Unity 2018.1b2. This tool shows you all the PlayerLoop systems that unity uses to update a frame, and demos how to add your own and even remove systems from the player loop. For more info see the patreon post https://www.patreon.com/posts/unity-2018-1-16336053
// Put this in an editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.LowLevel;
using UnityEngine.Profiling;