Skip to content

Instantly share code, notes, and snippets.

View ivorpad's full-sized avatar
🇪🇸
Working from Spain

Ivor ivorpad

🇪🇸
Working from Spain
View GitHub Profile
@ivorpad
ivorpad / machine.js
Created April 1, 2021 14:41
Generated by XState Viz: https://xstate.js.org/viz
let count = 0;
const functionThatCanFail = async () => {
const urls = [
`https://api.github.com/users/mojombo`,
`https://api.github.com/users/ivorpad`,
`https://api.github.com/users/failtofetch`,
`https://api.github.com/users/davidkpiano`
];
const user = await fetch(urls[count]);
@ivorpad
ivorpad / machine.js
Created April 1, 2021 11:44
Generated by XState Viz: https://xstate.js.org/viz
const functionThatCanFail = async () => {
const urls = [
`https://api.github.com/users/failtofetch`,
`https://api.github.com/users/mojombo`
];
return await fetch(urls[Math.floor(Math.random() * 2)]);
};
const healthCheck = () => {
return new Promise((resolve, reject) => {
@ivorpad
ivorpad / machine.js
Created January 28, 2021 05:54
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
[2021-01-05 22:55:29] waiting for changes...
src/http/any-catchall/index.ts:1:35 - error TS2307: Cannot find module '@architect/shared/architect-types' or its corresponding type declarations.
1 import { Request, Response } from "@architect/shared/architect-types";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/http/any-catchall/index.ts:2:21 - error TS2307: Cannot find module '@architect/shared/utils' or its corresponding type declarations.
2 import { log } from "@architect/shared/utils";
~~~~~~~~~~~~~~~~~~~~~~~~~
@ivorpad
ivorpad / setup-gh-cli-auth-2fa.md
Created December 3, 2020 22:08 — forked from ateucher/setup-gh-cli-auth-2fa.md
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
const { Telegraf } = require("telegraf");
const bot = new Telegraf(process.env.TELEGRAM_BOT_KEY);
bot.start((ctx) => ctx.reply('Welcome!'))
bot.launch()
export default (req, res) => {
if (req.method === "POST") {
const message = `Hey ${req.body.text} — a message from slack at ${
req.body.channel_name === "directmessage"
@ivorpad
ivorpad / .sql
Last active October 16, 2020 11:43
jsonb_path_query @ PostgreSQL 12
SELECT
jsonb_path_query(tracker_events::jsonb, '$.result[*] ? (@.status == "delivered").tracking_details') as events
FROM orders WHERE store_host='store-name.myshopify.com';
@ivorpad
ivorpad / machine.js
Created September 29, 2020 12:37
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ivorpad
ivorpad / machine.js
Last active September 29, 2020 05:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ivorpad
ivorpad / .css
Created September 4, 2020 07:52
backup
ul.rd-menu.rd-navbar-megamenu {
display: block;
width: initial;
max-width: initial;
padding: 2rem;
background: #fff;
}
.rd-navbar-static .rd-menu {