Skip to content

Instantly share code, notes, and snippets.

View davidpelayo's full-sized avatar

David Pelayo davidpelayo

View GitHub Profile
stereobooster /
Last active August 16, 2023 12:19
React Maps
[Raster tiles][rt] [Vector tiles][vt] GeoJSON virtual-dom offline map quality React component React Native
google maps + + good [4 unsupported][gm-react] [+][gm-native]
leaflet * + [+][ll-vt] + [+/-][ll-offline] depends [+][ll-rect]
d3 * + [+/-][d3-vdom] +/- depends [+][d3-react]
MapboxGL + + depends [+][mb-react] [+][mb-native]
Yandex Maps +
solace / MapComponent.jsx
Last active March 5, 2021 07:57
Updating map bounds using react-google-maps
/* Only the necessary information to address
* has been included here.
import React from 'react';
// Need these to muck around with bounds
paulirish /
Last active May 19, 2024 03:45
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
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

nkbt / .eslintrc.js
Last active May 11, 2024 13:03
Strict ESLint config for React, ES6 (based on Airbnb Code style)
"env": {
"browser": true,
"node": true,
"es6": true
"plugins": ["react"],
"ecmaFeatures": {
mculp / voices.txt
Created December 3, 2014 00:14
List of voices available by the `say` command on OS X
Agnes en_US # Isn't it nice to have a computer that will talk to you?
Albert en_US # I have a frog in my throat. No, I mean a real frog!
Alex en_US # Most people recognize me by my voice.
Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana.
Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst.
Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne.
Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme.
Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
Bahh en_US # Do not pull the wool over my eyes.
Bells en_US # Time flies when you are having fun.
gerbenvandijk / z-index-mixin.less
Last active December 13, 2019 07:03
Z-index mixin for LESS
@z-index-order: 'contact', 'lightbox', 'nav';
.zindex(@elementName) {
.loop(@elementName, @counter) when (@counter > 0) {
.loop(@elementName, @counter - 1);
.pickIndex(@elementName, @counter);
akesterson / gist:11391984
Created April 29, 2014 06:22
Why I switched from bamboo to jenkins
TL;DR - It was proving to be more buildsystem than I needed,
and I had found that there were other buildsystems that met my needs
that I felt were lighter and more nimble. It's still a fine product
that I continue to recommend to this day, I just no longer see it as
"The One True Way".
1: Bamboo was consuming a significant amount of system resources,
markSci5 / Git checkout remote branch
Created July 3, 2013 07:08
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test