Skip to content

Instantly share code, notes, and snippets.

Avatar

Futtetennista futtetennista

View GitHub Profile
@futtetennista
futtetennista / kindle2anki.sh
Last active Jun 15, 2019
Export Kindle highlights to Anki
View kindle2anki.sh
#!/usr/bin/env bash
set -euox pipefail
# Go to https://read.amazon.com/notebook and export your highlights as JSON using https://readwise.io/bookcision
#
# Install http://ankiweb.net/ and the https://foosoft.net/projects/anki-connect/index.html extension. Create a simple front-only card in anki, e.g.
# Card template: {{Front}}
# Styling:
# .card {
@futtetennista
futtetennista / FreeFSM.hs
Last active Sep 30, 2018
Free FSM! An implementation of finite state machines as in https://wickstrom.tech/finite-state-machines/2017/11/19/finite-state-machines-part-2.html using Free monads
View FreeFSM.hs
#!/usr/bin/env stack
-- stack script --resolver lts-9.14 --package free
{-# LANGUAGE GADTs, DeriveFunctor #-}
type CartItem =
String
type CreditCard =
String
View keybase.md

Keybase proof

I hereby claim:

  • I am futtetennista on github.
  • I am futtetennista (https://keybase.io/futtetennista) on keybase.
  • I have a public key ASB-391E1CLq7CqRsAvsqmW3Tnlm8PmcSh6_w4MaOZueego

To claim this, I am signing this object:

@futtetennista
futtetennista / RESOURCES.md
Last active May 25, 2017
Primer: Writing efficient code in a lazy language (Hamburg Haskell Meetup 2016-05-24)
View RESOURCES.md
@futtetennista
futtetennista / ThreadPoolIdlingResource.java
Last active Oct 12, 2016
Code taken from Espresso's AsyncTaskPoolMonitor and adapter to be used as an idling resource for any ThreadPoolExecutor
View ThreadPoolIdlingResource.java
/*
* Copyright (C) 2013 Google, 2014 Stefano Dacchille
*
* 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
View CustomUncaughtExceptionHandlerProxy.java
public class CustomUncaughtExceptionHandlerProxy implements Thread.UncaughtExceptionHandler {
private static CustomUncaughtExceptionHandlerProxy proxy;
private final boolean enabled;
private Thread.UncaughtExceptionHandler customUncaughtExceptionHandler;
private CustomUncaughtExceptionHandlerProxy(CustomApplication application) {
enabled = !application.inDevMode();
View IgnitedActivity
@Override
public boolean onIgnitedLocationChanged(Location location) {
return locationManager.onNewLocation(this, location, lastSearchedLocation);
}
View EndlessOnPageChangeListener
private class EndlessOnPageChangeListener implements OnPageChangeListener {
private static final int NO_PAGE = -1;
int loadingPage = NO_PAGE;
@Override
public void onPageSelected(int currentPage) {
// we're not on the loading element
if (loadingPage != currentPage) {
loadingPage = NO_PAGE;
currentAdapter.setLoadingData(false);
View IgnitedLocationActivity.java
@IgnitedLocationActivity
public class IgnitedLocationSampleActivity extends MapActivity {
// MUST BE OVERRIDDEN OR IGNITION LOCATION WON'T WORK!
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
}
// MUST BE OVERRIDDEN OR IGNITION LOCATION WON'T WORK!
You can’t perform that action at this time.