Skip to content

Instantly share code, notes, and snippets.

View samelhusseini's full-sized avatar

Sam El-Husseini samelhusseini

View GitHub Profile
This file has been truncated, but you can view the full file.
declare module "utils/idgenerator" {
namespace internal {
/**
* Generate a random unique ID. This should be globally unique.
* 87 characters ^ 20 length > 128 bits (better than a UUID).
* @return {string} A globally unique ID string.
*/
function genUid(): string;
}
/**
This file has been truncated, but you can view the full file.
declare module "utils/idgenerator" {
namespace internal {
/**
* Generate a random unique ID. This should be globally unique.
* 87 characters ^ 20 length > 128 bits (better than a UUID).
* @return {string} A globally unique ID string.
*/
function genUid(): string;
}
/**
@samelhusseini
samelhusseini / blocks.js
Created June 10, 2020 17:05
Chained If / else blocks
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
{
"type": "custom_if",
"message0": "if %1 %2",
"args0": [
{
"type": "input_value",
"name": "NAME"
},
@samelhusseini
samelhusseini / microbit-spotify.js
Last active March 29, 2022 01:27
A node script for listening to micro:bit serial messages and controlling spotify on a Mac
var SerialPort = require("serialport");
const Readline = SerialPort.parsers.Readline;
var spotify = require('spotify-node-applescript');
var port = new SerialPort('/dev/tty.usbmodem1422', {
baudRate: 115200,
autoOpen: false
})
const parser = new Readline();
port.pipe(parser);
@samelhusseini
samelhusseini / main.ts
Last active November 28, 2016 22:55
Rotary_Encoder
let Min_X = 1;
let Max_X = 15;
let a = 0
let b = 0
let x = 5
let lastA = pins.digitalReadPin(DigitalPin.P5);
basic.forever(() => {
a = pins.digitalReadPin(DigitalPin.P5);
b = pins.digitalReadPin(DigitalPin.P11)
@samelhusseini
samelhusseini / main.ts
Created November 23, 2016 19:00
Rotary Encoder Project
let Min_X = 1;
let Max_X = 15;
let a = 0
let b = 0
let x = 5
let lastA = pins.digitalReadPin(DigitalPin.P5);
basic.forever(() => {
a = pins.digitalReadPin(DigitalPin.P5);
b = pins.digitalReadPin(DigitalPin.P11)