Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bleroy's full-sized avatar

Bertrand Le Roy bleroy

View GitHub Profile
@bleroy
bleroy / WeekIn.NET.20170314.md
Last active November 19, 2022 23:59
Tips for the Week in .NET
@bleroy
bleroy / XmlHelper.cs
Last active September 18, 2022 03:11
A C# helper class to read and write XML from and to objects
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Linq;
namespace Nwazet.Commerce.Helpers {
public static class XmlHelper {
/// <summary>
/// Like Add, but chainable.
.alternate .background, .alternate .front-wall {
transform: scaleX(-1);
}
.alternate .l1 {
clip: rect(auto, 112px, auto, 54px);
}
setClass(viewport, "alternate",
(party.tile.row + party.tile.column +
(party.facing == Party.facingDirection.east || party.facing == Party.facingDirection.west ? 1 : 0)
) % 2 === 0);
const l0 = party.peek([0, -1]);
const r0 = party.peek([0, 1]);
const l1 = party.peek([-1, -1]);
const f1 = party.peek([-1, 0]);
const r1 = party.peek([-1, 1]);
const l2 = party.peek([-2, -1]);
const f2 = party.peek([-2, 0]);
const r2 = party.peek([-2, 1]);
const ll3 = party.peek([-3, -2]);
const rr3 = party.peek([-3, 2]);
.l1 {
clip: rect(auto, 122px, auto, 64px);
}
.left-wall {
display: inline-block;
position: absolute;
left: 0;
top: 0;
background-image: url(./img/WallLeft.png);
width: 168px;
<div class="viewport">
<div class="background"></div>
<div class="ll3 far-left-wall"></div>
<div class="rr3 far-right-wall"></div>
<div class="l3 left-wall"></div>
<div class="r3 right-wall"></div>
<div class="fl3 front-wall front-wall-farther"></div>
<div class="ff3 front-wall front-wall-farther"></div>
<div class="fr3 front-wall front-wall-farther"></div>
<div class="l2 left-wall"></div>
await foreach (Result result in idx.Search("love"))
{
// do something with that result
}
var index = await Index.Build(async builder =>
{
builder
.AddField("title")
.AddField("body")
await builder.Add(new Document
{
{ "title", "Twelfth-Night" },
{ "body", "If music be the food of love, play on: Give me excess of it…" },
public static class Util
{
/// <summary>
/// An extension method that enables the deconstruction of dictionary entries.
/// </summary>
/// <example>
/// ```cs
/// foreach ((string key, Foo value) in someDictionaryOfFoos)
/// {
/// // Do something with `key` and `value`...