Skip to content

Instantly share code, notes, and snippets.

View Morse-Code's full-sized avatar

Christopher Morse Morse-Code

View GitHub Profile
@Morse-Code
Morse-Code / DZTabBarController.m
Created October 29, 2012 00:40
Method to pass object(s) to child ViewControllers from parent ViewController. In this case a UITabBarController passes a modelobject to each of it's child views that support a given @selector. Container views (ie UINavigationController, UITabBarControlle
- (void)viewDidLoad
{
[super viewDidLoad];
self.dangerZones = [[DZStoredObjects alloc] init];
// Create a stack and load it with the view controllers from
// our tabs.
NSMutableArray *stack = [NSMutableArray arrayWithArray:self.viewControllers];
// While we still have items on our stack
while ([stack count] > 0) {
// pop the last item off the stack.
@Morse-Code
Morse-Code / MKMapKit_Annotations.m
Created October 28, 2012 02:43
Boilerplate MKMapView annotation view creation and update based on map region.
# pragma mark -
# MapView Delegate methods
- (void)mapView:(MKMapView *)map regionDidChangeAnimated:(BOOL)animated
{
NSArray *oldAnnotations = mapView.annotations;
[mapView removeAnnotations:oldAnnotations];
NSArray *weatherItems = [weatherServer weatherItemsForMapRegion:mapView.region maximumCount:4];
[mapView addAnnotations:weatherItems];
@Morse-Code
Morse-Code / .gitignore
Created October 27, 2012 19:05 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#########################
@Morse-Code
Morse-Code / Asset.m
Created September 6, 2012 02:00
Playlist aggregator
-(NSArray *)playlistsInFolder:(SPPlaylistFolder *)aFolder {
NSMutableArray *playlists = [NSMutableArray arrayWithCapacity:[[aFolder playlists] count]];
for (id playlistOrFolder in aFolder.playlists) {
if ([playlistOrFolder isKindOfClass:[SPPlaylist class]]) {
[playlists addObject:playlistOrFolder];
} else {
[playlists addObjectsFromArray:[self playlistsInFolder:playlistOrFolder]];
}
@Morse-Code
Morse-Code / UserHome1.scpt
Created September 5, 2012 00:40
Generic Access to User Home Folder
set myPath to POSIX path of (path to home folder)
display dialog "myPath is " & myPath
@Morse-Code
Morse-Code / sorry.php
Created April 27, 2012 14:52
Java Applet Deploy Parameters
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { id:'sorryApplet', code:'sorryGame.GameApplet', archive:'sorryGame.jar', width:1, height:1};
var parameters = {fontSize:16, jnlp_href:'sorryGame-applet.jnlp', java_status_events: 'true'};
var version = '1.6';
deployJava.runApplet(attributes, parameters, version);
</script>
@Morse-Code
Morse-Code / ReverseString.java
Created April 24, 2012 03:15 — forked from samterrell/ReverseString.java
Recursive String Reverse
public class ReverseString {
public static void main(String[] argv) {
String origString = argv[0];
System.out.println(origString);
System.out.println(reverse(origString));
}
public static String reverse(String str) {
if(str.length()<=1) return str;
@Morse-Code
Morse-Code / EE_RSS_Feed
Created April 24, 2012 03:09
Expression engine Itunes RSS feed
{exp:channel:entries channel="podcast" status="open"}
///***********************************************************************************
// This if statement doesn't work. content is shown for everyone no matter what
//*************************************************************************************
{if (group_id == "1" OR group_id == "7") && subscription_podcast != ""}
<item>
<title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
<itunes:author>Lex and Terry</itunes:author>
<itunes:summary>{exp:xml_encode}{description}{/exp:xml_encode}</itunes:summary>
@Morse-Code
Morse-Code / facebook.js
Created April 24, 2012 03:09
Find Facebook Profile via Facebook Picture.
/* I got tired of manually finding the Facebook profile ID via pictures of people
on facebook so I made this tiny bookmarklet. Add it to your browser bar and click
it whenever you're viewing a picture on facebook. It will take you to the address
of the person who posted the picture. Useful if your a creep. */
javascript:(function(){var sp = location.href.split('/'); var f = sp[sp.length-1].split('_'); window.open("http://www.facebook.com/profile.php?id="+f[2],Math.random()); })();
@Morse-Code
Morse-Code / gist:2475885
Created April 24, 2012 03:08 — forked from sgonyea/gist:2475444
How to find non-ASCII characters in a file
grep --color='auto' -P -n "[\x80-\xFF]"