Skip to content

Instantly share code, notes, and snippets.

View timothy1ee's full-sized avatar

Timothy Lee timothy1ee

View GitHub Profile
// adjust the textView width base on screen size and orientation
// the only constant width in the cells is the checkbox (64)
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat width = [self isPortraitOrientation] ? screenRect.size.width : screenRect.size.height;
width -= 64;
CGRect textRect = [textView.text boundingRectWithSize:CGSizeMake(width, MAXFLOAT)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]}
context:nil];
@timothy1ee
timothy1ee / gist:9057758
Created February 17, 2014 19:53
TTTAttributedLabel example
TTTAttributedLabel *label = [[TTTAttributedLabel alloc] initWithFrame:CGRectMake(10, 10, 200, 20)];
label.linkAttributes =
@{ (NSString *)kCTForegroundColorAttributeName : [UIColor redColor],
(NSString *)kCTUnderlineStyleAttributeName : @(kCTUnderlineStyleNone) };
label.enabledTextCheckingTypes = NSTextCheckingAllTypes;
label.text = @"Link to http://google.com";
[self.view addSubview:label];
@timothy1ee
timothy1ee / gist:27a9208a7df5490d8dcd
Created November 12, 2015 22:54
Swift gitignore
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
@timothy1ee
timothy1ee / custom_gmail_reader.py
Last active September 16, 2024 16:00
CustomGmailReader
"""
Google Mail reader.
The original code is: https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/gmail/base.py
Modifications made to create a cleaner document, and add metadata for filtering (to, from, subject, etc.)
"""
import base64
import email