Skip to content

Instantly share code, notes, and snippets.

View jparishy's full-sized avatar

Julius Parishy jparishy

View GitHub Profile
@jparishy
jparishy / .lldbinit
Created September 19, 2013 20:20
Print JSON from LLDB
...
command script import ~/.lldb/print_json.py
# Then restart Xcode
//
// main.m
// FSEventsTest
//
// Created by Julius Parishy on 8/20/13.
// Copyright (c) 2013 Fitocracy. All rights reserved.
//
#import <Foundation/Foundation.h>
@jparishy
jparishy / mlisp.m
Last active December 21, 2015 04:09
Playing with Lisp interpretation in a C/Objective-C hybrid. Mostly implemented in C with use of the Objective-C runtime.
//
// main.m
// MLisp
//
// Created by Julius Parishy on 8/13/13.
// Copyright (c) 2013 Lonely Ether. All rights reserved.
//
#import <Foundation/Foundation.h>
self.circleImageView.image = ^{
UIGraphicsBeginImageContextWithOptions(size, NO, UIScreen.mainScreen.scale);
[UIColor.ft_lightBlueColor set];
[[UIBezierPath bezierPathWithOvalInRect:CGRectInset(self.circleImageView.bounds, 1.0f, 1.0f)] stroke];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
@jparishy
jparishy / Output
Last active December 20, 2015 13:39
Today in Ugly Code
2013-08-02 11:37:42.612 Zip[36780:303] (
"Julius Parishy, 20",
"Bob Smith, 42",
"Ted Mosby, 30"
)
@jparishy
jparishy / gist:6033788
Last active December 19, 2015 23:18
Go fuck yourself, UICollectionView
@implementation FTTrack20TrackHomeFlowLayout
-(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
return YES;
}
/*
* If the size of your UICollectionViewCell is larger than the screen height (
* I think? Consistently getting booted at height > 480) then it decides to remove
//
// main.m
// project_euler_7
//
// Created by Julius Parishy on 7/11/13.
// Copyright (c) 2013 Fitocracy. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
typedef void(^FTFetchRequestConfigureBlock)(NSFetchRequest *fetchRequest);
typedef void(^FTFetchRequestCompletion)(NSOrderedSet *results, NSError *error);
typedef void(^FTFetchRequestSingleCompletion)(id model, NSError *error);
@interface FTFetchRequest : NSObject
@property (nonatomic, strong, readonly) NSManagedObjectContext *managedObjectContext;

a.

    -(void)someOtherNewAction:(UIButton *)button;
    ...
    [self.button addTarget:self action:@selector(someAction:) forControlEvents:UIControlEventTouchUpInside];

c. Double click 'someAction', only the text becomes selected.

d. Start typing 'someOtherNewAction'

RACSignal *latest = [RACSignal combineLatest:@[ self.maxWeightTextField.rac_textSignal, self.maxRepsTextField.rac_textSignal ]];
[latest subscribeNext:^(RACTuple *values) {
RACTupleUnpack(NSString *maxWeight, NSString *maxReps) = values;
CGFloat maxWeightValue = maxWeight.floatValue;
NSInteger repIndex = maxReps.integerValue;
CGFloat percentages[12] = {