Skip to content

Instantly share code, notes, and snippets.

@jinqian
jinqian / PokedexViewModel.kt
Last active January 6, 2020 10:47
PokedexViewModel.kt
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import io.grpc.okhttp.OkHttpChannelBuilder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class PokedexViewModel : ViewModel() {
@jinqian
jinqian / PokedeServer.kt
Last active December 9, 2019 15:51
PokedexServer.kt
class PokedexServer {
private val port = 50052
private var server: Server? = null
@Throws(IOException::class)
private fun start() {
//...
server = ServerBuilder.forPort(port)
@jinqian
jinqian / pokedex.proto
Created December 9, 2019 10:13
pokedex.proto
syntax = "proto3";
option java_multiple_files = true;
option java_package = "fr.xebia.hellogrpc";
option java_outer_classname = "PokedexProto";
option objc_class_prefix = "PD";
package pokedex;
service Pokedex {
@jinqian
jinqian / delete-branches.md
Created November 19, 2019 09:34
Delete branch by pattern

To delete many branches based on a specified pattern do the following:

  • Open the terminal, or equivalent.
  • Type in git branch | grep "<pattern>" for a preview of the branches that will be deleted.
  • Type in git branch | grep "<pattern>" | xargs git branch -D

Replace the with a regular expression to match your branch names and that’s it.

@jinqian
jinqian / kotlin-conf-2018-slides.md
Last active October 4, 2018 20:48
KotlinConf 2018 Slides
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports multiple lauguages. (en-US, en-GB, de-DE).
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
**/
@jinqian
jinqian / index.js
Created December 26, 2017 15:20
Example google assistant for LaLiga
// Copyright 2016, Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@jinqian
jinqian / gist:015cb4d6b6fcf1cc9896a290b3309c8a
Created July 6, 2017 08:39 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@jinqian
jinqian / README.md
Created June 22, 2017 11:48 — forked from shekibobo/README.md
Android: Base Styles for Button (not provided by AppCompat)

How to create custom button styles using Android's AppCompat-v7:21

Introduction

AppCompat is an Android support library to provide backwards-compatible functionality for Material design patterns. It currently comes bundled with a set of styles in the Theme.AppCompat and Widget.AppCompat namespaces. However, there is a critical component missing which I would have thought essential to provide the a default from which we could inherit our styles: Widget.AppCompat.Button. Sure, there's Widget.AppCompat.Light.ActionButton, but that doesn't actually inherit from Widget.ActionButton, which does not inherit from Widget.Button, so we might get some unexpected behavior using that as our base button style, mainly because Widget.ActionButton strictly belongs in the ActionBar.

So, if we want to have a decently normal default button style related to AppCompat, we need to make it ourselves. Let's start by digging into the Android SDK to see how it's doing default styles.

Digging In