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 / ajaxifying my django
Created February 11, 2011 18:23
Simplest way to do Ajax in Django?
from django.utils import simplejson
....
def problems_of_delivery(request, delivery_id):
delivery = get_object_or_404(Delivery, pk=int(delivery_id))
problem_list =[]
for problem in delivery.problem_set.all():
problem_list.append([problem.type.id , problem.comment ])
res_dict = {"date":datetime.now().strftime("%H:%M")}
res_dict["problems"]=problem_list
@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
*
@madewulf
madewulf / gist:3149407
Created July 20, 2012 07:55
Readme migrationsmap.net
MigrationsMap.net
=================
This is the code of the site [http://migrationsmap.net](http://migrationsmap.net), including the scripts
used to generate the JSON data files.
The code is under MIT license.
Don't hesitate to contact me at madewulf@gmail.com, or via twitter: http://twitter.com/madewulf if you have
@interface UIImage(ImmediateLoad)
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path;
@end
@implementation UIImage(ImmediateLoad)
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path {
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
#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) {

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.

//
// 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
@madewulf
madewulf / gist:7907886
Created December 11, 2013 10:03
Mini CSV example
import csv
reader = csv.reader(open('file.csv', 'rU'))
for row in reader:
print row[0]
@madewulf
madewulf / gist:3255752b28acd52a6bc4
Created June 9, 2014 18:40
Matchador App Store description jokes.
Testimonials:
------------
This is better than paying taxes!
-- A good friend
Best game that I ever played!
-- My Mom
It's so fun that I have a sudden need to kiss you

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