Skip to content

Instantly share code, notes, and snippets.

View joharei's full-sized avatar

Johan Reitan joharei

  • Olavstoppen
  • Sykkylven, Norway
View GitHub Profile
@itsJoKr
itsJoKr / marker_generator.dart
Last active November 11, 2023 11:16
Quick way to convert the widget to marker, not supposed to work with images.
import 'package:flutter/material.dart';
import 'dart:typed_data';
import 'package:flutter/rendering.dart';
import 'dart:ui' as ui;
/// This just adds overlay and builds [_MarkerHelper] on that overlay.
/// [_MarkerHelper] does all the heavy work of creating and getting bitmaps
class MarkerGenerator {
final Function(List<Uint8List>) callback;
final List<Widget> markerWidgets;
@passsy
passsy / Locale.kt
Last active February 9, 2022 13:05
Allows easy iteration about all available locales. Kotlin Collection implementation for LocaleList which doesn't implement Collection<Locale> itself.
package com.pascalwelsch.android.util
import android.content.Context
import androidx.core.os.ConfigurationCompat
import androidx.core.os.LocaleListCompat
import java.util.Locale
/**
* Returns an [Iterable] for the languages of the user, sorted by priority. First choice first.
*/
@serj-lotutovici
serj-lotutovici / GenericPolymorphicJsonAdapterFactory.java
Last active May 8, 2022 19:45
A Moshi JsonAdapter.Factory that creates Polymorphic JsonAdapter. Requires Moshi 1.4.0. (Tests written in kotlin)
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.JsonDataException;
import com.squareup.moshi.JsonReader;
import com.squareup.moshi.JsonWriter;
import com.squareup.moshi.Moshi;
import com.squareup.moshi.Types;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
@adrienbrault
adrienbrault / purge.sh
Created September 24, 2012 10:02
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5