Skip to content

Instantly share code, notes, and snippets.

@luiseduardohdbackup
luiseduardohdbackup / SwiftClassParsing.playground
Created January 10, 2016 19:11 — forked from jpsim/SwiftClassParsing.playground
Swift and Objective-C Class Parsing
////////////////////////////////////////////////
//
// Swift and Objective-C Class Parsing
//
////////////////////////////////////////////////
import Foundation
// Class parsing
@luiseduardohdbackup
luiseduardohdbackup / Macros.h
Created December 31, 2015 21:23 — forked from steipete/Macros.h
Declare on your main init that all other init methods should call. It's a nice additional semantic warning. Works with Xcode 5.1 and above. Not tested with earlier variants, but should just be ignored. A reference to this macro shortly appeared in https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObj…
#ifndef NS_DESIGNATED_INITIALIZER
#if __has_attribute(objc_designated_initializer)
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer))
#else
#define NS_DESIGNATED_INITIALIZER
#endif
#endif
@luiseduardohdbackup
luiseduardohdbackup / Messaging.cs
Created December 30, 2015 21:44 — forked from jonathanpeppers/Messaging.cs
ObjC Messaging
public static class Messaging
{
[DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public static extern IntPtr Intptr_objc_msgSend(IntPtr receiver, IntPtr selector);
[DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public static extern IntPtr IntPtr_objc_msgSend_byte(IntPtr receiver, IntPtr selector, byte arg1);
[DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public static extern IntPtr IntPtr_objc_msgSend_Double(IntPtr receiver, IntPtr selector, double arg1);
@luiseduardohdbackup
luiseduardohdbackup / Macros.h
Created December 30, 2015 18:38 — forked from numo16/Macros.h
Some useful iOS/Objective-C Macros
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
@luiseduardohdbackup
luiseduardohdbackup / Xcode7Macros.h
Created December 30, 2015 18:38 — forked from smileyborg/Xcode7Macros.h
Backwards compatible macros for Objective-C nullability annotations and generics
/**
* The following preprocessor macros can be used to adopt the new nullability annotations and generics
* features available in Xcode 7, while maintaining backwards compatibility with earlier versions of
* Xcode that do not support these features.
*/
#if __has_feature(nullability)
# define __ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
# define __ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
# define __NULLABLE nullable
@luiseduardohdbackup
luiseduardohdbackup / README.md
Created October 19, 2015 21:22 — forked from evandrix/README.md
Headless web browsers

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
67 facebook-ios-sdk
48 Bolts-iOS
39 AFNetworking
38 Google-Mobile-Ads-SDK
38 Reachability (Apple)
37 Crashlytics
31 Flurry-iOS-SDK
30 CocoaPods
29 GoogleConversionTracking
26 SDWebImage
@luiseduardohdbackup
luiseduardohdbackup / README.md
Created October 8, 2015 18:56 — forked from balupton/README.md
Node.js Best Practice Exception Handling
@luiseduardohdbackup
luiseduardohdbackup / NN.cs
Last active September 9, 2015 18:13 — forked from b9chris/NN.cs
Null Property Coalescence for C# 5 and Below
using System;
using System.Collections.Generic;
using System.Linq;
namespace Brass9
{
/// <summary>
/// Shorthand class for coping with common null situations
/// </summary>
public class NN
@luiseduardohdbackup
luiseduardohdbackup / ef-complextypes.cs
Last active August 29, 2015 14:27 — forked from bradymholt/ef-complextypes.cs
Entity Framework with Complex Types
public class Person {
public string FirstName {get;set;}
public string LastName {get;set;}
public Address = new Address(); // << It's important to instantiate Address.
}
[ComplexType] // << This attribute is important.
public class Address {
public string Address1 {get;set;}
public string Address2 {get;set;}