Skip to content

Instantly share code, notes, and snippets.

View miquelbeltran's full-sized avatar

Miguel Beltran miquelbeltran

View GitHub Profile
@slightfoot
slightfoot / static_html_view.dart
Last active July 1, 2023 15:57
Static Html View Widget - by Simon Lightfoot - 12/11/2019
// MIT License
//
// Copyright (c) 2020 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@slightfoot
slightfoot / main.dart
Last active April 16, 2020 17:48
Fab Popup - by Simon Lightfoot - 8th Feburary 2020
// MIT License
//
// Copyright (c) 2020 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@chrisbanes
chrisbanes / ScopedViewModel.kt
Last active October 25, 2022 21:29
ScopedViewModel
open class ScopedViewModel : ViewModel() {
private val job = Job()
protected val scope: CoroutineScope = job + Dispatchers.Main
override fun onCleared() {
super.onCleared()
job.cancel()
}
}
@hvisser
hvisser / DemoModeEnabler.kt
Created January 23, 2018 11:44
Enables demo mode on a device for the purpose of taking screenshots
class DemoModeEnabler {
fun enable() {
executeShellCommand("settings put global sysui_demo_allowed 1")
sendCommand("exit")
sendCommand("enter")
sendCommand("notifications", "visible" to "false")
sendCommand("network", "wifi" to "hide")
sendCommand("battery", "level" to "100", "plugged" to "false")
sendCommand("clock", "hhmm" to "1000")
@Elforama
Elforama / VMInjectionFactory.kt
Last active January 1, 2022 14:58
Android view model factory implementation allowing easy view model constructor injection.
/**
* Usage example:
*
* @Inject
* lateinit var mFactory: VMInjectionFactory<MyViewModel>
*/
class VMInjectionFactory <out Type: ViewModel> @Inject constructor(val vm: Lazy<Type>): ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(p0: Class<T>): T {
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 5, 2024 18:31
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@chadmaughan
chadmaughan / pre-commit.sh
Last active November 25, 2022 00:38
A git pre commit hook that runs the test task with the gradle wrapper
#!/bin/sh
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/pre-commit.sh pre-commit
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'