Skip to content

Instantly share code, notes, and snippets.

@danhart
danhart / redux-actions.ts
Created July 24, 2018 11:20 — forked from milankorsos/redux-actions.ts
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
};
};
@danhart
danhart / puppet_4_serverless.sh
Last active May 22, 2017 13:39
Puppet 4 Serverless Ubuntu Xenial
# See here for how to create your Puppet 4 repo
# https://github.com/puppetlabs/r10k/blob/master/doc/dynamic-environments/quickstart.mkd#configure-puppet-code-repository
wget http://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt-get update && sudo apt-get install puppet-agent
cd /etc/puppetlabs/code/environments/production && sudo rm -rf *
git clone <your-repo> .
sudo /opt/puppetlabs/puppet/bin/gem install r10k",
sudo /opt/puppetlabs/puppet/bin/r10k puppetfile install
@danhart
danhart / gist:6193895
Last active December 20, 2015 20:59
Find lines matching filenames in a directory
# First argument is the directory containing the filenames you wish to match against for
# Second argument is the directory you wish to search within
# e.g. matching_filenames public/images public/less
# will match against all filenames (recursively) in public/images by searching the public/less directory
# Tested on OS X
# Dependency: Ack
function matching_filenames() {
@danhart
danhart / gist:4270300
Created December 12, 2012 18:29
git show the conflicting commit during a rebase
function show_patch() {
git show $(head -1 .git/rebase-apply/${1} | awk '{ print $2 }')
}