Skip to content

Instantly share code, notes, and snippets.

@alattis
alattis / fetch_kindle.js
Created March 6, 2020 22:30 — forked from tokland/fetch_kindle.js
Get back my books from Kindle
#!/usr/bin/env node
/*
* @fileoverview Program to free the content in kindle books as plain HTML.
*
* This is largely based on reverse engineering kindle cloud app
* (https://read.amazon.com) to read book data from webSQL.
*
* Access to kindle library is required to download this book.
*/
@alattis
alattis / gist:cf400a9fe264dc796582
Created September 26, 2014 20:14
combined address
001, Downtown Seattle, 500 Pine Street, Seattle, WA, 98101, 206-628-2111
002, Northgate, 401 NE Northgate Way, Seattle, WA, 98125, 206-364-8800
003, Southcenter Square Rack, 17200 Southcenter Parkway Suite 110, Tukwila, WA, 98188, 206-407-1020
004, Bellevue, 100 Bellevue Square, Bellevue, WA, 98004, 425-455-5800
005, Southcenter, 100 Southcenter Shopping Center, Tukwila, WA, 98188, 206-246-0400
006, Tacoma Mall, 4502 S Steele Street Ste 800, Tacoma, WA, 98409, 253-475-3630
009, Spokane, 828 West Main Avenue, Spokane, WA, 99201, 509-455-6111
010, Alderwood, 3200 184th Street SW, Lynnwood, WA, 98037, 425-771-5755
012, Anchorage, 603 D Street, Anchorage, AK, 99501, 907-279-7622
014, Factoria Square Rack, 3920 124th Street SE, Bellevue, WA, 98006, 425-746-7200
1000,MILWAUKEE,1501 WEST ZELLMAN COURT,MILWAUKEE,WI,53221,(414) 764-2474
1001,BRAINTREE,705 GRANITE STREET,BRAINTREE,MA,2184,(781) 848-3200
1002,PINEBROOK,40 ROUTE 46 WEST,PINEBROOK,NJ,7058,(973) 227-6040
1003,PARAMUS,651 ROUTE 17 SOUTH,PARAMUS,NJ,7652,(201) 444-2224
1004,CLIFTON HEIGHTS,5202 W BALTIMORE AVENUE,CLIFTON HEIGHTS,PA,19018,(610) 259-7300
1005,STONY BROOK,2199 NESCONSET HIGHWAY,STONY BROOK,NY,11790,631-444-0150
1006,EYNON,840 SCRANTON CARBONDALE HWY,EYNON,PA,18403,(570) 876-4171
1007,FORESTVILLE,3200 DONNELL DRIVE,FORESTVILLE,MD,20747,(301) 736-6685
1008,BAILEYS CROSSROAD,3524 SOUTH JEFFERSON STREET,BAILEYS CROSSROAD,VA,22041,(703) 379-7878
1009,DORAVILLE,5766 BUFORD HIGHWAY NE,DORAVILLE,GA,30340,(404) 634-5566
001, Downtown Seattle, 500 Pine Street, Seattle, WA, 98101, 206-628-2111
002, Northgate, 401 NE Northgate Way, Seattle, WA, 98125, 206-364-8800
003, Southcenter Square Rack, 17200 Southcenter Parkway,Tukwila, WA, 98188, 206-407-1020
004, Bellevue, 100 Bellevue Square, Bellevue, WA, 98004, 425-455-5800
005, Southcenter, 100 Southcenter Shopping Center, Tukwila, WA, 98188, 206-246-0400
006, Tacoma Mall, 4502 S Steele Street Ste 800, Tacoma, WA, 98409, 253-475-3630
009, Spokane, 828 West Main Avenue, Spokane, WA, 99201, 509-455-6111
010, Alderwood, 3200 184th Street SW, Lynnwood, WA, 98037, 425-771-5755
012, Anchorage, 603 D Street, Anchorage, AK, 99501, 907-279-7622
014, Factoria Square Rack, 3920 124th Street SE, Bellevue, WA, 98006, 425-746-7200
001, Downtown Seattle, 500 Pine Street, Seattle, WA, 98101, 206-628-2111
002, Northgate, 401 NE Northgate Way, Seattle, WA, 98125, 206-364-8800
003, Southcenter Square Rack, 17200 Southcenter Parkway,Tukwila, WA, 98188, 206-407-1020
004, Bellevue, 100 Bellevue Square, Bellevue, WA, 98004, 425-455-5800
005, Southcenter, 100 Southcenter Shopping Center, Tukwila, WA, 98188, 206-246-0400
006, Tacoma Mall, 4502 S Steele Street Ste 800, Tacoma, WA, 98409, 253-475-3630
009, Spokane, 828 West Main Avenue, Spokane, WA, 99201, 509-455-6111
010, Alderwood, 3200 184th Street SW, Lynnwood, WA, 98037, 425-771-5755
012, Anchorage, 603 D Street, Anchorage, AK, 99501, 907-279-7622
014, Factoria Square Rack, 3920 124th Street SE, Bellevue, WA, 98006, 425-746-7200
#import <objc/runtime.h>
NSArray* ClassGetSubclasses(Class parentClass)
{
int numClasses = objc_getClassList(NULL, 0);
Class *classes = NULL;
classes = (Class*)malloc(sizeof(Class) * numClasses);
numClasses = objc_getClassList(classes, numClasses);
@alattis
alattis / gist:7905820
Last active December 31, 2015 00:09
escape everything
[NSString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet alphanumericCharacterSet]];
@alattis
alattis / gist:5297950
Created April 3, 2013 02:22
thread safe core data the easy way
//in background operation
backgroundMOC = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
[backgroundMOC setParentContext:appDelegate.managedObjectContext];
//in app delegate
if (coordinator != nil) {
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
}
@alattis
alattis / gist:5172993
Last active December 15, 2015 00:28
class method using gcd to draw an image
+ (UIImage *)defaultLeftImage {
static UIImage *defaultImage = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
UIGraphicsBeginImageContextWithOptions(CGSizeMake(20.f, 13.f), NO, 0.0f);
[[UIColor blackColor] setFill];
[[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 20, 1)] fill];
[[UIBezierPath bezierPathWithRect:CGRectMake(0, 5, 20, 1)] fill];
[[UIBezierPath bezierPathWithRect:CGRectMake(0, 10, 20, 1)] fill];
@alattis
alattis / gist:5079260
Created March 4, 2013 01:15
objective c singleton
+ (CLASS *)sharedInstance
{
static CLASS *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[CLASS alloc] init];
// Do any other initialisation stuff here
});
return sharedInstance;
}