Skip to content

Instantly share code, notes, and snippets.

View Calinou's full-sized avatar
🦄
______ is best pony.​

Hugo Locurcio Calinou

🦄
______ is best pony.​
View GitHub Profile
@jshorty
jshorty / snapshot_sprite.gd
Created April 5, 2020 08:29
Sprite that "snapshots" a Polygon2D for rendering performance
extends Sprite
# This dictates the size of the viewport used for the "snapshot".
export var source_image_size : Vector2
export var polygon : PoolVector2Array
func _ready():
var viewport_container = ViewportContainer.new()
viewport_container.set_size(source_image_size)
add_child(viewport_container)
@Calinou
Calinou / clang-format.sh
Created March 3, 2020 14:50
Portable shell script to format all files in a folder recursively using clang-format
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
find . \( -name '*.cpp' -o -name '*.hpp' -o -name '*.c' -o -name '*.h' \) \
-exec clang-format -i {} \;
@Calinou
Calinou / fade-to-black.sh
Created January 11, 2020 17:13
Generate a set of PNG frames that fade towards black
#!/bin/bash
START=599
for i in {600..700}; do
brightness="$((700-i))"
convert "$START.png" -modulate "$brightness%" "$i.png" &
done
@HungryProton
HungryProton / shader_cache.gd
Last active February 18, 2025 15:25
Godot shader cache hack
extends Spatial
var _materials := []
var _process_materials := []
var _count := 0
func _ready() -> void:
_find_all_materials("res://")
print(_process_materials)
@cart
cart / FXAA.tscn
Last active January 17, 2025 15:11
Godot Nvidia FXAA 3.11 Port
[gd_scene load_steps=3 format=2]
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
// Godot Nvidia FXAA 3.11 Port
// Usage: Drop this in to any 3D scene for FXAA! This is a port of the \"PC High Quality Preset 39\". However the medium quality
// parameters are also included. For medium quality, just comment out sections \"PS 6\" and above and uncomment the \"med 13\" variables.
@Calinou
Calinou / godot-init
Last active June 2, 2023 15:53
Scripts to initialize and edit a Godot project for quick testing
#!/bin/bash
#
# For Linux and macOS.
# The Godot editor must be in your `PATH` as `godot` for this script to work.
# Licensed under CC0 1.0 Universal.
set -euo pipefail
IFS=$'\n\t'
if [[ ! "${1:-}" || "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
@clayjohn
clayjohn / cube-to-panorama.glsl
Created April 9, 2019 02:13
Convert cubemap to panorama in Godot
shader_type canvas_item;
uniform sampler2D front;
uniform sampler2D left;
uniform sampler2D right;
uniform sampler2D back;
uniform sampler2D top;
uniform sampler2D bottom;
void fragment() {
@Calinou
Calinou / update-godot-3.x.sh
Last active November 11, 2023 18:52
Update, build and install Godot from source on Linux
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
SCONS_FLAGS=(
"lto=full"
"progress=no"
"debug_symbols=no"
)
@jakub-g
jakub-g / async-defer-module.md
Last active March 24, 2025 07:50
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@Calinou
Calinou / kanboard-dark.css
Last active November 5, 2021 12:46
Dark theme for Kanboard (WIP)
/* ==UserStyle==
@name Kanboard Dark
@namespace github.com/openstyles/stylus
@version 0.0.1
@license MIT
@description Dark theme for Kanboard
@author Calinou
==/UserStyle== */
:root {