Skip to content

Instantly share code, notes, and snippets.

View seansean11's full-sized avatar

Sean Michael seansean11

View GitHub Profile
@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 = {
// ES6 PROMISE CHAIN //
exports.seed = (knex) =>
knex('user_role').del()
.then(() => knex.insert(data.user_roles).into('user_role'))
.then(() => knex('user_address').del())
.then(() => knex.insert(data.user_addresses).into('user_address'))
.then(() => knex('user').del())
.then(() => knex.insert(data.users).into('user'));
@seansean11
seansean11 / .vimrc
Last active January 14, 2016 01:20
.vimrc
set nocompatible " required
filetype off " required
" Enable syntax highlighting
set number
" Allow backspacing in insert mode
set backspace=2
" Highlight all search results
@seansean11
seansean11 / .gitignore
Last active May 1, 2017 18:40
.gitignore for WordPress themes
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
# Ignore those unneeded sass-cache + node_modules files.
.sass-cache
.sass-cache/*
node_modules/
Undo previous commit
`git revert HEAD^`
Modify previous commit message
`git commit --amend`
Temporarily stash changes
`git stash`
Restore changes from stash