Skip to content

Instantly share code, notes, and snippets.

View nikhilbhatt's full-sized avatar
🎯
Focusing

Nikhil Bhatt nikhilbhatt

🎯
Focusing
View GitHub Profile
@nikhilbhatt
nikhilbhatt / connector.rb
Last active March 8, 2025 18:08
Rake runner
module TaskDbConnector
module Connector
def self.task_runner(block, params = {})
if params[:tenant].blank?
db_configs = db_configurations
if db_configs.is_a?(Hash) && db_configs.values.first.is_a?(String)
# Single database case
run_rake(block, params.merge(tenant: Rails.env))
else
@nikhilbhatt
nikhilbhatt / Email Cleaner
Created April 29, 2023 19:18
Google App Script to Delete emails permanently
function searchMails(searchQuery) {
return GmailApp.search(searchQuery, 0, 100);
}
function moveEmailsToTrash(emailThread) {
emailThread.moveToTrash();
}
function deleteEmailsPermanently(emailThread) {
Gmail.Users.Threads.remove('me', emailThread.getId());
@nikhilbhatt
nikhilbhatt / gsscript
Created November 19, 2022 20:17
App script code to create API from google sheets
function doGet(req) {
let spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
let personalDetails = spreadsheet.getSheetByName('personal-details'); //sheet name is personal-details
let personalDetailsValues = personalDetails.getDataRange().getValues(); //reading the sheet data(2D array of sheet data)
/*
personalDetailsValues output
[ [ 'First Name', 'Nikhil' ],
[ 'Last Name', 'Bhatt' ],
[ 'Email', 'nikhilbhatt931@gmail.com' ] ]
@nikhilbhatt
nikhilbhatt / bookmarks_code.txt
Last active December 7, 2025 10:30
Skip You Tube Ad script
javascript:(function(){setInterval(()=>{const skipButton = document.querySelector('.ytp-ad-skip-button'); const adOverlay= document.querySelector('.ytp-ad-overlay-close-container'); if(adOverlay !=undefined) adOverlay.click(); if(skipButton != undefined) skipButton.click();}, 2000)})();