Skip to content

Instantly share code, notes, and snippets.

View Vikasg7's full-sized avatar
🏠
Working from home

Vikas Gautam Vikasg7

🏠
Working from home
  • Full Time Freelancer
  • India
View GitHub Profile
@Vikasg7
Vikasg7 / UseFulFunctions.vba
Last active June 16, 2022 12:35
ReadTextFile, GetFolder, ExcelToHtml, PathValidator, Wait, Dimensions, RunShellCmdInHidden, FileCount functions in Excel VBA
Function ReadTextFile(ByVal fPath As String)
' A reference to "Microsoft Scripting Runtime library" has to be made before using FileSystemObject.
Dim FSobj As New FileSystemObject
Dim textfile As TextStream
Set textfile = FSobj.GetFile(fPath).OpenAsTextStream(1, -2)
ReadTextFile = textfile.ReadAll
textfile.Close
@Vikasg7
Vikasg7 / double-cola.clj
Last active January 5, 2023 20:44
double-cola kata in Clojure
(ns cola.core)
(def names ["Sheldon" "Leonard" "Penny" "Rajesh" "Howard"])
(defn double-size [[size name]]
[(* 2 size) name])
(def group (map vector (repeat 1) names))
(def groups (lazy-cat group (map double-size groups)))
@Vikasg7
Vikasg7 / repeatLatestOnInterval.js
Last active November 27, 2021 15:04
A custom Rxjs operator that takes the source observable and repeats the latest value on an interval while waiting for the new values to arrive.
// Usage:- https://replit.com/@Vikasg7/repeatLatestOnInterval
// Clojure version:- https://github.com/Vikasg7/clj-snake/blob/main/src/clj_snake/utils.clj
const repeatLatestOnInterval = (delayInMS) => (source) =>
new Observable((observer) => {
let id = null
const next = (value) => {
observer.next(value) // sending downstream
clearTimeout(id)
id = setTimeout(next, delayInMS, value)