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
namespace YourNamespace.Controllers { | |
using System.Web.Mvc; | |
using System.Web.SessionState; | |
using System; | |
[SessionState(SessionStateBehavior.ReadOnly)] | |
public class AjaxParallelController : Controller { | |
public JsonResult GetWait(int i = -1) { | |
System.Threading.Thread.Sleep(5000); | |
return Json(new { id = i, type = "parallel", ts = DateTime.Now.Ticks }, JsonRequestBehavior.AllowGet); | |
} |
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
using System; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
namespace TabBarFailTest { | |
public class Application { | |
static void Main(string[] args) { | |
try { | |
UIApplication.Main(args, null, "AppDelegate"); | |
} |
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
tell application "Microsoft PowerPoint" | |
activate | |
set slideShow to run slide show slide show settings of active presentation | |
set finalShotSize to 250 | |
set oPres to active presentation | |
set desktopPath to (path to desktop) | |
set N to 1 | |
-- Give presentation enough time to start. | |
delay 0.5 |
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
NSObject keyboardShowObserver; | |
NSObject keyboardHideObserver; | |
public override void ViewWillAppear(bool animated) { | |
base.ViewWillAppear(animated); | |
keyboardShowObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, (notification) => { | |
NSValue nsKeyboardBounds = (NSValue)notification.UserInfo.ObjectForKey(UIKeyboard.BoundsUserInfoKey); | |
RectangleF keyboardBounds = nsKeyboardBounds.RectangleFValue; | |
float height = View.Bounds.Height - keyboardBounds.Height; | |
if (NavigationController != null && NavigationController.TabBarController != null && NavigationController.TabBarController.TabBar != null) { |
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
// Xamarin.iOS (using MonoTouch.UIKit;) | |
static Random rand = new Random(); | |
public static UIColor GetRandomColor() { | |
int hue = rand.Next(255); | |
UIColor color = UIColor.FromHSB( | |
(hue / 255.0f), | |
1.0f, | |
1.0f); | |
return color; | |
} |
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
using System; | |
using Android.App; | |
using Android.Content; | |
using Android.Gms.Analytics; // via Google Play Services Xamarin Component (v19.0.0.1) | |
using Android.Gms.Analytics.Ecommerce; | |
using Android.Runtime; | |
using Android.Views; | |
using Android.Widget; | |
using Android.OS; |
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
public static class TaskHelper { | |
public static Task CompletedTask = AsCompletedTask(true); | |
public static Task<T> AsCompletedTask<T>(T result) { | |
TaskCompletionSource<T> precompletedSource = new TaskCompletionSource<T>(); | |
precompletedSource.SetResult(result); | |
return precompletedSource.Task; | |
} | |
public static void TrySetResultTask<TResult>(this TaskCompletionSource<TResult> tcs, Task<TResult> task) { | |
if (task == null) { | |
throw new ArgumentNullException("task"); |
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
using System; | |
using Foundation; | |
using UIKit; | |
using CoreGraphics; | |
using BigTed; | |
using System.Threading.Tasks; | |
using System.Linq; | |
using ObjCRuntime; | |
namespace HudOverTabsSample { |
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
// I had to use this to debug why `OnOptionsItemSelected` wasn't triggering for an ActionBar home tap. | |
// Turns out, `Resource.Id.home` and `Resource.Id.homeAsUp` are not related to `Android.Resource.Id.Home`. | |
var projectIdType = typeof(Resource.Id); | |
foreach (var field in projectIdType.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) { | |
if (item.ItemId == (int)field.GetValue(null)) { | |
Console.WriteLine("{0}: {1}", field.Name, item.ItemId); | |
} | |
} | |
var androidIdType = typeof(Android.Resource.Id); |
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
// LICENSE: MIT | |
public class UITableViewWithoutLayoutMargins : UITableView { | |
void InitializeWithoutMargins() { | |
// iOS 7 | |
if (RespondsToSelector(new Selector("setSeparatorInset:"))) { | |
SeparatorInset = UIEdgeInsets.Zero; | |
} | |
// iOS 8[+?] | |
if (RespondsToSelector(new Selector("setLayoutMargins:"))) { | |
LayoutMargins = UIEdgeInsets.Zero; |
OlderNewer