This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div css={styles}> | |
<div class="panel flex-container"> | |
<div class="header">fixed</div> | |
<div class="content flex-container non-scrollable"> | |
<div class="flex-container non-scrollable"> | |
expands.. | |
<div class="list scrollable"> | |
scrolls... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {mswMocks as ruleMocks, getRulesBody} from '../../../api/rules/rulesMocks' | |
import {mswMocks as rulesetMocks, getRulesetsBody} from '../../../api/rulesets/rulesetsMocks' | |
import {mswMocks as channelMocks} from '../../../api/channels/channelMocks' | |
import RuleBuilder from './RuleBuilder' | |
// -------------------------------------- setup ---------------------------------------- | |
let items = getRulesetsBody, | |
item = items[0], | |
{name, uuid} = item || {}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useEffect} from 'react' | |
import {fireEvent, within} from '@storybook/testing-library' | |
import userEvent from '@testing-library/user-event' | |
export const presentInteraction = storyFn => { | |
return ( | |
<div> | |
<PresentInteraction/> | |
{storyFn()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useThisState(key, component, initialState) { | |
let set = (val) => component.setState({[key]: val}), | |
initial = !(key in component.state) | |
if (initial) { | |
set(initialState) | |
} | |
let retVal = initial ? initialState : component.state[key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {every, filter} from 'lodash' | |
export const numericComparisons = { | |
lte: (a, b) => a <= b, | |
lt: (a, b) => a < b, | |
gt: (a, b) => a > b, | |
gte: (a, b) => a >= b, | |
eq: (a, b) => a === b, | |
neq: (a, b) => a !== b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get n linear steps between point{x, y} a and b | |
function interPoints(a, b, n) { | |
let int = (t) => ({ | |
x: a.x * (1 - t) + b.x * t, | |
y: a.y * (1 - t) + b.y * t | |
}), | |
step = 1/(n+1), | |
ret = []; | |
for (let i=0; i<n; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function selectParent(el, selector) { | |
let parent = null, | |
p = el.parentNode, | |
pp = p.parentNode, | |
sel = pp ? pp.querySelector(selector) : null, | |
done = !pp || sel === p; | |
console.log(selector, el) | |
return done ? sel : selectParent(p, selector); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script> | |
function round(n) { | |
return Math.round(n * 100)/100 | |
} | |
// parameters for 35mm microfilm rolls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// debounce function if arguments do not change | |
// https://github.com/lodash/lodash/issues/2403#issuecomment-290760787 | |
function activate(func, wait=0, options={}) { | |
var mem = _.memoize(function() { | |
return _.debounce(func, wait, options) | |
}, options.resolver); | |
return function(){mem.apply(this, arguments).apply(this, arguments)} | |
} |
NewerOlder