Skip to content

Instantly share code, notes, and snippets.

@thejustinwalsh
thejustinwalsh / SingleInstance.cs
Last active August 29, 2015 13:56
Class to handle the case where you need a single instance of an application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
/* Usage:
@thejustinwalsh
thejustinwalsh / delegate.h
Created July 26, 2014 19:48
Delegate Implementation
template<typename... params>
class Delegate
{
typedef void (*Type)(void* callee, params...);
public:
Delegate(void* callee, Type function) : _callee(callee), _delegate(function) {}
template <class T, void (T::*TMethod)(params...)>
static Delegate make(T* callee)
{
@thejustinwalsh
thejustinwalsh / code
Created April 30, 2015 15:38
Visual Studio Code from Terminal OSX
#!/bin/bash
open -a /Applications/Visual\ Studio\ Code.app/Contents/MacOS/Atom "$1"
class util.Random
{
public static function get instance():Random { return _instance; }
public function Random(seed:Number)
{
r = seed;
if (!_instance) _instance = this;
}

Keybase proof

I hereby claim:

  • I am thejustinwalsh on github.
  • I am thejustinwalsh (https://keybase.io/thejustinwalsh) on keybase.
  • I have a public key whose fingerprint is 4909 F883 2B00 FA63 0BE6 4F16 B2ED 6E59 F64C E113

To claim this, I am signing this object:

@thejustinwalsh
thejustinwalsh / gist:a1c2c126518d5dc0225c2627e9057ca1
Created June 3, 2016 07:17 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@thejustinwalsh
thejustinwalsh / cellAutoVoronoi.js
Created October 6, 2017 00:01 — forked from luckylooke/cellAutoVoronoi.js
Rewriten library cellauto to make it work on diagrams generated by Raymond Hill voronoi library( https://github.com/gorhill/Javascript-Voronoi )
// rewriten from http://sanojian.github.io/cellauto/
function CellAutoVoronoiCell(index) {
this.index = index;
this.delays = [];
}
CellAutoVoronoiCell.prototype.process = function(neighbors) {
return;
};
@thejustinwalsh
thejustinwalsh / EFX.hx
Last active May 15, 2018 16:00
Hashlink IOS Patch
package openal;
import openal.AL;
abstract Effect(Int) {
public inline function toInt() : Int { return this; }
public static inline function ofInt( v : Int ) : Effect { return cast v; }
}
abstract Filter(Int) {
public inline function toInt() : Int { return this; }
@thejustinwalsh
thejustinwalsh / Hashlink AppCenter
Last active April 4, 2024 17:45
Build script for building a heaps based project on iOS
@thejustinwalsh
thejustinwalsh / efx.c
Created March 30, 2019 21:54
EFX shim for OpenAL when using OpenAL without the EFX extension [iOS]
#include <hl.h>
void openal_al_get_auxiliary_effect_slotfv(int a, int b, vbyte* c) { }
float openal_al_get_auxiliary_effect_slotf(int a, int b) { return 0.f; }
void openal_al_get_auxiliary_effect_slotiv(int a, int b, vbyte* c) { }
int openal_al_get_auxiliary_effect_sloti(int a, int b) { return 0; }
void openal_al_auxiliary_effect_slotfv(int a, int b, vbyte* c) { }
void openal_al_auxiliary_effect_slotf(int a, int b, float c) { }
void openal_al_auxiliary_effect_slotiv(int a, int b, vbyte* c) { }
void openal_al_auxiliary_effect_sloti(int a, int b, int c) { }