Skip to content

Instantly share code, notes, and snippets.

View ianbishop's full-sized avatar

Ian Bishop ianbishop

View GitHub Profile
@ianbishop
ianbishop / revised_game_gui.rb
Created March 24, 2011 22:40
Revised GameGUI to show new send/respond_to? support
class GameGUI
def initialize(repeater)
@repeater = repeater
@repeater.subscribe(self)
end
# When a player (color) clicks on board location
# x,y we attempt a move by broadcasting it
def on_click(color, x, y)
@ianbishop
ianbishop / NotificationService.js
Created July 13, 2011 03:21
Oh god, singletons
/*
* Singleton service to manage notifications
* for players using GET /notifications/token
* for some player token
*/
function NotificationService() {
var instance = (function() {
/*
* Private variables
*/
@ianbishop
ianbishop / boat_placement.java
Created October 30, 2011 17:34
initial boat placement for battleship game
/*
Initialize all boat positions for a given player
*/
private boolean initBoatPositions(String message) {
boatPositions = new String[(Player.boats).length][];
String[] boatInfo = message.split(",");
ArrayList<String> usedPositions = new ArrayList<String>();
for(String boat : boatInfo) {
@ianbishop
ianbishop / gist:1671784
Created January 24, 2012 18:38
Installing X on Arch
pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils xorg-xauth
@ianbishop
ianbishop / gist:1671791
Created January 24, 2012 18:40
Setting DISPLAY for X
setenv DISPLAY=localhost:10.0
@ianbishop
ianbishop / gist:1671820
Created January 24, 2012 18:46
Configuring /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
@ianbishop
ianbishop / gist:1671827
Created January 24, 2012 18:47
Configuring /etc/ssh/ssh_config
ForwardX11 yes
@ianbishop
ianbishop / gist:1671829
Created January 24, 2012 18:47
Connect with SSH with X Forwarding
ssh -X user@ip
ListBox list = null;
switch (direction)
{
case ConversionDirection.TO:
list = toUnitList;
break;
case ConversionDirection.FROM:
list = fromUnitList;
break;
@ianbishop
ianbishop / gist:2649405
Created May 9, 2012 22:33
Rails 3.*: Moving to Mongo
# config/application.rb:
- require 'rails/all'
+ require "action_controller/railtie"
+ require "action_mailer/railtie"
+ require "active_resource/railtie"
+ require "rails/test_unit/railtie"
+ require "sprockets/railtie" # Only required if you're using asset pipeline