# --- GIT BRANCH PROMPT ---
function git_branch_name()
{
branch=$(git symbolic-ref HEAD 2> /dev/null | awk 'BEGIN{FS="/"} {print $NF}')
if [[ $branch == "" ]];
then
:
else
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Problem statement: https://www.codewars.com/kata/5547cc7dcad755e480000004/train/swift | |
import Foundation | |
func removNb(_ length: Int) -> [(Int,Int)] { | |
var matches = [(Int,Int)]() | |
var seenNumbers = [Int]() | |
let sumOfNumbers = ((length * length) + length) / 2 | |
var numbersToTry = Array(Array(1...length)[1...length-1].reversed()).makeIterator() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
enum Blueness: String { | |
case Most, Least | |
} | |
// Print out the days in a given year that are the most or least 'Blue' | |
func blueDays(`in` year: Int, blueness: Blueness) { | |
// Generate dates for each day for the given year |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A hook script to run Xcode unit tests before committing. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
WORKSPACE_PATH="path/to/your.xcworkspace" | |
SCHEME="scheme-name" | |
SDK="iphonesimulator" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT_NAME=ProjectNameHere | |
WORKSPACE=$(PROJECT_NAME).xcworkspace | |
SCHEME=$(PROJECT_NAME) | |
SDK=iphonesimulator | |
OUTPUT_PATH=test-report | |
DEFAULT_TASK=xcodebuild -workspace $(WORKSPACE) -scheme $(SCHEME) -sdk $(SDK) clean test | xcpretty --color ; exit ${PIPESTATUS[0]} | |
test: | |
$(DEFAULT_TASK) |
iPad Apps for Ken
- Pocket: A really good read it later app for stuff you want to, well, read stuff later. Universal app and has a Mac app also.
- Evernote: Pretty good note taking app. Lets you upload images containing text and it will index them and make them searchable. App is a little sluggish at times but the note taking view has some nice text formatting options you don't see else where. Again, there is an iPhone and Mac app.
- Flipboard: A nice RSS/news reader.
- Youtube: Good app for YouTube, obviously. Better than Apples attempt before they killed it off in my opinion. Shame it doesn't support airplay but still good.
- Screens: T
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define pred(format) [NSPredicate predicateWithFormat:format] | |
#define sort(key, asc) [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:key ascending:asc]] | |
//array of core data entities (giggle!) | |
NSArray *entities = (.)(.) | |
//filter array | |
NSArray *filtered = [entities filteredArrayUsingPredicate:pred(@"timestamp != nil")]; |