Skip to content

Instantly share code, notes, and snippets.

View dbeattie71's full-sized avatar

Derek Beattie dbeattie71

  • Nebraska
  • 19:12 (UTC -05:00)
View GitHub Profile
@dbeattie71
dbeattie71 / scale.cs
Created February 23, 2014 23:03 — forked from nicwise/scale.cs
public static UIImage ScaleImage(UIImage image, int maxSize)
{
UIImage res;
using (CGImage imageRef = image.CGImage)
{
CGImageAlphaInfo alphaInfo = imageRef.AlphaInfo;
CGColorSpace colorSpaceInfo = CGColorSpace.CreateDeviceRGB();
if (alphaInfo == CGImageAlphaInfo.None)
@dbeattie71
dbeattie71 / gist:9631328
Last active August 29, 2015 13:57 — forked from buildmaster/gist:1387224
Simple example of capturing a still image with AVCaptureDevice.
void initCameraView(){
NSError error = null;
captureSession = new AVCaptureSession(){
SessionPreset=AVCaptureSession.Preset640x480
};
var device = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video);
var deviceInput = AVCaptureDeviceInput.FromDevice(device,out error);
if(error!=null){
displayErrorOnMainQueueWithMessage(error,"Unable to setup capture");
return;
@dbeattie71
dbeattie71 / ParentViewController.Keyboard.cs
Created March 19, 2014 22:11 — forked from redent/ParentViewController.Keyboard.cs
Great example of how to slide the the view on input when the keyboard is displayed.
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Drawing;
namespace TwinCoders.Utils
{
public abstract partial class ParentViewController
{
@dbeattie71
dbeattie71 / gist:9728149
Created March 23, 2014 19:11
How to get double quotes around 'name' and 'filename' on Xamarin Monotouch iOS with the HttpClient.
else if (restRequest.ContentType == ContentTypes.MultipartFormData)
{
var multipartPartFormDataContent = new MultipartFormDataContent();
var contentJson = new StringContent(restRequest.GetRequestBody());
multipartPartFormDataContent.Add(contentJson);
httpRequestMessage.Content = contentJson;
if (restRequest.Files.Any())
foreach (var fileParameter in restRequest.Files)
{
1>Server command 'Build': application remote build failed
1>Command execution task ended with exception
1>Exception System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
1>Exception details can be found in the log file
1>
1>
1>Remote build step failed.
1>Done building target "_BuildNativeApplication" in project "Travefy.Touch.csproj" -- FAILED.
1>Done building project "Travefy.Touch.csproj" -- FAILED.
1>Build FAILED.
public class TextViewImeActionBinding : MvxAndroidTargetBinding
{
private bool subscribed;
private ICommand _command;
protected TextView TextView
{
get { return Target as TextView; }
}
/// <summary>
/// Author: softlion (softlion@softlion.com)
/// </summary>
/// <remarks>
/// Thanks to: Stuart Lodge
/// </remarks>
public class MvxRadioGroupSelectedIndexBinding : MvxAndroidTargetBinding
{
bool stopListeningCheckChanged = false;
<TextView
local:MvxBind="Text PasswordConfirm; ImeAction RegisterCommand"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:imeOptions="actionSend" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
@dbeattie71
dbeattie71 / MvxFileDownloadCache.cs
Created May 23, 2014 16:12
MvxFileDownloadCache fetchingEnabled
// MvxFileDownloadCache.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com
using System;
using System.Collections.Generic;
using System.Linq;