Skip to content

Instantly share code, notes, and snippets.

@wislon
wislon / MediaGalleryHelper.cs
Created November 6, 2014 03:13
Xamarin: Quickly add or remove an item from Android device's gallery
using Android.Content;
using Android.Media;
using Android.Provider;
using Android.Util;
using Uri = Android.Net.Uri;
namespace Classes.Helpers
{
/// <summary>
@wislon
wislon / SdkBeforeCleanFix.txt
Last active August 28, 2018 23:17
Fix '_SdkBeforeClean' build error when building xamarin xplat app
It seems to only be a problem on xplat solutions, as they set up a chain of 'clean'-task dependencies,
which apparently other solutions don't.
This is caused by a missing `;` in one of the msbuild `.targets` files as described here
(and is a bug in dotnet core 2.1.3 sdk, and VS 2017 15.8.x):
* https://github.com/onovotny/MSBuildSdkExtras/issues/89
which led to
@wislon
wislon / fragment.xml
Last active April 26, 2019 10:39
Transparent WebView Load Animated Gif (Xamarin Android)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:id="@+id/webLoadingIcon"
android:layout_width="44dp"
@wislon
wislon / xaml-xcc-info.md
Last active November 18, 2020 13:18
Xam.Forms XAML conditional compilation& design-time bindings intellisense in VS

Xam.Forms XAML conditional compilation& design-time bindings intellisense

Original article:

http://adventuresinxamarinforms.com/2015/03/17/xaml-v-code/

add (to each xaml file, near the top with the other xmlns definitions)

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
@wislon
wislon / ExportBlobToFile.sql
Created July 16, 2014 04:18
Export BLOB field from SQL Server to file on disk
-- 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
@wislon
wislon / keymap.cson
Last active May 7, 2021 22:06
Atom key bindings for numeric keypad
# 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'
@wislon
wislon / getcookiesgist.cs
Created September 10, 2015 20:46
Get Cookies from HTTPClient instance (using CookieContainer, or raw headers)
/// <summary>
/// Will return null if the cookie you were looking for isn't in the container.
/// </summary>
/// <param name="cookieName"></param>
/// <param name="cookieContainer"></param>
/// <returns></returns>
protected async Task<Cookie> ExtractCookieWithName(string cookieName, CookieContainer cookieContainer)
{
var cookies = cookieContainer.GetCookies(new Uri(SharedConstants.WebsiteBaseUrl));
var cookie = cookies[cookieName];
@wislon
wislon / 1_IPlatformCookieStore.cs
Last active February 27, 2022 03:02
Xamarin Forms xplat WebView Cookie Demo
using System.Collections.Generic;
using System.Net;
public interface IPlatformCookieStore
{
/// <summary>
/// List of cookies pulled from the cookie storage manager
/// on the device/platform you're on. Can be quite an expensive call,
/// so use it sparingly.
/// </summary>