Skip to content

Instantly share code, notes, and snippets.

View sheminusminus's full-sized avatar
🤖
Disco

Emily Presser sheminusminus

🤖
Disco
View GitHub Profile
@sheminusminus
sheminusminus / machine.js
Last active March 20, 2020 07:57
Generated by XState Viz: https://xstate.js.org/viz
const billStates = {
initial: 'invalid',
states: {
invalid: {},
valid: {},
},
};
const stepStates = Machine({
@sheminusminus
sheminusminus / migrate_example.js
Created January 5, 2020 19:48
Firebase admin migration example
// ===============
// migration function file
// ===============
// disclaimer: i currently have zero focus on performance for migrations, since they are run one time ever
module.exports = async (adminFb) => {
try {
const directoriesSnap = await adminFb
.database()
.ref('directories')
from itertools import islice
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
from firebase_admin import firestore
def _split(data, size=500):
"""Splits a dictionary into a sequence of smaller dictionaries."""
@sheminusminus
sheminusminus / convert_midi.py
Last active April 11, 2019 06:05
Totally amateur Tensorflow experiment, made largely by modifying other scripts, to train a neural network (LSTM) to compose songs (we used Disney songs as input)
# Scans the MIDI files in and converts them to the format expected by the neural network.
#
# We encode the MIDI note number as a one-hot vector, and the duration of the
# note as another one-hot vector. We combine all these vectors inside a big
# Numpy array and save it as X.npy.
import os
import struct
import numpy as np
from collections import defaultdict
const router = express.Router();
router.post('/swap', async (req, res) => {
const { code } = req.body;
try {
const url = `${spotifyConfig.SPOTIFY_ENDPOINT}/api/token`;
const postOptions = {
method: 'POST',
url,
headers: {
Authorization: spotifyConfig.AUTH_HEADER,
@sheminusminus
sheminusminus / index.html
Last active April 16, 2018 06:56
the code causing those errors
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Emily Kolar"/>
<title>emkolar.ninja</title>
<link rel="icon" type="image/png" href="./favicon.png" />
<link rel="stylesheet" href="./css/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600" rel="stylesheet" />
@sheminusminus
sheminusminus / index.html
Created March 31, 2018 08:32
webcam access
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>cam</title>
</head>
<body>
<script>
const video = document.createElement('video');
video.height = '500';

create schemes for each env

Product > Scheme > Edit Scheme > click Duplicate Scheme

This basically creates a new env configuration, so I named the new one Vibee Staging. Then I duplicated it again, and named the third one Vibee Production.

add env variables to each scheme

To add environment variables, choose edit scheme again, and:

Keybase proof

I hereby claim:

  • I am sheminusminus on github.
  • I am sheminusminus (https://keybase.io/sheminusminus) on keybase.
  • I have a public key ASBKQkTxABJBnkhITnMtv57PyYefcC_VhuDiPGbL_81_RQo

To claim this, I am signing this object:

// assuming you have radio inputs like this in your html:
// <input type="radio" name="gender" value="1"> Female
// <input type="radio" name="gender" value="2"> Male
// you can do something like this serverside:
function getGenderForInteger(genderInt) {
switch (genderInt) {
case 1: // handling the case where genderInt === 1
return 'Female';
case 2: // handling the case where genderInt === 2