Skip to content

Instantly share code, notes, and snippets.

// Sound
windows_speaker_config "1"
snd_mixahead "0.05"
snd_musicvolume "0"
//snd_headphone_pan_exponent "2"
//snd_front_headphone_position "45.0"
//snd_rear_headphone_position "135.0"
dsp_enhance_stereo "0"
snd_legacy_surround "0"
snd_pitchquality "1"

Keybase proof

I hereby claim:

  • I am alexfish on github.
  • I am alexfish (https://keybase.io/alexfish) on keybase.
  • I have a public key whose fingerprint is 4DC8 6C30 7333 6513 2995 C3C1 6DCA B9E7 FF89 6699

To claim this, I am signing this object:

extension Array {
func mapFilter<U>(transform: (T) -> U?) -> [U] {
var array: [U] = []
for element in self {
if let mapped: U = transform(element) {
array.append(mapped)
}
}
@alexfish
alexfish / quicksort.py
Last active August 29, 2015 14:06
quicksort!
def qsort(list, f):
if len(list) <= 1:
return list
pivot = list.pop(0)
less = []
more = []
for x in list:
if f(x, pivot):
@alexfish
alexfish / pullrequests.md
Created January 9, 2014 09:25
A template for creating pull requests

Pull Request Template

Title

#issue-number - issue title or feature-number - feature title

Description

One line summary

@alexfish
alexfish / server_config.plist
Created November 16, 2013 20:43
Sample `server_config` file for calasmash
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>port_preference</key>
<string></string>
<key>url_preference</key>
<string></string>
</dict>
</plist>
@alexfish
alexfish / sample.m
Created November 16, 2013 20:40
Sample method to get the URL for the mock backend provided by sinatra and calasmash
+ (NSURL *)calabashAPIURL
{
NSString *apiURLString = nil;
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"server_config" ofType:@"plist"];
NSDictionary *serverConfig = [NSDictionary dictionaryWithContentsOfFile:plistPath];
NSString *urlString = [serverConfig objectForKey:(NSString *)kURLPreference];
if(urlString.length > 0)
@alexfish
alexfish / stringCleaner.rb
Created July 12, 2012 14:36
Cleans carrige returns in strings to \n characters for pasting into Xcode localizable.strings file
string = ARGV.first
string = string.gsub(/\n/,"\\n")
file = File.new("output.txt", "w")
file.write(string)
file.close

##Available

###NSFileManager

  • + (NSString *)libraryPath
  • + (NSString *)documentsPath
  • + (NSString *)cachesPath
  • + (NSString *)preferencesPath
  • + (NSString *)tmpPath
//
// MySingleton.m
//
// 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: