Skip to content

Instantly share code, notes, and snippets.

View japhib's full-sized avatar

Jan Bergeson japhib

View GitHub Profile
@japhib
japhib / Generate2DLight.lua
Created May 2, 2022 16:20
Aseprite script to generate a 2d light sprite for Godot
-- Generate a 2d light for Godot
local rgba = app.pixelColor.rgba
local cel = app.activeCel
if not cel then
return app.alert("There is no active image")
end
local bounds = cel.bounds
@japhib
japhib / check-alphabetized.py
Created April 8, 2022 19:41
Script (in Python) for checking to make sure all public functions in Elixir files in a project are alphabetized! Use it in CI to enforce that certain files have all their functions alphabetized: `python3 check-alphabetized.py --checkall lib`
#!/usr/bin/env python3
import os
import re
import sys
from functools import total_ordering
from pprint import pprint
def printUsage():
@japhib
japhib / steamrevenue.py
Last active June 21, 2020 03:11
Python script that pulls games from Steam and estimates their revenue
# for tag IDs see: https://partner.steamgames.com/doc/store/tags
# for games in a particular tag see: https://store.steampowered.com/search/?tags=<tag_id>
tags = [
{'tag_name': '2D Fighter', 'tag_id': 4736},
{'tag_name': '2D Platformer', 'tag_id': 5379},
{'tag_name': '3D Fighter', 'tag_id': 6506},
{'tag_name': '3D Platformer', 'tag_id': 5395},
{'tag_name': '4X', 'tag_id': 1670},
{'tag_name': 'Action Roguelike', 'tag_id': 42804},
@japhib
japhib / CoroutineUtils.cs
Last active April 2, 2024 16:35
How to call a Unity coroutine within a try/catch block
using UnityEngine;
using System.Collections;
// Adapted from https://jacksondunstan.com/articles/3718
public static class CoroutineUtils
{
// Calls a coroutine but if there's an error in that coroutine, it'll log the error & return
// instead of just killing the caller.
//
// Call it like this: