Skip to content

Instantly share code, notes, and snippets.

View lando2319's full-sized avatar

Mike Land lando2319

View GitHub Profile
#!/bin/bash
echo "Updating Release State (.releaseState.json) with version $BACKEND_VERSION, with message $RELEASE_MESSAGE"
echo "$(sed '$d' .releaseState.json),
\"$BACKEND_VERSION\":{
\"message\":\"$RELEASE_MESSAGE\",
\"sandbox\":true,
\"production\":false
}
GITHUB_URL="https://api.github.com/repos/ChangEdApps/changed-javascript/pulls/$PULL_REQUEST"
# echo $GITHUB_URL
PULL_REQUEST_MERGED=$(curl -H "Authorization: Bearer $autoCommitterPAT" $GITHUB_URL 2> /dev/null | grep -oE '"merged": (true|false)' | cut -d " " -f 2 )
GITHUB_URL="https://api.github.com/repos/ChangEdApps/changed-javascript/commits/30af705280793c3acb94f70bc02c6fd0163d357b"
# echo $GITHUB_URL
PULL_REQUEST_MERGED=$(curl -H "Authorization: Bearer $autoCommitterPAT" $GITHUB_URL)
Circle()
.fill(.white)
.frame(height: shelfHeight / 2, alignment: .center)
.opacity(isAnimating ? 1.0 : 0.0)
.animation(Animation.linear(duration: 1).repeatForever(), value: isAnimating)
.onAppear{
isAnimating.toggle()
}
.allowsHitTesting(false)
// .offset(CGSize(width: -metrics.size.width * 0.40, height: -shelfHeight * 9.5)) // Back
@lando2319
lando2319 / build script
Created December 1, 2022 11:15
cp a file, prepend, make readonly... incredible
#!/bin/bash
# build script for savingsCalculator
adminDir=web-apps/changed-admin-app/functions/buildFunctions/
webDir=web-apps/changed-web-app/functions/buildFunctions/
adminFile=web-apps/changed-admin-app/functions/buildFunctions/savingsCalculator.js
webFile=web-apps/changed-web-app/functions/buildFunctions/savingsCalculator.js
@lando2319
lando2319 / assertLabelContainsBets
Last active August 14, 2022 12:58
My previous gist didn't work when my UITest splits the bets over the label as so, "5, Pass Line, 50", my previous method didn't account for this. If there is no odds just do empty string for odds label.
// This is to assert the odds "5, Pass Line, 50"
func assertLabelContainsBets(labelToTest: String, baseLabel:String, checqueLabel:String, oddsLabel:String) -> Bool {
let userBets = [baseLabel, checqueLabel, oddsLabel]
let labelToTestElements = labelToTest.components(separatedBy: ", ")
return userBets.sorted() == labelToTestElements.sorted()
}
@lando2319
lando2319 / assertStringEqualsEitherOrder.swift
Last active August 13, 2022 15:32
UI Testing on different devices was causing the order to be different, big devices would be "10, 6", small devices would be "6, 10", I wanted it to check for either.
func assertStringEqualsEitherOrder(labelToTest: String, baseLabel:String, checkLabel:String) -> Bool {
if labelToTest == "\(baseLabel), \(checkLabel)" { return true }
if labelToTest == "\(checkLabel), \(baseLabel)" { return true }
return false
}
// example usage
@lando2319
lando2319 / killProcess
Created May 11, 2022 12:58
can't run emulator because it didn't close properly last time
lsof -t -i tcp:8085 | xargs kill
{
"key": "numpad7",
"command": "git.sync",
"when": "editorTextFocus"
},
{
"key": "numpad_add",
"command": "git.stage",
struct HopBetsView: View {
@ObservedObject var localGameManager: GameManagerPro
@State var namespaceShowoff = false
@Namespace var showoff
var body: some View {
GeometryReader { metrics in
...
HStack(alignment: .center, spacing: .zero, content: {
var assert = require('assert');
var fs = require('fs');
var path = require('path');
let adminBuildFile = fs.readFileSync(path.join(__dirname, "../../web-apps/changed-admin-app/functions/buildFunctions/savingsCalculator.js")).toString();
let webBuildFile = fs.readFileSync(path.join(__dirname, "../../web-apps/changed-web-app/functions/buildFunctions/savingsCalculator.js")).toString();
let srcFile = fs.readFileSync(path.join(__dirname, "../utility/src/savingsCalculator.js")).toString();
describe("Testing whole file of savingsCalculator to ensure src matches buildFunctions", function() {
var prependMsg = "\n\n\n// WARNING!\n// READ ONLY BUILD FILE! DO NOT EDIT; SOURCE FILE LOCATED AT backend/utility/src/savingsCalculator.js\n\n\n\n";