Skip to content

Instantly share code, notes, and snippets.

@kingargyle
kingargyle / commit-msg
Created April 19, 2019 14:10 — forked from williamdenton/commit-msg
Git hooks
#!/bin/sh
commit_regex='^(PP-[0-9]+|fixup!)'
error_msg="Aborting commit. Your commit message is missing a JIRA ticket ('PP-1234')"
if ! grep -iqE "$commit_regex" "$1";
then
echo "$error_msg" >&2
exit 1
@kingargyle
kingargyle / BindingAdapter.java
Created November 29, 2018 21:16 — forked from JakeWharton/BindingAdapter.java
An adapter base class that uses a new/bind pattern for its views.
// Apache 2.0 licensed.
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */
public abstract class BindableAdapter<T> extends BaseAdapter {
@kingargyle
kingargyle / git-completion.bash
Created February 7, 2018 15:39 — forked from tomykaira/git-completion.bash
Show completion candidates for git-add, git-checkout --, and git-reset HEAD --
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@kingargyle
kingargyle / openconnect.md
Created February 6, 2018 14:46 — forked from moklett/openconnect.md
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@kingargyle
kingargyle / C-kernel-codestyle-eclipse.xml
Created August 11, 2017 15:37 — forked from txomon/C-kernel-codestyle-eclipse.xml
This is a configuration file for eclipse to make C code follow as much as possible Linux Codystyle
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="1">
<profile kind="CodeFormatterProfile" name="Linux Kernel" version="1">
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="80"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
@kingargyle
kingargyle / Jackson1ConverterFactory
Created March 8, 2017 21:30 — forked from svendroid/Jackson1ConverterFactory
Retrofit Jackson1ConverterFactory
package retrofit;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.ResponseBody;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectReader;
import org.codehaus.jackson.map.ObjectWriter;
import org.codehaus.jackson.type.JavaType;
@kingargyle
kingargyle / RetrofitCachingExample.java
Created March 7, 2017 18:30 — forked from swankjesse/RetrofitCachingExample.java
Demonstrate HTTP caching with OkHttp and Retrofit.
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader.TileMode;
import android.util.AttributeSet;