I hereby claim:
- I am rabidaudio on github.
- I am charlesjuliank (https://keybase.io/charlesjuliank) on keybase.
- I have a public key ASCiVJ-0jQV-f3X2dLlSFkk54lSFNeiX16hyPmy8gQeUKAo
To claim this, I am signing this object:
require 'csv' | |
data = <<~CSV | |
Album Track Tags Places Swears | |
This Is A Long Drive For Someone With Nothing To Think About Dramamine travel:distance, drugs:otc, geography, listerine, death, sleep:dreaming damn | |
This Is A Long Drive For Someone With Nothing To Think About Breakthrough light:sunlight, air | |
This Is A Long Drive For Someone With Nothing To Think About Custom Concern biome:desert, religion:church, labor:job, travel:parkinglot | |
This Is A Long Drive For Someone With Nothing To Think About Might comedy damn | |
This Is A Long Drive For Someone With Nothing To Think About Lounge light, vehicle:car, math, dancing, cold | |
This Is A Long Drive For Someone With Nothing To Think About Beach Side Property biome:beach, water:ocean, water:river, religion:god, telephone, labor:union, citytown:expansion California |
require 'open-uri' | |
# I happened to watch [this video](https://www.youtube.com/watch?v=le5uGqHKll8) and it got | |
# me thinking about if the executioner cheats by changing the word during the course of the | |
# game, can the guesser still win? | |
# | |
# Results: | |
# 1: y, 24 | |
# 2: ky, 20 | |
# 3: qqv, 16 |
-- Postgres jsonb_concat() function only merges the top level keys, it does not merge nested objects. | |
-- This will merge all nested objects. Note that it doesn't recurse through arrays, nor does it append | |
-- arrays, it simply replaces them. It would be easy to adjust this if you need. Tested on 9.6. | |
-- NOTE: This was mostly an experiment and has not been thoroughly vetted for functionality or performance, | |
-- use at your own risk! | |
-- This work is in the Public Domain. | |
CREATE OR REPLACE FUNCTION _deep_jsonb_concat(a jsonb, b jsonb) RETURNS jsonb AS $$ | |
DECLARE | |
key text; | |
merged jsonb; |
grammar English; | |
paragraph: sentence+ EOF; | |
sentence: prepositionalPhrase* subject activeVerb directObject indirectObject? prepositionalPhrase* '.' | |
| prepositionalPhrase* subject? toBeVerb (directObject | adjective)? prepositionalPhrase* '.' | |
| toBeVerb subject (directObject | adjective)? prepositionalPhrase* '?'; | |
subject: nounPhrase; | |
directObject: nounPhrase; |
I hereby claim:
To claim this, I am signing this object:
suspend fun showConfirmationDialog() = suspendCancellableCoroutine<Boolean> { cont -> | |
val dialog = AlertDialog.Builder(this) | |
.setMessage("Are you sure?") | |
.setPositiveButton("Yes", { _, _ -> cont.resume(true) }) | |
.setNegativeButton("No", { _, _ -> cont.resume(false) }) | |
.setCancelable(true) | |
.setOnCancelListener { cont.cancel() } | |
.create() | |
dialog.show() |
// see https://discuss.kotlinlang.org/t/units-of-measure/3454/7 | |
// see http://javanut.net/2017/05/23/more-fun-with-generics-in-kotlin/ | |
//class Bag<T> private constructor(val wrapped: List<T>): Collection<T> by wrapped { | |
// | |
// private class DefaultComparator<T>: Comparator<T> { | |
// override fun compare(o1: T, o2: T): Int = o1.toString().compareTo(o2.toString()) | |
// } | |
// | |
// companion object { |
package com.example | |
import kotlinx.coroutines.experimental.* | |
import java.util.concurrent.ExecutorService | |
import java.util.concurrent.Executors | |
/** | |
* simulated blocking operation | |
*/ | |
fun blockingFoo(x: Int): Int { |
// | |
// Observable+Promise.swift | |
// | |
// Created by Charles Julian Knight on 1/2/17. | |
// Copyright © 2017 Charles Julian Knight. All rights reserved. | |
// | |
import Foundation | |
import RxSwift | |
import PromiseKit |