Skip to content

Instantly share code, notes, and snippets.

Daniel Beard daniel-beard

Block or report user

Report or block daniel-beard

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
@hfossli
hfossli / standard.sh
Last active Aug 27, 2019
Standard bash script format
View standard.sh
#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
@tkersey
tkersey / xcbuild-debugging-tricks.md
Created Feb 3, 2018 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks
View xcbuild-debugging-tricks.md

New Build System Tricks

Command Line

# enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active Aug 26, 2019
Xcode new build system debugging tricks
View xcbuild-debugging-tricks.md

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
@P1kachu
P1kachu / calling_printf_osx.c
Created Nov 24, 2016
Calling printf in OSX - The overkill way
View calling_printf_osx.c
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <mach-o/dyld.h>
#include <mach-o/nlist.h>
#include <mach-o/dyld_images.h>
#include <mach/mach_vm.h>
/* Dyld is the OSX Dynamic Linker
* /usr/include//mach-o/loader.h
@steipete
steipete / gist:d9b44d8e9f341e81414e86d7ff8fb62d
Last active Sep 17, 2019
Using iOS 13/13.1 devices with Xcode 10.3 (instead of Xcode 11)
View gist:d9b44d8e9f341e81414e86d7ff8fb62d
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Xcode 10.3 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// For iOS 13.1 this trick currently seems to work (as of beta 2):
View how to resolve compiler flags.md

Xcode loads xcspec files (ascii plists) that specify everything (tools, buildphases, compilers, rules, etc) based on a set of conditions.

To evaluate these conditions you have to load these files and simulate the build process and construct your own "environment"

The target's build settings will help to resolve most of the environment variables by taking the basics from the particular platform you are using for the target (resolved from the SDKROOT value xcrun --show-sdk-platform-path --sdk)

when you load the spec of the compiler there is a key on it called "Options" which is an array of dictionaries that have

@stevenp
stevenp / gist:a6740694b4e23baccfab
Last active Sep 10, 2015
Disable App Transport Security in iOS 9
View gist:a6740694b4e23baccfab
Add this to the Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
@dnozay
dnozay / README.md
Last active Sep 13, 2019
jenkins groovy scripts collection.
View README.md
View Regex.swift
struct Regex {
let pattern: String
let options: NSRegularExpressionOptions!
private var matcher: NSRegularExpression {
return NSRegularExpression(pattern: self.pattern, options: self.options, error: nil)
}
init(pattern: String, options: NSRegularExpressionOptions = nil) {
self.pattern = pattern
View random.swift
import Darwin
extension Int {
static func random() -> Int {
return Int(arc4random())
}
static func random(range: Range<Int>) -> Int {
return Int(arc4random_uniform(UInt32(range.endIndex - range.startIndex))) + range.startIndex
}
You can’t perform that action at this time.