Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
Working on something exciting

Alexey Raspopov alexeyraspopov

✍️
Working on something exciting
View GitHub Profile
View build.mjs
////////////////////////////////////////////////////////////////////////////////
// Create a directory called "pages" next to
// this file, put markdown files in there, and
// then run:
//
// ```
// $ node build.mjs
// ```
//
// Then deploy the "build" directory somewhere.
@bvaughn
bvaughn / useSubscription-and-useMutableSource.md
Last active Dec 4, 2020
`useSubscription` and `useMutableSource` tearing and deopt behavior.
View useSubscription-and-useMutableSource.md

useSubscription and useMutableSource1 tearing and deopt behavior.

Mounting a new tree

The tree below represents a React application mounting. During mount, two components read from an external, mutable source. The first one (List) reads version 1 of that data and the second one (Item) reads version 2.

Deopt

useSubscription (legacy mode)

N/A.

View Infrastructure.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@malyw
malyw / index.js
Last active Jan 27, 2021
Capture DOM element screenshot using Chrome headless
View index.js
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
View system-sans-serif-fonts.css
body {
font-family:
-apple-system,
system-ui,
BlinkMacSystemFont,
"Segoe UI",
"Roboto",
"Noto Sans",
"Ubuntu",
"Droid Sans",
@A-gambit
A-gambit / ReactiveConf2017.md
Last active Mar 24, 2020
Proposal for lightning talk at ReactiveConf 2017: How do you make friends with React and FRP? 🤔 Start to develop your application using Focal.
View ReactiveConf2017.md

How do you make friends with React and FRP? 🤔 Start to develop your application using Focal.

This is a CFP for the ⚡️Lightning⚡️ talk at awesome ReactiveConf 2017. If you'd like to see this talk, please 🌟 star🌟 this summary and retweet my tweet 🙂 #ReactiveConf

image

Functional reactive programming (FRP) is very popular nowadays. The JavaScript community provides us with excellent tools like RxJS, Bacon, and Kefir. But, as we know, they have nothing to do with React. So how we can use the power of FRP in our React application? Using the correct state management, we can make friends with FRP and React and make our application truly reactive. In my lightning talk, I will talk about Focal

View _FP reading lists.md

A series of reading lists mostly related to functional programming.

@icebob
icebob / webpack.server.config.js
Last active Jun 29, 2018
NodeJS server/backend bundle with webpack
View webpack.server.config.js
var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
@Rich-Harris
Rich-Harris / service-workers.md
Last active Jan 27, 2021
Stuff I wish I'd known sooner about service workers
View service-workers.md

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@rebcabin
rebcabin / kalmanSample.c
Last active Apr 22, 2020
Kalman filtering as a fold with CBLAS and LAPACK
View kalmanSample.c
/*
Copyright 2016 Brian C. Beckman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software