Skip to content

Instantly share code, notes, and snippets.

Avatar

Jean-Michel Fayard jmfayard

View GitHub Profile
@jmfayard
jmfayard / Salsa - Paris.md
Last active October 23, 2022 12:16
Salsa - Paris.md
View Salsa - Paris.md
View goto.bash
#!/usr/bin/env bash
fail() {
echo "ERROR: $1"
exit 1
}
isInstalled() {
which "$1" > /dev/null
}
openUrls() {
URLS="$*"
@jmfayard
jmfayard / gradle-libs.versions.toml
Last active February 27, 2022 10:24
Migrante instantly to Gradle Versions Catalog with refreshVersions
View gradle-libs.versions.toml
## Generated by $ ./gradlew refreshVersionsCatalog
[plugins]
org-jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
org-jetbrains-kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version = "0.4.2" }
patrick = { id = "org.jetbrains.patrick", version = "0.4.2" }
@jmfayard
jmfayard / install.sh
Last active October 22, 2022 19:46
Command line tools that spark joy
View install.sh
#!/usr/bin/env bash -x
# > CLI tool that sparks joy
#
# stedolan/jq: Command-line JSON processor](https://github.com/stedolan/jq)
# direnv/direnv: unclutter your .profile](https://github.com/direnv/direnv)
# jonas/tig: Text-mode interface for git](https://github.com/jonas/tig)
# tmux/tmux: tmux source code](https://github.com/tmux/tmux)
# santinic/how2: stackoverflow from the terminal](https://github.com/santinic/how2)
# BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respecting your gitignore](https://github.com/BurntSushi/ripgrep)
# sharkdp/bat: A cat(1) clone with wings.](https://github.com/sharkdp/bat)
View runOnGitHub.yml
# .github/workflows/runOnGitHub.yml
# GitHub Actions documentation
# => https://docs.github.com/en/actions
name: runOnGitHub
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, main ]
@jmfayard
jmfayard / cloudSettings
Last active November 29, 2019 09:44
Visual Studio code
View cloudSettings
{"lastUpload":"2019-11-29T09:44:56.606Z","extensionVersion":"v3.4.3"}
View android-camera-samples-fragment.kt
public inline fun needsRefactoring(): Nothing = throw NotImplementedError("""
This does too much and needs to be refactored.
Don't put any kind of logic in the Activities and Fragments.
""".trimIndent())
class Camera2BasicFragment : Fragment(), View.OnClickListener,
ActivityCompat.OnRequestPermissionsResultCallback {
private val surfaceTextureListener = object : TextureView.SurfaceTextureListener {
override fun onSurfaceTextureAvailable(texture: SurfaceTexture, width: Int, height: Int) = needsRefactoring()
@jmfayard
jmfayard / stacktrace.txt
Created September 6, 2019 15:30
Cannot change dependencies of configuration ':classpath' after it has been resolved.
View stacktrace.txt
$ cd sample-kotlin
$ gw --stacktrace dependencyUpdates
executing gradlew instead of gradle
> Task :dependencyUpdates FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dependencyUpdates'.
> Cannot change dependencies of configuration ':classpath' after it has been resolved.
View MoshiAdapters.kt
object MoshiAdapters {
val moshi : Moshi = Moshi.Builder().build()
inline fun <reified T: Any> moshiAdapter(clazz: Class<T> = T::class.java): Lazy<JsonAdapter<T>>
= lazy { moshi.adapter(clazz) }
val movie: JsonAdapter<Movie> by moshiAdapter()
val user: JsonAdapter<User> by moshiAdapter()