Skip to content

Instantly share code, notes, and snippets.

View restorer's full-sized avatar

Viachaslau Tratsiak restorer

View GitHub Profile
@alexanderk23
alexanderk23 / heapq.asm
Last active June 3, 2021 14:34
heapq.asm
; Binheap priority queue
; Based on 6502 code by MagerValp
; https://github.com/MagerValp/AsmHeap
; 255 items max, 3 bytes wasted
struct HEAPQ
align 256
tree ds 255, 0
size db 0
@Matan
Matan / HaxeScript.hx
Last active February 5, 2022 12:27 — forked from clarkjones/HaxeScript.hx
haxex, a short shell script that can be used so you have Haxe shell scripting
#!/usr/bin/env haxex -lib mcli @
/**
Taken from mcli example https://github.com/waneck/mcli
Say hello.
Example inspired by ruby's "executable" lib example
**/
class HaxeScript extends mcli.CommandLine
{
/**
@ErikAugust
ErikAugust / spectre.c
Last active August 2, 2024 01:59
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@JakeSteam
JakeSteam / AlertDialogHelper.java
Last active September 16, 2019 13:10
"Custom Alert Dialog With Dynamic Buttons" for GameDevAlgorithms.com
public class AlertDialogHelper {
private static void displayAlertDialog(Context context, String title, String body, DialogAction... actions) {
LayoutInflater inflater = LayoutInflater.from(context);
final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
final View inflatedLayout = inflater.inflate(R.layout.custom_alert_dialog, null);
final AlertDialog dialog = new AlertDialog.Builder(context).create();
dialog.setView(inflatedLayout);
((TextView)inflatedLayout.findViewById(R.id.title)).setText(title);
((TextView)inflatedLayout.findViewById(R.id.body)).setText(body);
@player-03
player-03 / CPPRandomSeed.hx
Created January 19, 2017 01:43
Seed the random number generator in C++.
@:cppInclude('time.h')
class CPPRandomSeed {
public static function seed() {
#if cpp
untyped __cpp__('srand(time(NULL))');
#end
}
}
@haxiomic
haxiomic / Partial.hx
Last active February 26, 2023 11:44
Haxe macro to make all fields of a type optional (similar to Typescript's Partial<T>)
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.TypeTools;
#if !macro
@:genericBuild(PartialMacro.build())
#end
class Partial<T> {}
class PartialMacro {
@RealyUniqueName
RealyUniqueName / KeyValueIterator.hx
Last active October 14, 2016 10:35
Key-value map iterator
class KeyValueIterator<K,V> {
var map:Map<K,V>;
var keys:Iterator<K>;
static public inline function pairs<K,V>(map:Map<K,V>) return new KeyValueIterator(map);
public inline function new(map:Map<K,V>) {
this.map = map;
this.keys = map.keys();
}
@Arinerron
Arinerron / permissions.txt
Last active October 28, 2024 08:10
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO
@francescoagati
francescoagati / Main.hx
Created June 14, 2016 00:06
haxe abstract and inline objects
class Getter<T> {
var name:String;
var obj:T;
public inline function new(name:String,obj:T) {
this.name = name;
this.obj = obj;
}
public inline function get() return untyped (obj:haxe.DynamicAccess<Dynamic>)[name];