Skip to content

Instantly share code, notes, and snippets.

View davidkpiano's full-sized avatar
🎹
Working on XState Dev Tools

David Khourshid davidkpiano

🎹
Working on XState Dev Tools
View GitHub Profile
@tomhodgins
tomhodgins / useful-tests.js
Last active November 3, 2017 17:23
Useful Tests for JS-powered Styling
/* Useful Tests for JS-powered Styling */
/* ELEMENT QUERIES */
// Width-based tests
el => el.offsetWidth < 500 // less than 500px wide
el => el.offsetWidth <= 500 // less or equal to 500px wide
el => el.offsetWidth == 500 // 500px wide
el => el.offsetWidth >= 500 // greater or equal to 500px wide
el => el.offsetWidth > 500 // greater than 500px wide
import React from "react"
import { Machine } from "xstate"
const createMachineComponent = chart => Comp => {
const machine = Machine(chart)
return class Machine extends React.Component {
state = {
state: machine.getInitialState()
}
import React from 'react'
import { Machine } from 'xstate'
const createMachineComponent = chart => Comp => {
const machine = Machine(chart)
return class extends React.Component {
state = {
state: machine.getInitialState(),
data: {}
@acdlite
acdlite / coordinating-async-react.md
Last active June 17, 2024 11:56
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

@okonet
okonet / lightning_talk_proposal.md
Last active April 10, 2018 10:09
Make linting great again! -- ReactiveConf 2017 ⚡️talk proposal

Please 🌟 this gist to vote for this proposal!

Make linting great again!

tabs vs spaces

No other topic in software development probably has so much controversy as linting.

With a wrong workflow linting can be really a pain and will slow you and your team down. With a proper setup, though, it can save you hours of manual work reformatting the code and reducing the code-review overhead.

@kitten
kitten / reactiveconf-sc-cfp.md
Last active November 17, 2020 15:06
ReactiveConf 2017 Lightning Talk CFP: With styled-components into the future

styled-components Logo

With styled-components into the future

Preprocessing is dead, long live preprocessing!


This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐ star this gist. #ReactiveConf

@conorhastings
conorhastings / state-component.js
Last active March 30, 2017 20:36
you can enact most of the behavior of redux with a simple component
/* this lacks subscribe behavior or ability to dispatch from outside of component tree but that is generally not neccesary */
class State extends React.Component {
constructor(props) {
super(props);
this.state = YOUR_INITIAL_STATE;
}
reducer = (action, state, props) => {...newState};
/* setState takes an object of new state as first arg or a function of props and state that returns new state
* which we will use here
* we pass dispatch around and use it similarly to redux dispatch
@AmeliaBR
AmeliaBR / svg-tips-tricks-notes.md
Last active October 20, 2023 02:55
SVG Tips and Tricks (presentation at SVG Summit 2017)
@srdjan
srdjan / 100+ different counter apps...
Last active May 6, 2024 05:13
100+ different js counter apps...
100+ different js counter apps...