This file contains hidden or 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
#!/usr/bin/env sh | |
# op: if 1Password CLI is installed, delegate to it; | |
# otherwise, run the command after `--` unchanged. | |
if command -v op >/dev/null 2>&1; then | |
exec op "$@" | |
fi | |
# Skip args until `--`, then run the remainder. | |
while [ "$#" -gt 0 ]; do |
This file contains hidden or 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 { | |
createContext, | |
useContext, | |
useEffect, | |
useSyncExternalStore, | |
useState, | |
} from 'react'; | |
type Theme = 'dark' | 'light' | 'system'; |
This file contains hidden or 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
// In Android wdio config | |
config = { | |
before() { | |
global.$ = selector => { | |
const enhancedSelector = | |
typeof selector === 'string' && selector.startsWith('~') | |
? `//*[@resource-id="${selector.slice(1)}"]` | |
: selector | |
return driver.$(enhancedSelector) |
This file contains hidden or 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 { createRequire } from 'module' | |
const require = createRequire(import.meta.url) | |
export const expoConfig = require('/package.json') |
This file contains hidden or 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
// W3C Actions | |
await driver.performActions([ | |
{ | |
type: 'pointer', | |
id: 'finger1', | |
parameters: { pointerType: 'touch' }, | |
actions: [ | |
{ type: 'pointerMove', x: 100, y: 300 }, | |
{ type: 'pointerDown', duration: 1000 }, | |
{ type: 'pointerUp' }, |
This file contains hidden or 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
env: | |
# Add an optional dynamic string based on a PR number | |
SOME_ENV_VAR: static-string/${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }} | |
jobs: | |
some-job: | |
steps: | |
# Conditionally name a step | |
- name: Step for ${{ github.event_name == 'pull_request' && '(PR)' || '(main)' }} |
This file contains hidden or 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 { useRef, useEffect } from 'preact/hooks'; | |
export function useMountedEffect(cb: () => void, deps?: ReadonlyArray<unknown>): void { | |
const didMount = useRef(false); | |
useEffect(() => { | |
if (didMount.current) cb(); | |
else didMount.current = true; | |
}, deps); | |
} |
This file contains hidden or 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
.divider { | |
margin: 1.5rem 0; | |
position: relative; | |
overflow: hidden; | |
&::before, | |
&::after { | |
content: ''; | |
position: absolute; | |
top: 50%; |
This file contains hidden or 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
window.location.href.match(/[^/]$/) && (window.location.href += '/'); |
This file contains hidden or 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
const requireComponent = require.context( | |
'~/components', // components dir | |
true, // recursive | |
/^(\.\/.*)*V[A-Z].+\.vue$/, // name regex | |
); | |
requireComponent.keys().forEach(fileName => { | |
let baseComponentConfig = requireComponent(fileName); | |
baseComponentConfig = baseComponentConfig.default || baseComponentConfig; |
NewerOlder