This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
import SwiftUI | |
struct Collapsible<Content: View>: View { | |
@State var label: () -> Text | |
@State var content: () -> Content | |
@State private var collapsed: Bool = true | |
var body: some View { | |
VStack { |
unsigned long currentMillis = 0; | |
unsigned long previousMillisArc = 0; | |
unsigned long previousMillisFlicker = 0; | |
int timeArcOff = 3000; | |
int timeArcOn = 3000; | |
bool arc = false; //whether there's an arc right now or not | |
int ledState = LOW; | |
const int ledPin = 2; | |
int timeFlickerOn = 50; | |
int timeFlickerOff = 170; |
/** | |
* Levenshtein edit distance calculator | |
* Usage: levenstein <string> <string> | |
* | |
* Inspired by https://gist.github.com/bgreenlee/52d93a1d8fa1b8c1f38b | |
* Improved with http://stackoverflow.com/questions/26990394/slow-swift-arrays-and-strings-performance | |
*/ | |
class Tools { |
-(UIView*)paddingViewWithImage:(UIImageView*)imageView andPadding:(float)padding | |
{ | |
float height = CGRectGetHeight(imageView.frame); | |
float width = CGRectGetWidth(imageView.frame) + padding; | |
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; | |
[paddingView addSubview:imageView]; | |
return paddingView; |
// | |
// OAuthRequestSigner.m | |
// ----- | |
// | |
// Created by Dan Palmer on 29/07/2012. | |
// Copyright (c) 2012 Dan Palmer. All rights reserved. | |
// | |
#import "OAuthRequestSigner.h" |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
@implementation MySharedThing | |
+ (id)sharedInstance | |
{ | |
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{ | |
return [[self alloc] init]; | |
}); | |
} | |
@end |