Skip to content

Instantly share code, notes, and snippets.

View straybro's full-sized avatar
🐢
418 I'm a teapot

straybro straybro

🐢
418 I'm a teapot
View GitHub Profile
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:promise/recommended",
"plugin:sonarjs/recommended",
@pmurzakov
pmurzakov / Badoo PHP Russia 2019 talk.md
Last active September 10, 2021 22:01
Badoo PHP performance -- useful links and snippets -- PHP Russia 2019 talk
@busypeoples
busypeoples / InferProps.tsx
Created March 9, 2019 22:50
Infer Props using PropTypes.InferProps
import React from "react";
import { render } from "react-dom";
import PropTypes from "prop-types";
// Using PropTypes.InferProps
type InferPropTypes<
PropTypes,
DefaultProps = {},
Props = PropTypes.InferProps<PropTypes>
@jamesreggio
jamesreggio / react-forwardref-simple-example.js
Last active January 8, 2023 21:40
Simple example usage of React.forwardRef()
// EmailInput wraps an HTML `input` and adds some app-specific styling.
const EmailInput = React.forwardRef((props, ref) => (
<input ref={ref} {...props} type="email" className="AppEmailInput" />
));
class App extends Component {
emailRef = React.createRef();
render() {
return (
@jedwards1211
jedwards1211 / Match.js
Last active November 3, 2017 14:01
Power <Match> for react-router v4
import React, { PropTypes } from 'react'
import MatchProvider from 'react-router/MatchProvider'
import matchPattern from 'react-router/matchPattern'
import { LocationSubscriber } from 'react-router/Broadcasts'
class RegisterMatch extends React.Component<void, RegisterMatchProps, void> {
static contextTypes = {
match: PropTypes.object,
serverRouter: PropTypes.object
}
@bisubus
bisubus / ES5-ES6-ES2017-ES2019 omit & pick
Last active April 13, 2024 21:03
ES5/ES6/ES2017/ES2019 omit & pick
@mkusher
mkusher / Getstarted.md
Last active November 6, 2022 09:50
Лонгрид для новичков чата php

Введение

Этот текст о том, с чего начать прежде чем писать в https://telegram.me/prophp7

Правила

  1. Тема чата - php и связанное с ним. Оффтоп не приветствуется
  2. Общение стикерами оставьте для флудилок
@markerikson
markerikson / acemarke-jravaj-connect-discussion.md
Last active February 15, 2020 11:10
Reactiflux #redux discussion: top-down single connect vs multiple lower connects

May 12, 2016

[8:23 PM] jrajav:: Heya. I'm wondering what the function of components really are. Just don't fully understand - why not just pass in the state with something like store.subscribe( () => render( , document.getElementById('root') ) ) ?

[8:24 PM] jrajav:: Passing in dispatch functions as well

[8:24 PM] jrajav:: Then, split apart the state as appropriate further down for each subcomponent

[8:25 PM] jrajav:: If all of the components are pure, stateless functional components this approach should still be just as performant, right?

@ShirtlessKirk
ShirtlessKirk / event.js
Created October 30, 2015 15:31
Event polyfill for IE < 9 plus DOMContentLoaded, Custom Events (with fix for IE9 - 11)
/**
* Polyfill of .addEventListener, .removeEventListener, DOMContentLoaded for IE < 9
* CustomEvent for IE < 9
* Monkey patch custom event for IE9 - 11
*/
/*global define: false, module: false */
/*jslint bitwise: true, forin: true, sloppy: true */
(function eventModule(global, definition) { // non-exporting module magic dance
'use strict';
@JeffreyWay
JeffreyWay / PjaxMiddleware.php
Last active February 24, 2024 13:40
Laravel middleware for working with pjax.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Symfony\Component\DomCrawler\Crawler;
class PjaxMiddleware