Skip to content

Instantly share code, notes, and snippets.

View nesium's full-sized avatar
🌎
Working remotely

Marc Bauer nesium

🌎
Working remotely
View GitHub Profile
import XCTest
final class StandupsDetailNavigationTests: XCTestCase {
var app: XCUIApplication!
override func setUpWithError() throws {
self.continueAfterFailure = false
self.app = XCUIApplication()
self.app.launchEnvironment = [
"UITesting": "true",
@nesium
nesium / SimulatedSlowLoadingImage.swift
Created August 23, 2022 12:21 — forked from smileyborg/SimulatedSlowLoadingImage.swift
Snippet showing how to create an NSItemProvider with a simulated delay for loading an image
import UIKit
import MobileCoreServices
let image = UIImage() // your actual image
let itemProvider = NSItemProvider()
itemProvider.registerDataRepresentation(forTypeIdentifier: kUTTypeJPEG as String, visibility: .all) { (completionBlock) -> Progress? in
let unitsOfWork = 10 + Int64(arc4random_uniform(UInt32(10))) // 10 - 19 units
let progress = Progress.discreteProgress(totalUnitCount: unitsOfWork)
@nesium
nesium / semantic-commit-messages.md
Created February 27, 2022 16:03 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@nesium
nesium / encoding-video.md
Created November 15, 2020 14:25 — forked from glen-cheney/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@nesium
nesium / config.yml
Last active August 19, 2019 05:10 — forked from eoger/config.yml
sccache with rust
version: 2.1
commands:
setup-sccache:
steps:
- run:
name: Install sccache
command: |
cargo install sccache
# This configures Rust to use sccache.
echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV
@nesium
nesium / class_addMethod.swift
Created June 12, 2018 10:18
Add method to Obj-C class from Swift
let cls: AnyClass = NSClassFromString("NSConcreteValue")!
let types = "d@:" // [NSString stringWithFormat:@"%s%s%s", @encode(double), @encode(id), @encode(SEL)]
let block: @convention(block) (AnyObject?) -> Double = { (self: AnyObject!) -> (Double) in
return 1.0
}
let imp = imp_implementationWithBlock(unsafeBitCast(block, to: AnyObject.self))
class_addMethod(cls, Selector("doubleValue"), imp, types)
@nesium
nesium / gist:10a329cf381529b16a8c
Created November 26, 2014 11:05
Animated Output in Console from ObjC
#import <Foundation/Foundation.h>
@interface MyOutput : NSObject
@end
int main(int argc, const char * argv[]) {
MyOutput *output = [MyOutput new];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:output
selector:@selector(tick) userInfo:nil repeats:YES];
@nesium
nesium / gist:377675
Created April 24, 2010 14:02
Get Finder color label
- (int)_finderLabelColorOfPath:(NSString*)path{
CFURLRef url;
FSRef fsRef;
BOOL ret;
FSCatalogInfo cinfo;
// Get FSRef
url = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE);
if (!url) return 0;
ret = CFURLGetFSRef(url, &fsRef);
static uint64_t count = 7;

static NSString *suffixes[7] = {@"B", @"KiB", @"MiB", @"GiB", @"TiB", @"PiB", @"EiB"};
uint64_t i, c;

for (i = 1024, c = 0; i < (count << 60); i <<= 10, c++){
if (bytes < i)
return [NSString stringWithFormat:@"%0.2f%@",
(double)bytes / (double)(i >> 10), suffixes[c]];
}
return @"Big";
@nesium
nesium / gist:199206
Created October 1, 2009 20:07
Disable OS X CrashReporter
#Disable the OS X Crash reporter (quit dialog after an application crash)
defaults write com.apple.CrashReporter DialogType none
#To enable the crash reporter (default) change none to prompt