rcaldous / Enum from String - Kotlin
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 year ago
| 1 | // https://stackoverflow.com/questions/28548015/how-do-i-create-an-enum-from-a-string-in-kotlin |
| 2 | inline fun <reified T : Enum<T>> valueOf(type: String): T? { |
| 3 | return try { |
| 4 | java.lang.Enum.valueOf(T::class.java, type) |
| 5 | } catch (e: Exception) { |
| 6 | null |
| 7 | } |
| 8 | } |
rcaldous / RecordList Interface for Kotlin
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 year ago
| 1 | interface RecordList { |
| 2 | fun toRecordList(): MutableList<List<String>> |
| 3 | fun toMinimalRecordList(): MutableList<List<String>> |
| 4 | |
| 5 | val name: String |
| 6 | val header: List<String> |
| 7 | val headerMin: List<String> |
| 8 | } |
rcaldous / Create Folders from txt list
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 year ago
| 1 | xargs -d '\n' mkdir -p -- < folder_list.txt |
rcaldous / Clear Bash history
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 year ago
Don't want to be tempted to up arrow?
| 1 | cat /dev/null > ~/.bash_history && history -c && exit |
rcaldous / Git sub git actions (bulk actions)
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 year ago
| 1 | alias gfs="find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;" |
| 2 | alias gfp='ls | xargs -P10 -I{} git -C {} pull' |
rcaldous / Zip All sub folders (no compression)
0 gustos
0 bifurcaciones
1 archivos
Última actividad 1 year ago
| 1 | for i in */; do zip -r0 "${i%/}.zip" "$i"; done |
Siguiente
Anterior