This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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!") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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!") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CircleLayoutPieSlice.m | |
// dot | |
// | |
// Created by LOANER on 3/9/15. | |
// Copyright (c) 2015 Thomas Degry. All rights reserved. | |
// | |
#import "CircleLayoutPieSlice.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TriangleWrapper.m | |
// dot | |
// | |
// Created by LOANER on 3/10/15. | |
// Copyright (c) 2015 Thomas Degry. All rights reserved. | |
// | |
#import "TriangleWrapper.h" |