This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INPUT_DIR="input" | |
OUTPUT_DIR="output" | |
RESIZE_DIMENSIONS="1080x1080" | |
BLUR_RADIUS="0x50" # Standard deviation (0 for auto-radius) x Sigma (how much blur) | |
# Adjust Sigma (e.g., 5, 10, 15) for more or less blur | |
BORDER_SIZE="8" # Border thickness in pixels for the original image | |
BORDER_COLOR="white" # Color of the border |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"source_id": "302598399050397860", | |
"version": "1", | |
"workflow": { | |
"name": "Words from the Heart", | |
"blueprint": { | |
"version": "1", | |
"trigger": { | |
"type": "channel_action", | |
"id": "4bde8971-a75a-4310-b5ec-efceeea0a91a", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Define callback that will be triggered after a photo has been taken and saved to disk */ | |
private val imageSavedListener = object : ImageCapture.OnImageSavedListener { | |
override fun onError(error: ImageCapture.UseCaseError, message: String, exc: Throwable?) { | |
exc?.printStackTrace() | |
} | |
override fun onImageSaved(photoFile: File) { | |
lifecycle.coroutineScope.launch { | |
rotateImageCorrectly() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun start() { | |
program.accept(LoadLabelsMsg) | |
program.accept(LoadAccountsMsg) | |
} | |
override fun resume() { | |
} | |
override fun destroy() { | |
programDisposable.dispose() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccountActivity : AccountView { | |
lateinit var presenter: AccountPresenter | |
// Using the ViewBinder is simple | |
override var accountView: AccountViewModel by ViewBinder { | |
txt_username.text = it.userName | |
txt_company.text = it.company | |
txt_contact_email.text = it.email | |
txt_contact_phone.text = it.phone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* View binder with nullable types support | |
*/ | |
class ViewBinder<M>(val function: (M) -> Unit) : ReadWriteProperty<Any, M> { | |
private var mValue: M? = null | |
override fun getValue(thisRef: Any, property: KProperty<*>): M { | |
return mValue as M | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate a stream | |
Stream.unfold({0, 1}, fn {a, b} -> {a, {b, a + b}} end) | |
# Take the first 15 numbers | |
|> Enum.take(15) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a exercise in Programming Elixir from Pragmatic Bookshelf | |
fizzbuzz_check = fn | |
(0, 0, _) -> "FizzBuzz" | |
(0, _, _) -> "Fizz" | |
(_, 0, _) -> "Buzz" | |
(_, _, c) -> c | |
end | |
fizzbuzz = fn(n) -> fizzbuzz_check.(rem(n, 3), rem(n, 5), n) end |