Skip to content

Instantly share code, notes, and snippets.

View jihchi's full-sized avatar
🦀

Jihchi Lee jihchi

🦀
View GitHub Profile

Pros

  • Usage is simple, you could directly access the config via process.env.NEXT_PUBLIC_*, for example:
// call-site, agents.js
const restaurantApi = axios.createConfig({
 baseUrl: process.env.NEXT_PUBLIC_RESTAURANT_API_URI,
@jihchi
jihchi / deploy_keys.sh
Last active January 20, 2024 13:34
Add new deployment key to BitBucket via API
#!/usr/bin/env bash
set -e
KEY=public-key
LABEL=key123
###
# Method 1. Authenticate by your account & password
###
AUTH=user:password
@jihchi
jihchi / df
Last active December 5, 2020 01:41
123
@jihchi
jihchi / README.md
Last active February 22, 2020 12:21
curl -sSL https://git.io/Jv0mR | sudo bash
@jihchi
jihchi / WithTestId.re
Last active February 8, 2020 06:32
Wordaround -- Allow data-* in DOM elements -- data-test-id for example -- Reason React
[@react.component]
let make = (~id: string, ~children) =>
ReasonReact.cloneElement(children, ~props={"data-test-id": id}, [||]);
/**
AsyncData represents the state of data that is being loaded asynchronously.
This type does not represent failures by default, but it can by using Belt.Result.t as your 'a type.
The reason for this is that not all async data loading mechanisms will necessarily fail.
The other interesting bit is that `Reloading` can be used if you already have data (e.g. an Ok or Error Result),
but you need to reload the data to get a new Result.
*/
@jihchi
jihchi / Lets.re
Last active December 23, 2019 12:11
bs-let / let%Anything utilities and example from https://github.com/notablemind/renm/blob/master/src/utils/Lets.re
// source: https://github.com/notablemind/renm/blob/master/src/utils/Lets.re
module Async = {
type t('a) = Js.Promise.t('a);
let try_ = (promise, continuation) => Js.Promise.catch(continuation, promise);
let let_ = (promise, continuation) =>
Js.Promise.then_(continuation, promise);
let resolve = Js.Promise.resolve;
let reject = Js.Promise.reject;
let map = (promise, fn) => Js.Promise.then_(v => Js.Promise.resolve(fn(v)), promise);
@jihchi
jihchi / vim.sh
Created November 28, 2017 02:51
Compiling vim on Ubuntu 16 with LUA-support
# Remove previous installations
sudo apt-get remove vim vim-runtime vim-tiny vim-common
# Install dependencies
sudo apt-get install libncurses5-dev python-dev libperl-dev ruby-dev liblua5.2-dev
# Fix liblua paths
sudo ln -s /usr/include/lua5.2 /usr/include/lua
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so /usr/local/lib/liblua.so

Keybase proof

I hereby claim:

  • I am jihchi on github.
  • I am jihchi (https://keybase.io/jihchi) on keybase.
  • I have a public key ASDFHIEKvXoeDQ-t-apVDPO7quWLWAQ5XuemgoZsgN9Powo

To claim this, I am signing this object:

@jihchi
jihchi / README.md
Last active September 7, 2016 10:43
Elm with Sublimt Text 3

Elm Language Support

  1. Install Elm Language Support

elm-oracle

  1. npm install -g elm-oracle

elm-format

  1. Install elm-format
  2. To enable automatic formatting on every save, Go to Preferences -> Package Settings -> Elm Language Support -> User and add this setting: "elm_format_on_save": true