Skip to content

Instantly share code, notes, and snippets.

@blork
blork / Debouncer.swift
Last active March 20, 2019 14:36
Simple Debouncer in Swift 4
//
// Debouncer.swift
//
// Created by Sam Oakley on 20/03/2019.
//
import Foundation
class Debouncer {
@blork
blork / tableviewAnimation.m
Created February 20, 2015 11:48
Reload a tableview with nice animations.
- (void)reloadWithUpdatedObjects:(NSArray *)updatedObjects animated:(BOOL)animated
{
NSMutableArray *delete = [NSMutableArray array];
NSMutableArray *insert = [NSMutableArray array];
NSMutableArray *changed = [NSMutableArray array];
NSMutableDictionary *moved = [NSMutableDictionary dictionary];
NSInteger deleteIndex = 0;
for (NSObject *existingObject in self.objects)
{
@blork
blork / colors.xml
Created November 28, 2014 14:08
Material Colors
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#000000</color>
<color name="white">#FFFFFF</color>
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
<color name="red_300">#E57373</color>
@blork
blork / changelog.md
Last active August 29, 2015 14:07
What's new in Pinner 3.0.3

Pinner 3.0.3 (App Store)

  • Fixed landscape split view issues on iPhone 6 Plus.
  • Fixed a crash that could occur when sharing a bookmark.
  • Fixed a crash caused by an invalid URL being handed off (Handoff to Safari supports HTTP/HTTPS only).

##Share Extension

  • Never set the title and description to the same text. Brought to you by the department of redundancy department.
  • Add a notice if a bookmark has been previously added.
  • Fixed issue where PDFs could not be bookmarked.
@blork
blork / changelog.md
Last active August 29, 2015 14:07
What's new in Pinner 3.0.1

Pinner 3.0.1

The biggest update for Pinner yet, with hundreds of changes specially designed for iOS 8! If you like Pinner, please take the time to give it a nice review: it really helps!

  • Added @3x images for iPhone 6 Plus. So crisp.
  • Improved selection colour legibility in dark mode.
  • A few bug fixes.

@blork
blork / changelog.md
Last active August 29, 2015 14:07
What's new in Pinner 3.0.2

#Pinner 3.0.2

What's New

  • Improved extension compatibility with Pocket & others. You should now see both the URL and title when sharing to Pinner.
  • Tags are parsed from description text.
  • "Fill Description" option now works correctly.
  • Improved webview scrollbar display.
  • Fixed a bug that could cause articles containing HTML to be incorrectly displayed in the "Optimised" view.
  • Shows login page the first time the app runs.
  • Fixed a display bug that could cause spacing between title/description to be inconsistent. This one took a while to figure out.
@blork
blork / Prrprocessor.js
Created September 5, 2014 19:58
iOS Extension Web Page Preprocessor
var MyPreprocessor = function() {};
MyPreprocessor.prototype = {
run: function(arguments) {
// Pass the baseURI of the webpage to the extension.
arguments.completionFunction({"URL": document.URL, "pageSource": document.documentElement.outerHTML, "title": document.title, "selection": window.getSelection().toString()});
}
};
// The JavaScript file must contain a global object named "ExtensionPreprocessingJS".
var ExtensionPreprocessingJS = new MyPreprocessor;
@blork
blork / extensions.m
Last active May 20, 2021 14:25
Dealing with various extension data types
NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
NSItemProvider *itemProvider = item.attachments.firstObject;
// Shared plain text is stored here. Content varies wildly based on app.
NSString *sharedPlainText = [item.attributedContentText string];
if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypePropertyList]) {
[itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypePropertyList
options:nil
completionHandler:^(NSDictionary *item, NSError *error) {
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
NSInteger newIndex = toIndexPath.row;
NSInteger oldIndex = fromIndexPath.row;
EKReminder *movedReminder = self.remindersList[oldIndex];
[self.remindersList removeObjectAtIndex:oldIndex];
[self.remindersList insertObject:movedReminder atIndex:newIndex];
@blork
blork / New in 1.2.md
Last active August 29, 2015 13:56
Changelog for Tasked 1.2

New features

  • Change the app font to one of 22 alternatives.
  • You can hide the default "Reminders" list from the app.

Note: all settings are changed through the system Settings app.

Fixes

  • Fixed appearance of sharing options on iPad.
  • Improved display of notes screen.
  • Prevented reloading animation when moving to a new screen.