Skip to content

Instantly share code, notes, and snippets.

View goforbg's full-sized avatar
🎯
Focusing

Bharadwaj Giridhar goforbg

🎯
Focusing
View GitHub Profile
@goforbg
goforbg / inboxpirates-integration-helper.js
Created January 14, 2024 13:12
Inboxpirates Helper Functions
const htmlToFormattedText = require("html-to-formatted-text");
export const stringToBoolean = (string) => {
if (!string) {
return false;
}
switch (`${string}`?.toLowerCase().trim()) {
@goforbg
goforbg / gist:e72fa18754a2f1456a9f43d87f3f67a9
Created June 21, 2022 04:04
Get Query Params in Next JS without Next JS Router
//https://regex101.com/r/gmICzZ/1
const params = new URLSearchParams(window.location.href.match(/\?.*/)[0]);
const callBackUrl = params?.get("callbackUrl")
@goforbg
goforbg / Embed Youtube Video Circle Bottom Left Tailwind
Last active March 9, 2022 12:34
Embed Youtube Video Circle Bottom Left Tailwind
const [playingDemo, setPlayingDemo] = useState(0)
const [scrollTop, setScrollTop] = useState(0);
const [loaded, setLoaded] = useState(false)
useEffect(() => {
const onScroll = (e) => {
setScrollTop(e.target.documentElement.scrollTop);
@goforbg
goforbg / Sample Docker File to Build Next JS App With Env Variables from Github Secets and Actions
Created March 6, 2022 17:22
Sample Docker File to Build Next JS App With Env Variables from Github Secets and Actions
FROM node:14
ARG FOO=${FOO}
ENV FOO=${FOO}
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
---
name: Build and Push Docker Image to AWS ECR
on:
push:
branches: [ master ]
env:
A_ACCESS: '${{ secrets.A_ACCESS }}'
A_SECRET: '${{ secrets.A_SECRET }}'
FOO: '${{ secrets.FOO }}'
@goforbg
goforbg / Hashicorp-vault-on-aws-ec2-docker-compose
Last active March 30, 2022 09:06
Install docker docker compose and hashicorp vault on AWS EC2
#!/bin/bash
# Purpose: Vault Quick Setup
# Maintainer: DevOps Muhammad Asim
# OS Ubuntu/Amazon_Linux
# https://www.youtube.com/watch?v=TO557f1-Ksk&ab_channel=cloudgeeksinc
# 1. curl # https://gist.githubusercontent.com/goforbg/0abe3264ef082963d6491e28f100549a/raw/56845189cb14f24b7fd70514ca92aa1051706560/Hashicorp-vault-on-aws-ec2-docker-compose -o "vault.sh"
# 2. sudo chmod +x vault.sh
@goforbg
goforbg / form-to-google-sheets-next-js
Created January 10, 2022 06:40
Save formdata automatically onto google spread sheets
// req = HTTP incoming message, res = HTTP server response
export default async function handler(req, res) {
try {
if (req.method === "POST") {
// Process a POST request
if (!req.body) {
return res.status(403).send("Forbidden");
}
if (!req.body.name || !req.body.email) {
return res.status(400).send("Invalid Request");
@goforbg
goforbg / temporary-email-address-domains
Created December 19, 2021 06:32 — forked from adamloving/temporary-email-address-domains
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@goforbg
goforbg / test.ts
Created December 9, 2021 13:42 — forked from ninoseki/test.ts
Send a screenshot (by using puppeteer) to Slack
import request from "request";
import puppeteer from "puppeteer";
const API_URL = "https://slack.com/api/files.upload";
const SLACK_API_TOKEN = process.env.SLACK_API_TOKEN as string;
const CHANNEL = "general";
(async () => {
const url = "http://neverssl.com"
const browser = await puppeteer.launch();
@goforbg
goforbg / terms_of_service.markdown
Created November 8, 2021 15:32 — forked from devver/terms_of_service.markdown
A general Terms of Service under the Creative Commons License

Terms of Service

Last revised on [DATE]

The Gist

[COMPANY] operates the [SERVICE] service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.