Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
ruby0x1 / OrderedMap.hx
Last active April 30, 2020 22:18
A simple Haxe ordered Map implementation, MIT license
import Map;
class OrderedMapIterator<K,V> {
var map : OrderedMap<K,V>;
var index : Int = 0;
public function new(omap:OrderedMap<K,V>)
map = omap;
public function hasNext() : Bool
@ruby0x1
ruby0x1 / multi-player-html5-games-00-express.js
Created March 27, 2012 15:01
Multi-player games in HTML5
/* Copyright (c) 2012 Sven "FuzzYspo0N" Bergström
http://underscorediscovery.com
MIT Licensed. See LICENSE for full license.
Usage : node simplest.app.js
*/
var
@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 / main.cpp
Last active January 4, 2019 21:09
SDL2 sample
//SDL2 flashing random color example
//Should work on iOS/Android/Mac/Windows/Linux
#include <SDL.h>
#include <SDL_opengl.h>
#include <stdlib.h> //rand()
static bool quitting = false;
static float r = 0.0f;
@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"
@ruby0x1
ruby0x1 / FPS.hx
Last active July 12, 2017 11:47 — forked from AndreiRudenko/Fps.hx
Simple FPS Text instance, modified from @RudenkoArt as an example for http://luxeengine.com
package;
import luxe.Text;
import luxe.Color;
import luxe.Vector;
import luxe.Log.*;
import luxe.options.TextOptions;
class FPS extends Text {
class Main extends luxe.Game {
override function config(config:luxe.GameConfig) {
config.preload = PreloadAssets.parcel;
return config;
}