Skip to content

Instantly share code, notes, and snippets.

View dkasper's full-sized avatar
🌶️
Hacking

Dave Kasper dkasper

🌶️
Hacking
View GitHub Profile
https://source.unsplash.com/WiztboNPFcY/400x300
https://source.unsplash.com/Bxzrd0p6yOM/400x300
https://source.unsplash.com/B6O-Fc4TIvE/400x300
https://source.unsplash.com/nTTh5UXkHp8/400x300
https://source.unsplash.com/JjDqyWuWZyU/400x300
https://source.unsplash.com/EyeSSqkHIvc/400x300
https://source.unsplash.com/UPapS5-R_rk/400x300
https://source.unsplash.com/4m9j8TrudRs/400x300
https://source.unsplash.com/Glbh-AKaPiw/400x300
https://source.unsplash.com/01_igFr7hd4/400x300
{
"kind": "Listing",
"data": {
"modhash": "2tktfpjtv63127d614d282a009ab5fcb3c6d51d1ed002dca03",
"children": [
{
"kind": "t3",
"data": {
"domain": "self.announcements",
"banned_by": null,
@dkasper
dkasper / ios_resizer.sh
Last active August 29, 2015 13:56
Utility scripts for dealing with assets on iOS
#!/bin/bash
# This script assumes that ImageMagick is installed and the convert command is accessible\
# Create copies of all files in directory at 50% size (and names them without @2x)
for infile in *
do
outfile=$(echo $infile | sed -n "s/@2x//p")
test -z $outfile && continue
convert $infile -resize 50% $outfile
done
@dkasper
dkasper / gist:4323786
Created December 18, 2012 00:29
Testing code for afnetworking bug
-(void)testImageUpload {
NSString *url = [NSString stringWithFormat:@"/photos/index.json"];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://localhost:3000"]];
NSMutableURLRequest *request = [client multipartFormRequestWithMethod:@"POST" path:url parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
//100 bytes of data
NSString *seed = @"iauhsdoifusdoiusfsduyxctzivytcixhudsifnlekjrnjewrbfkuydgvyuqewbemnfdbfsoiddfhdalufhasdlnqeiuqeuwbfux";
NSMutableArray *seeds = [NSMutableArray arrayWithCapacity:654];
for(int i=0; i<653;i++) {
[seeds addObject:seed];
@dkasper
dkasper / CoreTextLabel.h
Created October 2, 2012 03:26
A multiline label drawn with core text. Needed it for line spacing, can easily be modified to use any core text properties though.
//
// CoreTextLabel.h
// Frost
//
// Created by David Kasper on 10/1/12.
//
#import <UIKit/UIKit.h>
#import <CoreText/CoreText.h>
@dkasper
dkasper / NSDictionary+cleanNull
Created August 31, 2012 04:29
Remove NSNull objects from NSDictionary
#import "NSDictionary+CleanNSNull.h"
@implementation NSDictionary (CleanNSNull)
-(NSDictionary *)cleanNull {
return [self dictionaryWithValuesForKeys:[[self keysOfEntriesPassingTest:^BOOL(id key, id obj, BOOL *stop) {
return ![obj isEqual:[NSNull null]];
}] allObjects]];
}