Encoding Strings
NSString *aString = @"Hello, iOS 7!"
NSString *encodedString = [NSString encodeBase64String:aString]
NSLog(@"Encoded String %@", encodedString) // returns 'SGVsbG8sIGlPUyA3IQ=='
Decoding Strings
- (void)clearCell | |
{ | |
_textField.text = nil; | |
[_textField toggleFloatLabel:UIFloatLabelAnimationTypeHide]; | |
} |
// | |
// GiftCardFlowLayout.m | |
// ID.me Marketplace | |
// | |
// Created by Arthur Sabintsev on 9/7/14. | |
// Copyright (c) 2014 ID.me, Inc. All rights reserved. | |
// | |
#import "GiftCardFlowLayout.h" |
Encoding Strings
NSString *aString = @"Hello, iOS 7!"
NSString *encodedString = [NSString encodeBase64String:aString]
NSLog(@"Encoded String %@", encodedString) // returns 'SGVsbG8sIGlPUyA3IQ=='
Decoding Strings
import java.text.DecimalFormat; | |
import java.util.Scanner; | |
public class PayAmmount { | |
public static void main(String[] args) { | |
double payRate | |
double hours; | |
Scanner keyScanner = new Scanner(System.in); |
env EDITOR=nano crontab -e |
// Macros for the top and bottom colors of the gradient | |
#define kGradientTopColor {0.0f/255.0f, 0.0f/255.0f, 0.0f/255.0f, 1.0f} | |
#define kGradientBottomColor {209.0f/255.0f, 209.0f/255.0f, 209.0f/255.0f, 1.0f} | |
// Macro for the area that should be covered by the gradient | |
#define kGradientBounds self.bounds | |
// Customize your UIView (e.g., UIView, UILabel, UIButton, etc...) drawRect method | |
- (void)drawRect:(CGRect)rect | |
{ |
extension SKTexture { | |
/* FIXME | |
This code breaks on iOS 8 (reference post) | |
http://stackoverflow.com/questions/19243111/spritekit-sktexture-crash/19248293#19248293 | |
*/ | |
convenience init(size: CGSize, firstColor: UIColor, lastColor: UIColor) { | |
guard let gradientFilter = CIFilter(name: "CILinearGradient") else { | |
self.init() |
layout | category | tags | |||||
---|---|---|---|---|---|---|---|
post |
resource |
|
##specs
@implementation UIImage (WRExtensions) | |
#pragma mark - | |
#pragma mark Scale and crop image | |
- (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize | |
{ | |
UIImage *sourceImage = self; | |
UIImage *newImage = nil; | |
CGSize imageSize = sourceImage.size; |
+ (NSString *)base64EncodeString:(NSString *)stringToEncode | |
{ | |
CFHTTPMessageRef messageRef = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, FALSE); | |
CFHTTPMessageAddAuthentication(messageRef, NULL, CFSTR("AS"), (__bridge CFStringRef)stringToEncode, kCFHTTPAuthenticationSchemeBasic, FALSE); | |
CFStringRef authStringRef = CFHTTPMessageCopyHeaderFieldValue(messageRef, CFSTR("Authorization")); | |
NSString *encodedString = [(__bridge NSString *)authStringRef substringFromIndex:10]; | |
CFRelease(messageRef); |