Skip to content

Instantly share code, notes, and snippets.

Working from home

Emanuel Quimper EQuimper

Working from home
View GitHub Profile
View machine.js
const paymentService = (context, event) =>
new Promise((resolve, reject) => {
// TODO: change this, it's MOCK
setTimeout(() => {
if (context.plan === 'annual') {
return reject('something went wrong');
return resolve();
EQuimper / useScrollRestoration.ts
Created Sep 20, 2020
NextJS save scroll position between page for back handler
View useScrollRestoration.ts
import React from 'react';
import Router, { NextRouter } from 'next/router';
// Save the scroll position for the given url
function saveScrollPosition(
url: string,
element: HTMLElement,
savePosition: (url: string, pos: number) => void
) {
View linking.js
export const APP_LIST = {
"whatsapp": {pkgName: "com.whatsapp", urlScheme: "whatsapp", urlParams: "app"}, // fa
"facebook": {pkgName: "com.facebook.katana", urlScheme: "fb", urlParams: "requests"}, // fa: facebook-official
"facebook messenger": {pkgName: "com.facebook.orca", urlScheme: "fb-messenger", urlParams: "user-thread/{user-id}"}, // fa: facebook
"skype": {pkgName: "", urlScheme: "skype", urlParams: "echo123?call"}, // fa
"wechat": {pkgName: "", urlScheme: "weixin", urlParams: "dl/chat"}, // fa
"snapchat": {pkgName: "", urlScheme: "snapchat", urlParams: "?u=foo"}, // fa
"twitter": {pkgName: "", urlScheme: "twitter", urlParams: "messages"}, // fa
"youtube": {pkgName: "", urlScheme: "youtube", urlParams: "watch?v=dQw4w9WgXcQ"}, // fa
"netflix": {pkgName: "", urlScheme: "nflx", urlParams: ""},
View toCamel.ts
export const toCamel = (value: string): string => (
value.replace(/([-_][a-z])/ig, ($1) => $1.toUpperCase()
.replace("-", "")
.replace("_", ""))
View tabview.js
import React, { useState, useRef, useContext, useCallback } from 'react';
import { Dimensions, View, Animated } from 'react-native';
import { TabView } from 'react-native-tab-view';
import { TabScreen } from './Tab';
import { CustomTabBar } from './TabBar';
import { ThemeContext } from 'react-native-elements';
import { useHeaderHeight } from '@react-navigation/stack';
const AnimatedHeader = ({ style, content }) => {
return <Animated.View style={style}>{content}</Animated.View>;
EQuimper / months.ts
Created Jan 27, 2020
Months with short + long in js/ts
View months.ts
const months = [
long: 'January',
short: 'Jan',
long: 'February',
short: 'Feb',
EQuimper / main.go
Created Jan 5, 2020 — forked from dopey/main.go
How to generate secure random strings in golang with crypto/rand.
View main.go
package main
import (
// Adapted from
View BottomSheetView.swift
// BottomSheetView.swift
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16
View gym exercices
4-Way Neck
Neck PushUp
Manual Neck
Bench Press
Bench Press (eccentric phase)
Bench Press Rebound
EDI Bench Press
EQuimper / Flexible Dockerized Phoenix
Created Jan 2, 2019 — forked from jswny/Flexible Dockerized Phoenix
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.
View Flexible Dockerized Phoenix


I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai