Skip to content

Instantly share code, notes, and snippets.

View AkashBabu's full-sized avatar
💭
busy writing js

Akash Babu AkashBabu

💭
busy writing js
  • Bangalore, Karnataka, India
View GitHub Profile
@AkashBabu
AkashBabu / fastio.go
Created November 5, 2018 09:46
Fast IO for scanning input via STDIn for competitive programming in Golang
/**
* This snippet assumes large input and large output and that all the input contains numbers in the form of string
*/
package main
import (
"bufio"
"io/ioutil"
"os"
@AkashBabu
AkashBabu / asyncLoop.js
Last active May 16, 2018 10:15
Executing Async loop in sequence using Generator Functions in NodeJS
function* generatorFn(arr = [], asyncFn) {
for(let item of arr) {
// Alter this function according to your needs.
// Also note that the below code would remain the same even in case of async-await functions
yield asyncFn(item)
}
}
async function execSequentially(arr, asyncFn) {
let gen = generatorFn(arr, asyncFn)