Skip to content

Instantly share code, notes, and snippets.

View Phocacius's full-sized avatar

Thorsten Hack Phocacius

  • WhereGroup GmbH
  • Baden-Württemberg, Germany
View GitHub Profile
@fredy-mederos
fredy-mederos / KoinJavaUtils.kt
Created March 27, 2018 19:00
Koin java utility functions to inject components and properties in java classes.
package com.common.utils
import org.koin.KoinContext
import org.koin.standalone.StandAloneContext
import kotlin.jvm.internal.Reflection
/**
* @author @fredy_mederos
*/
@LouisCAD
LouisCAD / SelectableRelativeLayout.java
Created June 29, 2016 09:28
A selectable RelativeLayout that will show Android's selectableItemBackground on foreground (ripple on Lollipop+) when touched.
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
@veganista
veganista / file.liquid
Created April 20, 2016 10:56
Debugging Objects in Shopify Templates
<script>console.log({{ product | json }});</script>
@aakashns
aakashns / gmid.py
Created November 30, 2015 05:18
Simple command script to download and add Google Material Design Icons ( https://www.google.com/design/icons/ ) to to your Android project
#! /usr/bin/env python
# Simple command script to download and add Google Material
# Design Icons ( https://www.google.com/design/icons/ ) to
# to your Android project.
# 'gmid' stands for 'Google Material Icons Downloader'
import sys
import os
@tartakynov
tartakynov / fourex.py
Last active December 20, 2024 08:10
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x
@xeoncross
xeoncross / http_accept_language.php
Last active February 7, 2025 13:05
Parse the HTTP except language header
<?php
function prefered_language($available_languages, $http_accept_language) {
$available_languages = array_flip($available_languages);
$langs = array();
preg_match_all('~([\w-]+)(?:[^,\d]+([\d.]+))?~', strtolower($http_accept_language), $matches, PREG_SET_ORDER);
foreach($matches as $match) {