View configure-ios
#!/bin/bash | |
################################################################################ | |
# | |
# Copyright (c) 2008-2009 Christopher J. Stawarz | |
# | |
# Modified by Nathaniel Gray in 2012 to support Clang, custom dev tool locations, | |
# and armv7. Also removed "make install" phase, since that can easily be done by | |
# hand. | |
# |
View ArrayTest.swift
// | |
// ArrayTest.swift | |
// SwiftTest | |
// | |
// Swift array subtyping semantics test | |
// | |
// Created by Nathan Gray on 6/7/14. | |
// Copyright (c) 2014 Mellmo. All rights reserved. | |
// |
View MonadTest.swift
/* | |
It appears that the Swift code generator requires fixed layout in a lot of contexts | |
where one might reasonably desire to use generics. Trying to do so gets you a | |
lovely error of this sort: | |
LLVM ERROR: unimplemented IRGen feature! non-fixed multi-payload enum layout | |
This is my hacky solution to that problem. I use a cell to encapsulate the generic | |
as a fixed-layout value. I've provided a prefix * operator to retrieve the value | |
(how retro!) in order to minimize the syntactic overhead of using the cell class. |
View link-simulators.sh
#!/bin/zsh | |
# Makes a symbolic link in your current directory to each iPhone simulator's data directory | |
devices=~/Library/Developer/CoreSimulator/Devices | |
plb=/usr/libexec/PlistBuddy | |
for f in $devices/*; do | |
simname=`$plb $f/device.plist -c "Print :name"` | |
ln -s $f/data ./$simname |
View OptionalFail.swift
val shouldLaunchMissiles : Bool? = false | |
// A million lines later, programmer forgets that shouldLaunchMissiles is an optional | |
if shouldLaunchMissiles { | |
println("The only way to win is not to play") | |
missiles.launch() | |
} else { | |
println("Let there be peace on Earth") | |
kittens.release() | |
} |
View hahahaha.m
// At some point I thought this was very clever | |
// | |
// Six months later I was like, why the hell is the tag on this view 1008017??!?! | |
-(void)awakeFromNib | |
{ | |
[super awakeFromNib]; | |
int tag = [self tag]; | |
if (tag > 1000000) { | |
int residue = tag - (tag / 1000000) * 1000000; |
View remove_sim_dups.py
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
from subprocess import Popen, PIPE | |
from subprocess import call | |
# Change this to True to see what will be deleted without deleting anything | |
DRY_RUN = False |
View sample.ml
(* This is the original function. It works fine, but makes extra calls to check_left and check_right. *) | |
let sorting_hat id = | |
if not (base_case id) then Dead | |
else | |
begin | |
if check_left id && check_right id then Central | |
else if check_left id then Left | |
else if check_right id then Right | |
else Dead | |
end |
View git-submodule-of-commit
#!/bin/sh | |
if [[ $# != 1 ]]; then | |
echo "usage: $0 SHA" | |
echo " Shows a list of submodules that exist at the given commit, along with their corresponding" | |
echo " submodule commits." | |
exit 1 | |
else | |
SHA=$1 | |
fi |
View git-details
#!/bin/zsh | |
# | |
# Shows the raw details of a commit and all its parents | |
# | |
if [[ $# < 1 ]]; then | |
SHA=HEAD | |
else | |
SHA=$1 |
OlderNewer