Skip to content

Instantly share code, notes, and snippets.

@dotnetguy83
dotnetguy83 / Files_Tests.m
Last active May 17, 2022 01:28
File Management (Objc)
#import <XCTest/XCTest.h>
#import "Files.h"
@interface Files_Tests : XCTestCase
{
NSString *testFileName;
}
@end
@implementation Files_Tests
@dotnetguy83
dotnetguy83 / String+Extensions.swift
Created February 12, 2020 05:50
String Utils (Swift)
import Foundation
import UIKit
public extension String {
func urlEncode() -> String? {
return self.addingPercentEncoding(withAllowedCharacters: CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[]{} ").inverted)
}
func urlDecode() -> String? {
return self.removingPercentEncoding
@dotnetguy83
dotnetguy83 / NSString+Extensions.h
Created February 12, 2020 05:48
NSString Utils (Objective-C)
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (Extensions)
- (NSString *)urlEncode;
- (NSString *)urlDecode;
@end
NS_ASSUME_NONNULL_END
@dotnetguy83
dotnetguy83 / UIImage_Related-Snippet.m
Last active February 10, 2020 06:07
iOS - Save Image to the user's Camera Roll album
@dotnetguy83
dotnetguy83 / NSObject+Extensions.m
Created September 3, 2018 10:13
NSObject Time Elap Category (Objc)
#import "NSObject+Extensions.h"
#import <objc/runtime.h>
@implementation NSObject (Extensions)
- (void)tickWithName:(NSString *)name {
NSDate *startDate = objc_getAssociatedObject(self, CFBridgingRetain(name));
if (startDate) {
NSLog(@"Tick (%@): nil", name);
return;