Skip to content

Instantly share code, notes, and snippets.

View lbguilherme's full-sized avatar

Guilherme Bernal lbguilherme

View GitHub Profile
@shadeglare
shadeglare / ApproachOne.cs
Last active February 21, 2021 14:12
Discriminating Unions
using System;
using System.Text.Json;
var inProgress = StatusFactory.InProgress();
var complete = StatusFactory.Complete("Expected data");
var failure = StatusFactory.Failure(404);
var options = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
@Burgestrand
Burgestrand / download-progress.rb
Created June 27, 2010 13:55
Ruby HTTP file download with progress measurement
require 'net/http'
require 'uri'
def download(url)
Thread.new do
thread = Thread.current
body = thread[:body] = []
url = URI.parse url
Net::HTTP.new(url.host, url.port).request_get(url.path) do |response|