Skip to content

Instantly share code, notes, and snippets.

A Coleman AshCoolman

Block or report user

Report or block AshCoolman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AshCoolman
AshCoolman / Styled utility functions package.md
Last active Feb 16, 2019
Styled utility functions package
View Styled utility functions package.md

Styled utility functions package

I try and resist putting stuff in this package. But its just for overflow when theme/markup doesn't cut it, and if I CONTINUALLY reuse some styles.

Package structure

.
├── defaultTheme
│   └── index.js
├── index.js
@AshCoolman
AshCoolman / dp-and-rn.md
Created Aug 21, 2018
Device-independent pixels and React Native
View dp-and-rn.md

Introduction

React Native dimensions are unitless & represent density-independent pixels (abstract pixels, representing a physical distance on the device)

Density-independent pixel (dp)

WARNING: DP (or DiP) not DPI

DP units keep _things roughly the same physical size

@AshCoolman
AshCoolman / BlurInterruptor.md
Created Mar 19, 2018
React Component to onBlur, only when leaving component
View BlurInterruptor.md

[PROOF OF CONCEPT] For when you want "tabbable" children (e.g. in Date selector composed of a textfield for Day, Month and year) but only want to perform validation on blur-entire-component not each Textfield

class BlurCapturer extends React.Component {
    static propTypes = {
        name: PropTypes.string.isRequired,
        onBlur: PropTypes.func,
        children: PropTypes.node,
@AshCoolman
AshCoolman / ag-snippets.md
Created Feb 28, 2018
Silver searcher snippets
View ag-snippets.md

ag -u -Q "autoprefixer({" .

@AshCoolman
AshCoolman / react-reason.md
Last active Feb 28, 2018
React reason doc notes
View react-reason.md

Creation, Props & Self

  • just a record
  • need a make function
  • creates new component every JSX invocation
  • props = labeled arguments make, last prop must be chilren

Props Forwarding

View reasonml-docs.md

Language basics

let binding

let is just an expression and akin to a function!

let greeting = hello
let greeting = "hi"; /* shadowed */
let scoped = {
@AshCoolman
AshCoolman / auto-bisect.sh
Last active Feb 28, 2018
When did the build break?
View auto-bisect.sh
#!/usr/bin/env bash
# https://lwn.net/Articles/317154/
# USAGE:
# 1. Place this file one level above the project folder
# 2. git bisect start <badSHA> <goodSHA>
# 3. chmod +x ../auto-bisect.sh
# 4. git bisect run ../auto-bisect.sh
rm -r .out
yarn;
View gist:628fc5be4a0c49894dae6f6203a5aba5
While such costs might be negligable for cold code, in the sort code comparator was invocated millions of times which made overheads of arguments adaptation quite pronounced.
@AshCoolman
AshCoolman / kk
Last active Feb 20, 2018
OSX notifications for 'kk.'
View kk
#!/usr/bin/env bash
notify "kk."
@AshCoolman
AshCoolman / label.js
Created Feb 15, 2018
Label to help with jest snapshots
View label.js
// Jests dont write to file in chron order, prefix with number helps
let count = 0;
const label = (tmpl, ...val) => {
val.reverse();
return `${
count++ // eslint-disable-line
}. ${
tmpl.reduce((p, c) => p + c + (val.length ? val.pop() : ''), '')
}`;
You can’t perform that action at this time.