Skip to content

Instantly share code, notes, and snippets.

View frankkienl's full-sized avatar
🤖
making Android apps

Frank Bouwens frankkienl

🤖
making Android apps
View GitHub Profile
@frankkienl
frankkienl / index.js
Created June 19, 2018 12:09
Call Firestore with Firebase Functions triggered by Storage
//Import libraries
const functions = require("firebase-functions");
const admin = require("firebase-admin");
//init
admin.initializeApp();
const firestore = admin.firestore();
//Create a function that is triggered by Storage
//https://firebase.google.com/docs/storage/extend-with-functions#trigger_a_function_on_changes
@frankkienl
frankkienl / RetrofitBug.java
Created September 22, 2017 14:50
Retrofit bug, exception on http201 with empty body
package nl.frankkie.retrofitbug;
import org.junit.Rule;
import org.junit.Test;
import okhttp3.ResponseBody;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import retrofit2.Call;
import retrofit2.Callback;
@frankkienl
frankkienl / aDarkRoomNotifierForTamperMonkey.js
Created September 6, 2016 12:17
Give notifications when A Dark Room's Gather button should be clicked again
// ==UserScript==
// @name A Dark Room notifier
// @namespace http://adarkroom.doublespeakgames.com/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://adarkroom.doublespeakgames.com/
// @grant none
// ==/UserScript==
//Andon's Color Badge basic program.
//Utilizes the ST7735 driver from Adafruit and the Adafruit Graphics Library
//Documentation can be found here: https://learn.adafruit.com/adafruit-gfx-graphics-library/graphics-primitives
//Due to size constraints (And my own coding abilities), no SD card interactions are programmed in.
//However, the standard SD card library can be used. I've added the SD card chip select pin below for reference.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
@frankkienl
frankkienl / Countries.java
Last active November 1, 2024 14:01
List of countries
/*
The Spotify API call, 'top-tracks' requires a ISO 3166-1 alpha-2 country code
//https://developer.spotify.com/web-api/get-artists-top-tracks/
//https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
//https://www.spotify.com/nl/legal/end-user-agreement/plain/#s19
//EU is not included in this list, as it generates this error:
{
"error": {
"status": 400,
"message": "Invalid country code"
@frankkienl
frankkienl / gist:06f4ba0da8e38e553258
Created June 3, 2015 07:25
Java Exceptions Testing. Finding out how re-throwing affects the stacktrace.
//Java Exceptions Testing. Finding out how re-throwing affects the stacktrace.
//Tested in: http://www.compilejava.net/
public class HelloWorld
{
public static void main(String[] args) throws Exception
{
testThrowUp();
}
@frankkienl
frankkienl / designer.html
Last active August 29, 2015 14:17
designer
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Brony MLP Überraschungspony Ratgeber</string>
<string name="main_welcome">"My Little Pony G4 Überraschungspony Ratgeber
Erstellt mit Daten der MLPMerch.com Überraschungspony-Datenbank.
Besuchen Sie MLPMerch.com für die Online Überraschungspony-Datenbank und MLP Merchandise Nachrichten!"</string>
<string name="action_settings">Einstellungen</string>
<string name="tut1">"Wussten Sie, das es gar keine große Überraschung sein muss, welches Pony sich in einer MLP-Überraschungspony Tüte versteckt?
Der Inhalt einer Überraschungspony Tüte lässt sich einfach feststellen ohne sie zu öffnen.
@frankkienl
frankkienl / no_recursion.js
Created August 19, 2014 17:23
Proof that some functions do not need to be recursive.
//Recursive
function A(n){
if (n <=0){return 0;}
return 1 - (1 - A( n - 1)) / 2;
}
//Not recursive, using a loop
function B(n){
if (n<=0){return 0;}
//TODO insert smart code here
@frankkienl
frankkienl / DeBet
Created June 19, 2014 13:15
De Bet
De Bet:
if (@W is LVL8 in Ingress op 2 juli 2014, 19:23, of eerder){
@F.geeft(@W, "6 beugelflessen");
} else {
@W.geeft(@F, "6 beugelflessen");
}