This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yugy.v2ex.daily.sdk; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.preference.PreferenceManager; | |
import com.loopj.android.http.AsyncHttpClient; | |
import com.loopj.android.http.AsyncHttpResponseHandler; | |
import com.loopj.android.http.JsonHttpResponseHandler; | |
import com.loopj.android.http.PersistentCookieStore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: http://www.bdunagan.com/2009/11/28/iphone-tip-no-nshost/ | |
// MIT license | |
// Remember to add CFNetwork.framework to your project using Add=>Existing Frameworks. | |
#import "BDHost.h" | |
#import <CFNetwork/CFNetwork.h> | |
#import <netinet/in.h> | |
#import <netdb.h> | |
#import <ifaddrs.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CATextLayer+NumberJump.m | |
// HGCodeScanner | |
// | |
// Created by HamGuy on 12/8/14. | |
// Copyright (c) 2014 HamGuy. All rights reserved. | |
// | |
#import "CATextLayer+NumberJump.h" | |
#import "NJDBezierCurve.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String | |
{ | |
var length: Int { | |
get { | |
return countElements(self) | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import Cocoa | |
extension NSRange { | |
init(location:Int, length:Int) { | |
self.location = location | |
self.length = length | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* = Add a "molly guard" to the publish button */ | |
add_action( 'admin_print_footer_scripts', 'sr_publish_molly_guard' ); | |
function sr_publish_molly_guard() { | |
echo <<<EOT | |
<script> | |
jQuery(document).ready(function($){ | |
$('#publishing-action input[name="publish"]').click(function() { | |
if(confirm('Are you sure you want to publish this?')) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
class String | |
def starts_with?(prefix) | |
prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix | |
end | |
end | |
HEADER_REGEX = /^#import\s+["<](.*)[">]/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UntoggleableSwitch : UISwitch | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIViewController *)topViewController{ | |
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
} | |
- (UIViewController *)topViewController:(UIViewController *)rootViewController | |
{ | |
if (rootViewController.presentedViewController == nil) { | |
return rootViewController; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSCodingSearchBar : UISearchBar | |
// Default by the system is YES. | |
// https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/UIKit.framework/UISearchBar.h | |
@property (nonatomic, assign, setter = setHasCentredPlaceholder:) BOOL hasCentredPlaceholder; | |
@end |