Skip to content

Instantly share code, notes, and snippets.

-- iTunes Info by James Savage [ AXIIXC : axiixc.com ]
-- Best used with GeekTool
if appIsRunning("iTunes") then
tell application "iTunes"
if player state is stopped then
set output to ".: No Track Selected :."
else
@axiixc
axiixc / Neon Assassin.tmTheme
Created January 9, 2010 07:00
Playing around with textmate themes
<?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>name</key>
<string>Neon Assasin</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@axiixc
axiixc / code-info.php
Created December 28, 2010 03:15
Quickly tells some info about a directory of text files
#!/usr/bin/php
<?php # Axiixc [ 2010 ]
function exByteSize($bytes)
{
$size = $bytes / 1024;
if ($size < 1024)
{
$size = number_format($size, 2);
$size .= ' KB';
@axiixc
axiixc / count-words.php
Created December 28, 2010 03:16
Tells the number of uses of words, ordered from most to least frequent
#!/usr/bin/php
<?php # Axiixc [ 2009 ]
$input = $argv[1];
$files = array();
if (is_dir($input))
{
$files = scandir($input);
foreach ($files as $key => $value)
$files[$key] = $input . '/' . $value;
@axiixc
axiixc / MobileAPISerializer.php
Created February 27, 2011 02:53
Convert php data structures to binary pllst. Utilities to simulate Core Foundations types also provided.
<?php
# axiixc [ 2011 ] - https://gist.github.com/845863
# Adapted from a ruby version at https://gist.github.com/303378
# Usage
$data = CFDictMake(
"False", FALSE,
"True", TRUE,
"Integer", 42,
@axiixc
axiixc / AXMutableOrderedDictionary.h
Created April 29, 2011 18:06
A mutable ordered dictionary collection for Objective-C.
@interface AXMutableOrderedDictionary : NSMutableDictionary <NSMutableCopying> {
@private
NSMutableArray * _keys;
NSMutableDictionary * _dict;
}
+ (id)newWithCapacity:(NSUInteger)initialCapacity;
+ (id)newWithOrderedDictionary:(AXMutableOrderedDictionary *)otherDictionary;
+ (id)newWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
@axiixc
axiixc / gist:960843
Created May 7, 2011 21:12
Quick and dirty, but it works. Scans your minecraft's server.log file and pulls out some stats.
<?php # axiixc.com
$file = 'server.log';
$contents = file($file);
$regexp_arr = array(
'message' => '/] <([A-Za-z0-9]+)>/',
'login' => '/] ([A-Za-z0-9]+) \[/',
'give' => '/] [A-Za-z0-9]+: Giving ([A-Za-z0-9]+) some/'
);
@axiixc
axiixc / NSNotificationCenter+Concurrency.h
Created May 23, 2011 22:04
So fun story, notification observers are invoked on the thread from which you send the notification. Also I like GCD.
#import <dispatch/dispatch.h>
@interface NSNotificationCenter (Concurrency)
+ (void)onMainQueuePostNotificationName:(NSString *)notificationName object:(id)object;
+ (void)onMainQueuePostNotificationName:(NSString *)notificationName object:(id)object userInfo:(NSDictionary *)userInfo;
+ (void)onQueue:(dispatch_queue_t)queue postNotificationName:(NSString *)notificationName object:(id)object;
+ (void)onQueue:(dispatch_queue_t)queue postNotificationName:(NSString *)notificationName object:(id)object userInfo:(NSDictionary *)userInfo;
@end
@axiixc
axiixc / MPVolumeView+ReferenceView.h
Created July 18, 2011 15:11
Really handy way to work with MPVolumeView since it doesn't have an IB component. Just create a UIView, and call this from -viewDidLoad, it will make sure to center and swap in a volume view.
#import <MediaPlayer/MediaPlayer.h>
@interface MPVolumeView (ReferenceView)
+ (MPVolumeView *)swapWithReferenceView:(UIView *)referenceView;
@end
@axiixc
axiixc / asym.rb
Created November 10, 2011 02:03
A ruby assembler for our totally awesome processor. Also with almost no error handling.
#!/bin/ruby
# Expectations:
# 1) File contains only hardware instructions, there is NO pseudoinstruction translation
# 2) All immediates are the correct size. The assembler will generate errors and cease
# code generation, but will not convert large immediates to $at.
# 3) Labels must be on a line by themselves. If an instruction follows a label it will
# cause undefined errors in assembly!
# 4) All comments must be denoted by a hash (#) symbol. They may appear anywhere in the
# program, and anything after the hash will be dropped from the instruction parsing.