Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
ruby0x1 / PSXDither.hlsl
Created September 1, 2021 22:09 — forked from ompuco/PSXDither.hlsl
Color dither & truncation based on Sony's PlayStation (1) hardware features & limitations.
#ifdef PSXDTH
#else
#define PSXDTH
//PS1 Hardware Dithering & Color Precision Truncation Function
//by ompu co | Sam Blye (c) 2020
//PS1 dither table from PSYDEV SDK documentation
@ruby0x1
ruby0x1 / opt_fsr.fxh
Created August 26, 2021 08:29 — forked from atyuwen/opt_fsr.fxh
An optimized AMD FSR implementation for Mobiles
//==============================================================================================================================
// An optimized AMD FSR's EASU implementation for Mobiles
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h
// -- FsrEasuSampleH should be implemented by calling shader, like following:
// half3 FsrEasuSampleH(float2 p) { return MyTex.SampleLevel(LinearSampler, p, 0).xyz; }
//==============================================================================================================================
void FsrEasuL(
out AH3 pix,
AF2 ip,
AF4 con0,
@ruby0x1
ruby0x1 / stb.c
Created February 24, 2021 17:55 — forked from urraka/stb.c
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define STBI_ONLY_PNG
#define STBI_ONLY_JPEG
#define STBI_ONLY_BMP
#define STBI_ONLY_GIF
#include "stb_image.h"
#include "stb_image_write.h"
@ruby0x1
ruby0x1 / Unreal-AnimBP-4.22-hotfix.cpp
Created June 15, 2019 03:48
SetAnimInstanceClass is broken in unreal 4.22. This is a project-level fix for it till 4.22.3 (or 4.23) comes out.
// Context: https://answers.unrealengine.com/questions/887556/view.html
// This post references a key commit here: https://github.com/EpicGames/UnrealEngine/commit/c4ea32533ee98508ab68038488a09b3a12d54cd4#diff-73715a20583ca5ead5c94c9183679d47
// This change forces evaluation to complete, before updating the animation class.
// This happens during ClearAnimScriptInstance - BUT - the code path to this change, is not special.
// That means it should be valid to do this BEFORE calling clear, i.e before even calling SetAnimInstanceClass itself!
// So that's what we do. We simply wrap SetAnimInstanceClass in a function we can call,
// and inside that function we ensure evaluation is complete. This fixes it for me in all my use cases!
// Requires:
// - C++ in your project.
@ruby0x1
ruby0x1 / github-webhook.node.js
Last active May 10, 2019 02:41
A simple example of a validated github webhook using node.js
//A simple example of a github webhook using node.js
//To correctly set up:
// Inside a file named `.env`, in the same directory the app runs,
// place a line with WEBHOOK_SECRET='...'
// The secret value must match the secret you give github on their UI.
//That's it. run with `node app.js` and point github at <url>/mywebhook.
//(Prbably put it behind nginx if you do make it public facing)
'use strict';
@ruby0x1
ruby0x1 / tweetdeck userstyles css
Last active February 12, 2018 14:49
tweetdeck: but not ugly
@-moz-document url("https://tweetdeck.twitter.com/"), url("https://tweetdeck.twitter.com/#") {
body { background-color:#000 }
html.dark .stream-item { background-color:#161619; border-bottom: solid 1px #000; }
html.dark .column { background-color:#161619; }
html.dark, html.dark body { background-color:#161619; }
html.dark .column-header, html.dark .column-header-temp { background-color:#000; }
html.dark .app-columns-container { background-color:#000 }
html.dark .column-message { background-color:#000 }
html.dark .column-title-edit-box { background-color:#212124 }
html.dark .column-nav-item { background:transparent; }
@ruby0x1
ruby0x1 / example.sh
Last active November 1, 2017 14:53
Running a bash script as a mac .app
#!/bin/bash
THIS_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# basically ./actual_binary but using a proper path
"${THIS_FOLDER}/actual_binary"
class Main extends luxe.Game {
override function config(config:luxe.GameConfig) {
config.preload = PreloadAssets.parcel;
return config;
}
@ruby0x1
ruby0x1 / msdf.glsl
Last active February 13, 2022 05:30
simple MSDF shader
float r = sample.r;
float g = sample.g;
float b = sample.b;
float median = max(min(r, g), min(max(r, g), b));
float signed_dist = median - 0.5;
float d = fwidth(signed_dist);
float opacity = smoothstep(-d, d, signed_dist);
//apply opacity to final alpha
color.a *= opacity;