Skip to content

Instantly share code, notes, and snippets.

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

Marc Bruins MarcBruins

🏠
Working from home
View GitHub Profile
@MarcBruins
MarcBruins / AutoCompleteTextFieldSetup.cs
Last active October 14, 2017 11:08
AutoCompleteTextField setup
AutoCompleteTextField.Setup(this, new List<string>() { "customizable", "xamarin", "autocomplete", "ios" });
@MarcBruins
MarcBruins / MyDataFetcher.cs
Created October 14, 2017 11:10
MyDataFetcher.cs
public class MyDataFetcher : IDataFetcher
{
private MapsPlaceAutoComplete autoCompleteMaps = new MapsPlaceAutoComplete();
public async Task PerformFetch(MBAutoCompleteTextField textfield, Action<ICollection<string>> completionHandler)
{
var result = await autoCompleteMaps.AutoComplete(textfield.Text);
var strings = result.Select(rs => rs.description).ToList();
completionHandler(strings);
}
@MarcBruins
MarcBruins / SimpleSortingAlgorithm.cs
Last active October 14, 2017 11:12
SimpleSortingAlgorithm.cs
public class SimpleSortingAlgorithm : ISortingAlghorithm
{
private int _maxChanges = 3;
public SimpleSortingAlgorithm() { }
public ICollection<string> DoSort(string userInput, ICollection<string> inputStrings)
{
var correctedStrings = new List<string>();
foreach (string input in inputStrings)
@MarcBruins
MarcBruins / MyViewSource.cs
Created October 14, 2017 11:13
MyViewSource.cs
public class MyViewSource : MBAutoCompleteViewSource
{
private ICollection<string> _suggestions;
private string _cellIdentifier = "CellId";
public override void NewSuggestions(ICollection<string> suggestions)
{
_suggestions = suggestions;
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@MarcBruins
MarcBruins / nullablecontructorparam.cs
Last active December 16, 2018 11:38
Nullable contructor parameter
public class AuthSettings
{
public AuthSettings(Uri apiBase, string token, string username = null)
{
ApiBase = apiBase;
Token = token;
Username = username;
}
}
@MarcBruins
MarcBruins / fixnullablecontstructorparams.cs
Created December 16, 2018 11:45
Fix nullable constructor params
public class AuthSettings
{
public AuthSettings(Uri apiBase, string token, string? username)
{
Username = username;
//Handle other params
}
public string? Username { get; }
}
@MarcBruins
MarcBruins / pullrequestreqeust.cs
Created December 16, 2018 11:51
PullRequest not nullable property
public class PullRequestRequest
{
public PullRequestRequest()
{
}
public string Body { get; set; }
}
@MarcBruins
MarcBruins / pullrequestnullable.cs
Created December 16, 2018 11:59
PullRequest with nullable property
public string Body? { get; set; }
@MarcBruins
MarcBruins / Pullrequestinitliazeproperty.cs
Created December 16, 2018 12:02
PullRequest initialize property explicitly
public class PullRequestRequest
{
public PullRequestRequest(string body)
{
Body = body;
}
public string Body { get; set; }
}