Skip to content

Instantly share code, notes, and snippets.

View jeffpeterson's full-sized avatar
🤠
Howdy!

Jeff Peterson jeffpeterson

🤠
Howdy!
View GitHub Profile
@jeffpeterson
jeffpeterson / ui-components.md
Last active October 10, 2022 03:49
UI Components

Composable UI

We’ll be splitting our components into two kinds: "UI Components" and "Domain Components".

UI Components

This is the design system I use for all of my projects. The goal is to reduce the complexity of building UI by an order of magnitude or more. The principles aren’t specific to React and apply generally to any web UI.

@jeffpeterson
jeffpeterson / backend.js
Created August 27, 2019 18:30
Automerge frontend/backend split example
import * as Backend from 'automerge/backend'
let doc = Backend.init()
loadChangesFromDisk().then(onRemoteChanges)
function onLocalChange(change) {
const [newDoc, patch] = Backend.applyLocalChange(doc, change)
doc = newDoc
saveChangeToDisk(change)

Keybase proof

I hereby claim:

  • I am jeffpeterson on github.
  • I am jeffpeterson (https://keybase.io/jeffpeterson) on keybase.
  • I have a public key ASD2XkEsPA5ERFu08W9mrjjmp-9bLYSu_Gg7OfEZ7HgZKAo

To claim this, I am signing this object:

@jeffpeterson
jeffpeterson / inheritance.js
Created July 20, 2015 22:54
Inheritance FTW
const FTW = class extends class extends class extends class extends class {
} {
} {
} {
} {
@jeffpeterson
jeffpeterson / _spool.js
Last active August 29, 2015 14:24
spool
export default spool
// thread first (left) argument
export function spool(s, r) {
return _spool(s, r, (r, args) => [r, ...args])
}
// thread last (right) argument
export function spoor(s, r) {
return _spool(s, r, (r, args) => [...args, r])
@jeffpeterson
jeffpeterson / imports.sh
Last active October 22, 2015 17:32
Find imports of files
#!/usr/bin/env ruby
if !ARGV[0]
puts "USAGE: #{$0} <file>"
exit 1
end
at_exit { run! }
def run!
#!/usr/bin/env bash
HUE_USERNAME=arsinh1234
# HUE_IP=192.168.1.5
HUE_IP=204.28.118.31:5080
rest() {
if [[ "${@}" == *{}* ]]; then
rest "${@//'{}'/1}"
class Object
def method_lookup *args, result
public_methods(false).select do |name|
begin
begin
next clone.send(name, *args) == result
rescue TypeError
next send(name, *args) == result
end
require 'turtle'
turtles = [Turtle.new, Turtle.new, Turtle.new]
while true
# get the command
print "Enter a command: "
s = gets.chomp
# exit?
! Definition for the 0 in `ta 0`:
! /usr/include/sys/trap.h
! Definition for the 4 in `mov 4, %g1`
! /usr/include/sys/syscall.h
.global main
.section ".data" ! We need read/write memory
format_string: