Skip to content

Instantly share code, notes, and snippets.

View r17x's full-sized avatar
🤘
REconciling...

RiN r17x

🤘
REconciling...
View GitHub Profile
@r17x
r17x / promise101.md
Created January 7, 2024 14:24
Promise101

Promise is Like a MONAD but Never be a MONAD

// same thing: f(x)
const apply = (x, f) => f(x)

const touch = (f) => (x) => {
  apply(x, f)
  return x
}
@r17x
r17x / obs-youtube-chat.css
Created November 15, 2023 15:08
Live Chat Transparent
.style-scope yt-live-chat-renderer {
background-color: rgb(0, 0, 0, 0);
}
#items.yt-live-chat-item-list-renderer > *.yt-live-chat-item-list-renderer {
background-color: rgb(0, 0, 0, 0);
}
.yt-live-chat-text-message-renderer {
@r17x
r17x / p.js
Created October 30, 2023 12:33
Promise!01!
const _data = (data) => ({ error: null, data })
const _error = (error) => ({ data: null, error })
const mapError = f => ({ error, data }) => ({ error: f(error), data })
const mapData = f => ({ error, data }) => ({ data: f(data), error })
const promiseMapData = f => p => p.then(f)
const promiseMapError = f => p => p.catch(f)
const promiseMe = (p) => pipe(
@r17x
r17x / nginx_validation_jwt.lua
Created September 7, 2023 14:41
Nginx Validation JWT
access_by_lua_block {
local http = require "resty.http"
local httpc = http.new()
-- Fetch the JWT token from Authorization header
local auth_header = ngx.var.http_Authorization
if auth_header then
local _, jwt_token = auth_header:find("Bearer%s+(.+)")
if jwt_token then
-- Perform subrequest to your API endpoint for token validation
@r17x
r17x / a.md
Last active August 5, 2023 14:59
Hackerrank Functional Programming Challenge w/ OCaml
@r17x
r17x / hosts
Created January 6, 2020 10:50
UNBLOCK-everything
# Static table lookup for hostnames.
# See hosts(5) for details
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
# [OPENLOAD.CO]
104.16.166.50 openload.co www.openload.co
104.16.165.50 t1.openload.co
104.16.164.50 tt1.openload.co
104.16.164.50 api.openload.co
# ini membutuhkan direnv
# maka install juga direnv
# agar .envrc dapat dijalankan
# isi dari .envrc adalah
use nix
@r17x
r17x / ComponentFlyHigh.js
Last active December 2, 2022 22:13
HOF (High order fly => Function) x HOC (High Order Component)
import YourComponent from 'your/path/Component'
/**
* @name ComponentFly
* @param {ReactElement} Component
* @param {function} reduceParam
* @return {ReactElement}
* @example
* const ComponentFlying = ComponentFly(YourComponent)(reduceParam)
* Array.map(ComponentFlying)
*/
@r17x
r17x / alacritty.yaml
Created June 29, 2022 05:57
alacritty.yaml
window:
dimensions:
columns: 0
lines: 0
padding:
x: 0
y: 0
dynamic_padding: false
@r17x
r17x / .envrc
Last active June 19, 2022 17:47
per project flakes.
use flake