Skip to content

Instantly share code, notes, and snippets.

View skolhustick's full-sized avatar

eshwarenm skolhustick

View GitHub Profile
//tailwind.config.js
module.exports = {
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
@skolhustick
skolhustick / read_athena_node.js
Last active June 23, 2021 17:31
Read from Athena using Node.js
/* Based on https://docs.aws.amazon.com/code-samples/latest/catalog/javascript-athena-index.js.html */
const _ = require('lodash')
const Queue = require('async/queue')
const AWS = require('aws-sdk')
require('dotenv').config()
AWS.config.update({
region: process.env.AWS_REGION,
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
@skolhustick
skolhustick / add_data_to_stream.js
Last active June 23, 2021 17:30
Add data to AWS Kinesis Data Stream with Node.js
const AWS = require('aws-sdk')
require('dotenv').config()
// Configure AWS SDK with the credentials created before
// You should probably use a .env file for this
AWS.config.update({
region: process.env.AWS_REGION,
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
})
@skolhustick
skolhustick / App.js
Created May 25, 2020 07:55
ChakraUI - Login Form with ColorMode
import React from 'react'
import {
ThemeProvider,
theme,
ColorModeProvider,
CSSReset,
Box,
Flex,
IconButton,
useColorMode,
@skolhustick
skolhustick / index.js
Created February 22, 2020 14:41
NextJS styled-components index.js
import React from 'react'
import Button from '../components/Button'
const Home = () => {
return <Button>Theme Test</Button>
}
export default Home
@skolhustick
skolhustick / _app.js
Created February 22, 2020 14:28
NextJS styled-components _app.js
import React, { useState, useEffect } from 'react'
import useDarkMode from 'use-dark-mode'
import { ThemeProvider } from 'styled-components'
import { lightTheme, darkTheme } from '../theme'
const MyApp = ({ Component, pageProps }) => {
const [isMounted, setIsMounted] = useState(false)
const darkMode = useDarkMode(true)
const theme = darkMode.value ? darkTheme : lightTheme
@skolhustick
skolhustick / Button.js
Created February 22, 2020 14:22
NextJS styled-components example component
import styled from 'styled-components'
const Button = styled.button`
background: ${props => props.theme.bg};
color: ${props => props.theme.fontColor};
`
Button.defaultProps = {
theme: {
bg: 'white',
@skolhustick
skolhustick / theme.js
Last active February 22, 2020 14:16
NextJS styled-components theme file
const light = {
bg: 'white',
fontColor: 'purple'
}
const dark = {
bg: 'black',
fontColor: 'white'
}
@skolhustick
skolhustick / Button.js
Created February 22, 2020 14:14
NextJS Dark Theme
import styled from 'styled-components'
const Button = styled.button`
background: ${props => props.theme.bg.primary};
color: ${props => props.theme.fontColor};
`
Button.defaultProps = {
theme: {
bg: 'white',
@skolhustick
skolhustick / nav.js
Created February 15, 2020 10:12
next-js-pwa-nav-js-metatags
import React from 'react'
import Link from 'next/link'
import Head from 'next/head'
const links = [
{ href: 'https://zeit.co/now', label: 'ZEIT' },
{ href: 'https://github.com/zeit/next.js', label: 'GitHub' }
].map(link => ({
...link,
key: `nav-link-${link.href}-${link.label}`