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 / RecyclerAdapter.kt
Created May 1, 2020 17:24
Handling scrolls between horizontal Recylerview and horizontal swipeable Viewpager2
val listener = object : OnItemTouchListener {
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
val action = e.action
if (recyclerview.canScrollHorizontally(RecyclerView.FOCUS_FORWARD)) {
when (action) {
MotionEvent.ACTION_MOVE -> rv.parent
.requestDisallowInterceptTouchEvent(true)
}
return false
}
@goforbg
goforbg / App.kt
Created December 13, 2020 07:07 — forked from tinmegali/App.kt
Injecting ViewModel with Dagger2 on Android using Kotlin
class App : Application(), HasActivityInjector {
@Inject lateinit var activityInjector: DispatchingAndroidInjector<Activity>
override fun activityInjector(): AndroidInjector<Activity> {
return activityInjector
}
override fun onCreate() {
super.onCreate()
@goforbg
goforbg / ViewExt.kt
Created February 26, 2021 06:55 — forked from Spikeysanju/ViewExt.kt
A useful extension function to transform EditText into DatePicker 💡
fun TextInputEditText.transformIntoDatePicker(
context: Context,
format: String,
maxDate: Date? = null
) {
isFocusableInTouchMode = false
isClickable = true
isFocusable = false
val myCalendar = Calendar.getInstance()
provider "aws" {
version = "~> 2.0"
region = "eu-west-2"
}
# Providing a reference to our default VPC
resource "aws_default_vpc" "default_vpc" {
}
# Providing a reference to our default subnets
@goforbg
goforbg / react-content-loader-dark-mode-next.js
Created August 21, 2021 04:27
danilowoz/react-content-loader displays a facebook-style skeleton loader. The gist handles color theme for dark and light mode switching when using Next js with useTheme() hook
import React from 'react'
import ContentLoader from 'react-content-loader'
import { useTheme } from 'next-themes'
const SkeletonLoader = (props) => {
const { theme, resolvedTheme } = useTheme()
return (
<div className="flex lg:md:justify-center m-5 items-center">
<ContentLoader
@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.

@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 / 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 / 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 / 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