Skip to content

Instantly share code, notes, and snippets.

Avatar
🐳
beep boop

Sed sedzd

🐳
beep boop
View GitHub Profile
@sedzd
sedzd / machine.js
Last active Feb 18, 2021
Generated by XState Viz: https://xstate.js.org/viz
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sedzd
sedzd / machine.js
Last active Jun 22, 2020
Generated by XState Viz: https://xstate.js.org/viz
View machine.js
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" ,
View index.js
#!/usr/bin/env node
console.log("exec js from gist inside terminal");
@sedzd
sedzd / safe.js
Created Jan 10, 2019
crypto encrypt decrypt class
View safe.js
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) {