Skip to content

Instantly share code, notes, and snippets.

View daltonclaybrook's full-sized avatar

Dalton Claybrook daltonclaybrook

View GitHub Profile
#include <stdio.h>
int main(int argc, const char * argv[])
{
char input[] = { 0xFF, 0x81, 0xBD, 0xA5, 0xA5, 0xBD, 0x81, 0xFF };
for (int i=0; i<8; i++)
{
char hex = input[i];
for (int j=0; j<8; j++)
//
// MOPModel.m
// MormonPanus
//
// Created by Dalton Claybrook on 8/29/14.
// Copyright (c) 2014 Space Factory Studios. All rights reserved.
//
#import "MOPModel.h"
#import <objc/runtime.h>
@daltonclaybrook
daltonclaybrook / cocoapods-bundle-id
Last active January 21, 2022 22:36
A post install script for CocoaPods that changes the bundle identifier of all pods to the one specified.
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == 'BREnterprise'
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution: The Carter Group LLC'
config.build_settings['PROVISIONING_PROFILE'] = '${BR_ENTERPRISE_PROVISIONING_PROFILE}'
end
end
end
@daltonclaybrook
daltonclaybrook / helper-bot.js
Last active August 29, 2015 14:22
Helper Bot
function handleGist(message, user, res) {
console.log('handling gist: ' + message);
var components = message.split(' ');
var gistID = null;
if (components.length >= 3) {
gistID = components[2];
// gistID = '6eb377c7c7e22f4e7002';
console.log('gistID: ' + gistID);
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
super.prepareForSegue(segue, sender: sender)
guard let navController = segue.destinationViewController as? UINavigationController,
packController = navController.topViewController as? PackViewController
where segue.identifier == SegueID.Pack else {
return
}
packController.delegate = self
//
// Copyright (c) 2016 Dalton Claybrook
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@daltonclaybrook
daltonclaybrook / input.go
Last active September 22, 2016 05:02
Punchcard
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
//: Playground - noun: a place where people can play
import UIKit
func wordFromNum(_ num: Int) -> String {
let suffixes = ["th","st","nd","rd","th"]
var idx = min(num % 10, suffixes.count-1)
let tens = num % 100
if tens > 10 && tens < 14 {
idx = 0
import UIKit
extension UIView { // Constraints
func constrainEdgesToSuperview() {
constrainEdgesToSuperview(with: .zero)
}
func constrainEdgesToSuperview(with inset: UIEdgeInsets) {
guard let superview=superview else { assertionFailure("must have a superview"); return }
class Tree<T: Comparable> {
let root: T
var left: Tree?
var right: Tree?
init(root: T) {
self.root = root
}
func search(value: T) -> Tree? {