Skip to content

Instantly share code, notes, and snippets.

View alecmontgomery's full-sized avatar

Alec Montgomery alecmontgomery

View GitHub Profile
@qmchenry
qmchenry / enumCaseName.swift
Created April 21, 2017 18:07
Swift enum name string with associated values
// Swift enums cannot be declared with a rawValue if they have associated values
// like good ol' Amargasaurus has. Using String(describing: dino) on a case with
// associated also includes the values, but works fine on unassociated cases.
// Mirror(reflecting: dino) can extract the name of an associated case, but is
// nil for unassociated cases. Our hero ?? swoops in to save the day!
enum Sauropoda {
case Amargasaurus(things: Int64, hasOtherThing: Bool?)
case Antetonitrus
// ...
@jgold6
jgold6 / DatePickerCustomRenderer.cs
Last active July 18, 2018 17:20
Date Picker Custom Renderer replacing Control
using System;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using TestiOSCutCopyPasteDisable.iOS;
using UIKit;
using Foundation;
using CoreGraphics;
using System.Security.AccessControl;
[assembly: ExportRenderer (typeof(DatePicker), typeof(DatePickerCustomRenderer))]
@cromandini
cromandini / universal-framework.sh
Last active February 12, 2024 12:13 — forked from cconway25/gist:7ff167c6f98da33c5352
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@natelandau
natelandau / .bash_profile
Last active July 27, 2024 05:39
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@ryanmaxwell
ryanmaxwell / ryan-objc.cfg
Last active June 26, 2019 16:41
Objective-C Uncrustify Config
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@edwardinubuntu
edwardinubuntu / gist:2397642
Created April 16, 2012 10:44
sectionIndexTitlesForTableView
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
NSMutableArray *toBeReturned = [[NSMutableArray alloc]init];
for(char c = 'A';c<='Z';c++)
[toBeReturned addObject:[NSString stringWithFormat:@"%c",c]];
return toBeReturned;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
NSInteger count = 0;
@anthonyherron
anthonyherron / ThreeFinderGesturesBackInXcode.txt
Created August 8, 2011 15:53
Enable 3 finger swipe to switch between .h & .m in Xcode
Three finger gestures are awesome in Xcode, but they disappeared in Lion :(
You can bring them back to life however...
Inspired by a post from @gordonhughes (http://geeksinkilts.com/?p=67), explaining how to bring them back on an external trackpad, I started digging around for a way to get it working on the internal trackpads for the mbp/mba models.
*edit*
Perhaps an easier way of doing this found by @gordonhughes again is just this 1 line in Terminal, haven't confirmed this yet though
defaults -currentHost write -g "com.apple.trackpad.threeFingerVertSwipeGesture" -int 1
@allending
allending / NKTTextViewTokenizer.h
Created February 1, 2011 08:07
Some expository code from Notekata as a UITextInputTokenizer example
//Copyright (c) 2010, Allen Ding
//All rights reserved.
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions are met:
//
//1. Redistributions of source code must retain the above copyright notice, this
//list of conditions and the following disclaimer.
//