This file contains hidden or 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
// JS code from https://stackoverflow.com/a/30522105 | |
/** | |
* Convert number to words. | |
* @param {number} input the number for conversion. | |
* @return number in words. | |
* @customfunction | |
*/ | |
function NUMWORDS(n) { |
This file contains hidden or 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
/** | |
*Direct Link: https://www.hackerrank.com/challenges/ctci-ransom-note/problem | |
*/ | |
function splitTextByReg(magazine, note) { | |
//Split both magazine words & note words by space -> Now we have two arrays | |
//From that arrays, check whether | |
let ransomNote = true; | |
// let magazineArr = magazine.split(" "); | |
// let noteArr = note.split(" "); | |
This file contains hidden or 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 splitTextByReg(text) { | |
let wordArr = text.split(/[\n,]/); | |
return wordArr[Math.floor(Math.random() * wordArr.length)]; | |
} | |
let text = "Basil,Aisd, Blysil" | |
console.log(splitTextByReg(text)); |
This file contains hidden or 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 puppeteer = require("puppeteer"); | |
(async () => { | |
try { | |
//Get the browser instance based on your computer | |
const browser = await puppeteer.launch({ | |
headless: false, | |
executablePath: | |
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", | |
}); |
This file contains hidden or 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
/* | |
10 | |
/ \ | |
4 17 | |
/ \ / \ | |
1 9 12 18 | |
let tree = { | |
"10": { | |
value: "10", |
This file contains hidden or 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
//Merge two sorted arrays into thrid array with O(n+m) | |
var merge = function (nums1, m, nums2, n) { | |
let i = 0, | |
j = 0, | |
k = 0; | |
let arr = []; | |
while (i < m && j < n) { | |
if (nums1[i] < nums2[j]) { | |
arr[k] = nums1[i]; |
This file contains hidden or 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
class Stack { | |
constructor() { | |
this.data = []; | |
} | |
push(val) { | |
this.data.push(val); | |
console.log(this.data) | |
} | |
This file contains hidden or 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
@arr = [1,3,4] | |
@n = 4 | |
@missing_nums = [] | |
(1..@n).each do |i| | |
if !@arr.include?(i) | |
@missing_nums.append(i) | |
end | |
end | |
puts @missing_nums |
This file contains hidden or 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
var url = 'YOUR URL HERE'; | |
function mainFunction() { | |
getAllUseruid(); | |
} | |
function getAllUseruid(){ | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var startRow = 2; |
This file contains hidden or 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
#This is a cron job scheduler wrintten in Google App Script which insert Success and timestamp to Google Sheet if its | |
#successfully fetch the url otherwise it will return Error | |
var sheet = 'Sheet1'; | |
function myFunction() { | |
var url = 'YOUR URL HERE'; | |
var options = { | |
'method': 'get' | |
}; | |
try { |
NewerOlder