Skip to content

Instantly share code, notes, and snippets.

View mflint's full-sized avatar

Matthew Flint mflint

View GitHub Profile
@mflint
mflint / LRRestyClient+FailureBlock.h
Created November 21, 2011 22:01
LRResty timeout workaround
//
// LRRestyClient+FailureBlock.h
//
#import <Foundation/Foundation.h>
#import <LRResty/LRResty.h>
#import "RVRestyClientBlockDelegate.h"
@interface LRRestyClient (FailureBlock)
@mflint
mflint / JournalList.lua
Created November 23, 2012 22:13
TrunkNotes script for showing lists of journal entries
--[[
# Introduction
This is a script for handling lists of journal entries, and will display
them in two ways:
* short mode, on just one line. This contains the latest five entries,
plus a link to an 'All' page
@mflint
mflint / kindle-wallpaper.php
Created February 4, 2013 22:37
This takes a folder of images and creates new images suitable for Kindle wallpapers. It'll add text to the image too.
<?php
/*
* This finds all jpegs in a directory ($sourcedirectory) and creates
* an advert for each one. It will:
* - resize
* - convert to greyscale
* - add a textbox at the bottom with a header and multiple lines of
* smaller texts, supplied as two arguments on the command line. The
* second argument may contain \n to create line breaks.
*/
@mflint
mflint / SlidesToLeftOnDeleteTableViewCell.m
Last active December 20, 2015 17:58
A subclass of UITableViewCell which slides to the left when the 'swipe to delete' gesture happens
#import "SlidesToLeftOnDeleteTableViewCell.h"
@interface SlidesToLeftOnDeleteTableViewCell ()
@property(nonatomic, assign) CGFloat deleteConfirmationShift;
@end
@implementation SlidesToLeftOnDeleteTableViewCell
- (void)prepareForReuse {
[super prepareForReuse];
@mflint
mflint / ThreadPool.java
Last active August 29, 2015 13:56
A simple thread pool in Java
package org.tthew.core;
import java.util.ArrayDeque;
import java.util.Queue;
public final class ThreadPool
{
public interface IThreadPool
{
void submitJob(final IJob job);
@mflint
mflint / stripfatlibrary.sh
Created April 5, 2014 23:45
bash script to strip unwanted symbols from an Apple fat-binary library
#!/bin/sh
# this is the name of the problematic lib
FRAMEWORK=ActivityX.framework
LIB=ActivityX
# these are the duplicate symbols
SYMBOLS="AFURLRequestSerialization.o AFHTTPRequestOperationManager.o AFURLSessionManager.o"
# the architectures in the lib

Keybase proof

I hereby claim:

  • I am mflint on github.
  • I am flint (https://keybase.io/flint) on keybase.
  • I have a public key whose fingerprint is 7159 7967 0976 28FB 3958 0A2D A1FD 567C 2016 837D

To claim this, I am signing this object:

@mflint
mflint / ApproximateColorComparison.swift
Created January 14, 2018 20:29
UIColor extension for getting approximate colors. I use this in unit tests sometimes.
//: Playground - noun: a place where people can play
import UIKit
import XCTest
extension UIColor {
private struct Best {
var color: (color: UIColor, name: String)
var distance: CGFloat
}
@mflint
mflint / .screenrc
Last active March 25, 2018 14:13
.screenrc
ignorecase on
defsilence on
defmonitor on
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW} %H %-w%{.rW}%n %t%{-}%+w %=%{..Y} %d/%m %c "
startup_message off
@mflint
mflint / QuickHelpMarkupExample.swift
Created April 7, 2018 10:25
Example of markup for Xcode "Quick Help"
//: Playground - noun: a place where people can play
import Foundation
/**
This func does the fnord.
- parameters:
- foo: The foo.
- bar: The bar.
- returns: A return value.