title | description | author |
---|---|---|
<!-- anti anti click bait --> |
<!-- write with humanity --> |
<!-- whoami/team/squad/personal --> |
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
/** | |
* @param {Number} n | |
* @return {Number} | |
* @example | |
* | |
* reverseNumber(123) // 321 | |
* reverseNumber(212) // 212 | |
* reverseNumber(123456789) // 987654321 | |
*/ | |
const reverseNumber = (input) => { |
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 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
// 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 |
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
/** | |
* 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", |
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
type checkNumber = int; | |
type cardNumber = string; | |
type cardType = | |
| Visa | |
| Mastercard; | |
type creditCardInfo = (cardNumber, cardType); |
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
export const getMaxCallStack = () => { | |
let i=0; | |
function rec(){ | |
i++; rec(); | |
} | |
try {rec();} catch(e){}finally{return i} | |
} |
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
// 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' }, |
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
// 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, | |
}, | |
{ |
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
// 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 |