Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Ben Chatelain phatblat

🎯
Focusing
Block or report user

Report or block phatblat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phatblat
phatblat / high-sierra-virtualbox-install.md
Last active Jul 2, 2018 — forked from arobb/sierra-virtualbox-install.md
Install macOS High Sierra in VirtualBox on macOS host
View high-sierra-virtualbox-install.md

Step 1 - Create a bootable macOS High Sierra ISO

hdiutil attach Downloads/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o Downloads/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach Downloads/HighSierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source Downloads/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -rp Downloads/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
@phatblat
phatblat / rename.fish
Created Mar 15, 2018
Renames a set of groovy files to kotlin, preserving folder hierarchy
View rename.fish
for file in **/*.groovy
mv $file (dirname $file)/(basename $file groovy)kt
end
@phatblat
phatblat / homebrew.mxcl.artifactory.plist
Created Jan 9, 2018
Custom Artifactory launchctl plist
View homebrew.mxcl.artifactory.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.jfrog.artifactory</string>
<key>WorkingDirectory</key>
<string>/usr/local/opt/artifactory/libexec</string>
@phatblat
phatblat / SchwartzianTransform.swift
Last active May 8, 2016
An example of the Schwartzian Transform in Swift
View SchwartzianTransform.swift
// Schwartzian Transform
let list = ["a", "aa", "aaaa"]
// Create tuples with the attribute to sort on in the 2nd position
let sorted = list.map { ($0, Int($0.characters.count)) }
.sort { $0.1 > $1.1 }
.map { $0.0 }
print(sorted)
View AppDelegateTests.m
- (void)testAppDelegate {
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate applicationWillEnterForeground:[UIApplication sharedApplication]];
[appDelegate applicationDidBecomeActive:[UIApplication sharedApplication]];
[appDelegate applicationWillTerminate:[UIApplication sharedApplication]];
[appDelegate applicationDidEnterBackground:[UIApplication sharedApplication]];
[appDelegate applicationWillResignActive:[UIApplication sharedApplication]];
BOOL output = [appDelegate application:[UIApplication sharedApplication] didFinishLaunchingWithOptions:[NSDictionary new]];
XCTAssertTrue(output,@"is not true");
}
@phatblat
phatblat / AppDelegate.swift
Last active Apr 15, 2019
Example of creating HKObserverQuery and enabling background delivery for multiple HKObjectType
View AppDelegate.swift
@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
let healthKitManager = HealthKitManager()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if onboardingComplete {
healthKitManager.requestAccessWithCompletion() { success, error in
if success { print("HealthKit access granted") }
else { print("Error requesting access to HealthKit: \(error)") }
}
@phatblat
phatblat / create_branch.rb
Created May 4, 2016
Script for creating a matching topic branch in each of repos in the current directory
View create_branch.rb
#!/usr/bin/env ruby
# create_branch.rb
base_branch="development"
ARGV.each do|a|
puts "Argument: #{a}"
end
@phatblat
phatblat / SpecFunctions.swift
Last active May 29, 2016
Swift 2.2 curried functions for asserting IB outlets and actions are wired up correctly.
View SpecFunctions.swift
//
// SpecFunctions.swift
//
// Created by Ben Chatelain on 6/6/15.
// Copyright (c) 2015-2016 Ben Chatelain.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View UIColor+Name.patch
diff --git a/SwiftGenWMO/Base.lproj/Main.storyboard b/SwiftGenWMO/Base.lproj/Main.storyboard
index 3f93ac0..8bf89f1 100644
--- a/SwiftGenWMO/Base.lproj/Main.storyboard
+++ b/SwiftGenWMO/Base.lproj/Main.storyboard
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
@phatblat
phatblat / build_carthage_framework.rb
Last active Mar 23, 2016
Fastlane action to build and archive a framework using Carthage
View build_carthage_framework.rb
module Fastlane
module Actions
module SharedValues
CARTHAGE_FRAMEWORK = :CARTHAGE_FRAMEWORK
end
class BuildCarthageFrameworkAction < Action
def self.run(params)
Actions.sh("carthage build --no-skip-current")
Actions.sh("carthage archive #{params[:framework_name]}")
You can’t perform that action at this time.