Skip to content

Instantly share code, notes, and snippets.

View remy's full-sized avatar
🌮
Hack. Learn. Fix. Teach.

Remy Sharp remy

🌮
Hack. Learn. Fix. Teach.
View GitHub Profile
// Example of the JavaScript module for the Arc project.
let bytes;
let slicePtr = 0;
function yellow(line, i) {
line[i + 1] = line[i] = 255;
line[i + 2] = 0;
}

What is your opinion about CSS-in-JS?

I had some "interesting" responses on Twitter over an observation I had that CSS-in-JS doesn't often come with a relatable use-case.

My opinion has always been: use the best tool for the job. When I first looked at CSS-in-JS it was because I was using a pattern library that included a 200K CSS file (compressed!). This wasn't okay. I wanted to only deliver the CSS that I was using in my components. CSS-in-JS appears to be a good match for this problem.

Coupled with the promise of scoped styled (i.e. no global styles interfering), the ability to automatically ensure only the used CSS is delivered, CSS-in-JS has its appeals.

The killer feature for me though, is if some CSS-in-JS tool can provide automatic, configuration-free, critical CSS.

@remy
remy / round.js
Created February 24, 2018 17:29
Better/more accurate Math.round
const round(value, decimals) =>Number(Math.round(value+'e'+decimals)+'e-'+decimals);
round(1.005, 2); // 1.01
Math.round(1.005, 2); // 1.00
// via http://www.jacklmoore.com/notes/rounding-in-javascript/
@remy
remy / recipe.md
Last active May 31, 2018 07:44
Recipe for "cheesy cloud biscuits"

Cheesy Cloud Biscuits

Intended to be a low carb, high fat, super tasty meal 💪

  • Makes: 4
  • Cooking time: 15 minutes
  • Prep time: ~5-10 minutes
@remy
remy / xy-from-i.js
Created February 21, 2018 15:41
Get x/y from index.
console.clear();
const w = 4;
const h = 6;
const res = Array.from({
length: w * h
}, (_, i) => i).map(i => {
const x = i % w;
const y = i / w | 0;
console.log('ok')
@remy
remy / .env
Created December 14, 2017 17:26
FOO=bar
@remy
remy / ActiveLink.js
Last active May 3, 2025 03:03
Next.js version of `activeClassName` support.
@remy
remy / .eslintignore
Last active April 13, 2021 04:48
My Next.js eslint config + `npm install --save-dev eslint eslint-plugin-react babel-eslint`
.next
out
@remy
remy / app@[email protected]
Created September 27, 2017 16:56
Fitbit Ionic fetch abstraction (only supports JSON in this state)
// FILENAME: app/polyfills/fetch.js
import Promise from './promise';
import * as messaging from "messaging";
const OPEN = messaging.peerSocket.OPEN;
// Helpful to check whether we are connected or not.
// setInterval(() => {
// const readyState = messaging.peerSocket.readyState;