Skip to content

Instantly share code, notes, and snippets.

View martyglaubitz's full-sized avatar

Marty Glaubitz martyglaubitz

View GitHub Profile
@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 / 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 / BorderDrawable.java
Last active August 29, 2015 14:02
A drawable which draws borders as background of a view
/* 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 / ActionBarTabsAtopFix.java
Last active August 29, 2015 14:02
Fix: Android Actionbar Tabs appear over ActionBar
final View homeIcon = findViewById(android.R.id.home);
((View) homeIcon.getParent()).setVisibility(View.GONE);
@martyglaubitz
martyglaubitz / DistributeLayout.java
Last active August 29, 2015 14:03
DistributingLayout
/* 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 / 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 / hprof.py
Created February 12, 2015 12:18
A python script to pull humpdump from an android device/emulat, which can be opened with Eclipse MAT
#!/usr/bin/python -u
import argparse
import subprocess
import time
parser = argparse.ArgumentParser(description='Pull a memory profile of an running process')
parser.add_argument('pid', nargs='+', help='The apps process id')
args = parser.parse_args()
@martyglaubitz
martyglaubitz / env.bat
Created March 31, 2015 12:37
Scripts to get node_modules bins into the path
path=%PATH%;node_modules\.bin
@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

@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) {