Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
ruby0x1 / Unreal-AnimBP-4.22-hotfix.cpp
Created Jun 15, 2019
SetAnimInstanceClass is broken in unreal 4.22. This is a project-level fix for it till 4.22.3 (or 4.23) comes out.
View Unreal-AnimBP-4.22-hotfix.cpp
// 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
A simple example of a validated github webhook using node.js
View github-webhook.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 Feb 12, 2018
tweetdeck: but not ugly
View tweetdeck userstyles css
@-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 Nov 1, 2017
Running a bash script as a mac .app
View example.sh
#!/bin/bash
THIS_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# basically ./actual_binary but using a proper path
"${THIS_FOLDER}/actual_binary"
View Main.hx
class Main extends luxe.Game {
override function config(config:luxe.GameConfig) {
config.preload = PreloadAssets.parcel;
return config;
}
@ruby0x1
ruby0x1 / msdf.glsl
Last active Nov 19, 2019
simple MSDF shader
View msdf.glsl
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;
@ruby0x1
ruby0x1 / hash_fnv1a.h
Last active Apr 5, 2020
FNV1a c++11 constexpr compile time hash functions, 32 and 64 bit
View hash_fnv1a.h
#pragma once
#include <stdint.h>
//fnv1a 32 and 64 bit hash functions
// key is the data to hash, len is the size of the data (or how much of it to hash against)
// code license: public domain or equivalent
// post: https://notes.underscorediscovery.com/constexpr-fnv1a/
inline const uint32_t hash_32_fnv1a(const void* key, const uint32_t len) {
@ruby0x1
ruby0x1 / Runner.hx
Last active Apr 22, 2019
A simple Haxe class for easily running threads and calling functions on the primary thread.
View Runner.hx
package;
#if cpp
import cpp.vm.Thread;
import cpp.vm.Deque;
#elseif neko
import neko.vm.Thread;
import neko.vm.Deque;
#end
@ruby0x1
ruby0x1 / hxcpp_cache_example.txt
Last active Jun 5, 2016
hxcpp compile cache example on a clean rebuild
View hxcpp_cache_example.txt
$ rm -rf bin/
$ flow run
flow / found custom config at /Users/sven/.flow.config.json
flow / 1.0.0-alpha.2 (node.js v0.12.7)
flow / target is mac ( arch 64 )
flow / haxe version 3.2.1
flow / build - snow.basic 1.0.0 for mac
flow / build - running haxe ...
You can’t perform that action at this time.