Skip to content

Instantly share code, notes, and snippets.

View miquelbeltran's full-sized avatar

Miguel Beltran miquelbeltran

View GitHub Profile
public class MainActivity extends AppCompatActivity {
// Removed members for example
// Retrofit Service, we will move this out of the MainActivity
GoogleBooksService service;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@PaperParcel
data class MyValue(
val id: Int,
val title: String = "",
val count: Int = 0,
val enabled: Boolean = false
) : PaperParcelable {
companion object {
@JvmField val CREATOR = PaperParcelMyValue.CREATOR
}
@AutoValue
public abstract class MyValue implements Parcelable {
public abstract int getId();
public abstract String getTitle();
public abstract int getCount();
public abstract boolean getEnabled();

Quality Disclaimer

Dear Recruiter/Hiring Manager: This project does not reflect the expected code quality of my professional work, neither reflects my level of expertise with a particular language, platform or library. It should be taken just as example of my passion for programming. On the contrary, if you where impressed by the work found here... Awesome! Let's talk.

@miquelbeltran
miquelbeltran / LiveTemplates.xml
Created May 11, 2017 08:51
IDEA Live Templates
<template name="test" value="@Test&#10;fun `$TEST_NAME$`() {&#10; $TEST_CONTENT$&#10;}" description="Kotlin Test Template" toReformat="false" toShortenFQNames="true">
<variable name="TEST_NAME" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="TEST_CONTENT" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="KOTLIN" value="true" />
</context>
</template>
@miquelbeltran
miquelbeltran / BowlingKtTest.kt
Last active May 19, 2017 12:23
Bowling Kata Dart vs Kotlin
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
internal class BowlingKtTest {
@Test
fun `score is 0 when the player did not knock down any pins`() {
assertEquals(0, Array(20, { 0 }).toList().score())
}
@Test
@miquelbeltran
miquelbeltran / pre-push.sh
Last active June 4, 2019 06:53 — forked from chadmaughan/pre-commit.sh
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'
external fun require(module:String):dynamic
fun main(args: Array<String>) {
println("Hello JavaScript!")
val express = require("express")
val app = express()
app.get("/", { req, res ->
res.type("text/plain")
group 'node-example'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
curl https://fcm.googleapis.com/fcm/send -X POST \
--header "Authorization: key=long auth key" \
--Header "Content-Type: application/json" \
-d '
{
"to": "the device token"
"notification":{
"title":"New Notification!",
"body":"Test"
},