Skip to content

Instantly share code, notes, and snippets.

View madewulf's full-sized avatar
🤷‍♂️
Multitasking.

Martin De Wulf madewulf

🤷‍♂️
Multitasking.
View GitHub Profile
@madewulf
madewulf / Makefile
Created October 25, 2017 15:05 — forked from johan/Makefile
Makefile of the steps in Mike Bostock's command-line cartography tutorial, parts 1-4 https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c
# request one at http://api.census.gov/data/key_signup.html and paste it below
CENSUS_API_KEY=YOUR_CODE_HERE
# a factor 1609.34 squared
SQ_M_TO_SQ_MI=2589975.2356
#prereqs:
# npm install -g shapefile # 0.6.1
# npm install -g d3-geo-projection # 1.2.1
# npm install -g ndjson-cli # 0.3.0
@madewulf
madewulf / TabComponent.swift
Created August 7, 2016 19:46 — forked from irace/TabComponent.swift
Easily roll your own `UITabBarController` alternatives. Here’s all the logic you need without assuming anything about your UI.
/**
* A class that can be part of a tabbed navigational interface (expected to be a `UIViewController` but can also be a
* coordinator that proxies through to an underlying controller).
*/
public protocol TabComponent {
/// The tab metadata
var tabItem: TabItem { get }
var viewController: UIViewController { get }
}
@madewulf
madewulf / link.md
Created July 25, 2016 12:45 — forked from Spaxe/link.md

I'm not 100% sure this is all accurate but:

It seems as though share extension predicates are a lot more specific than we originally thought. For example, if Instapaper declares support for only NSExtensionActivationSupportsWebURLWithMaxCount = 1, this means that activity controllers configured with a URL but also some other item types too, e.g. a string, won't show Instapaper.

So basically if you have multiple items in your activity items array, your controller will only show extensions that support all types. I imagine this would be extremely limiting, and as such, think the best option is to:

  • Only include a single provider in your items array. The provider would have a placeholder of a single type that will be provided to any activity or extension that isn't specifically accounted for
  • In the provider, specifically hardcode alternative item types for activities that need an alternative to the placeholder type:
    • "Copy" activity could use photo data, if present
  • "Mail" activity woul
//
// CommonMacros.h
// Created by Tom Adriaenssen (@inferis)
//
/*
* How to use this file:
* 1. Find your .pch file
* 2. Import this file
* 3. Make sure to import this file after UIKit and Foundation

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

#import <objc/runtime.h>
#import <objc/message.h>
#import <QuartzCore/QuartzCore.h>
#define PROPERTY(propName) NSStringFromSelector(@selector(propName))
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#ifdef DEBUG
static void PSPDFSwizzleMethod(Class c, SEL orig, SEL new) {
@interface UIImage(ImmediateLoad)
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path;
@end
@implementation UIImage(ImmediateLoad)
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path {
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
@madewulf
madewulf / asshole.js
Created May 30, 2011 08:48 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*