Skip to content

Instantly share code, notes, and snippets.

View markshiz's full-sized avatar

Mark Schisler markshiz

View GitHub Profile
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.TextView;
import com.github.jobs.BuildConfig;
import java.util.ArrayList;
import java.util.List;
@markshiz
markshiz / gist:6a3444a497ffe6fa90a0
Created June 27, 2014 05:23
Rails locale with HTTP_ACCEPT_LANGUAGE
require 'i18n'
module Rack
class Locale
def initialize(app)
@app = app
end
def call(env)
old_locale = I18n.locale
@markshiz
markshiz / gist:4410356
Last active December 10, 2015 08:48
A deep equality comparison for any NSObject
- (BOOL)isEqual:(id)object {
if ( [object isMemberOfClass:self.class] ) {
unsigned int count;
Ivar* ivars = class_copyIvarList(self.class, &count);
for(unsigned int i = 0; i < count; ++i) {
NSObject* lhs = object_getIvar(self, ivars[i]);
NSObject* rhs = object_getIvar(object, ivars[i]);
if ( [lhs isKindOfClass:NSObject.class] && [rhs isKindOfClass:NSObject.class] ) {
if ( ![lhs isEqual:rhs] ) {
free(ivars);

Keybase proof

I hereby claim:

  • I am markshiz on github.
  • I am markshiz (https://keybase.io/markshiz) on keybase.
  • I have a public key ASCH_7_0dtevFVMv6Yg16FbN4yYxOIRXAZ7QKhUzdktQ0go

To claim this, I am signing this object:

@markshiz
markshiz / CacheTest.java
Last active May 5, 2018 02:34 — forked from swankjesse/RetrofitCachingExample.java
Demonstrate HTTP caching with OkHttp 2.5.0 and Retrofit 1.9.0.
/*
* 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