Skip to content

Instantly share code, notes, and snippets.

View ecancino's full-sized avatar
:octocat:

Eduardo Cancino ecancino

:octocat:
View GitHub Profile
@ecancino
ecancino / pronunciation.md
Created April 5, 2024 15:22 — forked from nuno-andre/pronunciation.md
How to pronounce...
term [IPA][I] [respelling][r] notes
[ASIC][asic] /ˈeɪsɪk/ [source][asic]
[Bash][B] /bæʃ/ bash [source][B-1]
[CAPTCHA][cap] /kæp.tʃə/ kap-TCHA [source][cap]
[cout][c] see-out [✓ source][c-1]
[char][ch] /tʃɑr/ tchar [source][ch-1]
[deque][dq] /:dek/ deck
[etcd][e] /ˈɛtsiːdiː/ ET-see-dee [✓ source][e-1]
[fsck][f] fisk [✓ source][f-1], [alt][f-2]
@ecancino
ecancino / fromRomanNumerals.ts
Last active March 20, 2024 23:12
Convert roman to arabic numerals
const ROMAN_ARABIC_CONVERSION = {
I: 1,
V: 5,
X: 10,
L: 50,
C: 100,
D: 500,
M: 1_000,
V̅: 5_000,
X̅: 10_000,
@ecancino
ecancino / contracts...Account.sol
Last active June 27, 2021 05:42
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=false&runs=200&gist=
pragma solidity ^0.4.4;
contract Account {}
@ecancino
ecancino / stash_dropped.md
Created May 1, 2020 01:47 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@ecancino
ecancino / machine.js
Created April 27, 2020 00:25
Generated by XState Viz: https://xstate.js.org/viz
const fetchCuteAnimals = () => {
return fetch('https://www.reddit.com/r/aww.json')
.then(res => res.json())
.then(data => data.data.children.map(child => child.data))
}
const cuteAnimalMachine = Machine({
id: 'cuteAnimals',
initial: 'idle',
context: {
@ecancino
ecancino / machine.js
Last active April 27, 2020 00:23
Generated by XState Viz: https://xstate.js.org/viz
const delay = timer => ctx =>
ctx.multiplier * timer
const stoplight = Machine({
id: "stoplight",
strict: true,
context: {
multiplier: 2
},
on: {
@ecancino
ecancino / machine.js
Last active April 26, 2020 06:02
Generated by XState Viz: https://xstate.js.org/viz
// const { Machine, interpret } = require("xstate");
const lit = {
on: {
BREAK: "broken",
TOGGLE: "unlit"
}
};
const unlit = {
on: {
@ecancino
ecancino / Employee.js
Last active April 20, 2020 14:16
TS Check for JavaScript
// @ts-check
/*jshint esversion: 6 */
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
/**
* @class {Object} Person
@ecancino
ecancino / worker.js
Created October 8, 2019 15:53
WebWorker
console.log("hi!");
// worker.js
this.onmessage = e => {
console.log("worker.js: Message received from main script", e.data);
this.postMessage("Hello main");
};
@ecancino
ecancino / fetch.js
Created April 22, 2019 19:01
Fetch explained
function addUser(details) {
return fetch('https://api.example.com/user', {
mode: 'cors',
method: 'POST',
credentials: 'include',
body: JSON.stringify(details),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-XSRF-TOKEN': getCookieValue('XSRF-TOKEN')