Skip to content

Instantly share code, notes, and snippets.

View swissmanu's full-sized avatar
👻

Manuel Alabor swissmanu

👻
View GitHub Profile
@swissmanu
swissmanu / index.js
Last active April 20, 2023 06:26
Awtrix Light Countdown App with Node-RED. Paste code to a function node and customize the schedule on line 6 to your liking. Node will execute on any incoming message.
const prefix = "awtrix1";
const appName = "countdown";
const now = new Date();
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const schedule = [
{
date: { day: 1, month: 1 },
text: "First of January every year",
icon: "14004",
@swissmanu
swissmanu / stable.json
Last active February 3, 2022 13:43
Lanes Updates
{
"name": "v0.1.1",
"notes": "Updater Test",
"pub_date": "2021-02-03T10:00:00Z",
"platforms": {
"darwin": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbzgzUkZ1M2NQWUcveDc5K1M1OXl2MHBvZnlzemkwWUJPTDU5YkNBYWlrbzYxS09VMVE2SlY5ZW8rSW16Tk1lYWREWHNiSlBDVVVCWFBTSkViUkZiOUhKK0Vac1ZNMXc0PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjQzODc5NDk2CWZpbGU6L1VzZXJzL3J1bm5lci93b3JrL2xhbmVzL2xhbmVzL3NyYy10YXVyaS90YXJnZXQvcmVsZWFzZS9idW5kbGUvbWFjb3MvTGFuZXMuYXBwLnRhci5negpMOWpLTTVJQjUxdlZaNmNGMlVVQkJLdE1GQyt2bHBZQVlhNmE4TElNTVRackFhdGpVc0VFbGVuZktQYklGbkVaZnlnNjF5aXJsZjdJWEFQRWlLWXhCZz09Cg==",
"url": "https://github.com/swissmanu/lanes/releases/download/v0.1.0/Lanes.app.tar.gz"
},
"linux": {
export type Tuple2<A, B> = [A, B];
export type Tuple3<A, B, C> = [A, B, C];
export type Tuple4<A, B, C, D> = [A, B, C, D];
export type Tuple5<A, B, C, D, E> = [A, B, C, D, E];
export type Tuple6<A, B, C, D, E, F> = [A, B, C, D, E, F];
export type Tuple7<A, B, C, D, E, F, G> = [A, B, C, D, E, F, G];
export type Tuple8<A, B, C, D, E, F, G, H> = [A, B, C, D, E, F, G, H];
export type Tuple9<A, B, C, D, E, F, G, H, I> = [A, B, C, D, E, F, G, H, I];
export type Tuple10<A, B, C, D, E, F, G, H, I, J> = [A, B, C, D, E, F, G, H, I, J];
@swissmanu
swissmanu / stacktrace.js
Last active June 12, 2019 14:24
Revive a JavaScript stacktrace string with local available source maps.
const fs = require('fs');
const retrace = require('retrace'); // yarn add retrace
const path = require('path');
retrace.resolve = uri => {
// assumes that source maps are in the same directory as this script, but in
// a `maps` folder:
return readFile(path.join(__dirname, 'maps', `${path.basename(uri)}.map`));
};
@swissmanu
swissmanu / SketchSystems.spec
Last active November 15, 2019 07:48
Editable Page
Editable Page
Error
Reset -> View
View*
Read
Change Data -> WaitForEdit
Request Edit -> WaitForEdit
WaitForEdit
Ready -> Edit
Error -> Error
@swissmanu
swissmanu / apply-prettier.ts
Created March 21, 2019 07:19
Apply Prettier Schematic
import { Rule, Tree } from '@angular-devkit/schematics';
import * as prettier from 'prettier';
import { Observable } from 'rxjs';
export default function(): Rule {
return (tree: Tree) =>
new Observable<Tree>(o => {
prettier.resolveConfig(process.cwd()).then(prettierConfig => {
if (!prettierConfig) {
o.error(new Error('Could not resolve prettier configuration'));
@swissmanu
swissmanu / SketchSystems.spec
Last active February 28, 2019 10:40
Button
Button
Disabled
enable -> Enabled
Enabled*
disable -> Disabled
Inactive
focus -> Active
mouseEnter -> Hovered
function Input<T>({
value,
onChange,
children,
serialize,
deserialize
}: {
value: T;
deserialize: (value: T) => string | null;
serialize: (rawValue: string | null) => T;
< HTTP/1.1 302 Found
< Content-Length: 34
< Content-Type: text/html; charset=utf-8
< Date: Wed, 05 Dec 2018 09:32:46 GMT
< Location: /user/login
< Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
< Set-Cookie: i_like_gogs=346ffxxxxxxxae8b; Path=/; HttpOnly
< Set-Cookie: _csrf=Pka0s5RZO-QhdGetTwxxxxxxxxxxNjcxxxxxxx3D%3D; Path=/; Expires=Thu, 06 Dec 2018 09:32:46 GMT; HttpOnly
< Set-Cookie: redirect_to=%252Fuser%252Frepos; Path=/
@swissmanu
swissmanu / WithState.tsx
Last active September 11, 2018 07:43
A wrapper component providing state to a stateless React component in TypeScript.
// setState signature borrowed from react 😇
interface WithStateProps<S> {
initialState: S;
children: (
state: S,
setState: <K extends keyof S>(
state: ((prevState: Readonly<S>, props: {}) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
callback?: () => void
) => void
) => React.ReactChild;