Skip to content

Instantly share code, notes, and snippets.

View atomgomba's full-sized avatar

Károly Kiripolszky atomgomba

View GitHub Profile
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@atomgomba
atomgomba / portal-export.user.js
Last active October 18, 2020 14:46
IITC plugin: Export visible portals to JSON
// ==UserScript==
// @id iitc-plugin-portal-export
// @name IITC plugin: Export visible portals to JSON
// @category Info
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Display a list of all localized portals by level and faction.
// @include https://www.ingress.com/intel*
@atomgomba
atomgomba / common-steps-of-a-unit-test.java
Created February 22, 2017 10:22
Common steps of a unit test
// 1. arrange or setup step
Baby baby = new Baby();
// 2. act or action step
baby.removeToy();
// 3. assertion or verification step
assertTrue(baby.isCrying());
@atomgomba
atomgomba / assert-a-public-property.java
Created February 22, 2017 10:28
Assert a public property
Baby baby = new Baby();
baby.removeToy();
assertTrue(baby.isCrying());
@atomgomba
atomgomba / assert-a-return-value.java
Created February 22, 2017 10:28
Assert a return value
Baby baby = new Baby();
boolean toyGiven = baby.giveToy(null);
assertFalse(toyGiven);
@atomgomba
atomgomba / assert-change-in-dependency.java
Last active February 22, 2017 10:40
Assert change in dependency
Baby baby = new Baby();
Bottle bottle = new MockBottle();
// a csecsemőnek szüksége van egy üvegre a táplálkozáshoz
baby.feed(bottle);
assertTrue(bottle.isConsumeCalled());
class MockBottle extends Bottle {
@Override void consume() {
mConsumeCalled = true;
}
@atomgomba
atomgomba / assert-an-exception.java
Created February 22, 2017 10:30
Assert an exception
Baby baby = new Baby();
boolean exceptionWasThrown = false;
try {
baby.removeToy();
} catch (ToyNotExistsException e) {
exceptionWasThrown = true;
}
assertTrue(exceptionWasThrown);
@atomgomba
atomgomba / two-ways-of-dependency-injection.java
Last active February 22, 2017 10:42
Two ways of Dependency Injection
// injection via constructor
Baby baby = new Baby(new MockBottle());
// injection via setter
Baby baby = new Baby();
baby.giveBottle(new MockBottle());
@atomgomba
atomgomba / dependency-injection-bad-practice.java
Created February 22, 2017 10:31
Dependency Injection bad practice
class Baby {
private Bottle mBottle;
public Baby() {
// rossz, nem tesztelhető kód
mBottle = new Bottle();
}
}
@atomgomba
atomgomba / impossible-unit-test-on-android.java
Created February 22, 2017 10:32
Impossible unit test on Android
ArticleViewActivity a = new ArticleViewActivity();
Bundle b = new Bundle();
b.putString("articleId", "bab13");
a.onCreate(b);
assertTrue(a.hasArticle());