Skip to content

Instantly share code, notes, and snippets.

View jcraane's full-sized avatar

Jamie Craane jcraane

View GitHub Profile
@jcraane
jcraane / logback.xml
Created July 3, 2013 18:26
Sample logback.xml file with console and rolling file appender. The rollover is time based (daily) and size based, 5MB.
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<Pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
@jcraane
jcraane / serialization-issue.kt
Last active June 28, 2022 14:05
Jackson serialization issue with sub/super types
package nl.anwb.geocontext
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.databind.DatabindContext
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.JavaType
import com.fasterxml.jackson.databind.MapperFeature
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver
import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule
@jcraane
jcraane / DistanceUnit.kt
Created March 6, 2022 19:42
Complement for Distance.kt
import kotlin.math.abs
import kotlin.math.roundToLong
enum class DistanceUnit(private val orderLowerIsLarger: Int) {
KILOMETERS(1),
HECTOMETERS(2),
DECAMETERS(3),
METERS(4),
DECIMETERS(5),
CENTIMETERS(6),
@jcraane
jcraane / Distance.kt
Created March 6, 2022 19:42
Simple implementation of Distance in Kotlin
@JvmInline
value class Distance internal constructor(private val rawValue: Long) : Comparable<Distance> {
override fun compareTo(other: Distance) = this.rawValue.compareTo(other.rawValue)
val inWholeMeters: Long
get() = toLong(DistanceUnit.METERS)
val inWholeKilometers: Long
get() = toLong(DistanceUnit.KILOMETERS)
public class CircularDrawable extends Drawable {
private final Bitmap mBitmap;
private final Paint mPaint;
private final RectF mRectF;
private final int mBitmapWidth;
private final int mBitmapHeight;
public CircularDrawable(Bitmap bitmap) {
mBitmap = bitmap;
mRectF = new RectF();
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<shutdownHook/>
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<Pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
</encoder>
</appender>
SetOutputFilter DEFLATE
# mod_deflate configuration
<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/json
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jcarousellite.js"></script>
<script type="text/javascript">
$(document).ready(function (){
$(".carousel").jCarouselLite({
btnNext: ".next",
// Usage:
// blacklist
String[] blacklist = new String[]{"com.any.package", "net.other.package"};
// your share intent
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "some text");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "a subject");
// ... anything else you want to add
// invoke custom chooser