Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
dannycabrera / gist:3367417
Created August 16, 2012 06:41
Speex encode
// Here is what I am attempting, opening the file, encoding it (with your EncodeSpeech method)
// and trying to save the .spx back to a file. The encodedBytes returns with data but the newly
// create file "newFile" does not play. Am I missing something or am I just doing this the wrong
// way? Thanks for all your help.
string audioFile = @"C:\Users\DannyC\Desktop\newFileName.wav";
string newFile = @"C:\Users\DannyC\Desktop\Test.spx";
// Read file bytes
byte[] fileBytes = File.ReadAllBytes (audioFile);
@dannycabrera
dannycabrera / gist:5365508
Created April 11, 2013 17:43
SignalR error with Xamarin.iOS
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.AspNet.SignalR.Client.Resources.resources" was correctly embedded or linked into assembly "Microsoft.AspNet.SignalR.Client.iOS" at compile time, or that all the satellite assemblies required are loadable and fully signed.
@dannycabrera
dannycabrera / Xamarin.iOS AudioTrim Method
Created June 13, 2013 21:20
Xamarin.iOS AudioTrim Method
using System;
using System.IO;
using MonoTouch.Foundation;
using MonoTouch.AVFoundation;
using MonoTouch.CoreMedia;
namespace TestProject.Common
{
public class AudioTrim
{
@dannycabrera
dannycabrera / Xamarin.iOS Table Cell Selected Background Color
Last active December 24, 2015 02:09
Xamarin.iOS Table Cell Selected Background Color
UIView BGViewColor = new UIView ();
BGViewColor.BackgroundColor = UIColor.Red; //or whatever color you want.
BGViewColor.Layer.MasksToBounds = true;
cell.SelectedBackgroundView = BGViewColor;
@dannycabrera
dannycabrera / Xamarin.iOS Image Resize
Last active January 2, 2018 21:02
Xamarin.iOS Image Resize
CGContext context = UIGraphics.GetCurrentContext ();
context.InterpolationQuality = CGInterpolationQuality.None;
context.TranslateCTM (0, newSize.Height);
context.ScaleCTM (1f, -1f);
context.DrawImage (new RectangleF (0, 0, newSize.Width, newSize.Height), source.CGImage);
var scaledImage = UIGraphics.GetImageFromCurrentImageContext();
@dannycabrera
dannycabrera / Xamarin.iOS Get Carrier Name
Created September 27, 2013 15:36
Xamarin.iOS Get Carrier Name
static string GetCarrierName () { using (var info = new CTTelephonyNetworkInfo ()) { return info.SubscriberCellularProvider.CarrierName; } }
@dannycabrera
dannycabrera / Xamarin.iOS Create Contact
Created September 27, 2013 15:37
Xamarin.iOS Create Contact
var person = new ABPerson()
{
FirstName = "John",
LastName = "Doe"
};
NSError error;
var ab = ABAddressBook.Create (out error);
ab.Add (person);
@dannycabrera
dannycabrera / Xamarin.iOS IdentifierForVendor
Created September 27, 2013 15:38
Xamarin.iOS IdentifierForVendor
NSUuid identifier = UIDevice.CurrentDevice.IdentifierForVendor;
https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor
@dannycabrera
dannycabrera / gist:6730630
Created September 27, 2013 15:40
APS-Environment Entitlement
aps-environment - Receive push notifications in iOS
The entitlement key is different for iOS than it is for OS X. On either platform, however,
the provisioning portal assigns a value of development or production to the key, depending
only on which activity you are creating the provisioning profile for.
http://developer.apple.com/library/ios/#documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingLocalAndPushNotifications.html#//apple_ref/doc/uid/TP40011195-CH3-SW1
@dannycabrera
dannycabrera / iOS URL scheme index
Created September 27, 2013 15:44
iOS URL scheme index
http://handleopenurl.com & http://www.wiki.akosma.com/IPhone_URL_Schemes#Phone
tel - telephone (http://handleopenurl.com/scheme/phone)
html ex: <a href="tel:0031204637000">Call us</a>
native ex1: tel:0031204637000
native ex2: telprompt:##########
Apple Settings App (http://handleopenurl.com/scheme/apple-settings-app)
native ex: prefs:root=General&path=Bluetooth
html ex: <a href="prefs:root=AIRPLANE_MODE">Switch to airplane mode</a>