Skip to content

Instantly share code, notes, and snippets.

(lldb) po data
{
post = {
authorType = ByteUser;
comments = (
);
commentsCount = 0;
created = 1439682081451;
createdString = 1439682081451;
deleted = 0;
@nataliepo
nataliepo / gist:18832ae51019ed35a741
Created April 13, 2015 14:17
Create dictionary from file
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"allSources" ofType:@"json"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSError *error = nil;
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
# GraphikRegular
# GraphiAppRegular < 16.0
lineSpacingMultiplier = 1.3
@nataliepo
nataliepo / gist:f85083bbab2c1d66fcbb
Created December 9, 2014 18:12
lunch places that do not suck in soho
Berimbau Do Brasil
La Esquina
Eva's
Mooncake
@nataliepo
nataliepo / gist:dbde17be66655020f291
Last active August 29, 2015 14:08
useful way to inspect view hierarchy
po [[UIWindow keyWindow] recursiveDescription]
@nataliepo
nataliepo / gist:abd716667b6325a66608
Created September 11, 2014 14:07
keeping a forked repo up to date
to configure your repo to point to an upstream repo:
1. add this to .git/config:
[remote "upstream"]
url = https://github.com/gitusername/repo-name.git
fetch = +refs/heads/*:refs/remotes/upstream/*
2. fetch the other repo's changes into upstream/master
git fetch upstream
@nataliepo
nataliepo / observe.M
Created September 2, 2014 17:51
observing a view's frame change
// create the observer
[[self contentView] addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:NULL];
// track changes
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([object isKindOfClass:[UIView class]]) {
CGRect rect = [[change valueForKey:NSKeyValueChangeNewKey] CGRectValue];
@nataliepo
nataliepo / Vehicle-Car
Created September 2, 2014 00:59
Vehicle-Car
//
// CarFactory.swift
// test1
//
// Created by Alex Meckes on 9/1/14.
// Copyright (c) 2014 Alex Meckes. All rights reserved.
//
import Foundation
@nataliepo
nataliepo / gist:8d97ee5190f9a79dfcd0
Created June 12, 2014 14:07
sample social media list
http://www.twitter.com/brand-name
http://www.facebook.com/brand-name
http://www.yelp.com/biz/brand-name
http://www.youtube.com/user/brand-name
http://www.linkedin.com/in/brand-name
http://brand-name.wordpress.com/
http://brand-name.tumblr.com/
http://pinterest.com/brand-name/
http://www.hulu.com/profiles/brand-name
http://technorati.com/people/brand-name
@nataliepo
nataliepo / gist:85b5e5e6c2e1ece8749f
Created May 2, 2014 22:25
display_encouragement_logic
-(void)performFeedbackActionIfNeeded {
int index = 0;
BOOL found = NO;
int limit = [_logicUsedOnce count];
// Loop over the array of logic blocks.
// They'll draw the right thing as necessary.
while (!found && (index < limit)) {
BOOL (^checkCase)() = [_logicUsedOnce objectAtIndex:index];