Skip to content

Instantly share code, notes, and snippets.

View bsautner's full-sized avatar
🎯
Focusing

Benjamin Sautner bsautner

🎯
Focusing
  • Philadelphia, PA
View GitHub Profile
interface Sample {
fun getSomething(listener: Observer<Something>, id: String)
}
@bsautner
bsautner / gist:7175d0441fee4014aa0d13fbec8345d3
Last active July 9, 2019 14:06
Grouped By Function Anti-Pattern
/**
* Save all the things!
**/
interface SaveThings {
fun saveFoo(foo: Foo)
fun saveBar(bar: Bar)
@bsautner
bsautner / gist:28c9b9316f3b0237f03f40799fce7d52
Last active July 9, 2019 14:16
Group by Feature Pattern
/**
* Save things to storage for the Foo Feature
**/
interface SaveFoos : SaveThings {
fun saveFoo(foo: Foo)
}
#include <Servo.h>
int feedbackPinA0 = A0;
int feedbackPinB0 = A1;
int posA0;
int posB0;
int trigPin = 11; // Trigger
@bsautner
bsautner / gist:92ccdcde573b88d939c97ad553bb6a7c
Last active January 8, 2022 14:38
Lidar Python and MQTT Client
import RPi.GPIO as GPIO
from math import cos, sin, pi, floor
from adafruit_rplidar import RPLidar
from adafruit_rplidar import RPLidarException
import socket
from time import sleep
import time
import board
import digitalio
import json
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LIS2MDL.h>
Adafruit_LIS2MDL mag = Adafruit_LIS2MDL(12345);
float M_B[3] = { -0.713624,-22.782979, 24.966485}; //offsets
float M_Ainv[3][3] =
import java.io.File
enum class RPS(private val value: Int) {
ROCK(1), PAPER(2), SCISSOR(3);
fun compete(v: RPS) : Int {
if (this == v) {
return value + DRAW
}
when (this) {
import java.io.File
enum class RPS(private val value: Int) {
ROCK(1), PAPER(2), SCISSOR(3);
fun compete(v: RPS) : Int {
if (this == v) {
return value + DRAW
}
when (this) {
import java.io.File
enum class RPS(private val value: Int) {
ROCK(1), PAPER(2), SCISSOR(3);
fun compete(v: RPS) : Int {
if (this == v) {
return value + DRAW
}
when (this) {
flowchart LR
subgraph mobileApp[Host App]
direction LR
mvvm[MVVM]
logging[Logging and Analytics]
iot[IoT]
end