Skip to content

Instantly share code, notes, and snippets.

View trevdor's full-sized avatar

Trevor Farlow trevdor

View GitHub Profile
@trevdor
trevdor / Ts-and-Cs
Created June 11, 2024 21:41
Terms and Conditions
IMPORTANT: Please read this document carefully, as it contains very important information regarding your rights and obligations, as well as conditions, limitations, and exclusions that might apply to you. These terms require the use of arbitration on an individual basis to resolve disputes, rather than jury trials or class actions. By using our services and engaging other users of this website, you affirm that you are of legal age to enter into this agreement, and you accept and are bound by these terms and conditions. You may not use our services or engage other users of this website if you do not agree to these terms and are not at least eighteen (18) years of age.
These terms of service (these "Terms") apply to individuals (either adult students or parents of minor students) (“Students”) who search for, enter into agreements with, and pay (our “Services”) music lesson providers (“Music Teachers”) through www.MoonMagnetMusicSchool.com and any related mobile application, if and as applicable, (together the “
@trevdor
trevdor / truncate_middle.js
Created April 4, 2024 14:49
Truncate middle
export function truncateMiddle(text: string, truncationLength: number) {
if (text.length <= truncationLength || truncationLength <= ELLIPSIS_WIDTH) {
return text;
}
// ceil to favor an extra char or two before vs after the ellipsis
const halfLength = Math.ceil((truncationLength - ELLIPSIS_WIDTH) / 2);
const preEllipsisText = text.substr(0, halfLength).trim();
const postEllipsisText = text
.substr(
1. identify a component `desktop-client` does poorly on mobile
2. find the corresponding component in `/mobile` and copy it somewhere reasonable within `/desktop-client`
e.g. `packages/loot-design/src/components/mobile/accounts.js -> packages/desktop-client/src/components/accounts/MobileAccounts.js`
(I don't like this either, but haven't decided what would be better. Open to suggestions! Maybe a `/mobile` subfolder within e.g. `src/components/accounts`, `src/components/budget`...) It all feels a bit off cuz we're in `desktop-client` after all.
3. point the relevant bit of code to the new component
e.g.
```
const AcctCmp = isMobile ? MobileAccounts : Accounts;
return (<AcctCmp {...props} />);
```
@trevdor
trevdor / data-testid.md
Last active September 1, 2020 20:53
Test IDs: Preferred Option vs Last Resort

Definitions

TestID First

To interact with a UI element from a test, apply a data-testid attribute to that element in app code, then find by test ID.

TestID Last

To interact with a UI element from a test, first choice are accessible selectors like role, label, placeholder, then HTML5 and ARIA selectors based on title or alt text. Use data-testid as a last resort. This is the view put forth by @testing-library:

Keybase proof

I hereby claim:

  • I am trevdor on github.
  • I am trevdor (https://keybase.io/trevdor) on keybase.
  • I have a public key ASAjVeGRgM0_NMT_lh-aKH_RTt3qSNBhHv_v0Y5p6yQIBQo

To claim this, I am signing this object:

git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
import React from 'react';
import { createStyledComponent } from 'mineral-ui/styles';
import StartEnd from 'mineral-ui/StartEnd';
import NavTabs from './NavTabs';
import ProfileMenu from './ProfileMenu';
const Header = createStyledComponent(StartEnd, ({ theme }) => ({
backgroundColor: theme.panel_backgroundColor,
import _ from 'lodash';
import Immutable from 'immutable';
import {
initialState,
getPlan,
getPlanProperty,
getPlans,
} from '../redux/reducers/PlanReducer';