Skip to content

Instantly share code, notes, and snippets.

@blork
blork / Debouncer.swift
Last active Mar 20, 2019
Simple Debouncer in Swift 4
View Debouncer.swift
//
// Debouncer.swift
//
// Created by Sam Oakley on 20/03/2019.
//
import Foundation
class Debouncer {
@blork
blork / tableviewAnimation.m
Created Feb 20, 2015
Reload a tableview with nice animations.
View tableviewAnimation.m
- (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 Nov 28, 2014
Material Colors
View colors.xml
<?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 Aug 29, 2015
What's new in Pinner 3.0.3
View changelog.md

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 Aug 29, 2015
What's new in Pinner 3.0.1
View changelog.md

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 Aug 29, 2015
What's new in Pinner 3.0.2
View changelog.md

#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 Sep 5, 2014
iOS Extension Web Page Preprocessor
View Prrprocessor.js
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 Dec 13, 2018
Dealing with various extension data types
View extensions.m
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) {
View gist:9599421
- (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 Aug 29, 2015
Changelog for Tasked 1.2
View New in 1.2.md

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.