Skip to content

Instantly share code, notes, and snippets.

View christianklotz's full-sized avatar

Christian Klotz christianklotz

View GitHub Profile
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@ddeville
ddeville / x86_64-registers
Created June 29, 2013 12:21
x86_64 registers
rax - accumulator
rbx - base
rcx - count
rdx - data
r8-15
rsi - source index
rdi - destination index
rbp - base pointer
@tvon
tvon / moby.sh
Last active December 15, 2015 07:39
Concatenate header files from frameworks in the iOS 6.1 SDK, as described in Mark Dalrymple's talk on headers.
#!/bin/bash
OUTDIR=~/Desktop/moby
BASE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks"
mkdir -p ${OUTDIR}
cd ${BASE}
for dir in *
do
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@ole
ole / update_storyboard_strings.sh
Last active April 4, 2022 06:11
Automatically extract translatable strings from Xcode storyboards and update .strings files. Original version by MacRumors forum user mikezang (http://forums.macrumors.com/showpost.php?p=16060008&postcount=4). Slightly updated by Ole Begemann. NOTE: this Gist moved to a regular repo at https://github.com/ole/Storyboard-Strings-Extraction.
# (File moved to https://github.com/ole/Storyboard-Strings-Extraction)
@c0diq
c0diq / Xcode4HockeyAppTestFlightintegration.sh
Created March 27, 2012 07:13
Automatic TestFlight/HockeyApp Upload XCode Script
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
# Inspired by original script by incanus:
# https://gist.github.com/1186990
#
# Rewritten by martijnthe:
# https://gist.github.com/1379127
#
@atomicbird
atomicbird / NSObject+setValuesForKeysWithJSONDictionary.h
Created January 11, 2012 02:35
NSObject category for handling JSON dictionaries. Described in detail at http://www.cimgf.com/2012/01/11/handling-incoming-json-redux/
//
// NSObject+setValuesForKeysWithJSONDictionary.h
// SafeSetDemo
//
// Created by Tom Harrington on 12/29/11.
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@chbeer
chbeer / gist:1312967
Created October 25, 2011 14:42
performFetchAndUpdateTableView: that performs a fetch request on NSFetchedResultsController and updates table view
// ONLY WORKS WITH ONE SECTION!!
- (BOOL) performFetchAndUpdateTableView:(NSError **)error
{
NSArray *objectsBefore = [self.fetchedResultsController.fetchedObjects retain];
BOOL result = [self.fetchedResultsController performFetch:error];
if (result) {
NSArray *objectsAfter = self.fetchedResultsController.fetchedObjects;
@veritech
veritech / NSManagedObjectContext+blocks.m
Created May 9, 2011 04:21
NSMangedObjectContext async fetch requests
#import <Foundation/Foundation.h>
typedef void (^NSManagedObjectContextFetchCompleteBlock)(NSArray* results);
typedef void (^NSManagedObjectContextFetchFailBlock)(NSError *error);
@interface NSManagedObjectContext (NSManagedObjectContext_blocks)
-(void)executeFetchRequestInBackground:(NSFetchRequest*) aRequest
onComplete:(NSManagedObjectContextFetchCompleteBlock) completeBlock
@rsms
rsms / HUTF8MappedUTF16String.h
Created November 26, 2010 14:41
Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity range and index lookups
#ifndef H_UTF8_MAPPED_UTF16_STRING_H_
#define H_UTF8_MAPPED_UTF16_STRING_H_
#import <Foundation/Foundation.h>
#import <string>
/*
* Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity
* range and index lookups.
*