Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Slingin' Code

Dan Stroot dstroot

:octocat:
Slingin' Code
View GitHub Profile
@dstroot
dstroot / BLOG.md
Created Nov 1, 2019 — forked from elierotenberg/BLOG.md
Idiomatic Data Fetching using React Hooks
View BLOG.md

Idiomatic Data Fetching using React Hooks

This post has been written in collaboration with @klervicn

Virtually all web apps and websites need to pull data from a server, usually through a JSON-returning API. When it comes to integrating data fetching in React component, the "impedence mismatch" between the React components, which are declarative and synchronous, and the HTTP requests, which are imperative and asynchronous, is often problematic.

Many apps use third-party libraries such as Redux or Apollo Client to abstract it away. This requires extra dependencies, and couple your app with a specific library to perform data fetching. In most cases, what we want is a direct way to integrate plain HTTP requests (e.g. using native fetch) for usage in React components.

Here we will discuss how we can use React Hooks to do this in an elegant, scalable manner.

@dstroot
dstroot / resume.json
Last active Jul 5, 2019 — forked from thomasdavis/resume.json
{ "theme": "elegant"}
View resume.json
{
"basics": {
"name": "Daniel J. Stroot",
"label": "Technology Leader",
"summary": "I’m an experienced technology leader who drives IT transformation. I have a strong enterprise architecture, cloud architecture and open source technology skills. I also love building high-performing agile teams. Specialties: React, Redux, Javascript - still a \"full stack developer\" in my spare time.",
"website": "https://danstroot.com",
"email": "dan.stroot@gmail.com",
"location": {
"city": "Los Angeles",
"state": "california",
@dstroot
dstroot / lfu.go
Created Mar 8, 2019 — forked from fteem/lfu.go
Code example for the article "When to use Least Frequenty Used cache and how to implement it in Golang" https://ieftimov.com/golang-least-frequently-used-cache
View lfu.go
package main
import (
"container/list"
"fmt"
)
type CacheItem struct {
key string // Key of item
value interface{} // Value of item
@dstroot
dstroot / handlers.go
Last active Apr 26, 2021 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View handlers.go
package main
import (
"io"
"net/http"
"sync/atomic"
)
func index() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
View keybase.md

Keybase proof

I hereby claim:

  * I am dstroot on github.   * I am dstroot (https://keybase.io/dstroot) on keybase.   * I have a public key ASCCKrF70wPevMuYx-3aMbQ4Wv9Ruajf1Rsch62byYChVwo

To claim this, I am signing this object:

View Dockerfile
FROM golang:1.7-alpine
RUN apk add --no-cache \
git
ENV GOPATH $HOME/gocode
ENV PATH $GOPATH/bin:$PATH
COPY docker/entry.sh /docker-entrypoint
RUN chmod u+x /docker-entrypoint
View numverify.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
)
View exportjson.js
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
View osx-10.10-setup.md

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@dstroot
dstroot / app.js
Created Jul 13, 2014
Gulp, BrowserSync, Node, and Nodemon all working in harmony. ;)
View app.js
/**
* World's simplest express server
* - used to serve index.html from /public
*/
var express = require('express');
var serveStatic = require('serve-static');
var app = express();
app.use(serveStatic(__dirname + '/public'));