Skip to content

Instantly share code, notes, and snippets.

Matthew Flint mflint

  • Nottingham, UK
Block or report user

Report or block mflint

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mflint
mflint / DeparturesViewController.swift
Created Jan 26, 2019
data-driven screen dispatching for iOS
View DeparturesViewController.swift
class DeparturesViewController: UIViewController, ViewController {
private var viewModel: DeparturesViewModel!
func accept(_ viewModel: ViewModel) {
self.viewModel = viewModel as? DeparturesViewModel
}
}
@mflint
mflint / StringExtension.swift
Created Aug 29, 2018
A hacky String extension to convert html into NSAttributedString. Very Mastodon-specific. Very ugly.
View StringExtension.swift
import Foundation
extension String {
class HtmlComponent {
var parent: HtmlComponent?
var children = [HtmlComponent]()
init(parent: HtmlComponent? = nil) {
self.parent = parent
}
@mflint
mflint / QuickHelpMarkupExample.swift
Created Apr 7, 2018
Example of markup for Xcode "Quick Help"
View QuickHelpMarkupExample.swift
//: 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.
@mflint
mflint / .screenrc
Last active Mar 25, 2018
.screenrc
View .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 / ApproximateColorComparison.swift
Created Jan 14, 2018
UIColor extension for getting approximate colors. I use this in unit tests sometimes.
View ApproximateColorComparison.swift
//: 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
}
View keybase.md

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 / stripfatlibrary.sh
Created Apr 5, 2014
bash script to strip unwanted symbols from an Apple fat-binary library
View stripfatlibrary.sh
#!/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
@mflint
mflint / ThreadPool.java
Last active Aug 29, 2015
A simple thread pool in Java
View ThreadPool.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 / SlidesToLeftOnDeleteTableViewCell.m
Last active Dec 20, 2015
A subclass of UITableViewCell which slides to the left when the 'swipe to delete' gesture happens
View SlidesToLeftOnDeleteTableViewCell.m
#import "SlidesToLeftOnDeleteTableViewCell.h"
@interface SlidesToLeftOnDeleteTableViewCell ()
@property(nonatomic, assign) CGFloat deleteConfirmationShift;
@end
@implementation SlidesToLeftOnDeleteTableViewCell
- (void)prepareForReuse {
[super prepareForReuse];
@mflint
mflint / kindle-wallpaper.php
Created Feb 4, 2013
This takes a folder of images and creates new images suitable for Kindle wallpapers. It'll add text to the image too.
View kindle-wallpaper.php
<?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.
*/
You can’t perform that action at this time.