Skip to content

Instantly share code, notes, and snippets.

Avatar

Keith Grennan keeth

View GitHub Profile
@keeth
keeth / createWrappedSagaMiddleware.js
Last active Dec 27, 2020
Pre-process (de-batch, filter) actions for redux saga middleware, without affecting the reducers
View createWrappedSagaMiddleware.js
const noop = () => {};
const actionsToIgnore = new Set(['SOME_ACTION', 'SOME_OTHER_ACTION']);
function createWrappedSagaMiddleware() {
const delegate = createSagaMiddleware();
const sagaMiddleware = props => next => {
const actionHandler = delegate(props)(noop);
return action => {
// send to reducers, keep the result
const result = next(action);
@keeth
keeth / release.rb
Created Aug 10, 2016
Programmatically/script release an iOS app with Spaceship
View release.rb
#!/usr/bin/env ruby
require 'spaceship'
Spaceship::Tunes.login(ENV['FASTLANE_USER'], ENV['FASTLANE_PASSWORD'])
app_id = ARGV.shift
if app_id.nil?
abort('Usage: release.rb com.mycompany.myapp')
@keeth
keeth / heartbeat.js
Last active Aug 4, 2016
a better travis_wait (it prints the script output as it comes in, rather than all at the end)
View heartbeat.js
const spawn = require('child_process').spawn;
const command = process.argv[2];
const args = process.argv.slice(3);
const child = spawn(command, args);
console.log(`heartbeat: running command ${command} with args ${args}`);
const heartbeat = setInterval(() => {
console.log('❤️');
}, 1000 * 60);
@keeth
keeth / Select.js
Last active Dec 29, 2017
A formsy-react wrapper around React Select (ES6)
View Select.js
import React from 'react';
import Formsy from 'formsy-react';
import ReactSelect from 'react-select';
import './Select.less';
const Select = React.createClass({
mixins: [Formsy.Mixin],
View rebuild-ssh-config.sh
#!/bin/sh
pushd ~/src/github/ssh-config-aws
bundle exec ./ssh-servers-from-aws.rb spright
./rebuild-ssh-config.sh
popd
View HmacUtil.groovy
package fitt.util
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import java.security.SignatureException
class HmacUtil {
static String hmac(String text, String secret) {
String result
View gulpfile.js
var gulp = require('gulp');
var browserify = require('browserify');
var del = require('del');
var reactify = require('reactify');
var source = require('vinyl-source-stream');
var webserver = require('gulp-webserver');
var less = require('gulp-less');
var path = require('path');
var rename = require('gulp-rename');
var inject = require('gulp-inject');
View main top.sls
base:
'*':
- ssh
- salt
- java
'G@roles:cms':
- match: compound
- cms
# START salt-master bootstrap items
View fabfile.py
from fabric.api import *
import time
def bootstrap_salt_master():
sudo('add-apt-repository ppa:saltstack/salt -y')
sudo('apt-get update -y')
sudo('apt-get install salt-minion -y')
sudo('apt-get install salt-master -y')
sudo('apt-get upgrade -y')
View git_deploy_key.pem
{{ pillar['git_deploy_keys'][repo][type] }}