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
@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>
@jpr5
jpr5 / bot.rb
Created Apr 26, 2011
XMPP/Ruby Bot for HipChat
View bot.rb
#!/usr/bin/env ruby
#
# Script: HipChat bot in Ruby
# Author: Jordan Ritter <jpr5@darkridge.com>
#
unless `rvm-prompt i g`.chomp == "ree@xmpp"
exec("rvm ree@xmpp ruby #{$0}")
end
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

@lucholaf
lucholaf / gist:e37f4d26e406250a156a
Last active Sep 5, 2016
Xcode pre-action: generate Swift FAT file to reduce compilation time, since it's faster to recompile the whole source code in a single file
View gist:e37f4d26e406250a156a
> $PROJECT_DIR/merge.swift; find $PROJECT_DIR/ -iname *.swift -not -name merge.swift -exec cat {} >> $PROJECT_DIR/merge.swift \;
@nkuln
nkuln / cxa_throw_replace_backtrace.c
Created Mar 12, 2012
Override __cxa_throw and prints backtrace when exception is thrown (Linux)
View cxa_throw_replace_backtrace.c
#include <dlfcn.h>
#include <execinfo.h>
typedef void (*cxa_throw_type)(void *, void *, void (*) (void *));
cxa_throw_type orig_cxa_throw = 0;
void load_orig_throw_code()
{
orig_cxa_throw = (cxa_throw_type) dlsym(RTLD_NEXT, "__cxa_throw");
}
@nicklockwood
nicklockwood / gist:9605636
Last active Dec 25, 2017
Singleton Category implementation
View gist:9605636
Singleton.h
-------------
@protocol Singleton
@optional
+ (instancetype)sharedInstance;
@end
@samstokes
samstokes / todo
Last active Nov 2, 2018
A todo management system in a gist
View todo
#!/bin/bash -e
if [[ $# > 0 ]]; then
case "$1" in
-h | -\? | --help )
{
echo "Add a todo:"
echo " todo Reformulate the widget plans."
echo "See what you have to do:"
echo " todo"
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
@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
@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
You can’t perform that action at this time.