Skip to content

Instantly share code, notes, and snippets.

View Me1000's full-sized avatar

Randy Luecke Me1000

View GitHub Profile
View gist:9e403383da23be2fc918
// totally works!
[UIView animateWithDuration:0.5
CGRect bounds = self.scrollview.bounds;
bounds.origin = CGPointZero;
self.scrollview.bounds = bounds;
Me1000 / gist:5439162
Last active December 16, 2015 13:08
View gist:5439162
// I'm a bad person
var loc = window.location.hash;
if (loc.length > 0)
loc = loc.substr(1);
if (typeof window[loc] === "function")
View gist:5247758
Many people are not homophobic, they're simply echoing the homophobic social pressures around them. Showing support at the very least lets people know they're not alone and that it's okay to speak out.
This is particularly important for younger people.
(That said, I do my part to support equality offline, too)
View Results.txt
Test 0:
Manual Time: 0.001s
Built In Time: 0s
Test 1:
Manual Time: 0s
Built In Time: 0s
Test 2:
Manual Time: 0.003s
Built In Time: 0s
Test 3:
View input.j
@implementation Foo : Bar
id foo;
id x;
- (void)setFoo:(id)foo
var blah = foo;
foo = blah;
View GistMaker
retainedSelf = self;
View gist:3971902
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
const CGFloat threshHold = -60.0f;
const float minOpacity = 0.2;
CGFloat currentOffset = [scrollView contentOffset].x;
if (currentOffset < 0.0)
CGFloat currentProgress = currentOffset / threshHold;
[scrollView setAlpha:MAX(1.0 - (1.0 * currentProgress), minOpacity)];
View gist:3630322
@implementation VerticalLayoutView : CPView
double gapBetweenViews;
- (void)setGapBetweenViews:(double)aGap
gapBetweenViews = aGap;
View gist:3507567
NSString *localDateString = [NSDateFormatter dateFormatFromTemplate:@"MdY" options:0 locale:[NSLocale currentLocale]];
NSCharacterSet *validChars = [NSCharacterSet letterCharacterSet];
NSInteger i = 0;
NSMutableString *newString = [NSMutableString stringWithCapacity:5];
while (i < [localDateString length])
char charatcter = [localDateString characterAtIndex:i];
static NSString *appendChar = @"%c";
View gist:3445058
Goal: have a properly localized date (month/day in the correct order), yet
have a custom date component separator.
Example as follows:
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
NSLocale *gbLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"];
NSLocale *deLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"de_DE"];