Skip to content

Instantly share code, notes, and snippets.

View EleotleCram's full-sized avatar

Marcel Toele EleotleCram

  • Amsterdam, The Netherlands
View GitHub Profile
@EleotleCram
EleotleCram / bus.js
Last active March 7, 2017 13:23
drop-in synchronous bus gist using jquery-node
const $ = require('jquery-node');
// Description: drop-in synchronous bus gist using jquery-node
// Usage:
//
// bus.on("foo", (...args) => {
// console.log("foo was triggered", args);
// });
// bus.subscribe({
// onFoo(...args) {console.log("foo triggered too", args)}
@EleotleCram
EleotleCram / aprintf
Last active April 16, 2023 05:14
Simple arduino formatted printf
int aprintf(char *str, ...) {
int i, j, count = 0;
va_list argv;
va_start(argv, str);
for(i = 0, j = 0; str[i] != '\0'; i++) {
if (str[i] == '%') {
count++;
Serial.write(reinterpret_cast<const uint8_t*>(str+j), i-j);