Skip to content

Instantly share code, notes, and snippets.

View ElemarJR's full-sized avatar
🏠
Working from home

Elemar Rodrigues Severo Junior ElemarJR

🏠
Working from home
View GitHub Profile
// Este teste verifica o bit mais alto ligado em um bitboard
// (ver minha série sobre xadrez [http://elemarjr.net]) para entender o contexto
// Não só mais de um assert faz sentido, como a lógica no teste
// O equivalente a esse teste seriam 64 testes individuais (muito trabalho para pouco resultado, não acha)
[Test]
public void GetLeadingSquare_EverySquare()
{
var bitboard = new Bitboard();
for (int i = 0; i < 64; i++)
@ElemarJR
ElemarJR / gist:776090
Created January 12, 2011 12:21
Diagonal NEA1H8
public void ctor_DiagonalsNEA1H8()
{
Square[] squares = new Square[] {
Squares.A1,
Squares.B2,
Squares.C3,
Squares.D4,
Squares.E5,
Squares.F6,
Squares.G7,
using System.Collections.Generic;
using StrongChess.Model.Pieces;
namespace StrongChess.Model.Sets
{
struct PieceSet<TPieceRule>
where TPieceRule : IPieceRule, new()
{
Bitboard _Positions;
public PieceSet(Bitboard positions) : this()
14 Bis
AC_DC
Ac£sticos e Valvulados
Adele
Adriana Calcanhoto, Ana Carolina e Maris
Aerosmith
Aha
Air Supply
Alanis Morissette
Alceu Valenca- Elba Ramalho - Geraldo Azevedo
[Test]
public static void Class_AllStaticMethodsShouldBeDecoratedWithDebuggerStepThroughAttribute()
{
var methods = from m in typeof(Mooble.Util.StringExtensions).GetMethods()
where !m.IsSpecialName && m.IsStatic &&
m.GetCustomAttributes(typeof(DebuggerStepThroughAttribute), true).Count() == 0
select m.Name;
if (methods.Count() > 0)
{
namespace SilverlightApplication1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.Loaded += (s, e) => { this.DataContext = new Person(); };
}
}
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<StackPanel x:Name="LayoutRoot" Background="White">
public IEnumerable<Token> Scan(IEnumerable<char> source)
{
var currentState = StatesTable.States[StatesTable.InitialState];
string currentValue = "";
var enumerator = source.GetEnumerator();
bool @continue = enumerator.MoveNext();
while (@continue)
{
var c = enumerator.Current;
public class DummyObject
{
public void Touch()
{
if (_Touched != null)
this._Touched(this, EventArgs.Empty);
}
EventHandler _Touched;
public event EventHandler Touched
@ElemarJR
ElemarJR / quicksort.hs
Created June 22, 2011 16:39
quicksort em Haskell
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x: xs) =
let smallerOrEqual = [a | a <- xs, a <= x]
larger = [ a | a <- xs, a > x ]
in quicksort smallerOrEqual ++ [x] ++ quicksort larger