Skip to content

Instantly share code, notes, and snippets.

View daniel-beard's full-sized avatar

Daniel Beard daniel-beard

View GitHub Profile
@stevenp
stevenp / gist:a6740694b4e23baccfab
Last active September 10, 2015 23:26
Disable App Transport Security in iOS 9
Add this to the Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

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

@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# 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 :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.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
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@P1kachu
P1kachu / calling_printf_osx.c
Created November 24, 2016 20:30
Calling printf in OSX - The overkill way
#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
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active April 13, 2024 15:41
Xcode new build system debugging tricks

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>]
@tkersey
tkersey / xcbuild-debugging-tricks.md
Created February 3, 2018 23:10 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks

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
@hfossli
hfossli / standard.sh
Last active February 8, 2024 05:19
Standard bash script format
#!/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]"
@dino-
dino- / string-conversions.hs
Last active April 6, 2024 16:32
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
#!/usr/bin/env xcrun -sdk macosx swift
// Displays UI in an NSWindow which can interact with the commandline
// Usage: `echo "Bar" | ./swift-ui-commandline-tool.swift`
import Foundation
import SwiftUI
extension CommandLine {
static let input: String = { AnyIterator { readLine() }.joined() }()
@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active April 12, 2024 14:24
Optics Cheatsheet