Skip to content

Instantly share code, notes, and snippets.

<resources xmlns:tools="http://schemas.android.com/tools" tools:locale="pl">
<plurals name="numberOfSongsAvailable">
<item quantity="one">Znaleziono %d piosenkę.</item>
<item quantity="few">Znaleziono %d piosenki.</item>
<item quantity="other">Znaleziono %d piosenek.</item>
</plurals>
</resources>
@koral--
koral-- / Example.kt
Last active February 5, 2018 05:12
Android string formatting
val text = resources.getString(R.string.welcome_message, 4) //"You have 4 new messages."
@koral--
koral-- / strings.xml
Created January 14, 2018 18:13
XML entity in strings.xml
<!DOCTYPE resources [
<!ENTITY foo "Foo">
]>
<resources>
<string name="app_name">&foo;</string>
<string name="busy_warning">Sorry, &foo; is working hard, please try again in a moment.</string>
<string name="trademark">&foo; is a registerd trademark, all rights reserved.</string>
</resources>
@koral--
koral-- / step.yml
Created May 5, 2018 01:21
Bitrise Flutter step inputs
inputs:
- version: 0.3.1-beta
opts:
title: "Flutter version"
summary: Flutter version including channel. Without `v` prefix. E.g. `0.2.8-alpha` or `0.3.0-dev`.
is_expand: true
is_required: true
- working_dir: $BITRISE_SOURCE_DIR
opts:
@koral--
koral-- / config.go
Last active May 6, 2018 22:20
Bitrise Flutter step config model
// Config ...
type Config struct {
Version string `env:"version,required"`
WorkingDir string `env:"working_dir,dir"`
Commands []string `env:"commands,required"`
}
@koral--
koral-- / bitrise.yml
Created May 7, 2018 00:21
bitrise.yml example
- change-workdir:
title: Switch working dir to test / _tmp dir
description: |-
To prevent step testing issues, like referencing relative
files with just './some-file' in the step's code, which would
work for testing the step from this directory directly
but would break if the step is included in another `bitrise.yml`.
run_if: "true"
inputs:
- path: ./_tmp
@koral--
koral-- / sample_test.go
Created May 7, 2018 00:37
Go unit test example
func TestDownloadFileUnreachableURL(t *testing.T) {
dummyFile, err := os.Open("/dev/null")
require.NoError(t, err)
err = downloadFile("http://unreachable.invalid", dummyFile)
require.Error(t, err)
}
@koral--
koral-- / step.yml
Last active May 7, 2018 01:32
Flutter dependencies
deps:
brew:
- name: git
- name: curl
- name: unzip
apt_get:
- name: git
- name: curl
- name: unzip
- name: libglu1-mesa
@koral--
koral-- / downloadutil.go
Last active May 7, 2018 16:47
Defer statement in Go
func downloadFile(downloadURL string, outFile *os.File) error {
response, err := http.Get(downloadURL)
if err != nil {
return err
}
defer func() {
if err := response.Body.Close(); err != nil {
log.Warnf("Failed to close (%s) body", downloadURL)
}
@koral--
koral-- / bitirise.yml
Created October 16, 2018 12:26
Chuck Norris jokes step inputs
inputs:
- category:
opts:
title: "Joke category, optional."
summary: |
Optional category of the joke, see [list of available categories](https://api.chucknorris.io/jokes/categories).
If empty joke won't be restricted to any category.
is_expand: true
is_required: false
- api_base_url: "https://api.chucknorris.io"