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
func takePhoto() {
takePhotoCommand := exec.Command("./photo.sh")
result, err := takePhotoCommand.Output()
fmt.Println(string(result))
if err != nil {
panic(err)
} else {
fmt.Println("Phto was taken")
@thomasdegry
thomasdegry / gist:fab0354150e6441249eb
Created March 10, 2015 15:43
Pan over CAShapeLayers and determine which one is panned on
//
// TriangleWrapper.m
// dot
//
// Created by LOANER on 3/10/15.
// Copyright (c) 2015 Thomas Degry. All rights reserved.
//
#import "TriangleWrapper.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"
//
// CircleLayoutPieSlice.m
// dot
//
// Created by LOANER on 3/9/15.
// Copyright (c) 2015 Thomas Degry. All rights reserved.
//
#import "CircleLayoutPieSlice.h"
- (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]),
- (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)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];
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');
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;
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];