Skip to content

Instantly share code, notes, and snippets.

Karol Wrótniak koral--

Block or report user

Report or block koral--

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:+"
}
}
@koral--
koral-- / build.gradle
Last active Feb 6, 2019
JitPack sample
View build.gradle
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
jcenter()
}
@koral--
koral-- / build.gradle
Last active Jan 30, 2019
Build.gradle example
View build.gradle
repositories {
mavenCentral()
jcenter()
gradlePluginPortal()
maven { url 'https://jitpack.io' }
}
@koral--
koral-- / .bitrise.secrets.yml
Created Oct 17, 2018
MY_STEPLIB_REPO_FORK_GIT_URL source in .bitrise.secrets.yml
View .bitrise.secrets.yml
envs:
- MY_STEPLIB_REPO_FORK_GIT_URL: git@github.com:DroidsOnRoids/bitrise-steplib.git
@koral--
koral-- / bitrise.yml
Created Oct 16, 2018
Bitrise step test workflow
View bitrise.yml
test:
steps:
- go-list: {}
- golint: {}
- errcheck: {}
- script:
inputs:
- content: |-
#!/usr/bin/env bash
go vet
@koral--
koral-- / step.yml
Created Oct 16, 2018
Bitrise step output
View step.yml
outputs:
- CHUCK_NORRIS_JOKE:
opts:
title: "Random Chuck Norris joke text"
summary: Random joke about Chuck Norris from API
@koral--
koral-- / main.go
Last active Oct 16, 2018
Bitrise step Chuck Norris jokes main function
View main.go
func main() {
var config Config
if err := stepconf.Parse(&config); err != nil {
log.Errorf("Could not validate config, error: %s\n", err)
os.Exit(1)
}
joke, err := getRandomJoke(config)
if err != nil {
@koral--
koral-- / main.go
Last active Oct 16, 2018
Downloading Chuck Norris joke as a plain text
View main.go
func getRandomJoke(config Config) (string, error) {
request, err := buildJokeRequest(config)
if err != nil {
return "", err
}
response, err := getJoke(request)
if err != nil {
return "", err
}
@koral--
koral-- / main.go
Created Oct 16, 2018
Reading plain text HTTP response
View main.go
func readJokeFromResponse(response *http.Response) (string, error) {
if response.StatusCode != http.StatusOK {
return "", fmt.Errorf("server returned an error: %s", response.Status)
}
content, err := ioutil.ReadAll(response.Body)
return string(content), err
}
@koral--
koral-- / main.go
Created Oct 16, 2018
HTTP request with timeout in Go
View main.go
func getJoke(request *http.Request) (*http.Response, error) {
client := &http.Client{}
client.Timeout = 20 * time.Second
return client.Do(request)
}
You can’t perform that action at this time.