Skip to content

Instantly share code, notes, and snippets.

View eoinahern's full-sized avatar
🏠
reading the joy of kotlin. fantastic book

eoin_a eoinahern

🏠
reading the joy of kotlin. fantastic book
View GitHub Profile
@eoinahern
eoinahern / build.gradle
Created October 13, 2017 11:30
gradle dependency conflict solutions
//force a resolution
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.3.0'
}
@eoinahern
eoinahern / build.gradle
Created October 13, 2017 13:04
exclude a module
//excluding a module!
androidTestCompile ("com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion") {
exclude group: 'com.google.code.findbugs', module:'jsr305'
}
androidTestCompile ("com.android.support.test.espresso:espresso-contrib:$rootProject.espressoVersion") {
exclude group: 'com.google.code.findbugs', module:'jsr305'
}
androidTestCompile ("com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion") {
@eoinahern
eoinahern / build.gradle
Last active October 13, 2017 13:32
my build.gradle dependencies after modification.
dependencies {
//resolve a dependency
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.3.0'
resolutionStrategy.force 'com.android.support:support-compat:25.3.0'
}
// App's dependencies, including test
package models
type User struct {
UserName string `json: "username" gorm: "type:TEXT; primary_key; not null"`
Verified bool `json: "verified" gorm: "type : "BOOLEAN" `
Password string `json: "password" gorm: "type: TEXT"`
Token string `json: "token" sql:"-" gorm:"-" `
Podcasts []Podcast `json: "podcasts" gorm: "ForeignKey:UserEmail;AssociationForeignKey:UserName"`
}
@eoinahern
eoinahern / models.go
Created January 9, 2018 20:58
updated models.
package models
type User struct {
UserName string `json: "username" gorm: "primary_key; type:TEXT"`
Verified bool `json: "verified" gorm: "type : "BOOLEAN" `
Password string `json: "password" gorm: "type: TEXT"`
Token string `json: "token" sql:"-" gorm:"-" `
Podcasts []Podcast `json: "podcasts" gorm: "ForeignKey:UserEmail"`
}
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
"os"
)
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
"os"
)
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
//back navigation in android
//initate toolbar
val detailsToolbar: Toolbar by lazy { findViewById<Toolbar>(R.id.toolbar) }
//in onCreate
this.setSupportActionBar(detailsToolbar)
actionBar = supportActionBar
actionBar?.apply {
this.setDisplayHomeAsUpEnabled(true)
@eoinahern
eoinahern / CallToApi.java
Created June 22, 2018 10:39
rx problem a guy was having on slack. put into a gist because the code was formatted badly. An attempt to make the code more readable.
Interceptor addHeadersInterceptor = chain -> {
if (tokenInvalid){
String token = getToken()); //If multiple call stays here blocked.
}
};
public String getToken() {