Skip to content

Instantly share code, notes, and snippets.

mkdir C:\ARM-Temp
@numo16
numo16 / MemoryMonito.cs
Created February 14, 2013 19:26
Windows Phone Memory Monitor utility class
public sealed class MemoryMonitor : IDisposable
{
#region Private members
private bool _isEnabled;
private bool _showVisualization;
private bool _isInitialized;
private bool _currentWarningExceeded;
private bool _currentCriticalExceeded;
private DispatcherTimer _timer;
private Popup _popup = new Popup();
@numo16
numo16 / PropertyChangedViewModel.cs
Created January 17, 2013 16:35
INotifyPropertyChanged Implementation
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged<T>(Expression<Func<T>> propertyEvaluator)
{
var lambda = propertyEvaluator as LambdaExpression;
var member = lambda.Body as MemberExpression;
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(member.Member.Name));
@numo16
numo16 / CCUtils.cs
Created December 12, 2012 05:41
Helper methods for Cocos2d-xna
public class CCUtils
{
public static CCRect CCRectIntersection(CCRect r1, CCRect r2)
{
CCRect intersection = new CCRect(Math.Max(CCRect.CCRectGetMinX(r1), CCRect.CCRectGetMinX(r2)), Math.Max(CCRect.CCRectGetMinY(r1), CCRect.CCRectGetMinY(r2)), 0, 0);
intersection.size.width = Math.Min(CCRect.CCRectGetMaxX(r1), CCRect.CCRectGetMaxX(r2)) -
CCRect.CCRectGetMinX(intersection);
intersection.size.height = Math.Min(CCRect.CCRectGetMaxY(r1), CCRect.CCRectGetMaxY(r2)) -
CCRect.CCRectGetMinY(intersection);
return intersection;
@numo16
numo16 / Macros.h
Created August 20, 2012 20:38
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