Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mturley's full-sized avatar

Mike Turley mturley

View GitHub Profile
@mturley
mturley / arrow-functions-and-equality.js
Created June 24, 2018 13:20
More ranting about JavaScript for Jenn
/*
Jenn, I was looking back on the github examples I gave you and realized one more thing:
If you didn't know it already, the ES6 arrow function syntax, has two shorthands
the first one I showed in my example already:
*/
const arrowFn = () => { };
const arrowFn = () => { return thing; };
@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 / 1-plexbox-setup-README.md
Last active December 19, 2023 22:07
Ubuntu Server plexbox setup

Start with a fresh Ubuntu Server 16.04 installation. NOTE: In the commands and files below, be sure to replace <yourusername> with your username and <yourgroupname> with your group name (probably the same as your username). Also, replace <yourhostname> with your server's hostname.

Install Dependencies:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list
sudo apt update
@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
@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')
};
// ...