Skip to content

Instantly share code, notes, and snippets.

View McNight's full-sized avatar
:shipit:
Focusing

Adam McNight McNight

:shipit:
Focusing
View GitHub Profile
@rygorous
rygorous / gist:8908164
Created February 10, 2014 00:16
Game changer.
static __m128i const shuffles[16] = {
#define _ -1 // for readability
{ _,_,_,_, _,_,_,_, _,_,_,_, _,_,_,_ }, // 0000
{ 0,1,_,_, _,_,_,_, _,_,_,_, _,_,_,_ }, // 0001
{ _,_,_,_, 0,1,_,_, _,_,_,_, _,_,_,_ }, // 0010
{ 0,1,_,_, 2,3,_,_, _,_,_,_, _,_,_,_ }, // 0011
{ _,_,_,_, _,_,_,_, 0,1,_,_, _,_,_,_ }, // 0100
{ 0,1,_,_, _,_,_,_, 2,3,_,_, _,_,_,_ }, // 0101
{ _,_,_,_, 0,1,_,_, 2,3,_,_, _,_,_,_ }, // 0110
{ 0,1,_,_, 2,3,_,_, 4,5,_,_, _,_,_,_ }, // 0111
#import <Foundation/Foundation.h>
@interface WTF : NSObject
-:x;
@end
@implementation WTF
-:x;
{
return x;
@danzimm
danzimm / mach_list_services.c
Last active August 29, 2015 13:58
List the mach services on your computer, or at least all the ones up the default bootstrap chain!
#include <stdio.h>
#include <mach/mach.h>
#include <bootstrap_priv.h>
#include <stdlib.h>
void error(int a, int r, const char *str) {
const char *err = bootstrap_strerror(r);
fprintf(stderr, "%s (%#02x) %s\n", str, r, err);
exit(a);
}
#include <stdio.h>
#include <CommonCrypto/CommonKeyDerivation.h>
#include <CommonCrypto/CommonCryptor.h>
#include <assert.h>
#include <dispatch/dispatch.h>
int main (int argc, char *argv[]) {
uint64_t salt = 0;
dispatch_group_t group = dispatch_group_create();
@import UIKit;
@import AVFoundation;
@class _UISiriWaveyView;
@protocol _UISiriWaveyViewDelegate <NSObject>
- (CGFloat)audioLevelForWaveyView:(_UISiriWaveyView *)waveyView;
@end
typedef NS_ENUM(NSInteger, _UISiriWaveyViewMode) {
@jaybaird
jaybaird / gist:6003951
Last active December 19, 2015 19:09
Binary Tree with NSArray
#import <Foundation/Foundation.h>
@interface Node : NSObject
@property (nonatomic) NSInteger identifier;
@property (nonatomic, copy) NSString *value;
+ (Node *)nodeWithIdentifier:(NSInteger)identifier value:(NSString *)value;
@end
@implementation Node
+ (Node *)nodeWithIdentifier:(NSInteger)identifier value:(NSString *)value {
@conradev
conradev / CKSpinnerView.h
Created September 19, 2013 21:05
CKSpinnerView - Emulating the app download spinner in the iOS 7 App Store
//
// CKSpinnerView.h
//
// Created by Conrad Kramer on 9/19/13.
// Copyright (c) 2013 Conrad Kramer. All rights reserved.
//
#import <CKShapeView/CKShapeView.h>
@interface CKSpinnerView : CKShapeView
@CodaFi
CodaFi / CFIMultiMap.c
Last active December 24, 2015 12:59
A fully bridged multimap implementation.
/*
* Copyright (c) 2013 CodaFi. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
@n-b
n-b / PropertyMacros.h
Created April 15, 2012 18:45
KVC compile-time checking macros
//
// PropertyMacros.h
//
//
// Created by Nicolas Bouilleaud on 12/04/12,
// using ideas by Uli Kusterer (http://orangejuiceliberationfront.com/safe-key-value-coding/)
// Laurent Deniau (https://groups.google.com/forum/?fromgroups#!topic/comp.std.c/d-6Mj5Lko_s)
// and Nick Forge (http://forgecode.net/2011/11/compile-time-checking-of-kvc-keys/)
//
//
@steipete
steipete / PSPDFViewController.h
Last active June 6, 2017 03:56
This method will help to prevent a lot of emails about "weird bugs".
// Defines a yet undocumented method to add a warning if super isn't called.
#ifndef NS_REQUIRES_SUPER
#if __has_attribute(objc_requires_super)
#define NS_REQUIRES_SUPER __attribute((objc_requires_super))
#else
#define NS_REQUIRES_SUPER
#endif
#endif
@interface UIViewController (SubclassingWarnings)