Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Marc Bruins MarcBruins

🏠
Working from home
Block or report user

Report or block MarcBruins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fixreturningnull.cs
public static IReadOnlyCollection<string> FirstPopulatedList(List<string> list1, List<string> list2)
{
if (HasElements(list1))
return list1;
if (HasElements(list2))
return list2;
return new List<string>();
}
@MarcBruins
MarcBruins / returnnull.cs
Last active Dec 16, 2018
Returning null
View returnnull.cs
public static IReadOnlyCollection<string> FirstPopulatedList(List<string> list1, List<string> list2)
{
if (HasElements(list1))
return list1;
if (HasElements(list2))
return list2;
return null;
}
@MarcBruins
MarcBruins / Pullrequestinitliazeproperty.cs
Created Dec 16, 2018
PullRequest initialize property explicitly
View Pullrequestinitliazeproperty.cs
public class PullRequestRequest
{
public PullRequestRequest(string body)
{
Body = body;
}
public string Body { get; set; }
}
@MarcBruins
MarcBruins / pullrequestnullable.cs
Created Dec 16, 2018
PullRequest with nullable property
View pullrequestnullable.cs
public string Body? { get; set; }
@MarcBruins
MarcBruins / pullrequestreqeust.cs
Created Dec 16, 2018
PullRequest not nullable property
View pullrequestreqeust.cs
public class PullRequestRequest
{
public PullRequestRequest()
{
}
public string Body { get; set; }
}
@MarcBruins
MarcBruins / fixnullablecontstructorparams.cs
Created Dec 16, 2018
Fix nullable constructor params
View fixnullablecontstructorparams.cs
public class AuthSettings
{
public AuthSettings(Uri apiBase, string token, string? username)
{
Username = username;
//Handle other params
}
public string? Username { get; }
}
@MarcBruins
MarcBruins / nullablecontructorparam.cs
Last active Dec 16, 2018
Nullable contructor parameter
View nullablecontructorparam.cs
public class AuthSettings
{
public AuthSettings(Uri apiBase, string token, string username = null)
{
ApiBase = apiBase;
Token = token;
Username = username;
}
}
View .hyper.js
// 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',
View MyViewSource.cs
public class MyViewSource : MBAutoCompleteViewSource
{
private ICollection<string> _suggestions;
private string _cellIdentifier = "CellId";
public override void NewSuggestions(ICollection<string> suggestions)
{
_suggestions = suggestions;
}
@MarcBruins
MarcBruins / SimpleSortingAlgorithm.cs
Last active Oct 14, 2017
SimpleSortingAlgorithm.cs
View 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)
You can’t perform that action at this time.