Skip to content

Instantly share code, notes, and snippets.

View ctreffs's full-sized avatar
💭
🏊 🚴‍♂️ 🏃

Christian Treffs ctreffs

💭
🏊 🚴‍♂️ 🏃
View GitHub Profile
@ctreffs
ctreffs / copy_appropriate_google-service-info-plist.sh
Created June 26, 2018 13:42 — forked from tylermilner/copy_appropriate_google-service-info-plist.sh
A shell script to selectively copy your GoogleService-Info.plist into your app bundle based on the current build configuration.
# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
# Get references to dev and prod versions of the GoogleService-Info.plist
# NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Dev/${GOOGLESERVICE_INFO_PLIST}
GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Prod/${GOOGLESERVICE_INFO_PLIST}
# Make sure the dev version of GoogleService-Info.plist exists
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_DEV}"
/** A pthread-based recursive mutex lock. */
public class Mutex {
private var mutex: pthread_mutex_t = pthread_mutex_t()
public init() {
var attr: pthread_mutexattr_t = pthread_mutexattr_t()
pthread_mutexattr_init(&attr)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)
let err = pthread_mutex_init(&self.mutex, &attr)
@ctreffs
ctreffs / imgui_memory_editor.h
Created August 6, 2017 21:12 — forked from ocornut/(Archived) imgui_memory_editor.h
Mini memory editor for ImGui (to embed in your game/tools)
// Mini memory editor for ImGui (to embed in your game/tools)
// Animated GIF: https://cloud.githubusercontent.com/assets/8225057/9028162/3047ef88-392c-11e5-8270-a54f8354b208.gif
//
// You can adjust the keyboard repeat delay/rate in ImGuiIO.
// The code assume a mono-space font for simplicity! If you don't use the default font, use ImGui::PushFont()/PopFont() to switch to a mono-space font before caling this.
//
// Usage:
// static MemoryEditor mem_edit_1; // store your state somewhere
// mem_edit_1.Draw("Memory Editor", mem_block, mem_block_size, 0x0000); // run
//
@ctreffs
ctreffs / sdl-metal-example.m
Created August 5, 2017 11:06 — forked from slime73/sdl-metal-example.m
SDL + Metal example
/**
* This software is in the public domain. Where that dedication is not recognized,
* you are granted a perpetual, irrevokable license to copy and modify this file
* as you see fit.
*
* Requires SDL 2.0.4.
* Devices that do not support Metal are not handled currently.
**/
#import <UIKit/UIKit.h>
@ctreffs
ctreffs / speedup.sh
Created November 29, 2016 11:56 — forked from madson/speedup.sh
Script to mount directories DerivedData and iPhoneSimulator in the RAM
#!/bin/bash
# set disk size for 512 MB
disksize=$((512*(512*4)))
# mounting DerivedData virtual disk
disknum=$(hdid -nomount ram://$disksize | tr -cd '[0-9]')
newfs_hfs -v DerivedData /dev/rdisk$disknum
diskutil mount -mountPoint ~/Library/Developer/Xcode/DerivedData /dev/disk$disknum