Skip to content

Instantly share code, notes, and snippets.

Avatar

Liam O'Boyle elyobo

View GitHub Profile
@elyobo
elyobo / react-shallow-compare.js
Created Jun 12, 2021
Extract of React's `shallowCompare`
View react-shallow-compare.js
/**
* 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 Nov 19, 2020
Example showing how redux reducers are just normal reducers, using the example of summing an array of numbers.
View reducer-example.js
/* 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 },
View keybase.md

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:

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