Skip to content

Instantly share code, notes, and snippets.

View jslatts's full-sized avatar

Justin Slattery jslatts

View GitHub Profile
@jslatts
jslatts / app.js
Last active December 8, 2019 22:19
Utility to bind selectors to a slice of state. Helpful for keeping things DRY when colocating selectors and reducers
// Example of usage
import { selectors } from './rootReducer';
import { selectors } from '../../reducers/rootReducer';
const mapStateToProps = (state: State, ownProps: any) => ({
theseObjects: selectors.getTheseObjects(state),
thoseObjects: selectors.getThoseObjects(state),
showSomethinginUi: selectors.getSomethingFromUiSelectors(state),
@jslatts
jslatts / ReactConfig.cs
Last active May 17, 2021 05:44
webpack config for React.NET with server side bundle
ReactSiteConfiguration.Configuration.AddScriptWithoutTransform("~/wwwroot/ng-server.bundle.js");
ReactSiteConfiguration.Configuration.JsonSerializerSettings = new Newtonsoft.Json.JsonSerializerSettings
{
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
};
// Don't use slower IE engine
ReactSiteConfiguration.Configuration.AllowMsieEngine = false;
@jslatts
jslatts / requiresToImports.js
Created April 14, 2016 21:35 — forked from dmnd/requiresToImports.js
Converts commonJS requires to es6 imports
// converts commonJS requires to es6 imports
// var foo = require('foo');
// ->
// import foo from 'foo';
//
// jscodeshift -t requiresToImports.js src/**/*.js*
'use strict';
module.exports = function(fileInfo, api) {
var j = api.jscodeshift;
@jslatts
jslatts / keybase.md
Created December 14, 2015 20:58
keybase.md

Keybase proof

I hereby claim:

  • I am jslatts on github.
  • I am jslatts (https://keybase.io/jslatts) on keybase.
  • I have a public key whose fingerprint is BEAC D369 6650 0EA1 E5BD 8E0A BABD ED49 FC7B 0E86

To claim this, I am signing this object:

@jslatts
jslatts / CommentStore.js
Last active August 29, 2015 14:17
Example RefluxJS Store
'use strict';
//External
var Reflux = require('reflux');
//Local
var CommentActions = require('./CommentActions');
var CommentStore = Reflux.createStore({
@jslatts
jslatts / Dockerfile
Last active August 29, 2015 14:05
Dockerfile for node.js app
# Dockerfile to run node app
# VERSION 1 - EDITION 2
# Base image used is Ubuntu 14.04 LTS
FROM ubuntu:14.04
MAINTAINER me
# Install wget
RUN apt-get update && apt-get install -y \
@jslatts
jslatts / user_add.sls
Created April 7, 2014 20:58
SaltStack Custom Python State to Add Users
#!py
def run():
'''
Manage sudo enabled user adds/removes
'''
# temp fix for regression https://github.com/saltstack/salt/issues/7693
if '__pillar__' in globals():
globals()['pillar'] = globals()['__pillar__']
@jslatts
jslatts / gist:8758791
Created February 1, 2014 21:01
config.hdf for drupal + hhvm
Log {
Level = Error
NoSilencer = false
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
Header = false
InjectedStackTrace = true
NativeStackTrace = true
MaxMessagesPerRequest = -1
# error log settings
@jslatts
jslatts / error
Created November 5, 2013 21:57
pillar error
Data failed to compile:
----------
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/state.py", line 2293, in call_highstate
top = self.get_top()
File "/usr/lib/pymodules/python2.7/salt/state.py", line 1880, in get_top
return self.merge_tops(tops)
File "/usr/lib/pymodules/python2.7/salt/state.py", line 1814, in merge_tops
top[env][tgt] = ctop[env][tgt]
TypeError: list indices must be integers, not str
@jslatts
jslatts / example
Last active December 27, 2015 12:19
Desired feature for gitfs + saltstack
Currently we can do this for file system mapping:
file_roots:
base:
- /srv/salt/base
dev:
- /srv/salt/dev
qa:
- /srv/salt/qa
prod: