Skip to content

Instantly share code, notes, and snippets.

View njonsson's full-sized avatar
🤝
Working @amzn but open to new opportunities

Nils Jonsson njonsson

🤝
Working @amzn but open to new opportunities
View GitHub Profile

Keybase proof

I hereby claim:

  • I am njonsson on github.
  • I am njonsson (https://keybase.io/njonsson) on keybase.
  • I have a public key whose fingerprint is 546E EA0C B2D1 AFC7 D08B B11C 27D3 E4D0 BF33 68B4

To claim this, I am signing this object:

@njonsson
njonsson / IMultiValueDictionary.cs
Created March 20, 2010 22:04
MultiValueDictionary, a generic collection of keys paired with zero or more values each
namespace System.Collections.Generic
{
/// <summary>
/// Represents a generic collection of keys paired with zero or more values
/// each.
/// </summary>
/// <typeparam name="TKey">The type of the keys in the
/// <see cref="IMultiValueDictionary{TKey,TValues}"/>.</typeparam>
/// <typeparam name="TValues">The type of the value list elements in the
/// <see cref="IMultiValueDictionary{TKey,TValues}"/>.</typeparam>
module DirectoriesAndFiles
module ClassMethods
def directories(path)
new(path).directories
end
def files(path)
new(path).files
begin
do_something_error_prone
rescue AParticularKindOfError
# Insert heroism here.
rescue Exception
write_to_error_log
raise
end
require 'tevye'
poor_tevye = Tevye.new
result = catch(:miracle_of_miracles) do
poor_tevye.live
end
rich_tevye = Tevye.new
def rich_tevye.rich_man?
true
end
result = catch(:miracle_of_miracles) do
rich_tevye.live
end
catch :foo do
catch :bar do
do_something_that_can_throw_foo_or_bar
end
end
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>
passwordComplexity jQuery plugin demo
</title>
<style type='text/css'>
* {
font-family: Helvetica, Arial, sans-serif;
var mintonsPlayhouseCirca1941 = new Nightclub();
mintonsPlayhouseCirca1941.Bouncer = delegate(person)
{
// Welcome, paying customers!
var customer = person as ICustomer;
if ((customer != null) && (customer.CashOnHand > 0)) return true;
// Feel free to sit in ... if you can play, that is.
var musician = person as IMusician;
if ((musician != null) &&
using System;
using System.Collections.Generic;
class Nightclub
{
private readonly List<Person> occupants = new List<Person>();
public Nightclub()
{
occupants = new List<Person>();