Skip to content

Instantly share code, notes, and snippets.

View JamieMason's full-sized avatar
🙋
Looking for work

Jamie Mason JamieMason

🙋
Looking for work
View GitHub Profile
@belgattitude
belgattitude / ci-yarn-install.md
Last active November 5, 2024 08:32
Composite github action to improve CI time with yarn 3+ / node-modules linker.
const BASE83_ALPHABET = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~`;
const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const BMP_HEADER = `data:image/bmp;base64,Qk3mAQAAAAAAADYAAAAoAAAADAAAAPT///8BABgAAAAAALABAAAAAAAAAAAAAAAAAAAAAAAA`;
const sRGBToLinear = (value: number) => {
const v = value / 255;
if (v <= 0.04045) {
return v / 12.92;
} else {
return Math.pow((v + 0.055) / 1.055, 2.4);
@adamkl
adamkl / AppContextProvider.tsx
Created February 10, 2020 22:20
xState service layer
import React from "react";
import { createUserSessionService } from "services/UserSessionService";
import { createNavService } from "services/NavService";
// Wiring up our "IOC container"
const userSessionService = createUserSessionService();
// NavService depends on UserSessionService
const navService = createNavService(userSessionService);
@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@mikaello
mikaello / group-objects-by-property.md
Last active October 8, 2024 12:41 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group array of JavaScript objects by keys

This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.

Implementation

const groupBy = keys => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = keys.map(key => obj[key]).join('-');
@iarna
iarna / package-lock.json
Last active November 6, 2017 12:29
shrinkpack bug
{
"name": "x",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"whatwg-fetch": {
"version": "2.0.3",
"resolved": "file:whatwg-fetch-2.0.3.tar",
"integrity": "sha512-RFZv5NwmYdZP+xIWp6SZkF0kiBe6oG05+mlWRZNi+lTMM99NByWEtXoTjR8SLNS3FVJ0iy0Y3h44skNHlVvY4w=="
@siddharthkp
siddharthkp / reactivconf-2017-proposal.md
Last active February 25, 2024 10:06
Building applications for the next billion users
@abiodun0
abiodun0 / contramap-functor.js
Last active August 13, 2021 21:11
Contramap and functors in js. react as an example
import React from 'react'
// Comp:: a -> JSX;
const Comp = g => ({
fold: g,
contramap: f => Comp(x => g(f(x))),
concat: other => Comp((x) => <div> {g(x)} {other.fold(x)} </div>)
});
// Reducer :: (a, b) -> a
@morewry
morewry / monorepo-tool-comparison.md
Last active May 11, 2022 08:54
Comparison of Monorepo Tools For Web Client / Front End Projects (That Probably Use HTML, CSS, and JS)

Mono Repository Tool Comparison

For Web Client / Front End Projects

(That Probably Use HTML, CSS, and JS)

I made a list of 20 things I might want out of a monorepo tool for a Design System to use as a basis for comparing some of the options including Lerna, Northbrook, and Rush.

⚠️ Northbrook's author says the project is pretty dead and now uses Lerna.

Qualifications Wanted

@doot0
doot0 / sysfonts.css
Created January 16, 2017 09:33
Github's system fonts stack
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}