Skip to content

Instantly share code, notes, and snippets.

View clintonmedbery's full-sized avatar

Clinton Medbery clintonmedbery

View GitHub Profile
@clintonmedbery
clintonmedbery / understanding-kubernetes.md
Created March 14, 2023 13:23
Understanding Kubernetes

What is kubernetes context?

A kubernetes context is just a set of access parameters that contains a Kubernetes cluster, a user, and a namespace.

From Stack overflow: "A context is the connection to a specific cluster (username/apiserver host) used by kubectl. You can manage multiple clusters that way. Namespace is a logical partition inside a specific cluster to manage resources and constraints."

We can get the context by running:

kubectl config current-context

@clintonmedbery
clintonmedbery / AsyncSingleton.ts
Created November 22, 2021 16:21
Example of a async singleton class
export class TestServer {
static _instance: TestServer;
static app: Thing;
constructor() {
return (async () => {
if (TestServer._instance) {
return TestServer._instance;
}
const app = await Something();
TestServer.app = app;
@clintonmedbery
clintonmedbery / implementation.js
Last active April 5, 2021 23:39
Venn Diagram Functional Component - React - venn-diagram.component.js
import { VennDiagram } from '../../../components/venn-diagram/venn-diagram.component'
import styles from './talent-profile-diagram-styles.module.scss'
import { DIAGRAM_COLORS } from '../../../components/venn-diagram/venn-diagram.utilities'
let skillSets = {
data: ["things", "stuff", "other things", "java", ],
label: "Group Name",
sets: ["Group Name"]
}
<VennDiagram sets={skillSets} />
@clintonmedbery
clintonmedbery / bst.js
Created February 8, 2021 01:35
Binary Search Tree
class Node {
constructor(data){
this.right = null;
this.left = null;
this.data = data
}
}
class Bst {
constructor() {
@clintonmedbery
clintonmedbery / optionalWrapper.js
Created January 26, 2021 15:28
High Order Context
const ThingsWrapper = (props) => {
const { userID } = props
const {
things,
setThings
} = useThingsContext()
const [newThings] = useApi('GET', `${BASE_URL}/things`, null)
@clintonmedbery
clintonmedbery / fade.css
Created November 17, 2020 20:53
Bottom Fade
.container {
margin-bottom: 5px;
padding-bottom: 5px;
width: 233px;
overflow:hidden;
text-overflow: ellipsis;
content: "";
position:relative;
max-height: 19em;
}
@clintonmedbery
clintonmedbery / middle.css
Created August 14, 2020 18:15
Center CSS
.middle {
display: flex;
justify-content: center;
padding: 10px;
}
@clintonmedbery
clintonmedbery / buildQueryString.js
Last active November 12, 2020 20:13
build a query string
import _ from 'lodash'
export const buildQueryString = (url, params) => {
let queryStrings = Object.keys(params)
.map((key) => {
if (!_.isNil(params[key])) {
if (Array.isArray(params[key])) {
if (params[key].length === 0) {
return
}
let arrayParams = params[key].map((item) => {
@clintonmedbery
clintonmedbery / isMount.js
Last active February 4, 2020 05:37
Useful Hooks
//Hook used to determine if it is a component's first mount
//Useful to put in useEffect functions that share data calls but not all the same calls
import { useRef, useEffect } from 'react'
//https://stackoverflow.com/a/56267719/3058839
export const useIsMount = () => {
const isMountRef = useRef(true)
useEffect(() => {
isMountRef.current = false
@clintonmedbery
clintonmedbery / ThingComponent.js
Last active January 3, 2020 20:10
React Code Sample with hooks
import React, { useState, useEffect } from 'react'
const Thing = (props) => {
let [things, setThings] = useState([])
useEffect(() => {
}, [])
return (
<ThingView