Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Meroket

Adi Hermawan skinnyguy

🚀
Meroket
  • PT. Indocyber Global Technology
  • 127.0.0.1
  • @skinnyguy_
View GitHub Profile
@skinnyguy
skinnyguy / downloadcsv.js
Created Dec 19, 2020
Generated data into csv with papaparse in javascript
View downloadcsv.js
function downloadCSV(csvTitle = "", csvHeader = [], csvData = []) {
// create filename using today unix time
const today = new Date().getTime()
const fileName = "Download-" + today + ".csv";
// Create title for csv
const title = csvTitle || "Download CSV example"
// Add header into first row
csvData.splice(0, 0, csvHeader)
@skinnyguy
skinnyguy / getContrasText.js
Created Apr 27, 2021
Generate contrast text!!!
View getContrasText.js
function setContrastText(hexColor="", isBlackAndWhite=false) {
if (!hexColor) return "black"
if (hexColor.slice(0, 1) === "#") {
hexColor = hexColor.slice(1)
}
if (hexColor.length === 3) {
hexColor = hexColor.repeat(2)
}