Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am axiixc on github.
  • I am axiixc (https://keybase.io/axiixc) on keybase.
  • I have a public key whose fingerprint is 37A6 BB5F 25ED F824 9B66 7BF8 B907 7DAB 7DF3 DEE3

To claim this, I am signing this object:

// class CountDownEvent {
// init(endDate: NSDate, name: String);
// }
extension CountDownEvent: NSSecureCoding {
convenience init(coder: NSCoder!) {
let endDate = coder.decodeObjectOfClass(NSDate.classForCoder(), forKey: "endDate") as NSDate
let name = coder.decodeObjectOfClass(NSString.classForCoder(), forKey: "name") as NSString
self.init(endDate: endDate, name: name) // Is this not how you call another initializer?
-- 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 / 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