Skip to content

Instantly share code, notes, and snippets.

View jurassix's full-sized avatar
🐢
hello world

Clint Ayres jurassix

🐢
hello world
View GitHub Profile
@jurassix
jurassix / React Inline Styles with Media Query.markdown
Last active March 22, 2022 11:08
React Inline Styles with Media Query
@jurassix
jurassix / React Inline Styles with responsive design.markdown
Last active August 29, 2015 14:17
React Inline Styles with responsive design
export const contains = (list = [], test) => list.indexOf(test) >= 0;
export const removeItemAt = (list = [], index = 0) =>
[
...list.slice(0, index),
...list.slice(index + 1),
];
export const insertItemAt = (list = [], index = 0, item) =>
[
export const joinArray = (list = [], separator) =>
list.reduce((joinedList, item, index, {length}) => {
joinedList.push(item);
if (index < (length - 1)) {
joinedList.push(separator);
}
return joinedList;
}, []);
@jurassix
jurassix / abortable.js
Last active April 21, 2016 14:38
Abort your promises!
const abortable = (func) => (...args) => {
let aborted = false;
const abort = () => { aborted = true; };
const promise = new Promise((resolve, reject) => {
const resolveIfNotAborted = resolution => {
if (aborted) {
reject(Error('promise aborted'));
}
@jurassix
jurassix / machine.js
Created June 20, 2020 03:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions