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.Threading.Tasks; | |
using Android.Content; | |
using Xamarin.Auth; // install this component from the component store or nuget | |
namespace Mobile.Droid.Classes | |
{ | |
public static class FacebookOAuth2Helper | |
{ | |
/// <summary> |
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 Android.Content; | |
using Android.Media; | |
using Android.Provider; | |
using Android.Util; | |
using Uri = Android.Net.Uri; | |
namespace Classes.Helpers | |
{ | |
/// <summary> |
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
/*stick this in linqpad and then open the resulting file in a hex editor (or sublime text)*/ | |
Int32 bob = 640036; | |
using (var fs = new FileStream("d:\\temp.dat", FileMode.Create, FileAccess.ReadWrite)) | |
{ | |
var br = new BinaryWriter(fs); | |
br.Write(bob); // writes out 24 c4 09 00 | |
fs.Flush(); | |
fs.Close(); |
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
-- because I keep having to do this at odd times and I keep having to look it up | |
use master | |
go | |
EXEC sp_configure 'show advanced options', 1 | |
GO | |
Reconfigure | |
go |
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
# some additional keybindings that let you use the keypad as arrows (old-school) | |
'.editor': | |
'num-left': 'core:move-left' | |
'num-right': 'core:move-right' | |
'num-up': 'core:move-up' | |
'num-down': 'core:move-down' | |
'num-end' : 'editor:move-to-end-of-screen-line' | |
'num-home' : 'editor:move-to-first-character-of-line' | |
'num-pageup': 'core:page-up' |
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
// Add a reference to (and using) System.Net.NetworkInformation | |
string addressOrIp = "127.0.0.1"; | |
Ping ping = new Ping(); | |
PingReply reply = ping.Send(addressOrIp); | |
if (reply.Status == IPStatus.Success) | |
{ | |
Console.WriteLine ("Address: {0}", reply.Address.ToString ()); | |
Console.WriteLine ("RoundTrip time: {0}", reply.RoundtripTime); | |
Console.WriteLine ("Time to live: {0}", reply.Options.Ttl); |
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
// For better way which actually allows you to retrieve the method body and parse it, have a look at Mono.Cecil | |
// and links below: | |
// see http://stackoverflow.com/questions/5741350/look-if-a-method-is-called-inside-a-method-using-reflection | |
// and http://stackoverflow.com/questions/4372205/how-to-inject-call-to-system-object-equals-with-mono-cecil | |
// and http://www.codeproject.com/Articles/499960/Accessing-Assembly-Metadata-with-Reflection-or-Mon | |
private static IEnumerable<MethodInfo> GetTheMethods() | |
{ | |
string assemblyFile = Assembly.GetAssembly(typeof (YourClass)).Location; | |
Assert.IsTrue(File.Exists(assemblyFile)); |
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
// See: | |
// http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/d80eb3c7-8d1b-4284-a157-ba415cfbcc14 (taicomjp's solution) | |
// http://blog.aggregatedintelligence.com/2010/06/wcf-ssl-certificates-and-certificate.html | |
// http://msdn.microsoft.com/en-us/library/system.net.security.remotecertificatevalidationcallback.aspx | |
// also see http://www.iis.net/learn/manage/configuring-security/how-to-set-up-ssl-on-iis | |
// to quickly set up a test certificate on a local website in IIS | |
// All this does is happily accept any certificate thrown at it, regardless of whether it's got the right | |
// domain name, etc. | |
// you'll need to add references/usings for: |
NewerOlder