Skip to content

Instantly share code, notes, and snippets.

@poemdexter
poemdexter / gist:1077352
Created July 12, 2011 03:42
copying playerlist for thread safe enumeration
public List<Player> getPlayerListCopy()
{
List<Player> copy;
lock (this.playerList)
{
copy = this.playerList.ToList();
}
return copy;
}
@poemdexter
poemdexter / rover.java
Created February 1, 2012 02:35
rover kata java, junit 1.31.12
package PokerKata;
import org.junit.Assert.*;
public class Rover {
public class Bot {
public String facing;
public int X;
@poemdexter
poemdexter / Mastiff.cs
Created February 22, 2012 15:09
Physics for Goons
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace Mastiff
{
class Physics
What tools do you use for:
email
calendaring
project management
source control
bug tracking
Are the working conditions quiet?
Are you agile? Do you subscribe to a specific methodology or framework?
What does a typical development phase/sprint look like?
What does a typical day of a developer consist of?
int f = 5;
public void dan(int x)
{
x = 6;
}
dan(f);
System.out.print(f);
@poemdexter
poemdexter / gist:2041837
Created March 15, 2012 04:17
G110 keyboard script to make the colors flicker
function OnEvent(event, arg)
if (event == "M_PRESSED" and arg == 3) then
for i=0,100,1 do
color( 255, 0 , 0 )
color( 0 , 255, 0 )
color( 0 , 0 , 255)
color( 255, 0 , 0 )
color( 0 , 255, 0 )
color( 0 , 0 , 255)
@poemdexter
poemdexter / gist:2154100
Created March 21, 2012 23:21
sprite dictionary!
private IDictionary<string, Texture2D> Sprites;
private void LoadSpriteDictionary(ContentManager content)
{
Sprites.Add("wall", content.Load<Texture2D>("Entities/Environment/wall"));
Sprites.Add("floor", content.Load<Texture2D>("Entities/Environment/floor"));
}
# in player.rb
class Player
def initialize(window)
@bandit_sprite = Gosu::Image.new(window, "bandit.bmp", false)
@x = @y = 0
end
def draw
@bandit_sprite.draw(24*@x, 24*@y, 1)
class Player
def initialize(window)
@bandit_sprite = Gosu::Image.new(window, "bandit.bmp", false)
@x = @y = 0
end
def draw
@bandit_sprite.draw(24*@x, 24*@y, 1)
end
# this is also what the player.rb looks like
class Enemy
def initialize(window)
@skeleton_sprite = Gosu::Image.new(window, "skeleton.bmp", false)
@x = @y = 19
end
def draw