Skip to content

Instantly share code, notes, and snippets.

View thomasdegry's full-sized avatar
🍾
Popping off

Thomas Degry thomasdegry

🍾
Popping off
View GitHub Profile
// Playground - noun: a place where people can play
// Lesson 05
// Complete these, in order, writing code under each TODO statement. Each statement calls for a function to be written, write each of them and then immediately call it after the function definition.
// TODO: Write a function that prints out "Hello world!" 10 times
func helloWorld() {
for index in 1...10 {
println("Hello world!")
}
// Playground - noun: a place where people can play
// Lesson 05
// Complete these, in order, writing code under each TODO statement. Each statement calls for a function to be written, write each of them and then immediately call it after the function definition.
// TODO: Write a function that prints out "Hello world!" 10 times
func helloWorld() {
for index in 1...10 {
println("Hello world!")
}
for(Cycle *cycle in self.cycleManager.cycleData) {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd"];
CardViewController *card = [[CardViewController alloc] initWithCycle:cycle];
card.view.frame = CGRectMake(xPos + 5, 0, self.scrollView.frame.size.width - 10, self.scrollView.frame.size.height);
[self.scrollView addSubview:card.view];
[self.cards addObject:card];
if(scrollView.contentOffset.y <= self.maxScrollDistance) {
NSLog(@"REGULAR");
float newY = self.startScrollViewY - scrollView.contentOffset.y / 3;
float newScrollViewHeight = self.view.frame.size.height - newY;
scrollView.frame = CGRectMake(0, newY, self.scrollView.frame.size.width, newScrollViewHeight);
} else if(scrollView.contentOffset.y < 0) {
NSLog(@"NEGATIVE");
float newY = self.startScrollViewY - scrollView.contentOffset.y / 3;
float newScrollViewHeight = self.view.frame.size.height - newY;
var PictureScroller = (function () {
var self;
function PictureScroller ($el) {
self = this;
self.$parent = $el.parent();
self.$el = $el;
self.$floatingContent = $el.find('.floating-content');
self.$pictures = $el.find('.pic');
- (void)constructButtons {
self.numberOfMonths = 1 + self.pastOffset + self.futureOffset;
NSMutableArray *buttons = [[NSMutableArray alloc] init];
// Loop from i - self.pastOffset to i <= self.futureOffset + 1 to include start month
for ( int i = -[[NSNumber numberWithInteger:self.pastOffset] intValue]; i <= self.futureOffset + 1; i++ ) {
NSDateComponents *offSetComponents = [[NSDateComponents alloc] init];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectZero];
- (void)createTriangles {
UIView *triangleWrapper = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.collectionView.frame.size.width, self.collectionView.frame.size.height)];
[self.collectionView addSubview:triangleWrapper];
CGFloat radius = MIN(self.collectionView.frame.size.width, self.collectionView.frame.size.height) / 2.5;
CGPoint center = triangleWrapper.center;
for (NSInteger i = 0; i < [self.collectionView numberOfItemsInSection:0]; i++) {
CGPoint point1 = CGPointMake(center.x + radius * sinf(2 * (i - 0.5) * M_PI / [self.collectionView numberOfItemsInSection:0]),
center.y + radius * -cosf(2 * (i - 0.5) * M_PI / [self.collectionView numberOfItemsInSection:0]));
- (void)createTriangles {
UIView *triangleWrapper = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.collectionView.frame.size.width, self.collectionView.frame.size.height)];
triangleWrapper.backgroundColor = [UIColor yellowColor];
[self.collectionView addSubview:triangleWrapper];
CGFloat radius = MIN(self.collectionView.frame.size.width, self.collectionView.frame.size.height) / 2.5;
CGPoint center = triangleWrapper.center;
for (NSInteger i = 0; i < [self.collectionView numberOfItemsInSection:0]; i++) {
CGPoint point1 = CGPointMake(center.x + radius * sinf(2 * (i - 0.5) * M_PI / [self.collectionView numberOfItemsInSection:0]),
//
// CircleLayoutPieSlice.m
// dot
//
// Created by LOANER on 3/9/15.
// Copyright (c) 2015 Thomas Degry. All rights reserved.
//
#import "CircleLayoutPieSlice.h"
@thomasdegry
thomasdegry / gist:aea8e21dd83f8a2b2b41
Last active August 29, 2015 14:16
Determin Which layer was panned
//
// TriangleWrapper.m
// dot
//
// Created by LOANER on 3/10/15.
// Copyright (c) 2015 Thomas Degry. All rights reserved.
//
#import "TriangleWrapper.h"