Skip to content

Instantly share code, notes, and snippets.

View mturley's full-sized avatar

Mike Turley mturley

View GitHub Profile
const getActivePlaybook = task => {
if (!task || !task.options || !task.options.playbooks) return {};
const { options: { playbooks } } = task;
if (playbooks.pre.status === 'Active') return playbooks.pre;
if (playbooks.post.status === 'Active') return playbooks.post;
return {};
};
const playbooksByTaskId = mostRecentTasks.reduce(
(map, task) => ({
@mturley
mturley / nfo-and-nab-example.txt
Created June 27, 2018 22:05
n, i, nfo, nit, np, nip and nab. Fish shell aliases and functions for using npm and grabbing package names super quickly.
~/git > nfo ngnx-local Wed Jun 27 18:01:36 2018
npm ERR! code E404
npm ERR! 404 Not found : ngnx-local
npm ERR! 404
npm ERR! 404 'ngnx-local' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
@mturley
mturley / reducer2.js
Last active June 21, 2018 23:13
Another example of reducer handler functions, arrow function shorthand for immediate return, and helper functions
import {
BLUEPRINTS_FILTER_UPDATE_VALUES,
COMPONENTS_FILTER_UPDATE_VALUES, COMPONENTS_FILTER_ADD_VALUE
} from '../actions/filter';
// const filter = (state = [], action) => {
// switch (action.type) {
// case COMPONENTS_FILTER_ADD_VALUE:
// // ...
// return Object.assign({}, state,
@mturley
mturley / reducer.js
Last active June 21, 2018 23:12
example of reducer handlers in an object
import {
BLUEPRINTS_FILTER_UPDATE_VALUES,
COMPONENTS_FILTER_UPDATE_VALUES, COMPONENTS_FILTER_ADD_VALUE
} from '../actions/filter';
// const filter = (state = [], action) => {
// switch (action.type) {
// case COMPONENTS_FILTER_ADD_VALUE:
// // ...
// return Object.assign({}, state,
@mturley
mturley / Wizard.test.js
Created March 25, 2018 21:00
Merge conflicts in Wizard.test.js
import React from 'react';
import { mount } from 'enzyme';
<<<<<<< modal-wizard
import { Button, Row, Col, Wizard } from '../../index';
=======
import { Row, Col } from 'react-bootstrap';
import { Button } from '../Button';
import { Wizard } from './index';
import {
@mturley
mturley / MyComponent.js
Last active January 9, 2018 17:17
A Higher-Order React Component for Controlled State
import React from 'react';
import PropTypes from 'prop-types';
class MyComponent extends React.Component {
someMethod() {
const { setControlledState } = this.props;
setControlledState({ value: 'New Value' });
}
render() {
const { value } = this.props;
@mturley
mturley / app.js
Created July 15, 2012 23:24
My quick and dirty DOM insertion animation attempt in Meteor
if (Meteor.is_client) {
// ...
var collections = {
Comments : new Meteor.Collection('comments'),
Likes : new Meteor.Collection('likes')
};
// ...
@mturley
mturley / log-excerpt.txt
Created April 17, 2014 03:09
Exception in Enjin Minecraft Plugin
[03:05:51 WARN]: Exception in thread "pool-3-thread-2964"
[03:05:51 WARN]: org.apache.commons.lang.UnhandledException: Plugin EnjinMinecraftPlugin v2.5.6 generated an exception while executing task 9
at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException