Skip to content

Instantly share code, notes, and snippets.

View willlarche's full-sized avatar

Will Larche willlarche

View GitHub Profile
import 'package:flutter/material.dart';
// import 'package:google_fonts/google_fonts.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@willlarche
willlarche / gist:cdb5a8ca372f1ec41ec1
Last active August 29, 2015 14:20
recursive problem
- (void)recursiveCategoryEqualTo:(MNRCategory *)modelObject assignTo:(MNRCategory*)pointerToReturn testedOn:(MNRCategory*)category;
{
if ([category.objectID isEqualToString:((MNRCategory *)modelObject).objectID])
{
pointerToReturn = category;
}
if (category.children.count)
{
for (MNRCategory *childCat in category.children) {
[self recursiveCategoryEqualTo:modelObject assignTo:pointerToReturn testedOn:childCat];
@willlarche
willlarche / gist:7142440
Last active December 26, 2015 11:18
CALayerShadow path that will work because it's closed.
[minorShadowPath moveToPoint:CGPointMake(0, self.bounds.size.height - offset)];
[minorShadowPath addLineToPoint:CGPointMake(self.bounds.size.width - offset, self.bounds.size.height - offset)];
[minorShadowPath addLineToPoint:CGPointMake(self.bounds.size.width - offset, self.bounds.size.height - offset - 1)];
[minorShadowPath addLineToPoint:CGPointMake(0, self.bounds.size.height - offset - 1)];
[minorShadowPath closePath];
[self.layerThatNeedsShadow setShadowPath:minorShadowPath.cgPath];
@willlarche
willlarche / gist:7142381
Last active December 26, 2015 11:18
CALayer shadow path with just a line
[minorShadowPath moveToPoint:CGPointMake(0, self.bounds.size.height - offset)];
[minorShadowPath addLineToPoint:CGPointMake(self.bounds.size.width - offset, self.bounds.size.height - offset)];
[self.layerThatNeedsShadow setShadowPath:minorShadowPath.cgPath];
@willlarche
willlarche / gist:7126205
Last active December 26, 2015 08:59
CATextLayer implicit animation of fontSize.
[CATransaction begin];
[CATransaction setAnimationDuration:0];
[self.dateLayer setFontSize:13.0];
[CATransaction commit];
@willlarche
willlarche / gist:7126160
Last active December 26, 2015 08:59
CATextLayer explicit animating fontSize does nothing.
CABasicAnimation *dateLayerFontSize = [CABasicAnimation animationWithKeyPath:@"fontSize"];
[dateLayerFontSize setDuration:duration];
[dateLayerFontSize setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[dateLayerFontSize setFromValue:[NSNumber numberWithFloat:11.0]];
[dateLayerFontSize setToValue:[NSNumber numberWithFloat:23.0]];
[self.dateLayer addAnimation:dateLayerFontSize forKey:@"animateFontSize"];
@willlarche
willlarche / gist:6952423
Created October 12, 2013 17:08
Working switch statement with internal alloc init and declaration.
switch (something)
{
case 1:
{
NSObject *testing=[[NSObject alloc] init];
break;
}
}
@willlarche
willlarche / gist:6952409
Created October 12, 2013 17:06
Switch statement with internal alloc init.
switch (something)
{
case 1:
NSObject *testing=[[NSObject alloc] init];
break;
}
@willlarche
willlarche / gist:6952383
Created October 12, 2013 17:04
Switch statement with alloc init that works
NSObject *testing;
switch (something)
{
case 1:
testing=[[NSObject alloc] init];
break;
}