Skip to content

Instantly share code, notes, and snippets.

View EliaECoyote's full-sized avatar
🌚
ㅋㅋㅋㅋ

Elia Camposilvan EliaECoyote

🌚
ㅋㅋㅋㅋ
View GitHub Profile
@EliaECoyote
EliaECoyote / zsh-git-completion.sh
Created October 30, 2020 12:40
Setup zsh git completion
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ~/.config/git-completion.zsh
mkdir -p ~/.zsh/functions && cp git-completion.zsh ~/.zsh/functions/_git
// an example to create a new mapping `ctrl-y`
// mapkey('<Ctrl-y>', 'Show me the money', function() {
// Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).');
// });
unmap('R');
unmap('E');
unmap('<Ctrl-i>');
unmap("<Ctrl-'>");
unmap('cp');
@EliaECoyote
EliaECoyote / create-usb.sh
Created April 15, 2020 14:44 — forked from bmatcuk/create-usb.sh
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
function makeStack() {
let head = null
function push(item) {
if (head == null) head = { value: item }
else head = { value: item, next: head }
}
function isEmpty() {
return head == null
}
function peek() {
@EliaECoyote
EliaECoyote / UseMachine.re
Created November 27, 2019 08:34
ReasonML useMachine react hook
/**
* describes the outcome of the machine reducer
* fn.
* The Invalid variant value describes the case
* where an undesired event is received
* (cannot receive the event while being in
* current state).
* The Ignored variant value describes the case
* where we just want to not take action after
* receiving a specific event.
@EliaECoyote
EliaECoyote / machine.js
Last active November 13, 2019 11:01
Generated by XState Viz: https://xstate.js.org/viz
const States = {
play: 'play',
error: 'error',
idle: 'idle'
}
const Transitions = {
loginSuccessful: 'loginSuccessful',
didDisplaySharer: 'didDisplaySharer',
cancelPlayRequest:
@EliaECoyote
EliaECoyote / machine.js
Last active November 6, 2019 09:50
Generated by XState Viz: https://xstate.js.org/viz
"use strict";
// machine state definitions
var States;
(function (States) {
States["idle"] = "idle";
States["userLogged"] = "userLogged";
States["userUnlogged"] = "userUnlogged";
States["startTimePending"] = "startTimePending";
States["startTimeReady"] = "startTimeReady";
})(States || (States = {}));
function removeByKey (myObj, deleteKey) {
return Object.keys(myObj)
.filter(key => key !== deleteKey)
.reduce((result, current) => {
result[current] = myObj[current];
return result;
}, {});
}
import * as functions from 'firebase-functions';
import * as express from 'express';
const app = express();
function buildOgTemplate(event: any) {
return `
<!DOCTYPE html>
<html>
<head>
import * as functions from 'firebase-functions';
import * as express from 'express';
const app = express();
app.get('/events/:id', (request, response) => {
const userAgent = request.get('user-agent');
if (userAgent.indexOf("facebookexternalhit") === 0) {
res.status(200).send(`
<!doctype html>