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
"use strict"; | |
const cors = require("cors"); | |
const express = require("express"); | |
const smartcar = require("smartcar"); | |
const app = express().use(cors()); | |
const port = 8000; | |
const client = new smartcar.AuthClient({ |
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
- (UIBezierPath*)slicePathForDataPoint:(DataPoint*)dataPoint forCompleted:(float)completed forTotal:(float)total { | |
if(!total) { | |
return nil; | |
} | |
float percentOfTotal = (completed+fabsf([dataPoint.number floatValue]))/total; | |
float percentCompleted = completed/total; | |
percentOfTotal *= self.animationScaleFactor; | |
percentCompleted *= self.animationScaleFactor; |
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
// use the built-in ios linguistics functionality to stem the tags | |
+ (NSMutableArray *)stemTags:(NSMutableArray*)originalTags { | |
NSLinguisticTagger *tagger = [[NSLinguisticTagger alloc] | |
initWithTagSchemes:[NSArray arrayWithObjects:NSLinguisticTagSchemeLemma, nil] | |
options:(NSLinguisticTaggerOmitWhitespace | NSLinguisticTaggerOmitPunctuation)]; | |
NSMutableArray *stemmedTags = [[NSMutableArray alloc] init]; | |
// convert tags to string | |
[tagger setString:[originalTags componentsJoinedByString:@" "]]; |
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
- (IBAction)handlePanGesture:(UIPanGestureRecognizer*)gesture | |
{ | |
CGPoint translation = [gesture translationInView:self.view]; | |
if (gesture.state == UIGestureRecognizerStateChanged) { | |
// user is swiping, translate the view for the image by 1/4 the translation, and the text by 1/2 the translation to give parallax effect | |
self.currentSlide.imageView.frame = CGRectMake(self.currentSlide.imageView.frame.origin.x+translation.x/4,0,self.currentSlide.imageView.frame.size.width, self.currentSlide.imageView.frame.size.height); | |
self.currentSlide.slideText.view.frame = CGRectMake(self.currentSlide.slideText.view.frame.origin.x+translation.x/2,0,self.currentSlide.slideText.view.frame.size.width, self.currentSlide.slideText.view.frame.size.height); | |
// save the cumulative translation and reset the local translation | |
self.panTranslation += translation.x; |
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
/** | |
* Code to add an animated shadow to a UICollectionViewCell | |
*/ | |
// | |
// HAIMainMenuCollectionViewCell.m | |
// app-haikudeck | |
// | |
// Created by Kevin Leneway |
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)FPPickerController:(FPPickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { | |
// first check for image from camera roll or camera | |
UIImage *image = [info objectForKey:@"FPPickerControllerOriginalImage"]; | |
// if not found, check to see if the image has been downloaded | |
if(!image) { | |
NSData *localData = [NSData dataWithContentsOfURL:[info objectForKey:@"FPPickerControllerReferenceURL"]]; | |
if(localData) { | |
image = [UIImage imageWithData:localData]; | |
} |
NewerOlder