Skip to content

Instantly share code, notes, and snippets.

@anthonyec
anthonyec / gamepad_debugger.gd
Last active April 11, 2024 13:44
Godot gamepad input visualisation for debugging (GDScript 2)
@tool
extends Control
@export var device: int = 0
func _process(delta: float) -> void:
queue_redraw()
func _draw() -> void:
# Set the size, the layout isn't dynamic and based on something I sketched!
local eb_move_adj = 1.1
local playerFilter = function(item, other)
if other.isCoin then return 'cross'
elseif other.isWall then return 'slide'
elseif other.isExit then return 'touch'
elseif other.iswater then return 'cross'
else return 'slide'
end -- else return nil
end
@ndevenish
ndevenish / rewrite_with_black.sh
Created March 19, 2019 12:07
Script to rebase pre-black branches onto post-black tree
#!/bin/bash
cat <<EOF
Rewriting current branch to master, by applying black.
This is only tested for simple, linear branches and results should
be checked thoroughly before abandoning the old history.
EOF
# Find out the combined base commit
@jayktaylor
jayktaylor / fandom.md
Last active March 18, 2023 14:48
Removing featured videos on FANDOM

Hiding the videos

Hiding with uBlock Origin

uBlock Origin, unlike AdBlock Plus and other alternatives, doesn't allow companies to pay to whitelist their ads, and it blocks trackers too. Using it will provide the best experience on Wikia, as the majority of ads and slowdowns will be eliminated.

To block videos using uBlock Origin:

  • Click the uBlock Origin icon in your browser
  • Then click 'Open dashboard' (the furthest icon on the right under the power icon)
  • Click 3rd party filters
  • Click the Update now button and then enable uBlock filters - Annoyances
@LotteMakesStuff
LotteMakesStuff / InspectorButtonsTest.cs
Last active November 2, 2023 21:03
Code running pack! two property drawing scripts that make it super easy to trigger code via buttons in the inspector, and get feedback! [TestButton] draws you little buttons that call a method on your MonoBehaviour, and [ProgressBar] give you a great way to show feedback from long running methods. These are *super* helpful for things like proced…
using UnityEngine;
using System.Collections;
public class InspectorButtonsTest : MonoBehaviour
{
[TestButton("Generate world", "DoProcGen", isActiveInEditor = false)]
[TestButton("Clear world", "ClearWorld", 2, isActiveInEditor = false)]
[ProgressBar(hideWhenZero = true, label = "procGenFeedback")]
public float procgenProgress = -1;
@cobbpg
cobbpg / Unity-hotswapping-notes.md
Last active February 17, 2024 19:04
Unity hotswapping notes

Unity hotswapping notes

Unity has built-in support for hotswapping, which is a huge productivity booster. This feature works not only with graphics assets like bitmaps and meshes, but also with code: if you edit the source and save it, the editor will save the state of the running game, compile and load the new code, then load the saved state and continue where it left off. Unfortunately, this feature is very easy to break, and most available 3rd party plugins have little regard for it.

It looks like there’s a lot of confusion about hotswapping in Unity, and many developers are not even aware of its existence – which is no wonder if their only experience is seeing lots of errors on the console when they forget to stop the game before recompiling... This document is an attempt to clear up some of this confusion.

Nota bene, I’m not a Unity developer, so everything below is based on blog posts and experimentation. Corrections are most welcome!

The basic flow of hotswapping

@TarasOsiris
TarasOsiris / FlowMap.shader
Last active April 20, 2023 07:36
Flow Map Shader for Unity3D. Used with Sprites.
Shader "Custom/Flow Map"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
// Flow
_FlowMap ("Flow Map", 2D) = "white" {}
_FlowSpeed ("Flow Speed", float) = 0.05
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
# This file provides a long_running decorator to indicate that a function needs a long amount of time to complete and
# the computer should not enter standby. This file currently only works on Windows and is a no-op on other platforms.
import ctypes
import platform
ES_CONTINUOUS = 0x80000000
ES_SYSTEM_REQUIRED = 0x00000001
@berkus
berkus / gist:8225683
Created January 2, 2014 20:01
Working with GitHub pull requests from git

From http://www.somethingorothersoft.com/2012/05/22/pulling-github-pull-requests-with-git/

Fetch all Pull Requests (even closed ones)

Just execute the following commands and you'll be able to fetch all pull requests by simply executing git fetch pr. Pull requests will be stored in a remote as individual remote branches. So a pull request 123 will be accessible as 'pr/123':

git remote add pr https://github.com/upstream/repo.git
git config --local --unset remote.pr.fetch
git config --local --add remote.pr.fetch "+refs/pull/*/head:refs/remotes/pr/*"