Skip to content

Instantly share code, notes, and snippets.

View jednano's full-sized avatar
💾
Writing codes

Jed jednano

💾
Writing codes
  • Austin, TX
View GitHub Profile
@Hotell
Hotell / cra-2-ts-css-modules-guide.md
Last active March 25, 2022 16:07
typed css-modules - CRA 2.0

CRA 2.x + TS setup:

This will give you complete intellisense and type safety within your app and CSS modules

typesafe-css-modules

🚨 NOTE

  • refactoring className from ts file wont update your css/scss className, to change class names you have to change it within your .module.scss file
@seansean11
seansean11 / store-types.ts
Last active January 25, 2023 19:03
Using Redux Thunk with Typescript (example)
import { ActionCreator } from 'redux'
import { ThunkAction } from 'redux-thunk'
import { WebService } from 'app/services/WebService'
// Create this reusable type that can be imported into your redux action files
export type ThunkResult<R> = ThunkAction<R, RootState, Services, RootAction>
// Services are only necesarry because we are using
// `reduxThunk.withExtraArgument({ webService }))` when we are creating our store.
export type Services = {
@lixiaoyan
lixiaoyan / entry.js
Last active June 28, 2019 20:33
React 16: ReactDOM.hydrate(...)
import React from "react";
import ReactDOM from "react-dom";
import { AppContainer } from "react-hot-loader";
import App from "./App";
const render = (hydrate = false) => {
const container = document.querySelector("#app");
const element = (
<AppContainer>
@milankorsos
milankorsos / redux-actions.ts
Last active November 10, 2022 10:58
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
export PATH="/usr/local/opt/python/bin:$PATH"
export GPG_TTY=$(tty)
# export START="$HOME/a"
# if [[ $PWD == $HOME ]]; then
# cd $START
# fi
# alias ls='ls -F --color --show-control-chars'
@machty
machty / router.md
Last active December 16, 2015 00:49
The smallest possible router refinement.

Proposal

  1. No longer encourage/allow external calls to a Route's transitionTo method.
  2. Instead, make use of a new routeTo event, with the same semantics as transitionTo, only that it's an event that routes can respond to.
  3. ApplicationRoute will have a default routeTo handler which passes its args to an internal transitionTo.
  4. URL changes will be converted into a routeTo event event.
@aubricus
aubricus / vagrant-ssh.bat
Last active December 12, 2015 03:58
Windows, Vagrant ssh snippet
:: Windows / Vagrant ssh snippet
:: Gotcha: Calling "ssh" from the windows CMD.exe requires Cygwin installed and
:: added to the PATH. This allows me to use the ssh port, but does not
:: require that I run this batch through Cygwin.
:: Notes:
:: The Vagrant convenience "vagrant ssh" doesn't work on windows.
:: One is left to manually ssh into the virtual box, which can be cumbersome.