Skip to content

Instantly share code, notes, and snippets.

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

RiN r17x

🤘
REconciling...
View GitHub Profile
/**
* @param {Number} n
* @return {Number}
* @example
*
* reverseNumber(123) // 321
* reverseNumber(212) // 212
* reverseNumber(123456789) // 987654321
*/
const reverseNumber = (input) => {
@r17x
r17x / .envrc
Created February 7, 2022 14:18
Nix-Shell w/ rust
use nix
@r17x
r17x / math.js
Created July 13, 2021 05:16
HeyTayoo.js
// HEY TAYO HEY TAYO DIA SI FUNGSI NAKAL MELAJU MENGHAJAR
// basic operation {a + b} {a - b} as function
let add = (a, b) => a + b;
let sub = (a, b) => a - b;
// function for add one {a + 1}
let addOne = (b) => add(1, b);
// function for reverse value by length that defined as {a}
// and solve with Math
let reverse = (a, b) => addOne(sub(a, b));
// function for know the maximum value of numbers
/**
* Example `FizzBuzz` with JavaScript (Pattern-Matching Like????????????) λ_(ツ)_/¯
* I Love this tweet
* @see https://twitter.com/cajuinaoverflow/status/1395022027204005889
* JavaScript will make You Crazy (Trust Me!)
*/
const FizzBuzz = n => ({
true: n,
[ n % 5 === 0]: "Buzz",
[ n % 3 === 0]: "Fizz",
@r17x
r17x / Payment.re
Created May 1, 2021 10:15
Payment Case with FP
type checkNumber = int;
type cardNumber = string;
type cardType =
| Visa
| Mastercard;
type creditCardInfo = (cardNumber, cardType);
@r17x
r17x / index.js
Created April 26, 2021 15:34
Measure my Browser callstack
export const getMaxCallStack = () => {
let i=0;
function rec(){
i++; rec();
}
try {rec();} catch(e){}finally{return i}
}
@r17x
r17x / remove-console-log.js
Created April 20, 2021 05:50
[Metaprogramming] Basic with javscript - Remove Console.log code
// remove-consoles.js
// run with command jscodeshift -t remove-consoles.js src/**/*.js
export default (fileInfo, api) => {
const j = api.jscodeshift;
return j(fileInfo.source)
.find(j.CallExpression, {
callee: {
type: 'MemberExpression',
object: { type: 'Identifier', name: 'console' },
@r17x
r17x / array.js
Created April 8, 2021 08:01
I dunno what i'm doing but i know it's just help people
// ISSUE https://www.facebook.com/permalink.php?story_fbid=2923264041231670&id=100006443087773
// we have some data with item is
// { id: number, name: string, jumlahDonasi: number }
const data = [
{
id: 1,
name: "c",
jumlahDonasi: 2000,
},
{
@r17x
r17x / gql-fetch.js
Created March 17, 2021 04:57
Raw Graphql Query in Browser (Pure Javascript)
// UNCOMMENT when run in node
// let fetch = require("node-fetch");
let GQL_URI = "https://api.graphql.jobs/";
let query = `query{
jobs{
title
description
company{
name
title description author
<!-- anti anti click bait -->
<!-- write with humanity -->
<!-- whoami/team/squad/personal -->

Background

Goal