Skip to content

Instantly share code, notes, and snippets.

View sedzd's full-sized avatar
🐳
beep boop

Sed sedzd

🐳
beep boop
View GitHub Profile
@sedzd
sedzd / machine.js
Last active June 14, 2021 09:49
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sedzd
sedzd / machine.js
Last active February 18, 2021 15:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sedzd
sedzd / machine.js
Last active June 22, 2020 17:02
Generated by XState Viz: https://xstate.js.org/viz
const otpIsValid = (context, event) => {
return context.otpSent && event.otp && event.otp.length === 6;
}
const otpIsNotValid = (context, event) => {
return !context.otpSent || !event.otp || event.otp.length !== 6;
}
const CardStatusMachine = Machine(
{
id: "Card Status" ,
@sedzd
sedzd / index.js
Last active November 10, 2019 14:03
#!/usr/bin/env node
console.log("exec js from gist inside terminal");
@sedzd
sedzd / safe.js
Created January 10, 2019 07:48
crypto encrypt decrypt class
const crypto = require('crypto');
const key = crypto.randomBytes(32);
const iv = crypto.randomBytes(16);
const algorithm = 'aes-256-cbc'
class Safe {
constructor(key, iv) {
this.key = key,
this.iv = iv
}
encrypt (text) {