Skip to content

Instantly share code, notes, and snippets.

View afk-mario's full-sized avatar
🥔

afk afk-mario

🥔
View GitHub Profile
@afk-mario
afk-mario / sfx-event.gd
Last active March 17, 2023 02:13
SFX Manager
tool
extends Resource
class_name SfxEvent, "res://ui/editor_icons/sfx.svg"
const PROPERTY_HINT_TYPE_STRING := PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS + 2
enum SEQUENCE_TYPE { RANDOM, LOOP, HOLD }
enum SEQUENCE_RESET { TIME, NEVER }
@afk-mario
afk-mario / level-post-import-bake-wall-collision-polygon.gd
Created February 7, 2023 15:03
Godot 3.x Generate Collision Polygons from tilemap
# https://stackoverflow.com/questions/67412060/godot-engine-merging-more-than-two-polygons-using-geometrys-merge-polygons-2d
# https://github.com/a327ex/a327ex-template/blob/dd0a63aefbc3cae268d165deef8fdf931f776f55/engine/map/tilemap.lua
# https://github.com/a327ex/blog/issues/5
# https://godotengine.org/qa/30006/build-a-collision-polygon-from-tilemap-outline
tool
extends Node
var walls_layer := 2
func post_import(level: Node2D) -> Node2D:
// Proquints JS implementation without needing the DOM
// https://github.com/dsw/proquint
import crypto from "crypto";
export function genquint() {
const hex = `x${crypto.randomBytes(16).toString("hex")}`;
try {
const quint = hex2quint(hex);
return { hex, quint };
} catch (e) {
@afk-mario
afk-mario / import_set_material_specular.gd
Last active October 26, 2021 17:05
Custom script that modifies specular param on Godot imported 3D scenes.
tool
extends EditorScenePostImport
enum LogLevelEnum { QUIET, VERBOSE }
var log_level :int = LogLevelEnum.VERBOSE
export var specular := 0
func post_import(scene):
talk("Setting custom specular on Spatial Materials...")
iterate(scene)
return scene
@afk-mario
afk-mario / notion-utils.js
Last active May 24, 2021 15:44
Notion rich text block to markdown
const MY_HOST = 'myhost.com';
export function richTextToMarkdown(block) {
const { type } = block;
if (type !== 'rich_text') {
console.error(
new Error('Triying to convert non rich text block to markdown')
);
return null;
}
This file has been truncated, but you can view the full file.
-- Logs begin at Sat 2020-01-11 15:25:10 CST, end at Tue 2020-07-21 18:25:52 CDT. --
Jul 21 17:39:01 archlinux sway[1426]: 00:00:00.936 [sway/input/seat.c:930] Cannot load xcursor theme for output 'HDMI-A-2' with scale 1.000000
Jul 21 17:39:01 archlinux sway[1426]: 00:00:01.015 [sway/input/seat.c:930] Cannot load xcursor theme for output 'HDMI-A-2' with scale 1.000000
Jul 21 17:39:01 archlinux sway[1426]: 00:00:01.015 [sway/input/seat.c:930] Cannot load xcursor theme for output 'DVI-D-1' with scale 1.000000
Jul 21 17:39:01 archlinux sway[1511]: Got sleep lock: 11
Jul 21 17:39:02 archlinux sway[1509]: [2020-07-21 17:39:02.038] [info] Resources files: /home/afk/.config/waybar/config, /home/afk/.config/waybar/style.css
Jul 21 17:39:02 archlinux sway[1509]: [2020-07-21 17:39:02.622] [warning] For a functional tray you must have libappindicator-* installed and export XDG_CURRENT_DESKTOP=Unity
Jul 21 17:39:02 archlinux sway[1509]: [2020-07-21 17:39:02.628] [warning] module battery: Disabling module "battery", No ba
@afk-mario
afk-mario / firebase-upload.js
Created September 16, 2019 07:06
rc-upload & firebase
const customUpload = async ({ file, uploadTo, onProgress, onError, onSuccess }) => {
const storage = firebase.storage();
try {
const storageRef = await storage.ref();
const uploadFile = storageRef.child(`${uploadTo}/${file.name}`);
const uploadTask = uploadFile.put(file);
uploadTask.on(
"state_changed",
snapshot => {
@afk-mario
afk-mario / game.txt
Created August 15, 2019 05:47
flickgame
{"gameLink":"www.flickgame.org","canvasses":[[2586,"0",7,"1",151,"0",12,"1",146,"0",16,"1",142,"0",19,"1",140,"0",21,"1",139,"0",22,"1",137,"0",8,"1",5,"c",11,"1",136,"0",7,"1",7,"c",11,"1",134,"0",7,"1",8,"c",11,"1",134,"0",7,"1",8,"c",11,"1",133,"0",8,"1",9,"c",10,"1",133,"0",8,"1",9,"c",10,"1",132,"0",9,"1",10,"c",9,"1",132,"0",9,"1",10,"c",9,"1",132,"0",9,"1",10,"c",9,"1",132,"0",9,"1",11,"c",7,"1",133,"0",10,"1",10,"c",8,"1",132,"0",11,"1",10,"c",7,"1",132,"0",12,"1",9,"c",7,"1",133,"0",11,"1",9,"c",7,"1",133,"0",12,"1",8,"c",7,"1",134,"0",12,"1",7,"c",7,"1",134,"0",13,"1",5,"c",8,"1",135,"0",24,"1",137,"0",23,"1",139,"0",20,"1",9399,"0"],[1170,"0",11,"c",146,"0",25,"c",23,"0",11,"c",98,"0",35,"c",10,"0",20,"c",92,"0",72,"c",83,"0",80,"c",78,"0",84,"c",73,"0",88,"c",70,"0",91,"c",68,"0",92,"c",67,"0",95,"c",64,"0",98,"c",62,"0",100,"c",59,"0",103,"c",56,"0",105,"c",54,"0",107,"c",52,"0",109,"c",51,"0",110,"c",49,"0",112,"c",47,"0",114,"c",46,"0",114,"c",46,"0",115,"c",45,"0",116,"c",44,"0",62,"c",7,"d",4
@afk-mario
afk-mario / game.txt
Created August 15, 2019 05:47
flickgame
{"gameLink":"www.flickgame.org","canvasses":[[2586,"0",7,"1",151,"0",12,"1",146,"0",16,"1",142,"0",19,"1",140,"0",21,"1",139,"0",22,"1",137,"0",8,"1",5,"c",11,"1",136,"0",7,"1",7,"c",11,"1",134,"0",7,"1",8,"c",11,"1",134,"0",7,"1",8,"c",11,"1",133,"0",8,"1",9,"c",10,"1",133,"0",8,"1",9,"c",10,"1",132,"0",9,"1",10,"c",9,"1",132,"0",9,"1",10,"c",9,"1",132,"0",9,"1",10,"c",9,"1",132,"0",9,"1",11,"c",7,"1",133,"0",10,"1",10,"c",8,"1",132,"0",11,"1",10,"c",7,"1",132,"0",12,"1",9,"c",7,"1",133,"0",11,"1",9,"c",7,"1",133,"0",12,"1",8,"c",7,"1",134,"0",12,"1",7,"c",7,"1",134,"0",13,"1",5,"c",8,"1",135,"0",24,"1",137,"0",23,"1",139,"0",20,"1",9399,"0"],[1170,"0",11,"c",146,"0",25,"c",23,"0",11,"c",98,"0",35,"c",10,"0",20,"c",92,"0",72,"c",83,"0",80,"c",78,"0",84,"c",73,"0",88,"c",70,"0",91,"c",68,"0",92,"c",67,"0",95,"c",64,"0",98,"c",62,"0",100,"c",59,"0",103,"c",56,"0",105,"c",54,"0",107,"c",52,"0",109,"c",51,"0",110,"c",49,"0",112,"c",47,"0",114,"c",46,"0",114,"c",46,"0",115,"c",45,"0",116,"c",44,"0",62,"c",7,"d",4
@afk-mario
afk-mario / drag.js
Last active January 20, 2019 23:47
Drag And drop without target [es6]
// This snippet of code is based on
// https://www.kirupa.com/html5/drag.htm
// https://stackoverflow.com/questions/36098039/javascript-move-element-with-mousemove-event-60-fps-requestanimationframe
const GetClient = (e) => {
const { touches = [] } = e;
const [touch] = touches;
const client = touch || e;
return client;
};