Skip to content

Instantly share code, notes, and snippets.

@badbabykosh
badbabykosh / set-interval-spec.js
Last active September 4, 2015 00:16 — forked from pkananen/set-interval-spec.js
testing setInterval with Jasmine using a Mock Clock
describe('createIntervalCallback', function() {
var sut = $.clockTest;
it('calls setInterval with callback() at a delay of 7000 ms', function() {
spyOn(sut, 'callback');
jasmine.Clock.useMock();
sut.createIntervalCallback();
jasmine.Clock.tick(7000);
@badbabykosh
badbabykosh / hash_of_hashes.rb
Created December 9, 2012 18:28
Attempting to build hash of hashes
def build_virtual_boards_hash(board, player)
virtual_boards_hash = {}
new_board_hash = {}
virtual_board = board.dup
empty_spaces_on_board = virtual_board.grid.select{ |k, v| v == " " }.keys
index_mark = 'VB'+empty_spaces_on_board.length.to_s
while empty_spaces_on_board.length >= 1
empty_spaces_on_board.each do |empty_space_symbol|