This is a list of my solutions for Functional Programming Challenge in hackerrank and solved with OCaml.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ini membutuhkan direnv | |
# maka install juga direnv | |
# agar .envrc dapat dijalankan | |
# isi dari .envrc adalah | |
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window: | |
dimensions: | |
columns: 0 | |
lines: 0 | |
padding: | |
x: 0 | |
y: 0 | |
dynamic_padding: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we write Maybe module (stolen from haskell) | |
module Maybe = { | |
type t<'a> = | |
| Just('a) | |
| Nothing | |
let fmap = (x, fn) => | |
switch x { | |
| Just(x) => Just(x->fn) | |
| Nothing => Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = (a, b) => a + b | |
const adds = (...n) => n.reduce(add) | |
const mul = (a, b) => a * b | |
const muls = (...n) => n.reduce(mul) | |
const div = (a, b) => a / b | |
const divs = (...n) => n.reduce(div) | |
const mod = (a, b) => a % b |