Skip to content

Instantly share code, notes, and snippets.

View elifry's full-sized avatar

Elijah Fry elifry

View GitHub Profile
@elifry
elifry / iosWait.swift
Created October 3, 2021 21:55
Swift iOS simple wait command
DispatchQueue.main.asyncAfter(deadline: .now() + 0.9, execute: {
self.self.doScan()
})
@elifry
elifry / spacer.sh
Created October 3, 2021 21:54
Mac OS put spacers in dock
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
@elifry
elifry / multiplePermissionsWrapper.kt
Created October 3, 2021 21:52
Kotlin wrapper for checking multiple permissions
val hasPermissions: Boolean
get() {
return ArePermissionsEnabled fromList stupidList
}
//**/
/ * This is a helper class used for checking permissions/
/ */
@elifry
elifry / natLangDoAfter.kt
Created October 3, 2021 21:49
Kotlin infix do after x time
import android.os.Handler
//**/
/ * This is a helper function used for timing, written with infix functions that make it/
/ * possible to write a timer resembling natural language. It contains both seconds and milliseconds/
/ * for convenience./
/ */
/ * Usage:/
/ * Do after 100 seconds {}/
/ * Do after aHundred milliseconds {}/
@elifry
elifry / calcAvg.java
Created October 3, 2021 21:47
Java calculate average from arraylist
private double calculateAverage(ArrayList<Integer> list) {
double sum = 0;
for (Integer elem : list) {
sum += elem;
}
sum = sum / list.size();
return sum;
}
@elifry
elifry / checkbox.css
Created October 3, 2021 21:42
CSS for checkbox
input[type='checkbox'] {
opacity: 0;
}
input[type='checkbox'] + label {
font: auto;
position: absolute;
// top: 25px;
display: flex;
align-items: center;