If you want to write stateless functions in React and need to combine a number of setState functions to that stateless function.
Enables to compose a number of functions expecting state and props. This enables to reuse functions when needed and
eases testing those functions (as they are standalone and decoupled from React.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://stackoverflow.com/questions/38090023/whats-the-lodash-fp-equivalent-of-ramdas-evolve-function/38425764#38425764 | |
| const mapValuesWithKey = _.mapValues.convert({cap: false}); | |
| function evolve(transformations) { | |
| return item => | |
| mapValuesWithKey((value, key) => { | |
| const transformation = _.getOr(_.identity)(key)(transformations); | |
| const type = typeof transformation; | |
| return type === 'function' ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyWrapper extends React.Component { | |
| componentDidMount() { | |
| this.setState({ | |
| instance: new WhateverIAmWrapping(this.node) | |
| }); | |
| } | |
| render() { | |
| return ( | |
| <div ref={(ref) => this.node } /> | |
| {this.state.instance ? ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| const toPromise = (load) => (new Promise((resolve) => ( | |
| load(resolve) | |
| ))); | |
| class LazilyLoad extends React.Component { | |
| constructor() { | |
| super(...arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function tail($fn) | |
| { | |
| $underCall = false; | |
| $pool = []; | |
| return function (...$args) use (&$fn, &$underCall, &$pool) { | |
| $result = null; | |
| $pool[] = $args; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 101com.com, 101order.com, 123found.com, 180hits.de, 180searchassistant.com, 1x1rank.com, 207.net, 247media.com, 24log.com, 24log.de, 24pm-affiliation.com, 2mdn.net, 2o7.net, 360yield.com, 4affiliate.net, 4d5.net, 50websads.com, 518ad.com, 51yes.com, 600z.com, 777partner.com, 77tracking.com, 7bpeople.com, 7search.com, 99count.com, a-ads.com, a-counter.kiev.ua, a.0day.kiev.ua, a.aproductmsg.com, a.collective-media.net, a.consumer.net, a.mktw.net, a.sakh.com, a.ucoz.net, a.ucoz.ru, a.xanga.com, a32.g.a.yimg.com, aaddzz.com, abacho.net, abc-ads.com, absoluteclickscom.com, abz.com, ac.rnm.ca, accounts.pkr.com.invalid, acsseo.com, actionsplash.com, actualdeals.com, acuityads.com, ad-balancer.at, ad-balancer.net, ad-center.com, ad-images.suntimes.com, ad-pay.de, ad-rotator.com, ad-server.gulasidorna.se, ad-serverparc.nl, ad-souk.com, ad-space.net, ad-tech.com, ad-up.com, ad.100.tbn.ru, ad.71i.de, ad.980x.com, ad.a8.net, ad.abcnews.com, ad.abctv.com, ad.about.com, ad.aboutit.de, ad.aboutwebservices.com, ad.abum.com, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hify from './create-element'; | |
| import React from 'react'; | |
| import { render } from 'react-dom'; | |
| const h = hify(React.createElement.bind(React)); | |
| class Test extends HTMLElement { | |
| static observedAttributes = ['attr'] | |
| attributeChangedCallback (name, oldValue, newValue) { | |
| this.innerHTML = `Hello, ${this.getAttribute('attr')}!`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Simple static proxy trait | |
| * | |
| * Aura DI is used for lazy loading | |
| * | |
| * Set `const PROXY_IDENTIFIER = "SomeClass" in your proxy class, and use this trait. | |
| * | |
| * Call `Some\Proxy\SomeClass::register(new SomeClassInstance)` to have it register the alias. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php declare(strict_types=1); | |
| require_once "✨.🐘"; | |
| ✨($_)->strlen("foo")->var_dump($_); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RUN apt update | |
| RUN apt upgrade -y | |
| RUN apt install -y apt-utils | |
| RUN a2enmod rewrite | |
| RUN apt install -y libmcrypt-dev | |
| RUN docker-php-ext-install mcrypt | |
| RUN apt install -y libicu-dev | |
| RUN docker-php-ext-install -j$(nproc) intl | |
| RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev | |
| RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ |