Skip to content

Instantly share code, notes, and snippets.

View kpunith8's full-sized avatar
🏠
Working from home

Punith K kpunith8

🏠
Working from home
View GitHub Profile
@kpunith8
kpunith8 / mac-issues-and-fixes.md
Last active September 17, 2021 10:47
Mac BigSur issues and fixes

Fixing error: “app_name” cannot be opened because the developer cannot be verified.

  • Check where the app is installed
$ which app_name
  • Lift the quarantine for the app name binary Now you need to tell Mac OS to trust this binary by lifting the quarantine. Do this by the following terminal command
@kpunith8
kpunith8 / app.js
Last active October 10, 2023 03:17
Using query and route params with useContext() Hook
import React, {useState} from 'react'
import RouteContext, {EMPTY_ROUTE} from './route-context'
const App = props => {
const [route, setRoute] = useState(EMPTY_ROUTE)
useEffect(() => {
// Logic to update the setRoute() based on the current route
// route object has params and query keys, update them accordingly
// or pass setRoute setter as vlaue to th Provider
@kpunith8
kpunith8 / discord-bot.md
Last active March 1, 2021 14:14
NodeJS Discord Bot

Creating a BOT in Discord

  • Create an application https://discord.com/developers/applications/

  • Once an app created, go to Bot section and add one bot with a type bot

  • Once Bot created copy the Token which is a secret and please don't share it with anyone, needed to connect to the Bot using API

  • Authorize the bot to be attached to your discord server, make sure you have created a Server in https://discord.com

@kpunith8
kpunith8 / phishing.md
Last active February 3, 2021 15:45
Cyber security info
  • Fisrt look at the url and make sure it has, https in it or a lock 🔒 symbol in the address bar when you click it
  • If you open the link and it takes you to multiple links not the one you intended to see as it was described in the message
  • If it asks for any camera or contact permission, I will not continue opening it
  • If the link asks you to share the message immediately opening the link it's definitely bogus link though it may be secure one but people trying to establish their online presence through fake images like gold and money as a link image
  • Most of the legitimate websites or online services will never ask you to sign up or login or share immediately. They will have a product info and info like that
  • There are lot of ways to identify whether it's a fake or not, I would look at the above as basic measures for most of the people
  • And to all of you browse web day in dayout, I would recommend you to use Brave browser
  • It blocks lot of malicious links and ads and trackers so that you are privacy i
@kpunith8
kpunith8 / exchange-rate.jsx
Last active January 19, 2021 16:55
React-Redux with hooks
import React, {useEffect} from 'react'
import {useSelector, useDispatch} from 'react-redux'
import {getAmount, changeAmount, changeCurrencyCode, getCurrencyCode} from './store'
const ExchangeRate = () => {
const amount = useSelector(getAmount) // or write inline selector, state => state.rates.amount
const code = useSelector(getCurrencyCode)
const dispatch = useDispatch()
const onAmountChange = e => dispatch(changeAmount(e.target.value)) // or write inline dispatch, {type: CHANGE_AMOUNT, payload: e.target.value}
@kpunith8
kpunith8 / git-tips.md
Created January 19, 2021 09:57
Git tips
@kpunith8
kpunith8 / problem.js
Created November 11, 2020 10:49
Finddem Problem to find the total experience of an employee
const _ = require('lodash')
const condidateProfile = {
experience: [
{
company: 'ABC',
startDate: 2020,
present: true
},
// {
@kpunith8
kpunith8 / index.js
Last active July 10, 2020 11:07
Execute js code from gist in a terminal using npx
#!/usr/bin/env node
function helloThere(name) {
console.log('Hi,', name)
}
helloThere('Punith K')
/* Padding to the hover effect without adding padding to the original element */
':hover': {
background: gray,
cursor: 'pointer',
width: 240px, /* Can be dynamic */
padding: '0 10px',
margin-left: -10px,
},
@kpunith8
kpunith8 / Container.js
Last active June 16, 2020 12:53
Sticky Nav Bar - In react with css module using gastby
import React from "react"
import containerStyles from "./container.module.css"
const Container = ({ children }) => {
return <div className={containerStyles.container}>{children}</div>
}
export default Container