Skip to content

Instantly share code, notes, and snippets.

View albertoventurini's full-sized avatar

Alberto Venturini albertoventurini

View GitHub Profile
import java.util.Objects;
/**
* This class represents a pair of values.
*/
public class Pair<T1, T2> {
public final T1 first;
public final T2 second;
@albertoventurini
albertoventurini / multiosc.scd
Last active March 30, 2018 20:08
Multi oscillator synth written in Supercollider

( s.meter; s.freqscope; s.plotTree; )

( var g0 = Group.new(s); // g0 = main synth group var g1 = Group.after(g0); // g1 = effect group

@albertoventurini
albertoventurini / SingleValueMap.java
Created September 29, 2017 09:48
An implementation of Java's AbstractMap that returns the same value for all keys.
package com.amazonaws.ec2.tagging.util;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
public class SingleValueMap<K, V> extends AbstractMap<K, V> {
public class Startup
{
// This method is required by Katana:
public void Configuration(IAppBuilder app)
{
var webApiConfiguration = ConfigureWebApi();
// Use the extension method provided by the WebApi.Owin library:
app.UseWebApi(webApiConfiguration);
}
@albertoventurini
albertoventurini / CachingFunction.cs
Created July 17, 2015 14:55
C# caching function
using System;
using System.Collections.Generic;
namespace CachingFunction
{
public class CachingFunction<T1, TResult>
{
private readonly Func<T1, TResult> _func;
private T1 _cachedParam;
private TResult _cachedResult;