Skip to content

Instantly share code, notes, and snippets.

View nikkanetiya's full-sized avatar

Nikunj Kanetiya nikkanetiya

View GitHub Profile
@nikkanetiya
nikkanetiya / blue-theme.css
Last active October 16, 2024 20:36
GHL-Theme
:root {
--sidebar-bg-color: #0c2d3f;
--sidebar-parent-active-li-bg-color: rgba(24, 139, 246, .1);
--sidebar-li-color: #ffffff;
--sidebar-collapse-li-bg-color: #103855;
--custom-link-color: #38a0db;
--custom-primary: rgb(56, 160, 219);
--custom-primary-border-color: rgba(24, 139, 246, .1);
--custom-yellow-color: #ff6600;
--custom-yellow-active: #ff9900;
@nikkanetiya
nikkanetiya / freshconnect.js
Created July 2, 2020 13:47
How to use freshchat script inside GHL
const freshChatToken = "<token-here>"; // Please update your token here
function clientInitFreshChat() {
window.fcWidget.init({
token: freshChatToken,
host: 'https://wchat.freshchat.com',
config: {
headerProperty: {
hideChatButton: true
}
@nikkanetiya
nikkanetiya / queries.ts
Last active February 18, 2022 11:59
Slow Query Logging
// firestoreFetchSingle - This is our logger and timer function which will log if the fetch took more than 60 seconds to return the result
// locations - fetch document by id
public static getById(id): Promise<Location> {
return new Promise<Location>(async(resolve, reject) => {
try {
const snapshot = await firestoreFetchSingle(Location.collectionRef().doc(id), 'location', id)
if (!snapshot.exists) return reject("location not found");
const doc = new Location(snapshot);
@nikkanetiya
nikkanetiya / EmailSender.js
Last active March 18, 2023 13:27
Email Sending With Rate per account rate limit with PubSub, Cloud Task
class EmailSender {
constructor(rateLimiter, projectId, queueLocation, queueName) {
this.rateLimiter = rateLimiter;
this.projectId = projectId;
this.queueLocation = queueLocation;
this.queueName = queueName;
}
async sendEmailWithRateLimit(from, to, subject, body, accountId, maxMessages, windowMs) {
const key = `${accountId}_email_rate_limit`;