Skip to content

Instantly share code, notes, and snippets.

View martyglaubitz's full-sized avatar

Marty Glaubitz martyglaubitz

View GitHub Profile
@martyglaubitz
martyglaubitz / sitemap_lighthouse.py
Last active May 21, 2021 08:22
Script which given a URL to a Sitemap, takes each URL and performs a Lighthouse check on it
import csv
import dataclasses
import json
import io
import os
import os.path
import subprocess
import sys
import urllib.parse
import urllib.request
@martyglaubitz
martyglaubitz / check_sitemap.py
Created May 6, 2020 11:41
Check urls in sitemap
import csv
import datetime
import io
import sys
import urllib.request
import xml.dom.minidom
def get_sitemap_urls(sitemap_url):
response = urllib.request.urlopen(sitemap_url)
@martyglaubitz
martyglaubitz / select_driver.cpp
Last active September 7, 2019 12:20
Utility to automatically select the best suitable video driver for Irrlicht
#include <iostream>
#include "select_driver.h"
IrrlichtDevice* createDeviceWithBestGraphicsDriver(dimension2d<u32> resolution)
{
for (auto driverType : driverTypesByPreference)
{
IrrlichtDevice *result = createDevice( driverType, resolution, 16,
@martyglaubitz
martyglaubitz / GaussianBlurTransformation.java
Last active September 3, 2017 13:31
A gaussian blur transformation for picasso, using renderscript.
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.Element;
import android.support.v8.renderscript.RenderScript;
import android.support.v8.renderscript.ScriptIntrinsicBlur;
import com.squareup.picasso.Transformation;
public class GaussianBlurTransformation implements Transformation {
@martyglaubitz
martyglaubitz / jcr2sqlite.py
Created July 6, 2017 18:20
Creates an SQLite database from a Magnolia JSON dump
import json
import sqlite3
def load_jcr_json(filePath: str):
with open(filePath) as file:
return json.load(file)
nodes_scheme = '''
CREATE TABLE IF NOT EXISTS nodes (
@martyglaubitz
martyglaubitz / CircleNetworkImageView.java
Last active January 8, 2016 11:59
Circle mask NetworkImageView for Volley
/* The MIT License (MIT)
Copyright (c) 2014, Marty Glaubitz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@martyglaubitz
martyglaubitz / SP.ClientContext.prototype.loadAsync
Last active January 3, 2016 05:39
A leaner version of the "executeQueryAsync" method of the ClientContext class
/*
* USAGE
*
* var ctx = SP.ClientContext.get_current();
*
* var web = ctx.get_web();
* var groups = web.get_siteGroups();
*
* ctx.loadAsync([web, groups], function (err, clientObjects) {
* if (err) {
@martyglaubitz
martyglaubitz / FragmentNavigationManager.kt
Last active December 8, 2015 14:29
Utlity classes to enable the handling of backpressed in Fragments
interface FragmentNavigationManager {
fun onNavigateUp(): Boolean
fun registerUpNavigationListener(upNavigationListener: UpNavigationListener)
fun unregisterUpNavigationListener(upNavigationListener: UpNavigationListener)
}
@martyglaubitz
martyglaubitz / SubjectClickListener.java
Created October 26, 2015 21:59
A reusable click listener which emits an object on click
package de.schlankr.utils;
import android.support.annotation.IdRes;
import android.view.View;
import rx.subjects.PublishSubject;
public class SubjectClickListener <V> implements View.OnClickListener {
public static <V> SubjectClickListener<V> get(final PublishSubject<V> publishSubject, final View clickTarget, final View tagTarget, @IdRes final int listenerId) {
@martyglaubitz
martyglaubitz / gist:9d258a1ac3dd701b1c35
Created June 10, 2015 11:45
PostgreSQL start/stop under mac

#STOP launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

#START launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist