Skip to content

Instantly share code, notes, and snippets.

View tenpaiyomi's full-sized avatar

Eric Musgrove tenpaiyomi

View GitHub Profile
let defaults = NSUserDefaults.standardUserDefaults()
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
if !defaults.boolForKey("initialLaunch") {
defaults.setBool(true, forKey: "initialLaunch")
self.window?.rootViewController = mainStoryboard.instantiateViewControllerWithIdentifier("IntroductionViewController") as! IntroductionViewController
} else {
self.window?.rootViewController = mainStoryboard.instantiateViewControllerWithIdentifier("SecondViewController") as! SecondViewController
}
override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? {
var answer = super.layoutAttributesForElementsInRect(rect)
for i in 1..<answer!.count {
let currentLayoutAttributes: UICollectionViewLayoutAttributes = answer![i] as! UICollectionViewLayoutAttributes
let prevLayoutAttributes: UICollectionViewLayoutAttributes = answer![i-1] as! UICollectionViewLayoutAttributes
let maximumSpacing = 4
let origin = Int(CGRectGetMaxX(prevLayoutAttributes.frame))
if((origin + maximumSpacing + Int(currentLayoutAttributes.frame.size.width)) < Int(self.collectionViewContentSize().width)) {
log_formatter = logging.Formatter(log_format, datefmt=log_date_format)
log_handler.setFormatter(log_formatter)
worker_logger = logging.getLogger('worker')
worker_fh = logging.FileHandler(filename + '.log', mode='a')
worker_fh.setFormatter(log_formatter)
worker_logger.setLevel(logging.INFO)
worker_logger.addHandler(worker_fh)
structured_logger = logging.getLogger('structured')
var $time = Date.now || function(){
return +new Date();
};
function $unlink(object){
var unlinked;
if (typeof (object) === "object") {
unlinked = {};
for (var p in object) unlinked[p] = $unlink(object[p]);
} else{
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// Request remote notification authorization
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
...
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *deviceTokenString = [[[[deviceToken description]
#0 0x00007fff85dbc5f0 in object_getClass ()
#1 0x0000000100154214 in rb_objc_convert_immediate ()
#2 0x0000000103302b5e in <????> ()
#3 0x000000010331bdb0 in <????> ()
#4 0x0000000100031a43 in -[SRRecorderControl shortcutRecorderCell:keyComboDidChange:] at /Users/eric/Development/TT/SRRecorderControl.m:344
#5 0x000000010002dad5 in -[SRRecorderCell performKeyEquivalent:] ()
#6 0x0000000100030dfe in -[SRRecorderControl performKeyEquivalent:] ()
#7 0x00007fff86947f57 in -[NSControl _performKeyEquivalent:conditionally:] ()
#8 0x00007fff86947e1f in -[NSView performKeyEquivalent:] ()
#9 0x00007fff86947e1f in -[NSView performKeyEquivalent:] ()
<div>&nbsp;<br/><br/><span style="font-size:medium">We solve mobile problems</span><br/><span style="font-size:medium">for </span><span style="font-size:medium"><span style="color:#ff5400;">advertisers</span></span><span style="font-size:medium">, </span><span style="font-size:medium"><span style="color:#ff5400;">developers</span></span><span style="font-size:medium">,</span><br/><span style="font-size:medium">and </span><span style="font-size:medium"><span style="color:#ff5400;">users</span></span><span style="font-size:medium">.</span><br/><br/><a href="/gwt/x?source=wax&amp;u=http%3A%2F%2Fkappboom.com/index.html&amp;wsi=796f4ee2360ce6b9&amp;ei=K8tVTfK3HZHsxQWsuMWNDQ&amp;wsc=yq">HOME</a> <a href="/gwt/x?source=wax&amp;u=http%3A%2F%2Fkappboom.com/about.html&amp;wsi=796f4ee2360ce6b9&amp;ei=K8tVTfK3HZHsxQWsuMWNDQ&amp;wsc=yq">ABOUT</a> <a href="/gwt/x?source=wax&amp;u=http%3A%2F%2Fkappboom.com/career.html&amp;wsi=796f4ee2360ce6b9&amp;ei=K8tVTfK3HZHsxQWsuMWNDQ&amp;wsc=yq">CAREERS</a> <a href="/gwt/x?source=wax&a
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"foo == 24"];
NSLog(@"%@", predicate);
predicate = [NSPredicate predicateWithFormat:@"%@ == 24", @"foo"];
NSLog(@"%@", predicate);
-------
2010-12-01 18:40:47.753 Test[19006:207] foo == 24
2010-12-01 18:40:47.754 Test[19006:207] "foo" == 24
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/comicReaderTemplate.xhtml">
<ui:define name="top">
<div>Sync Button</div>
<div>Add Comic Button</div>
class MyAwesomeController < ApplicationController
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Logged in"
redirect_to root_url