Skip to content

Instantly share code, notes, and snippets.

View dayanruben's full-sized avatar

Dayan Ruben dayanruben

View GitHub Profile
@dayanruben
dayanruben / keybase.md
Created July 15, 2016 19:13
Keybase proof

Keybase proof

I hereby claim:

  • I am dayanruben on github.
  • I am dayanruben (https://keybase.io/dayanruben) on keybase.
  • I have a public key whose fingerprint is C83F 99D3 E3FA 0915 1D36 B99C 0C18 C12A 8813 8109

To claim this, I am signing this object:

@dayanruben
dayanruben / cleanup_gradle_cache.sh
Created January 23, 2018 23:21
Cleanup script on "~/.gradle" to delete files not accessed recently.
find ~/.gradle -type f -atime +30 -delete
find ~/.gradle -type d -mindepth 1 -empty -delete
@dayanruben
dayanruben / base62.kt
Last active June 29, 2020 00:39
Base62 encoding/decoding
class Base62 {
val order = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
val base = order.length
fun encode(number: Int): String {
var num = number
var res = ""
while (num > 0) {
res = "${order[num % base]}$res"
@dayanruben
dayanruben / BecomingVisible.swift
Last active February 1, 2024 17:50
This Swift code is a SwiftUI extension for the View protocol. It adds a new method `onChangeVisibility(perform:)` that allows you to perform an action when the visibility of the view changes.
import SwiftUI
extension View {
func onChangeVisibility(perform action: @escaping (Bool) -> Void) -> some View {
modifier(BecomingVisible(action: action))
}
}
private struct BecomingVisible: ViewModifier {
@State var action: ((Bool) -> Void)