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
double Gamma(double x) | |
{ | |
if (x < 0) | |
{ | |
return double.PositiveInfinity; | |
} | |
// Gamma(x) = (x-1)! so add 1, to make user gets | |
// expected result, I really don't want use increamental operator here. |
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
//Author casperOne | |
public class Node | |
{ | |
private readonly IDictionary<string, Node> _nodes = new Dictionary<string, Node>(); | |
public string Name { get; set; } | |
public string Path { get; set; } | |
public IDictionary<string, Node> Nodes | |
{ |
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
fs.iRotated += (object dSender, EventArgs de) => { | |
Debug.WriteLine("________________________________________________________"); | |
Debug.WriteLine("The modal view just rotated...."); | |
Debug.WriteLine("My current orientation (UIApplication.SharedApplication.StatusBarOrientation.ToString()) = " + UIApplication.SharedApplication.StatusBarOrientation.ToString()); | |
Debug.WriteLine(string.Format("My screen resolution is: Width = {0} Height = {1}", | |
this.View.Bounds.Width.ToString(), | |
this.View.Bounds.Height.ToString())); | |
var fsSender = (FlipsideViewController) dSender; | |
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 class ActiveWindows:UIWindow | |
{ | |
NSTimer idleTimter; | |
double idleTimeInterval; | |
public MyWindows (RectangleF frame):base(frame) | |
{ | |
idleTimeInterval = 10; //Change the idle time | |
idleTimter = | |
NSTimer.CreateScheduledTimer (idleTimeInterval, WindowIdleNotification); |
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 Extensions | |
{ | |
public static UIImage ToImage (this UIView view) | |
{ | |
RectangleF canvasRect = view.Bounds; | |
UIGraphics.BeginImageContextWithOptions (canvasRect.Size, false, 0.0f); | |
CGContext ctx = UIGraphics.GetCurrentContext (); | |
ctx.FillRect (canvasRect); | |
view.Layer.RenderInContext (ctx); |
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 System.IO; | |
using Android.App; | |
using Android.Content; | |
using Android.Content.Res; | |
using Android.OS; | |
using Android.Runtime; | |
using Android.Views; | |
using Android.Webkit; |
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
var email = new Intent(Android.Content.Intent.ActionSendto); | |
email.SetType("text/html"); | |
email.PutExtra(Android.Content.Intent.ExtraSubject, "Subject here"); | |
email.PutExtra(Android.Content.Intent.ExtraText, | |
Html.FromHtml("<p><b>Some Content</b></p><small><p>More content</p></small>")); | |
StartActivity(Intent.CreateChooser(email, "Email:")); |
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 void Email(Context context, string emailTo, string emailCC, string subject, string emailText, List<string> filePaths) | |
{ | |
var email = new Intent(Intent.ActionSendMultiple); | |
email.SetType("text/plain"); | |
email.PutExtra(Intent.ExtraEmail, new string[]{emailTo}); | |
email.PutExtra(Intent.ExtraCc, new string[]{emailCC}); | |
var uris = new List<IParcelable>(); | |
filePaths.ForEach(file=> { |
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 System.Collections.Generic; | |
using System.Linq; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
using MonoTouch.Dialog; | |
namespace TwoLayerDialog | |
{ |
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
private static readonly DateTime Jan1st1970 = new DateTime | |
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); | |
public static long CurrentTimeMillis() | |
{ | |
return (long) (DateTime.UtcNow - Jan1st1970).TotalMilliseconds; | |
} | |
public static DateTime GetDateFromMilliSeconds(long milliseconds) | |
{ |
OlderNewer