Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Mazur mazur

View GitHub Profile
@mazur
mazur / Underpants.cs
Created Apr 11, 2012
Steal Underpants Enumerator
View Underpants.cs
namespace StealTheseUnderpants
{
using System;
public class Underpants
{
public UnderpantsEnumerator GetEnumerator()
{
return new UnderpantsEnumerator();
}
View calc3.mirah
import java.util.HashMap
interface IOperator do
def run(x:int, y:int)
returns int
end
end
class Operators
macro def add_op(name, &op)
View cal2.mirah
import java.util.HashMap
interface IOperator do
def run(x:int, y:int)
returns int
end
end
class Operators
def add
View calc1.mirah
interface IOperator do
def run(x:int, y:int)
returns int
end
end
class Add
implements IOperator
def run(x:int, y:int)
View gist:1010987
"Find the 2345 number!"[/[0-9]+/] # => "5"
"Find the 2345 number!"[/[^0-9]+/] # => "Find the "
@mazur
mazur / gist:1003052
Created Jun 1, 2011
Build IronRuby on mono OSX/Ubuntu
View gist:1003052
#!/bin/bash
shopt -s extglob #Enables extglob
# OS: OSX 10.6.7 and Ubuntu 11.04
# Mono: 2.10.1
# Mono 2.10 is required since we need C# 4.0 support to compile IronRuby.
# C# 4.0 support can either be found in mono 2.10 or 2.6 compiled with special
# flags.
View gist:907648
public IEnumerable<Action> Parameterized_shit_method_bithes()
{
yield return () => Run_me_with_params(5, 4);
yield return () => Run_me_with_params(7, 8);
yield return () => Run_me_with_params(12, 56);
}
protected void Run_me_with_params(int x, int y)
{
// Assert shit here
View gist:876140
public class FooMap : ClassMap<Foo>
{
}
@mazur
mazur / gist:875813
Created Mar 18, 2011
For fun and fun
View gist:875813
; This is a comment
; Everything that is declared "outside" a class is automatically placed in the class "Global"
this_is_a_variable: 5
; Types are not dynamic, they are inferenced.
this_is_a_method: (x, y) {
result: x + y; Everything after ; is not read and treated like a comment
You can’t perform that action at this time.