Skip to content

Instantly share code, notes, and snippets.

View copleykj's full-sized avatar
😎
Totally Committed

Kelly Copley copleykj

😎
Totally Committed
View GitHub Profile
@copleykj
copleykj / navigation.jsx
Created April 26, 2018 15:12
React Navigation - StackNavigator nested in DrawerNavigator
import React from 'react';
import { StackNavigator, DrawerNavigator } from 'react-navigation';
import ScreenOne from '../screens/ScreenOne';
import ScreenTwo from '../screens/ScreenTwo';
import SideBar from '../components/SideBar';
const AppNavigator = StackNavigator({
FirstScreen: {
@copleykj
copleykj / FEM-download-bookmark.js
Created May 19, 2018 19:41
Bookmarklet to automatically download Front End Masters videos
javascript:(function(){
const vdo = document.getElementsByTagName("video")[0];
vdo.pause();
const vdoUrl = vdo.src
const link = document.createElement('a');
link.href = vdoUrl;
link.target= '_blank';
const paths = location.pathname.split('/');
const e = document.createEvent('MouseEvents');
@copleykj
copleykj / makeTypes.ts
Created February 3, 2020 01:25
Dirty way to output types for an object such as a Mongo documents
// This isn't comprehensive and is a pretty dirty hack piece of code,
// but it gets you close when you have a ton of fields in mongo
// collection documents that you need to create interfaces for
function makeTypes(obj: { [key: string]: any }, depth: number = 0) {
if (obj) {
let types: string = '';
Object.keys(obj).forEach((key) => {
const value = obj[key];
if (value) {
@copleykj
copleykj / useReactiveQuery.ts
Last active January 8, 2022 23:14
Grapher Hooks
import { useState, useEffect, useRef } from 'react';
import { useTracker } from 'meteor/react-meteor-data';
import { Grapher } from 'meteor/cultofcoders:grapher';
import { Meteor } from 'meteor/meteor';
interface QueryInfo<T> {
loading: boolean
ready: boolean
data: T[]
error: Meteor.Error | null