Skip to content

Instantly share code, notes, and snippets.

View GregularExpressions's full-sized avatar

Greg Gunner GregularExpressions

View GitHub Profile
@GregularExpressions
GregularExpressions / OrderHistoryForm.html
Created July 18, 2017 12:37
Paddle User Order History and License Recovery Form Example
<!DOCTYPE html>
<html>
<head>
<title>History API</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
<script type="text/javascript">
Paddle.Setup({
@GregularExpressions
GregularExpressions / gist:2af43a15cc4aafb3f8f4
Created November 21, 2014 16:24
moveManagedObjects:ToContext:
- (NSArray*) moveManagedObjects:(NSArray*)managedObjects toContext:(NSManagedObjectContext*)newContext
{
NSMutableArray* movedManagedObjects = [NSMutableArray array];
for (NSManagedObject* managedObject in managedObjects) {
NSManagedObject* newManagedObject = [newContext objectWithID:managedObject.objectID];
[movedManagedObjects addObject:newManagedObject];
}
return movedManagedObjects;
}
@GregularExpressions
GregularExpressions / gist:10115164
Created April 8, 2014 12:08
Supplementary view set highlighted
- (void) setHighlighted:(BOOL)highlighted
{
if (highlighted) {
[self setBackgroundColor:kCellSelectionColour];
[self.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[obj setAlpha:0.5];
}];
} else {
[self setBackgroundColor:[UIColor whiteColor]];
[self.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
@GregularExpressions
GregularExpressions / gist:10114517
Last active August 29, 2015 13:58
UICollectionView subclass overriding touches
- (void) touchesBegan:(NSSet *)touches
withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
UITouch* touch = touches.allObjects.firstObject;
if ([touch.view isKindOfClass:[SupplementaryViewClass class]]) {
SupplementaryViewClass *sectionHeader = (SupplementaryViewClass*)touch.view;
[sectionHeader setHighlighted:YES];
}
}