Skip to content

Instantly share code, notes, and snippets.

Avatar
🔗
Interlocking...

Rafael Teixeira monoman

🔗
Interlocking...
View GitHub Profile
@monoman
monoman / UberQueue.cs
Created Aug 16, 2021
My Take on David Fowler UberQueue Challenge
View UberQueue.cs
// See https://aka.ms/new-console-template for more information
using System.Collections;
using System.Collections.Generic;
Console.WriteLine("Hello, UberQueue!");
var uq = new UberCollections.UberQueue<string>(
new TestAsyncQueue(delay: 500, "One", "Two", "Three"),
new TestAsyncQueue(delay: 1000, "Four", "Five"),
new TestAsyncQueue(delay: 150, "Six", "Seven", "Eight", "Nine")
@monoman
monoman / FAQ-Document_Registry_on_REST.md
Last active Dec 28, 2020
Trying to add a Document file to a chain through the IL2 Node’s REST API
View FAQ-Document_Registry_on_REST.md

FAQ - Document Registry on REST [DEPRECATED]

Scenario

Trying to add a Document file to a chain through the IL2 Node’s REST API

Questions

1 - Where should the document content be posted to?

The body content of the POST is the file content (as native unencoded bytes) and it should be posted to the URL built from the query parameters

Partial request path: /documents@t_HlFTTruR33B6_hsgfpq8bPCaADamwrfQy1stPJTkY?Cipher=None&Name=BlahBlah.txt

View ConfigureLogger.cs
static void ConfigureLogger()
{
const string logConfig = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<log4net>
<root>
<level value=""INFO"" />
<appender-ref ref=""console"" />
</root>
<appender name=""console"" type=""log4net.Appender.ColoredConsoleAppender"">
<layout type=""log4net.Layout.PatternLayout"">
@monoman
monoman / TranslatableStrings_Example.cs
Last active Aug 29, 2015
TranslatableStrings aims to enable Roslyn to again be at peace with resources or any other translation mechanism when using string interpolation
View TranslatableStrings_Example.cs
var person="David";
Console.WriteLine($_"Hello {person}");
// Prints "Alô David" in pt-BR
Console.WriteLine($"Hello {person}");
// Prints "Hello David" in pt-BR
View SplayTree`2.cs
/* ---- MIT LICENSE ----
Copyright (c) 2011 John Gietzen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@monoman
monoman / Thanks to Hao Kung, b_levitt
Created Oct 27, 2014
Add to Global.asax.cs and call InitJQuery on Application_Start() to avoid "WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'" on migrating to ASP.NET 4.5
View Thanks to Hao Kung, b_levitt
Based on **b_levitt** answer to http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery
But avoiding hardcoding the jQuery version (doesn't play nice with nuget) by using some regex as explained by **Hao Kung** on http://stackoverflow.com/questions/12029161/version-wildcard-in-mvc4-bundle
@monoman
monoman / gist:2053145
Created Mar 16, 2012
Some things that could make ASP.NET MVC 4 Web API even better
View gist:2053145
// this offends my coding sensibility
public Contact GetContact(int id)
{
Contact contact = _repository.Get(id);
if (contact == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return contact;
View nuget.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="nuspec"
targetNamespace="{0}"
elementFormDefault="qualified"
xmlns="{0}"
xmlns:mstns="{0}"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="package">
<xs:complexType>
View ReadonlyProperties.cs
public class Person {
public Person(string name, int age) {
_name = name;
_age = age;
}
private readonly string _name;
private readonly int _age;
/// Full name
public string Name { get _name; }
/// Age in years
@monoman
monoman / Boo Marvels - 1
Last active Sep 25, 2015
Boo's creator answering a question on Boolang list. Another wonder of meta-programming...
View Boo Marvels - 1
Daniel Brauer's Question:
Of course I just figured it out: I was trying to declare a bunch of floats like this:
[SerializeField]
m_forwardPower = 2f,
m_backwardPower = 1f,
m_strafePower = 0f,
m_maxVelocity = 5f,
m_turnSpeed = 3f,