Skip to content

Instantly share code, notes, and snippets.

View heinrichreimer's full-sized avatar

Jan Heinrich Reimer heinrichreimer

View GitHub Profile
@heinrichreimer
heinrichreimer / hidden.css
Created September 24, 2013 14:06
Hide all elements with attribute "hidden"
[hidden]{
display:none;
}
function validate_url($url){
$result = preg_match("/^(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})(\/([\da-z\.-]+))*\/?(([\w\.-]+)\.([\da-z]{2,6}))?((\#[\w\.-]+)|(\?([\da-z]+(=[\da-z]+)?)(&([\da-z]+(=[\da-z]+)?))*))?/i", $url);
return $result;
}
/*Usage*/
if(validate_url("http://heinrich-reimer.de")){
/*Do something*/
}
@heinrichreimer
heinrichreimer / ListAdapter.java
Last active March 17, 2016 21:31
A RecyclerView.Adapter which can be used as a List and notifies the RecyclerView of every changes to the contained data.
package com.heinrichreimersoftware.playstorewatcher.adapters;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@heinrichreimer
heinrichreimer / DataBindingRecyclerViewAdapter.java
Last active March 23, 2017 02:22
RecyclerView adapter class for using data binding to replace view inflation.
package foo.bar;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.support.annotation.LayoutRes;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import java.util.List;
@heinrichreimer
heinrichreimer / extract_app_income_google_merchant.py
Last active March 30, 2017 01:50
This script helps you to calculate the total income from a Google merchants payment report CSV file.
#!/usr/bin/env python
import csv
import sys
import os.path
from decimal import Decimal
def endswith_case_insensitive(a, b):
a_lower = a.lower()
@heinrichreimer
heinrichreimer / redirect.html
Last active March 30, 2017 02:00
Redirect to any other webpage. (JS required)
<script type="text/javascript">
<!--
window.location = "https://www.heinrichreimer.com/";
//–>
</script>
@heinrichreimer
heinrichreimer / CONTRIBUTION_TEMPLATE.md
Last active March 30, 2017 02:04
This contribution guidelines provide useful information and basic rules for contributing to Heinrich Reimer Software open source projects.

Contributing Guidelines

@heinrichreimer
heinrichreimer / refresh-portfolio.sh
Created February 4, 2018 00:25
Script that runs on my web server and fetches, builds and deploys my personal portfolio. Portfolio sources can be found here: https://github.com/heinrichreimer/heinrichreimer.github.io
#!/usr/bin/env bash
set -e # Halt script on error.
# GitHub repo to fetch the portfolio from.
PORTFOLIO_REPO_USERNAME=heinrichreimer
PORTFOLIO_REPO_NAME=heinrichreimer.github.io
# Path to deploy the portfolio to.
PORTFOLIO_DEPLOY_PATH=~/www/heinrichreimer.com
@heinrichreimer
heinrichreimer / Wysker_Launchfilm_1_1_4_Metadata.xml
Created February 14, 2018 14:19
Metadata embedded into the Wysker_Launchfilm_1_1_4.mp4 file of the Wysker treasure hunt: https://www.youtube.com/watch?v=Ajhyirdd9CE
<?xml version="1.0"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c143 79.161210, 2017/08/11-10:28:36 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/" xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/" xmlns:illustrator="http://ns.adobe.com/illustrator/1.0/" xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/" xmlns:creatorAtom="http://ns.adobe.com/creatorAtom/1.0/" xmlns:bext="http://ns.adobe.com/bwf/bext/1.0/" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmlns:tiff="http://ns.adobe.com/t
@heinrichreimer
heinrichreimer / DataBindingFragment.java
Created March 21, 2017 15:42
Fragment class for using data binding to replace view inflation.
package foo.bar;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;