Skip to content

Instantly share code, notes, and snippets.

View jschmidtnj's full-sized avatar

Joshua Schmidt jschmidtnj

View GitHub Profile
@jschmidtnj
jschmidtnj / git_cheatsheet.md
Last active September 21, 2021 21:22
git commands, etc.
@jschmidtnj
jschmidtnj / deviceDetect.tsx
Created March 22, 2021 23:32
device detection script and android input fix (uses onBlurCapture because onkeydown is broken on chrome)
import type { FocusEvent, KeyboardEvent } from 'react';
const [isDesktop, setIsDesktop] = useState<boolean>(false);
useEffect(() => {
(async () => {
setIsDesktop((await deviceDetect()).isDesktop);
})();
}, []);
export const deviceDetect = async (): Promise<
@jschmidtnj
jschmidtnj / handle_cache.ts
Created March 5, 2021 17:02
graphql apollo cache setup
try {
const cacheData = cloneDeep(client.cache.readQuery<PostsQuery, PostsQueryVariables>({
query: Posts,
variables: args.postsVariables
}));
if (!cacheData) {
throw new Error('no cache data found');
}
const postCache = cacheData.posts.results.find(elem => elem.id === args.data.id);
@jschmidtnj
jschmidtnj / mediaDownload.resolver.ts
Created October 15, 2020 19:38
media download resolver with type graphql
import { ObjectId } from 'mongodb';
import { Resolver, FieldResolver, ResolverInterface, Root } from 'type-graphql';
import { DownloadLinks } from '../schema/structure/baseFile';
import Media from '../schema/structure/media';
import { fileBucket, getMediaKey, getS3DownloadSignedURL } from '../utils/aws';
@Resolver(_of => Media)
class DownloadLinksResolver implements ResolverInterface<Media> {
@FieldResolver(_returns => DownloadLinks)
Biased Phrasing Alternatives
Blacklist / Whitelist AllowList / DenyList
Master / Slave Primary / Replica Leader / Follower
Brown bags Lunch and learn, Tech talks
Man hours Hours of effort
Pow wow Huddle, Standup, Discussion
Grandfathered Legacy, Exempt
“Hi Guys” Y'all, Folks
Black/Gray days Blocked/Restricted days
@jschmidtnj
jschmidtnj / get_words.py
Created May 2, 2020 16:59
get words from dictionary with given letters
#!/usr/bin/python3
import argparse
parser = argparse.ArgumentParser(description='Get words from dictionary with same letters.')
parser.add_argument('-d', dest='dictionary', default=None,
help='dictionary file path', nargs=1, type=str)
parser.add_argument('-r', dest='repeating', default=True,
help='allow repeating letters', nargs=1, type=bool)
parser.add_argument('-l', dest='letters', default=None,
help='allowed letters', nargs=1, type=str)
@jschmidtnj
jschmidtnj / sign.py
Last active April 18, 2020 01:51
keybase sign script to replace comment with /verify (makes it easier for recipients)
#!/usr/bin/python3
import argparse
from subprocess import check_output
# keybase sign message or file
# replace comment with /verify so recipients can find it easily
parser = argparse.ArgumentParser(description='Sign message.')
parser.add_argument('-i', dest='file_path', default=None,
help='file input', nargs=1)

Keybase proof

I hereby claim:

  • I am jschmidtnj on github.
  • I am joshuaschmidt (https://keybase.io/joshuaschmidt) on keybase.
  • I have a public key ASCsC2FFS7LJzDL1AHE2Seuj1uoV7X2yu7TbS4G3np9sQwo

To claim this, I am signing this object: