Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
# Script to setup a Next.js application with Typescript, Storybook, SCSS and Jest
# Inspired by https://medium.com/swlh/2020-complete-setup-for-storybook-nextjs-typescript-scss-and-jest-1c9ce41e6481
# After this script is executed, manually add the following lines to package.json scripts section:
# "test": "jest",
# "test:watch": "jest --watch",
# "test:coverage": "jest --coverage",
@jherax
jherax / configure.md
Last active June 13, 2024 18:10
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.

I bundled these up into groups and wrote some thoughts about why I ask them!

If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email carl.vitullo@gmail.com

Onboarding and the workplace

https://blog.vcarl.com/interview-questions-onboarding-workplace/

  • How long will it take to deploy my first change? To become productive? To understand the codebase?
  • What kind of equipment will I be provided? Will the company pay/reimburse me if I want something specific?
@1st
1st / intro.md
Last active February 10, 2020 07:54
NPM watcher that helps to access data in the linked directory

Linking directory in ReactJS project

I found that users of Create-React-App script have issues with building few projects that are based on the same "core" library. Let's imagine that you have a ui directory where you keep all UI React components. And you have two projects - blog and shop.

Now you wish to use the shared UI components in both these projects. But if you will create a symlink to a "raw" source code (where you use ES2015) - you will see that your code can't be imported, because it expects that they should be already compiled.

@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@yelouafi
yelouafi / SimpleSagaMiddleware.html
Last active March 12, 2017 10:57
A simplified implementation of redux-saga middleware
<!doctype html>
<html lang="en">
<body>
<script>
const sagaMiddleware = store => gen => {
var resolve, reject
var done = new Promise((res, rej) => {
resolve = res
@mars
mars / create-react-app-on-heroku.sh
Created July 29, 2016 01:12
Create a React app & deploy to Heroku
## Global install of the app generator
npm install -g create-react-app
## Setup the app (first-time only)
create-react-app my-app
cd my-app
git init
# Create the Heroku app; requires free account at https://www.heroku.com/
heroku create -b https://github.com/heroku/heroku-buildpack-static.git
@carbureted
carbureted / react-native-pouchdb.js
Last active January 9, 2016 19:49
Untested and somewhat ugly way to run pouchdb on react-native
/*
I just got a hacky, untested instance of pouchdb running on my
react-native IOS simulator five minutes ago. To do so, I installed
https://github.com/andpor/react-native-sqlite-storage and then pretended that it
was actually https://github.com/litehelpers/Cordova-sqlite-storage. This is
probably broken in some horribly subtle way, but the APIs I've manually tested
seem to work. Use very much at your own risk, and let me know how it goes.
I'm kind of shocked somebody hasn't come up with any other working solution, since
pouchdb and react-native are a perfect fit and there seems to be tons of demand.
*/
@monicao
monicao / react.md
Last active February 23, 2021 19:07
React Lifecycle Cheatsheet

React Component Lifecycle

  • getInitialState
  • getDefaultProps
  • componentWillMount
  • componentDidMount
  • shouldComponentUpdate (Update only)
  • componentWillUpdate (Update only)
  • componentWillReceiveProps (Update only)
  • render
@jancassio
jancassio / Dispatcher.js
Last active May 16, 2016 18:28
JavaScript Dispatcher
/**
* Dispatcher
* Author: Jan Cassio <hey@jancassio.com>
*
* A small event dispacher helper for general usage.
*/
var Dispatcher = {
events: {},
/**
* Emit an event that can be handled by subscribed handlers.