Skip to content

Instantly share code, notes, and snippets.

View jimbobbennett's full-sized avatar
🦙
Doing all the dev rels

Jim Bennett jimbobbennett

🦙
Doing all the dev rels
View GitHub Profile
@jimbobbennett
jimbobbennett / ObservableExtensions.cs
Last active July 29, 2023 01:41
Pausable IObservable stream
public static class ObservableExtensions
{
/// <summary>
/// Creates a stream that can be paused and resumed. Whilst paused any updates to the source stream will be saved in a replay stream.
/// Once the stream is resumed, the items saved in the replay stream will be published to the ouput stream.
/// The stream can be paused and resumed by publishing a bool to the isPausedStream - true to pause, false to resume.
/// By default the stream starts as paused, but this can be overridden by setting the isPausedOnStart parameter.
/// </summary>
/// <typeparam name="T">The object that provides notification information.This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.</typeparam>
/// <param name="sourceStream">The stream to read from and either republish or save whilst the strea
@jimbobbennett
jimbobbennett / GetColourForBeacon
Created June 24, 2015 20:12
Code to get a UIColour to match the BeaconColor enum for Estimote iBeacons
public UIColor GetColourForBeacon(BeaconColor beaconColor)
{
switch (beaconColor)
{
case BeaconColor.Blueberry:
return UIColor.FromRGB(72, 61, 139);
case BeaconColor.Mint:
return UIColor.FromRGB(173, 255, 47);
case BeaconColor.Ice:
return UIColor.FromRGB(72, 209, 204);
@jimbobbennett
jimbobbennett / BeaconRanging
Created June 28, 2015 14:38
Ranging using the default Estimote iBeacon UUID
var uuid = new NSUuid ("B9407F30-F5F8-466E-AFF9-25556B57FE6D");
var region = new BeaconRegion(uuid, "MyRegion");
_beaconManager.StartRangingBeacons(region);
@jimbobbennett
jimbobbennett / lock.ps1
Created July 2, 2015 14:46
Code to put an exclusive lock on a file
param([string]$fileName)
#Open the file in read only mode, without sharing (I.e., locked as requested)
$file = [System.io.File]::Open($fileName, 'Open', 'Read', 'None')
#Wait in the above (file locked) state until the user presses a key
Write-Host "Press any key to continue ..."
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
#Close the file
@jimbobbennett
jimbobbennett / NearablesViewController.cs
Created October 8, 2015 06:52
Nearables example that doesn't work
public override void ViewDidLoad()
{
base.ViewDidLoad();
var beaconManager = new BeaconManager();
beaconManager.AuthorizationStatusChanged += (s, e) =>
{
var manager = new NearableManager();
Cleaning: XamarinStudio.TechTalk.SpecFlow (Debug)
Build started 5/16/2016 7:32:50 PM.
__________________________________________________
Project "/Users/JimBennett/GitHub/SpecFlow/IdeIntegration/XamarinStudioIntegration/XamarinStudio.TechTalk.SpecFlow.csproj" (Clean target(s)):
Initial Properties:
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
Apple_PubSub_Socket_Render = /private/tmp/com.apple.launchd.MtpcFNxwWQ/Render
@jimbobbennett
jimbobbennett / BigIoTHack.md
Last active July 29, 2023 01:37
Useful links for the Basingstoke Big IoT Hack

Free Azure account

Sign up here - aka.ms/BigIoTFree

  • 12 months of free services
  • £150 credit
  • Other services always free

You need a credit card for verification only - we do not charge you unless you choose to upgrade to a Pay as You Go subscription. We just need to verify you are not a bot!

@jimbobbennett
jimbobbennett / AzureForStudents.md
Last active January 10, 2020 21:17
Azure for students link

aka.ms/FreeStudentAzure

@jimbobbennett
jimbobbennett / HackathonStarterTemplates.md
Created January 18, 2020 11:45
Hackathon starter templates