Skip to content

Instantly share code, notes, and snippets.

#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
@interface RBAppDelegate : NSObject <NSApplicationDelegate>
{
NSStatusItem *systemStatusItem;
QTMovie *radio;
}
-(void) playURLString:(NSString*) urlString
{
NSURL *url = [NSURL URLWithString:urlString];
NSDictionary *movieAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
url,
QTMovieURLAttribute,
[NSNumber numberWithBool:YES],
QTMovieOpenForPlaybackAttribute,
nil];
<?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">
<array>
<dict>
<key>name</key>
<string>NRK P1</string>
<key>url</key>
<string>http://lyd.nrk.no/nrk_radio_p1_ostlandssendingen_mp3_h</string>
</dict>
#import "RBAppDelegate.h"
@implementation RBAppDelegate
- (void) createMenu
{
NSStatusBar *bar = [NSStatusBar systemStatusBar];
systemStatusItem = [bar statusItemWithLength:NSVariableStatusItemLength];
[systemStatusItem setTitle:@"Radio"];
[systemStatusItem setHighlightMode:YES];
#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
@interface RBAppDelegate : NSObject <NSApplicationDelegate>
{
NSStatusItem *systemStatusItem;
QTMovie *radio;
NSMutableArray *menuItems;
NSArray *stations;
-(void) play:(NSMenuItem*) menuItem
{
for(NSMenuItem *i in menuItems) {
[i setState:NSOffState];
}
[menuItem setState:NSOnState];
NSDictionary *station = [stations objectAtIndex:menuItem.tag];
NSString *name = [station valueForKey:@"name"];
[systemStatusItem setTitle:name];
-(void) play:(NSMenuItem*) menuItem
{
for(NSMenuItem *i in menuItems) {
[i setState:NSOffState];
}
[menuItem setState:NSOnState];
NSDictionary *station = [stations objectAtIndex:menuItem.tag];
NSString *name = [station valueForKey:@"name"];
[systemStatusItem setTitle:name];
@runeb
runeb / xmp.rb
Last active April 10, 2022 21:30
Adobe XMP parser for JPEG files, in Ruby
def xmp(filename)
xap = "http://ns.adobe.com/xap/1.0/\0".freeze
f = File.open(filename, 'r')
xml = nil
begin
return nil unless f.readbyte == 0xFF
return nil unless f.readbyte == 0xD8
while !f.eof
case f.readbyte
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>Magic Music Changes</title>
<link>https://gist.github.com/runeb/8774083/raw/gistfile1.xml</link>
<description>Most recent changes with links to updates.</description>
<language>en</language>
<item><title>Version 1.0 (12)</title><pubDate>Sun, 02 Feb 2014 21:35:32 +0000</pubDate><enclosure url="http" length="1234567890" type="application/octet-stream" sparkle:version="12" sparkle:shortVersionString="1.0" sparkle:dsaSignature="dsa"/></item></channel>
</rss>