Skip to content

Instantly share code, notes, and snippets.

View elyobo's full-sized avatar

Liam O'Boyle elyobo

View GitHub Profile
@elyobo
elyobo / react-shallow-compare.js
Created June 12, 2021 00:28
Extract of React's `shallowCompare`
/**
* Extracted React shallowEqual, because it's not exported.
*
* @see https://github.com/facebook/react/issues/16919
* @see https://github.com/facebook/react/blob/master/packages/shared/shallowEqual.js
*/
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
@elyobo
elyobo / reducer-example.js
Last active November 19, 2020 04:58
Example showing how redux reducers are just normal reducers, using the example of summing an array of numbers.
/* eslint-disable */
// Note: requires redux
// Run this and read the comments
const { createStore } = require('redux')
const INITIAL_STATE = 0
const ACTIONS = [
{ type: 'number', value: 1 },
{ type: 'number', value: 2 },

Keybase proof

I hereby claim:

  • I am elyobo on github.
  • I am elyobo (https://keybase.io/elyobo) on keybase.
  • I have a public key ASDDQCkXJgTG3gxkLUjG63GUgqfoYCm3dq_l1MMPUc0zRgo

To claim this, I am signing this object:

<?php
use PHPUnit_Framework_TestCase as BaseTestCase;
class TestFixer extends BaseTestCase
{
public function fix(&$target, $source, $keep = false) {
if (!$source) {
return;
}