Skip to content

Instantly share code, notes, and snippets.

View raphaelbadia's full-sized avatar
😄

Raphaël Badia raphaelbadia

😄
View GitHub Profile
#!/usr/bin/env node
/* eslint-disable no-console */
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
// edited to work with the appdir by @raphaelbadia
const path = require('path');
@raphaelbadia
raphaelbadia / TransServer.tsx
Last active June 19, 2023 10:20
Trans component from lingui
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
ComponentType,
createElement,
ElementType,
isValidElement,
ReactElement,
ReactNode,
} from 'react';
import { i18n } from '@lingui/core';
@raphaelbadia
raphaelbadia / jwtRS256.sh
Created September 30, 2022 09:55 — forked from Holger-Will/jwtRS256.sh
generate public private key pair (RSA RS256) for use with koa-jwt jasonwebtoken etc.
# generate private key
openssl genrsa -out private.pem 2048
# extatract public key from it
openssl rsa -in private.pem -pubout > public.pem
@raphaelbadia
raphaelbadia / machine.js
Last active January 23, 2021 21:28
Generated by XState Viz: https://xstate.js.org/viz
const fetchRandomDog = () => null
const specialitySelectMachine = Machine({
id: "dog fetcher",
initial: "loading",
context: {
dog: null,
error: null
},
states: {
@raphaelbadia
raphaelbadia / machine.js
Created January 23, 2021 20:52
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const mainMachine = Machine({
id: 'main',
initial: 'idle',
context: {
// retries: 0
},
states: {
idle: {
on: {
@raphaelbadia
raphaelbadia / node_nginx_ssl.md
Created April 25, 2020 05:51 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@raphaelbadia
raphaelbadia / docker_setup.sh
Last active June 1, 2018 11:14
install docker in goinfre
#!/bin/sh
# sh docker_setup.sh
# from https://gist.github.com/gcamerli/b8cf836f8627cb285f33086db10096a2
# Assuming you’re using zsh and you’ve already installed
# VirtualBox from MSC
LOGIN=$(whoami)
rm -rf ~/.docker
@raphaelbadia
raphaelbadia / transform.ts
Created October 23, 2017 12:27
transform php-api returned json to classes
class Mother {
protected toInt = []
protected toBool = []
protected toObject = []
deserialize(instanceData) {
console.log('mother deserializing ')
const keys = Object.keys(this);
for (const key of keys) {
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">