Skip to content

Instantly share code, notes, and snippets.

View howardgrigg's full-sized avatar

Howard Grigg howardgrigg

View GitHub Profile
@howardgrigg
howardgrigg / ESV.php
Created June 4, 2022 21:44
ESV.org API - simple php curl example
<?php
// Get Authorization token from https://api.esv.org/docs/ and paste it below, also include referer URL
public function getESVText($query = ''){
$url = 'https://api.esv.org/v3/passage/text/?';
$data = array(
'q'=> $query,
'include-headings' => 'false',
'include-footnotes' => 'false',
func Rvoltages() -> AnyView?{
var userinputs = [
[UserInput().inputRVoltI, "Lead I"],
[UserInput().inputRVoltII, "Lead II"]
]
var inputs: some View{
Section(header: Text("R Voltages")){
ForEach(userinputs, id: \.self){userinput in
HStack{
class UserInput: ObservableObject {
@Published var foo: String = ""
@Published var bar: String = ""
}
struct ContentView: View {
@ObservedObject var input = UserInput()
let userinputs = ['foo', 'bar']
var body: some View {
for userinput in userinputs{
var CalcAxis: Int?{
func calculate() throws -> Int?{
var AxisValues = [Double]()
if inputLead1pos.double != nil{
AxisValues.append(Double(inputLead1pos) ?? 0)
}
if inputLead1neg.double != nil{
AxisValues.append(Double(inputLead1neg) ?? 0)
}
if inputLeadAVFpos.double != nil{
var CalcAxis: Int{
var AxisValues = [Double]()
if inputLead1pos.double != nil{
AxisValues.append(Double(inputLead1pos) ?? 0)
}
if inputLead1neg.double != nil{
AxisValues.append(Double(inputLead1neg) ?? 0)
}
if inputLeadAVFpos.double != nil{
AxisValues.append(Double(inputLead1pos) ?? 0)
let xPRIntervals: [Int: [Int: [Double]?]] = [
1:[
60: nil,
80: nil,
100: [0.1, 0.12]
],
6:[
60: nil,
140: [0.11, 0.14],
160: [0.1, 0.13]
let xPRIntervals: [Int: [Int: [Double]?]] = [
1:[
60: nil,
80: nil,
100: [0.1, 0.12]
],
6:[
60: nil,
140: [0.11, 0.14],
160: [0.1, 0.13]
func monthsOld(DOBStr: String) throws -> Int{
enum monthsOldError: Error{
case futureDate
}
let formatter = DateFormatter()
formatter.dateFormat = "yyyy/MM/dd"
let DOB = formatter.date(from: DOBStr)
let timesince: Double = DOB!.timeIntervalSinceNow
if timesince > 0.0{
throw monthsOldError.futureDate
#include <FastLED.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX
#define REDPIN 10
#define GREENPIN 11
#define BLUEPIN 9
#define BUTTONPIN 12
const byte numChars = 14;
#include <FastLED.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX
#define REDPIN 10
#define GREENPIN 11
#define BLUEPIN 9
#define BUTTONPIN 12
const byte numChars = 14;