Skip to content

Instantly share code, notes, and snippets.

View clintonmedbery's full-sized avatar

Clinton Medbery clintonmedbery

View GitHub Profile
@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
@clintonmedbery
clintonmedbery / useEffect
Created June 21, 2019 16:09
useEffect componentDidMount and componentWillUnmount
useEffect(() => {
const fetchContainerData = async () => {
try {
const result = await SomethingService.getSomething();
setSomething(result);
} catch (error) {
console.error('ERROR: ', error);
}
};
fetchContainerData();
@clintonmedbery
clintonmedbery / Dockerfile
Created June 21, 2019 02:01
Shiny Dockerfile
FROM rocker/shiny:3.6.0
RUN sudo apt-get update
RUN mkdir -p /var/lib/shiny-server/bookmarks/shiny
RUN DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends vim
RUN sudo apt-get install lsof
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
libxml2-dev \
@clintonmedbery
clintonmedbery / .zshrc
Last active June 12, 2019 23:19
Useful Bash Aliases
#Edit in vim
alias vimRc="vim ~/.zshrc"
alias vimHosts="sudo vim /private/etc/hosts"
#Edit Code
alias codeRc="code ~/.zshrc"
alias codeHosts="sudo code /private/etc/hosts"
#Source Terminal
alias sourceRc="source ~/.zshrc"
alias dockStopAll="docker stop $(docker ps -q)"
@clintonmedbery
clintonmedbery / WhatPhone.swift
Created October 2, 2018 23:37
Determine iPhone
if UIDevice().userInterfaceIdiom == .phone {
switch UIScreen.main.nativeBounds.height {
case 1136:
print("iPhone 5 or 5S or 5C")
case 1334:
print("iPhone 6/6S/7/8")
case 1920, 2208:
print("iPhone 6+/6S+/7+/8+")
case 2436:
print("iPhone X, Xs")
@clintonmedbery
clintonmedbery / DataSave.cs
Created July 8, 2018 01:46
Save Data Unity
public void SaveTransactions(){
FileStream file = File.Create(Application.persistentDataPath + "/needItData.dat");
TransactionData transactionData = new TransactionData(amount, transactions);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(file, transactionData);
file.Close();
}
public void LoadTransactions(){
@clintonmedbery
clintonmedbery / Problem1.php
Last active April 4, 2018 03:12
Cet Interview Problem 1
$accountsJSON = '{
"Header": {
"Time": "2018-04-02T20:17:46.38"
},
"Current Account Balances": [
{
"AcctName" : "MassagePlace1",
"AcctNum" : 10010,
"CurrentBalance" : "24.20"
},
//https://www.hackerrank.com/challenges/birthday-cake-candles/problem
function birthdayCakeCandles($n, $ar) {
/*
* Write your code here.
*/
//Splice the array into the size we need
array_splice($ar, $n);
//Get the Max value
$maxValue = max($ar);
@clintonmedbery
clintonmedbery / ReactComponent.jsx
Last active May 8, 2018 15:09
ReactContainer Boilerplate
import React from 'react'
export const ThingComponent = ({ things, stuff}) => (
<Container>
<form>
</form>
</Container>
);