Skip to content

Instantly share code, notes, and snippets.

@pi0
pi0 / next.config.js
Created March 12, 2021 17:29
Webpackbar with Next.js
const Webpackbar = require('webpackbar')
module.exports = {
webpack: (config, { isServer }) => {
config.plugins.push(new Webpackbar({ name: isServer ? 'server' : 'client' }))
return config
}
}
@jamesfulford
jamesfulford / useLocalStorage.js
Last active December 2, 2021 08:32
useLocalStorage() React Hook (from https://usehooks.com/useLocalStorage/)
import { useState } from "react";
export function useLocalStorage<T>(key: string, initialValue: T): [T, (s: T) => void] {
// State to store our value
// Pass initial state function to useState so logic is only executed once
const [storedValue, setStoredValue] = useState<T>(() => {
try {
// Get from local storage by key
const item = window.localStorage.getItem(key);
// Parse stored json or if none return initialValue
@paul-vd
paul-vd / untrack-git-files.md
Last active February 25, 2021 09:22
This helps untract files previous pushed to repo, and then added to .gitignore

This helps untract files previous pushed to repo, and then added to .gitignore

git rm -r --cached .
git add .
git commit -m "chore: untracked files issue resolved to fix .gitignore"

Here is another example un-tracking files like .env and then removing it from the history

import css from "rollup-plugin-css-porter";
import pkg from "../../package.json";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import path from "path";
import commonjs from "rollup-plugin-commonjs";
import { terser } from "rollup-plugin-terser";
process.env.BABEL_ENV = "production";
process.env.NODE_ENV = "production";
@gjerokrsteski
gjerokrsteski / remove env file from git forever
Last active July 11, 2024 08:40
remove env file from git history forever
echo '.env' >> .gitignore
git rm -r --cached .env
git add .gitignore
git commit -m 'untracking .env'
git push origin master
@jherax
jherax / configure.md
Last active July 27, 2024 22:04
VS Code: Debugging with Jest

VS Code: Debugging Jest

Sometimes, debugging with console.log is not enough to find out what is happening in the code, as console.log prints only plain objects but neither functions nor objects with circular references. Besides, it's possible you may need to know the context and flow of the code.

Read more about debugging with VS Code in VS Code: Debugging.

xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew cask install iterm2
# update iterm2 settings -> colors, keep directory open new shell, keyboard shortcuts
brew install bash # latest version of bash
# set brew bash as default shell
brew install fortune
brew install cowsay
brew install git
@adardesign
adardesign / markdown.md
Created February 21, 2012 18:47
markdown Template

Banner Rotator

Banner rotator on adorama.com

Overview

Requires: jQuery 1.4 and up.

Syntax

Strong and Emphasize

@spudbean
spudbean / gist:1558257
Last active July 18, 2024 20:15
Look of disapproval and other emoticons
ಠ_ಠ
( ͡° ͜ʖ ͡°)
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
http://www.fileformat.info/convert/text/upside-down.htm
WRTTN http://wrttn.me/30dbfd/
Unicode Emoticons