Skip to content

Instantly share code, notes, and snippets.

awesome stuff

Iiro Krankka roughike

awesome stuff
View GitHub Profile
mcrumm /
Last active Sep 28, 2022
Phoenix + SQLite Deployment tips

Deploying to with SQLite

Deploying a Phoenix app to is a what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"

It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd (erm, firecracker) world.

This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari

* 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
* Unless required by applicable law or agreed to in writing, software
wispborne /
Last active Aug 17, 2020
Comparison of Java to Kotlin for various simple methods.
/** Example of a {@link Class} declaration */
public final class MyClass {
private boolean someBool;
public MyClass() {
public MyClass(boolean someBool) {
this.someBool = someBool;
danielgomezrico / jacoco.gradle
Last active Oct 5, 2020
Gradle - jacoco gradle file that is setup to run tests and create test coverage reports for Android (junit tests or connectedTests...). apply to your project and check "reporting" in gradle tasks. Thanks to for it.
View jacoco.gradle
project.afterEvaluate {
// Grab all build types and product flavors
def buildTypes = android.buildTypes.collect { type -> }
def productFlavors = android.productFlavors.collect { flavor -> }
// When no product flavors defined, use empty
if (!productFlavors) productFlavors.add('')
productFlavors.each { productFlavorName ->
buildTypes.each { buildTypeName ->
mikelehen / generate-pushid.js
Created Feb 11, 2015
JavaScript code for generating Firebase Push IDs
View generate-pushid.js
* Fancy ID generator that creates 20-character string identifiers with the following properties:
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
staltz /
Last active Sep 28, 2022
The introduction to Reactive Programming you've been missing
nicktoumpelis /
Created Apr 23, 2014
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
JakeWharton /
Created May 6, 2012
Base fragment to ensure the parent activity implements a contract interface.
/* Base fragment to ensure the parent activity implements a contract interface. */
public abstract class ContractFragment<T> extends Fragment {
private T mContract;
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()
View redis_pubsub_demo.rb
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby