Skip to content

Instantly share code, notes, and snippets.

View coryalder's full-sized avatar

Cory Alder coryalder

View GitHub Profile
@coryalder
coryalder / SuggestionController.swift
Created November 19, 2015 00:50
Autocomplete filter code from Rivet's autocomplete suggestion engine
// depends on https://github.com/coryalder/LevenshteinSwift
class SuggestionController {
// has a couple of notable vars:
// delegate, where the inputted text is loaded from
// rawCompletions, an array of possible suggestions (unfiltered)
// autocompletions, the filtered array of suggestions we're offer up to the user
func filterAutocompletions() {
<table>
<tr><td>hi</td><td>hello</td></tr>
<tr><td>howdy</td><td>hi hi</td></tr>
<tr><td>bye</td><td>goodbye</td></tr>
</table>
@coryalder
coryalder / fb_open_source_ios
Created August 23, 2012 20:10
Open source libraries used in the new Facebook app.
Appirater
AQGridView
AutoHyperlinks
Boost
Chromium
CocoaLumberjack
CoreTextHyperlinkView
EGODatabase
EGOTableViewPullRefresh
HPGrowingTextView
@coryalder
coryalder / textmatesparkle.sh
Created August 14, 2012 04:51
Automatically update to the current version of TextMate
#!/bin/bash
cd ~/textmate
git pull origin
git submodule update
ninja TextMate
: ${NEWTEXTMATEPATH:="$HOME/build/TextMate/Applications/TextMate/TextMate.app"}
if [ -d $NEWTEXTMATEPATH ]; then
rm -rf /Applications/TextMate.app
mv $NEWTEXTMATEPATH /Applications/
fi
@coryalder
coryalder / sopa.url
Created January 18, 2012 05:41
Wikipedia SOPA bypass
javascript:$('#mw-page-base, #mw-head-base, #content, #mw-head, #mw-panel, #footer').css('display','inherit'); $('#mw-sopaOverlay').css('display','none');
@coryalder
coryalder / cbcradioapps.txt
Created September 13, 2011 00:27
Apps that provide access to CBC Radio Streams
iOS Apps
http://itunes.apple.com/ca/app/tunein-radio-pro/id319295332?mt=8
http://itunes.apple.com/ca/app/tunein-radio/id418987775?mt=8
http://itunes.apple.com/ca/app/ootunes-radio-recording-alarm/id302782364?mt=8
http://itunes.apple.com/ca/app/ifree-radio/id401485652?mt=8
Android Apps
http://daappsblog.blogspot.com/2010/03/listen-tweet-apps-for-android.html
https://market.android.com/details?id=com.radio.rapp&feature=search_result
@coryalder
coryalder / Appropirate.py
Created May 17, 2011 05:51
Creates a glitching effect called "datamoshing" using pygame and pymedia
#! /usr/bin/env python
# based on vplayer.py (http://pymedia.org/tut/src/vplayer.py.html) by dmitry borisov (http://pymedia.org)
# bloated and uglied for fair reasons by sven könig (http://www.popmodernism.org)
import sys, thread, time, traceback, Queue, os
import optparse
import pymedia
import pymedia.video.muxer as muxer
@coryalder
coryalder / New Roman Times.dvtcolortheme
Created February 4, 2011 21:07
New Roman times (http://objectivesea.tumblr.com/post/2830368087/proportional-font-programming) updated for Xcode 4. Place in ~/Library/Developer/Xcode/UserData/FontAndColorThemes/
<?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>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
// extends http://johnehartzog.com/2009/10/easy-to-create-buttons-with-cocos2d/
// give you a button that toggles between two images
// uses cocos2d 0.9, so all the classes are called CCMenuItem instead of MenuItem.
// other than that it should work with older versions of cocos2d
+ (id)buttonWithImage:(NSString*)file
andImage:(NSString *)otherFile
atPosition:(CGPoint)position
target:(id)target
selector:(SEL)selector
@coryalder
coryalder / protocol_id.m
Created July 31, 2015 21:49
id and protocol conformance
// when specify id as the type, you can use NSObject methods.
// when you specify as a custom protocol, you cannot.
// UNLESS you say that your custom protocol includes <NSObject>
#import <Foundation/Foundation.h>
@protocol CustomProtocol // <NSObject> // uncommenting <NSObject> fixes the issue
@end