Skip to content

Instantly share code, notes, and snippets.

View moechofe's full-sized avatar

martin mauchauffée moechofe

  • Paris, France
View GitHub Profile
@moechofe
moechofe / Cheditor.nx
Created August 18, 2019 11:04
LowResNX personal GFX editor
'REV4
'MEMORY MAPPING
'$A000..$AFFF LOADED CHARA FROM FILE
'$B000..$DFFF LOADED BG FROM FILE
'CELL 8X8 TOUCH COORDS
GLOBAL CX,CY
'WHICH CORNER WAS TAPPED TO GO TO BGEDITOR, WHICH CORNER TO TAP TO GO BACK
@moechofe
moechofe / codea-small-bitmap-font.lua
Last active February 28, 2018 11:18
Small bitmap font tool, extract from a bigger project. May not works without proper integration.
local glyphsMesh
local fontSelected=1
local fontData={
{row=0,col=0,space=5,spaces={
[32]=3,
[33]=2,[34]=7,[35]=6,[36]=6,[37]=6,[39]=2,[40]=3,[41]=3,[42]=6,[43]=6,[44]=3,[45]=4,[46]=2,[47]=4,[48]=4,
[49]=3,[50]=4,[51]=4,[52]=4,[53]=4,[54]=4,[55]=4,[56]=4,[57]=4,[58]=2,[59]=3,[60]=4,[61]=4,[62]=4,[64]=7,
[73]=4,[74]=4,[75]=6,[76]=4,[77]=6,
[84]=6,[87]=6,[89]=6,[91]=3,[92]=4,[93]=3,[94]=4,[96]=7,
@moechofe
moechofe / redis.php
Last active August 29, 2015 14:27
Redis client/listener which use phpiredis extension and socket
<?php
// Need: https://github.com/nrk/phpiredis
class ErrorRespond extends Exception {}
class ErrorConnection extends Exception {}
class ErrorProtocol extends Exception {}
class Client

waitgroup

Simple helper to run asynchronous functions and wait for them to finish before calling a callback function.

Callback use the node.js format:

  cb = function(err, result...){...}
@moechofe
moechofe / pooltask.md
Last active August 29, 2015 14:05
Simple helper to use a pool of worker asynchronous functions to handle of queue of tasks. Each done worker will be re-used to handle the next task.

pooltask

Simple helper to use a pool of worker asynchronous functions to handle of queue of tasks. Each done worker will be re-used to handle the next task.

Callback use the node.js format:

  cb = function(err, result...){...}
@moechofe
moechofe / waterfall.md
Last active August 29, 2015 14:04
A javascript helper used to call a serie of asynchronous functions passing the result from the previous one to the following

waterfall

Simple helper to call a serie of asynchronous functions. Each result from a function will be passed as arguments to the next one.

Callback use the node.js format:

  cb = function(err, result...){...}
@moechofe
moechofe / getArgs.php
Last active February 15, 2019 16:27
Quick and effective command line parser for PHP using getopt().
<?php
/**
* Parse the command line and fill variables.
* Params:
* array $opts = An associated array. Keys are the option names.
* Values are the references to variables that receive the values from the command lines.
* Nothing is returned but when values of the array $opts are passed by reference, they will contain the
* values extracted from the command line.
* Keys must be string.