Skip to content

Instantly share code, notes, and snippets.

View jeffbarg's full-sized avatar
🏝️
Building

Jeff Barg jeffbarg

🏝️
Building
View GitHub Profile
import SwiftUI
import PlaygroundSupport
// In this demo, I'm going to recreate the recording view
// from the voice memos app. It consists of two parts, the recording button
// and the audio slices (stubbed out here!)
//
// Thanks for following along! I'll post all the code on Github :)
//
struct RecordView: View {
@jeffbarg
jeffbarg / component.js
Last active April 20, 2020 17:25
Example React Component using Async fn to fetch data
export default ({ date }) => {
const [charts, setCharts] = React.useState();
React.useEffect(() => {
let fn = async () => {
let chartResponse = await axios.post("/api/get_charts", { date });
setCharts(chartResponse.data);
};
fn();
}, [date]);
@jeffbarg
jeffbarg / component.js
Created April 20, 2020 17:23
Async React Component
export default ({ date }) => {
const [charts, setCharts] = React.useState();
React.useEffect(() => {
let fn = async () => {
let chartResponse = await axios.post("/api/get_charts", { date });
setCharts(chartResponse.data);
};
fn();
}, [date]);

Keybase proof

I hereby claim:

  • I am jeffbarg on github.
  • I am jeffbarg (https://keybase.io/jeffbarg) on keybase.
  • I have a public key ASDw8uqPJNRbiUWeJjuFT1AvIUZ1ryS5temcDt066LB1lgo

To claim this, I am signing this object:

//
// main.swift
// 14cli
//
// Created by Jeff Barg on 6/3/14.
// Copyright (c) 2014 Fructose Tech. All rights reserved.
//
import Foundation
import Cocoa
from random import *
j = 0
for i in range(100000):
x = 0.0
while (x < 1.0):
x += random()
j += 1