Skip to content

Instantly share code, notes, and snippets.

@jay-babu
jay-babu / fieldVsConstructorInjection.go
Last active July 17, 2022 02:05
Field Vs. Constructor Injection
package main
import (
"net/http"
)
type FieldInjection struct {
foo http.Server
bar http.Server
}
@jay-babu
jay-babu / main.go
Created December 10, 2021 00:14
DI With Interfaces Golang
func main() {
area := ProvideShape()
fmt.Println(area)
}
@jay-babu
jay-babu / injectDependency.go
Created December 5, 2021 06:08
Golang DI Injectors
// Provider
func NewFirebaseApp() *firebase.App {
opt := option.WithCredentialsFile(filename)
app, err := firebase.NewApp(context.Background(), nil, opt)
if err != nil {
log.Fatalf("error initializing app: %v\n", err)
}
return app
}
@jay-babu
jay-babu / basicDependency.go
Last active December 5, 2021 05:26
Golang DI Code Snippets
// Provider
func NewFirebaseApp() *firebase.App {
opt := option.WithCredentialsFile(filename)
app, err := firebase.NewApp(context.Background(), nil, opt)
if err != nil {
log.Fatalf("error initializing app: %v\n", err)
}
return app
}
@jay-babu
jay-babu / createFileInFolder.gs
Last active August 17, 2021 02:00
Create Sheet based on Column
function createFileInFolder(folderId, fileName) {
const folder = DriveApp.getFolderById(folderId)
console.log(folder.getName())
const files = folder.getFilesByName(fileName)
if (files.hasNext()) {
return SpreadsheetApp.open(files.next())
}
const file = SpreadsheetApp.create(fileName)
const copyFile = DriveApp.getFileById(file.getId())
folder.addFile(copyFile)
'Code Created by Sumit Bansal from trumpexcel.com
Sub SplitEachWorksheet()
Dim FPath As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
ws.Copy
Application.ActiveWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Sub Splitdatabycol()
'updateby Extendoffice
Dim lr As Long
Dim ws As Worksheet
Dim vcol, i As Integer
Dim icol As Long
Dim myarr As Variant
Dim title As String
Dim titlerow As Integer
Dim xTRg As Range
@jay-babu
jay-babu / Itachi Mangekyou.json
Created March 7, 2021 19:02
Wallpaper Engine
{
"audiocount": 640,
"audiocount1": null,
"audioprocessing": true,
"autobarsrotate": true,
"autobarsrotatespeed": 3,
"autologorotate": true,
"autologorotatespeed": 10,
"background": null,
"backgroundcolor": "0 0 0",