Skip to content

Instantly share code, notes, and snippets.

View wsrzx's full-sized avatar
🏠
Working from home

William Rodriguez wsrzx

🏠
Working from home
View GitHub Profile
@wsrzx
wsrzx / laziness.cs
Last active September 1, 2020 11:57
public int Type
{
get
{
return Url switch
{
string tw when tw.Contains("twitter", StringComparison.InvariantCultureIgnoreCase) => 1,
string fb when fb.Contains("facebook", StringComparison.InvariantCultureIgnoreCase) => 2,
string gh when gh.Contains("github", StringComparison.InvariantCultureIgnoreCase) => 3,
string lk when lk.Contains("linkedin", StringComparison.InvariantCultureIgnoreCase) => 4,
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Migration">
<Version>1.0.0-preview02</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Arch.Core.Common">
<Version>2.0.1-preview02</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Arch.Core.Runtime">
<Version>2.0.1-preview02</Version>
</PackageReference>
//...
var currentContext = Android.App.Application.Context;
var receiver = new BluetoothDeviceDiscoverReceiver(currentContext);
var filter = new IntentFilter(BluetoothDevice.ActionFound);
filter.AddAction(BluetoothAdapter.ActionDiscoveryStarted);
filter.AddAction(BluetoothAdapter.ActionDiscoveryFinished);
currentContext.RegisterReceiver(receiver, filter);
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:behaviors="clr-namespace:AwesomeSeries.Behaviors;assembly=AwesomeSeries"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AwesomeSeries.Views.MainView">
<ContentPage.Content>
<ListView
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
HasUnevenRows="True"
public static class AttachedItemTappedBehavior
{
public static readonly BindableProperty CommandProperty =
BindableProperty.CreateAttached(
propertyName: "Command",
returnType: typeof(ICommand),
declaringType: typeof(ListView),
defaultValue: null,
defaultBindingMode: BindingMode.OneWay,
validateValue: null,
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace AwesomeSeries.Infra.HttpTools
public const string ApiUrl = "https://api.themoviedb.org/3";
public const string ApiKey = "ad332258020257fb88e2cc468225dcb0";
public const string ApiImageBaseUrl = "https://image.tmdb.org/t/p/w500/";
using System;
using Newtonsoft.Json;
namespace AwesomeSeries.Models
{
public class Serie
{
[JsonProperty("original_name")]
public string OriginalName { get; set; }
@wsrzx
wsrzx / mac_high_sierra_py_dev.md
Created June 27, 2018 15:24
Mac OS High Sierra Python Dev Environment Setup

Install iTerm2

Download and install https://www.iterm2.com/

Install the Xcode Command Line Tools directly from the command line

xcode-select --install

Install Hombrew

@wsrzx
wsrzx / PushTagUpdate.cs
Created June 12, 2018 10:54
Atualização de tags no Azure Notification Hubs
//https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.notificationhubs.partialupdateoperation?view=azure-dotnet
var partialUpdates = new List<PartialUpdateOperation>();
PartialUpdateOperation replaceTag = new PartialUpdateOperation();
replaceTag.Operation = UpdateOperationType.Replace;
replaceTag.Path = "/tags/coxinha";
replaceTag.Value = "kibe";
partialUpdates.Add(replaceTag);