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 / 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
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 / 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()
@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 / 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
}