Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
migueldeicaza / gist:4598018
Created January 22, 2013 20:17
MonoMac samples using NSTableView
CFNetwork/Views/CheckHeadersView.designer.cs
CFNetwork/Views/HeaderTableDataSource.cs
CoreWLANWirelessManager/ScanResultsTableDataSource.cs
Makefile
NSTableViewBinding/AppDelegate.cs
NSTableViewBinding/EditController.cs
NSTableViewBinding/Info.plist
NSTableViewBinding/Main.cs
NSTableViewBinding/NSTableViewBinding.csproj
NSTableViewBinding/NSTableViewBinding.sln
@migueldeicaza
migueldeicaza / gist:4579408
Last active December 11, 2015 09:19 — forked from anonymous/gist:4515011
Simple AI loop using Async code, to use as basis on "How to avoid garbage with Async" post.
private async void Think()
{
Loop:
Program.MineCycles++;
Say("Walking to the mine!");
await this.WaitSeconds(2.0f);
Say("Entering the mine!");
await this.WaitSeconds(1.0f);
class MyContainer : Canvas {
public MyContainer ()
{
Add (new SomeChild (this));
}
}
class SomeChild : some_child_that_can_be_added_to_a_canvas {
MyContainer PArent;
@migueldeicaza
migueldeicaza / gist:4154897
Created November 27, 2012 15:41
Sample to show how to use UITableViewSource in a class
class TransparentOverlay : UIView {
// Note: UITableViewSource is an aggregated version of DataSource + Delegate, convenient
class MySources : UITableViewSource {
TrasparentOverlay container;
public MySources (TrasparentOverlay container)
{
this.container = container;
}
<deapsquatter> Excuse me. Been doing a lot of Task<> stuff today in MonoTouch.
<deapsquatter> hence looking forward to async , await
<deapsquatter> Gotta say, Im still amazed at how easy developing this fairly complex
iOS app has been using MonoTouch. Thought I would have hit multiple
brick walls by now. But alas its all been plain sailing. Gotta hand
it to Xamarin. Amazing product.
<spl> what's the product?
<deapsquatter> Company I work for is called CentraStage. The iOS app is for managing
> in what way and how far someone can decompile our apps
All software distributed can be decompiled.
If you use C#, people can use C# decompilers.
If you use Java, people can use Java compilers (in Android's case they can use a DEX decompiler, or a DEX to JVM and then a Java decompiler)
If you use native code, they can use IDA Pro that turns native code into source code
diff --git a/src/foundation.cs b/src/foundation.cs
index 341704b..c7d8912 100644
--- a/src/foundation.cs
+++ b/src/foundation.cs
@@ -118,6 +118,12 @@ namespace MonoMac.Foundation
[Export ("initWithAttributedString:")]
IntPtr Constructor (NSAttributedString other);
+ [Export ("enumerateAttributesInRange:options:usingBlock:")]
+ void EnumerateAttributes (NSRange range, NSAttributedStringEnumeration options, NSAttributedRangeCallback callback);
[[UILabel appearance] setFont:[UIFont italicSystemFontOfSize:100]];
[[UILabel appearance] setTextColor:[UIColor redColor]];
[[UILabel appearance] setShadowColor:[UIColor redColor]];
[[UILabel appearance] setShadowOffset:CGSizeMake(4,4)];
int i=0;
unsigned int mc = 0;
Method * mlist = class_copyMethodList(object_getClass([UILabel appearance]), &mc);
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include <sys/wait.h>
#if defined(__FreeBSD__) || defined(__NetBSD__)
#define SA_STACK SA_ONSTACK
#endif
static void
.thumb_func _rem
_rem:
push {r7, lr}
mov r7, sp
sub sp, #8
str r0, [sp, #4]
str r1, [sp]
ldr r0, [sp, #4]
ldr r1, [sp]
bl ___modsi3