Skip to content

Instantly share code, notes, and snippets.

View sallar's full-sized avatar
:shipit:
Staring into an abyss

Sallar sallar

:shipit:
Staring into an abyss
View GitHub Profile
@sallar
sallar / main.js
Created February 22, 2018 17:10
Electron IPC Enqueue
ipc.on('channel:enqueue', (e, payload) => {
const { channelName, stack, id } = payload;
getQueue()
.channel(channelName)
.enqueue(
() => {
return new Promise(resolve => {
ipc.once(`channel:resolve:${id}`, resolve);
e.sender.webContents.send(`channel:execute:${id}`);
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<input type="password" name="password">
@sallar
sallar / example.ts
Last active August 13, 2023 01:08
TypeScript Either / Pattern Matching
import { Either, Left, Right, match } from './patterns.ts';
interface Person {
name: string;
}
const readValueFromAPI = (): Either<Error, Person> => {
// ...
const person: Person = {
name: 'Test',