Skip to content

Instantly share code, notes, and snippets.

@adamawolf
adamawolf / delete_all_kindle_documents.js
Created Jan 25, 2013
Faced with 80 old Instapaper Kindle documents and no delete all button, I did what any self respecting coder would do.
View delete_all_kindle_documents.js
//load jquery in console separately first
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();
//delete ALL entries currently listed in Manage Your Kindle screen
idsToDelete = []
$('form[name="fionaDL"] input[name="contentName"]').each(function () { idsToDelete.push(this.value); })
$(idsToDelete).each(function() {Fion.deleteItem('deleteItem_' + this);})
@adamawolf
adamawolf / gist:3823502
Created Oct 2, 2012
How to print out a CGPathRef for debugging purposes
View gist:3823502
static void outputApplier(void* info, const CGPathElement* element)
{
NSMutableArray* a = (NSMutableArray*) info;
int nPoints;
NSString * pathElementType = nil;
switch (element->type)
{
case kCGPathElementMoveToPoint:
@adamawolf
adamawolf / geojson_us.js
Created Sep 3, 2012
GeoJSON Multipolygon for the United States
View geojson_us.js
{
"type": "MultiPolygon",
"coordinates":
[
[
[
[ -123.123779, 48.227039 ], // contig. u.s.
[ -123.318787, 49.000042 ],
[ -121.742592, 49.000267 ],
[ -95.157394, 49.000493 ],
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active Aug 10, 2020
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
View Apple_mobile_device_types.txt
i386 : iPhone Simulator
x86_64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)
@adamawolf
adamawolf / gist:2698506
Created May 15, 2012
Prevent UIWebView callouts when users long tap on links
View gist:2698506
[[self webView] stringByEvaluatingJavaScriptFromString:@"\
var css = document.createElement(\"style\");\
css.type = \"text/css\";\
css.innerHTML = \"body { -webkit-touch-callout: none; }\";\
document.body.appendChild(css);"];
@adamawolf
adamawolf / Remap.c
Created May 29, 2010
An Objective-C data structure that accepts setVariableName: and variableName messages without declaring a variableName property.
View Remap.c
//
// Remap.m
//
// Created by Adam Wolf on 5/24/10.
//
#import "Remap.h"
@interface Remap ()
@property (nonatomic, retain) NSMutableDictionary * _data;
You can’t perform that action at this time.