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
let arr = [1,2,3,4,5,6]; | |
let start = 0; | |
let end = arr.length - 1; | |
while (start < end) { | |
let temp = arr[start]; | |
arr[start] = arr[end]; | |
arr[end] = temp; | |
start++; | |
end--; |
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
for file in *.jpg; do cwebp -q 80 "$file" -o "${file%.jpg}.webp"; done |
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
cwebp -preset picture -q 80 d:\source-images-original\1.jpg -o d:\source-images-result\1.webp |
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
import React, { useRef } from "react"; | |
import Select from "react-select"; | |
export default function App() { | |
const selectInputRef = useRef(); | |
const onClear = () => { | |
selectInputRef.current.select.clearValue(); | |
}; |
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
// library pdfMake | |
import pdfMake from "pdfmake/build/pdfmake"; | |
import pdfFonts from "pdfmake/build/vfs_fonts"; | |
pdfMake.vfs = pdfFonts.pdfMake.vfs; | |
// document definition | |
let docDefinition = { | |
content: [{ | |
text: 'Report Goods Receive', | |
style: 'header' |
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
let dataProps = [{ | |
"id": 1, | |
"mat_doc": "5000001724", | |
"mat_doc_year": 2020, | |
"mat_doc_item": 1, | |
"ref_doc_num": "SJ1234567892", | |
"header_text": null, | |
"posting_date": "2020-08-09T17:00:00.000Z", | |
"doc_date": "2020-08-09T17:00:00.000Z", | |
"move_type": "101", |
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
/** | |
* Risyandi - 2021 | |
* how to create increment to triple number. | |
* first we have value from looping with initial duplicate 3. | |
* and the expected result like this : | |
* 111 222 333 | |
* 111 222 333 | |
* 111 222 333 | |
* 444 555 666 | |
* 444 555 666 |
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
/** | |
* Risyandi - 2022 | |
* how to create string to encode : | |
* first we have a data array as input | |
* for the example : [a, a, b, b, b, c, c] | |
* and for the expected result should be appear like this | |
* for the expected result : a2b3c2 | |
*/ | |
function stringEncode(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
function cekFunction(value) { | |
let length = value.split(" ").length; | |
let dimension = ""; | |
if (length <= 2) { | |
dimension = value.split(" ").length > 1 ? value.split(" ")[0] : ""; | |
} else { | |
dimension = value.split(" ").length > 1 ? value.split(" ")[1] : ""; | |
} | |
let dimensionValue = dimension.split("x").length > 1 ? dimension.split("x") : []; | |
let volume = dimensionValue.length > 1 ? parseFloat(dimensionValue[0]) * parseFloat(dimensionValue[1]) * parseFloat(dimensionValue[2]) : 0; |
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
let string = "A man, a plan, a canal: Panama"; | |
function palindromeTwo(alphabet) { | |
alphabet = alphabet.replace(/[^a-z0-9]/gi, "").toLowerCase(); | |
let reverse = alphabet.split("").reverse().join(""); | |
return alphabet === reverse; | |
} | |
palindromeTwo(string); |