Skip to content

Instantly share code, notes, and snippets.

View Spartan322's full-sized avatar

George L. Albany Spartan322

View GitHub Profile
@jonathanhefner
jonathanhefner / gist:3229878
Created August 1, 2012 19:13
CSS-only technique to remove whitespace from between inline-block elements
<!--
Here is a CSS-only technique to remove whitespace from between inline-block
elements. Note that any text nodes that are direct children of the
containing-element will need their font-size manually readjusted.
-->
<style type="text/css">
.big-text {
font-size: 48px;
}
@egel
egel / auto-remove-sublime-license-popup
Last active April 8, 2024 23:00
Auto-remove Sublime's license popup
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime_plugin
import subprocess
from time import sleep
import sys
cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
log = lambda message: sys.stderr.write("Log: %s\n" % message)
@vermorel
vermorel / Half.cs
Last active November 26, 2023 22:43
C# Half-precision data type
/// ================ Half.cs ====================
/// The code is free to use for any reason without any restrictions.
/// Ladislav Lang (2009), Joannes Vermorel (2017)
using System;
using System.Diagnostics;
using System.Globalization;
namespace SystemHalf
{
Get TagTool from https://ci.appveyor.com/project/Beatthezombie/tagtool/builds/32275655/job/0nyje3212u82w3li/artifacts
Source is at https://github.com/TheGuardians/TagTool.
Extract the archive into the game's maps folder, then open TagTool.exe.
Current capabilities (TLDR):
Create, duplicate, rename tags.
Edit tag fields and tagblocks.
Import custom texture, model, sound, simple collisions tags.
Port content from Halo 3 and ODST 360 .map files.
@NovemberDev
NovemberDev / godot_async_scene_loader.gd
Last active February 10, 2024 22:57
Asynchronously loads scenes in godot
# Loads a scene in the background using a seperate thread and a queue.
# Foreach new scene there will be an instance of ResourceInteractiveLoader
# that will raise an on_scene_loaded event once the scene has been loaded.
# Hooking the on_progress event will give you the current progress of any
# scene that is being processed in realtime. The loader also uses caching
# to avoid duplicate loading of scenes and it will prevent loading the
# same scene multiple times concurrently.
#
# Sample usage:
#
@MightyPrinny
MightyPrinny / ChooseWithProbabilities.cs
Created January 24, 2020 06:43
Chooses values from an array using a probabilities array
/// <summary>
///Returns a random object from the array with probabilities
///</summary>
/// <param name="prob">the probability of being chosen for each value in the array, their sum must be <= 1</param>
public static T ChooseWithProbabilities<T>(float[] prob,params T[] array)
{
float rn = RNG.Randf();
int len = array.Length;
float[][] intervals = new float[len][];
if (len != prob.Length || len == 0)
@aaronfranke
aaronfranke / convert-to-godot4.sh
Last active April 2, 2024 16:20
This script bulk-renames many things in Godot 3 projects to hopefully make it easier to convert them to Godot 4.
#!/usr/bin/env bash
# This script bulk-renames many things in Godot 3 projects to hopefully
# make it easier to convert them to Godot 4. The goal is to do as much
# replacing as possible here so that the diffs Godot produces are smaller.
set -uo pipefail
IFS=$'\n\t'
# Loops through all text files tracked by Git.
@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!