Skip to content

Instantly share code, notes, and snippets.

View madeinfree's full-sized avatar
🐱
Focusing

Whien_Liou madeinfree

🐱
Focusing
View GitHub Profile
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API
/* file: Recompose.re */
/* The very definition of a HOC, it's a function that gets a react component and returns another react component */
type hoc = ReasonReact.reactClass => ReasonReact.reactClass;
module type CreateWithStateParams = {
/* This is the secret sauce ingredient, with it the users can pass whatever state they want */
type state;
let defaultValue: state;
};
@rauschma
rauschma / reasonml-operators.md
Last active April 10, 2018 21:12
ReasonML operators
Construction or operator Associativity
prefix operator
. .( .[ .{
[ ] (array index)
#···
applications, assert, lazy left
- -. (prefix)
**··· lsl lsr asr right
*··· /··· %··· mod land lor lxor left
@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?

@danseethaler
danseethaler / StyledButton.js
Last active July 5, 2017 19:20
A styled css-in-js button
('use strict');
import React from 'react';
import glamorous from 'glamorous';
const colors = {
success: '#29A88E',
danger: '#C65F4A',
primary: '#6DCFD3',
info: '#FFD035',
@javilobo8
javilobo8 / download-file.js
Last active May 13, 2025 05:55
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@geoffreydhuyvetters
geoffreydhuyvetters / react_fiber.md
Last active August 15, 2024 15:17
What is React Fiber? And how can I try it out today?

A top-level App component returns <Button /> from its render() method.

  1. What is the relationship between <Button /> and this in that Button’s render()?

  2. Does rendering <Button><Icon /></Button> guarantee that an Icon mounts?

  3. Can the App change anything in the Button output? What and how?


@davestevens
davestevens / LetsEncrypt.md
Last active November 6, 2024 11:48
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@paulirish
paulirish / what-forces-layout.md
Last active May 16, 2025 16:40
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent