Skip to content

Instantly share code, notes, and snippets.

View drub0y's full-sized avatar

Drew Marsh drub0y

View GitHub Profile
@drub0y
drub0y / app.html
Last active January 17, 2017 17:14 — forked from Thanood/app.html
Aurelia-Materialize bridge collapsible onOpen/Close events
<template>
<div class="collapsible-open-close-events">
<ul md-collapsible="on-open.call: collapsibleOpen($event); on-close.call: collapsibleClose($event)">
<li ref="firstSection">
<div class="collapsible-header"><i class="mdi-image-filter-drama"></i>First<span md-badge data-badge-caption="opens">${firstSection.openCount || 0}</span><span md-badge data-badge-caption="closes">${firstSection.closeCount || 0}</span></div>
<div class="collapsible-body"><p>Lorem ipsum dolor sit amet.</p></div>
</li>
<li ref="secondSection">
<div class="collapsible-header"><i class="mdi-maps-place"></i>Second<span md-badge data-badge-caption="opens">${secondSection.openCount || 0}</span><span md-badge data-badge-caption="closes">${secondSection.closeCount || 0}</span></div>
<div class="collapsible-body"><p>Lorem ipsum dolor sit amet.</p></div>
@drub0y
drub0y / app.html
Last active January 23, 2017 18:17 — forked from Thanood/app.html
Aurelia-Materialize bridge badge with custom caption
<template>
<div>
<ul class="collection">
<li class="collection-item">Sent</li>
<li class="collection-item">Inbox<span md-badge="is-new: true;">3</span></li>
<li class="collection-item">Spam<span show.bind="spamCount > 0" class="yellow black-text" md-badge="is-new: true; caption.bind: spamCaption">${spamCount}</span></li>
</ul>
</div>
<div class="actions">
<hr />
@drub0y
drub0y / Ignorer.cs
Last active October 17, 2017 23:19
Continuation without unecessary allocation via static method and cached delegate
public static class TaskExtensions
{
private static Action<Task> IgnorerContinuationAction = IgnorerContinuation;
public static void Ignore(this Task task)
{
if (task.IsCompleted)
{
var exception = task.Exception;
}
@drub0y
drub0y / BigIntegerBase64JsonConverter.cs
Created May 16, 2020 17:13
A System.Text.Json converter implementation that efficiently encodes the BigInteger to Base64
internal sealed class BigIntegerBase64JsonConverter : JsonConverter<BigInteger>
{
public override BigInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var bigIntegerBytes = reader.GetBytesFromBase64();
return new BigInteger(bigIntegerBytes);
}
public override void Write(Utf8JsonWriter writer, BigInteger value, JsonSerializerOptions options)
@drub0y
drub0y / RestClientConfig.java
Created April 30, 2025 17:47
Canonical Spring RestClient + JDK HttpClient configuration
@Configuration
public class RestClientConfig {
@Bean
public RestClient myRestClient(final RestClient.Builder restClientBuilder) {
final var httpClient = HttpClient
.newBuilder()
.version(HttpClient.Version.HTTP_2)
.executor(Executors.newVirtualThreadPerTaskExecutor())
.build();