Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Heinrich Reimer heinrichreimer

View GitHub Profile
@heinrichreimer
heinrichreimer / SpanningGridLayoutManager.java
Last active Apr 26, 2021
GridLayoutManager implementation that stretches to fit all grid items on screen and disables scrolling. Useful for dashboards etc.
View SpanningGridLayoutManager.java
package com.example;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class SpanningGridLayoutManager extends GridLayoutManager {
@heinrichreimer
heinrichreimer / background_wallpaper_styles.xml
Created May 1, 2014
Use android wallpaper as activity background
View background_wallpaper_styles.xml
<resources>
<style name="Configuration.Theme" parent="Configuration.Theme.Base">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowBackground">#1000</item>
</style>
</resources>
View validate_url.php
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 / hidden.css
Created Sep 24, 2013
Hide all elements with attribute "hidden"
View hidden.css
[hidden]{
display:none;
}
@heinrichreimer
heinrichreimer / redirect.html
Last active Mar 30, 2017
Redirect to any other webpage. (JS required)
View redirect.html
<script type="text/javascript">
<!--
window.location = "https://www.heinrichreimer.com/";
//–>
</script>