Skip to content

Instantly share code, notes, and snippets.

@thompson4822
thompson4822 / memory_game.dart
Created January 26, 2014 15:55
Simple Memory Game For Lenny
import 'dart:html' as html;
import 'dart:math';
import 'package:stagexl/stagexl.dart';
Stage stage = null;
RenderLoop renderLoop;
/**
* Tracks all of the glyphs and can create new ones on demand.
*/
@thompson4822
thompson4822 / testElem.coffee
Created June 24, 2013 20:00
Defining AngularJS directives in CoffeeScript
@angular.module('HelloApp', ['components'])
@angular.module('components', [])
.directive('testElem', ->
restrict: 'A'
template: '<div class="my-directive-class"><h1>Hello...</h1><p ng-repeat="obj in arr">{{obj}}</p></div>'
link: (scope, iterStartElement, attr) ->
$(".my-directive-class").css({ 'background-color': 'yellow'})
scope.arr = ["Steve", 'is', 'the', 'beast']
)
// Sudoku Generator For Scala
// Pretty efficient, can create a puzzle in under a millisecond on my machine.
abstract class Difficulty { def revealCount: Int }
case class Easy() extends Difficulty { val revealCount = 41 }
case class Medium() extends Difficulty { val revealCount = 35 }
case class Hard() extends Difficulty { val revealCount = 31 }
class SudokuPuzzle(difficulty: Difficulty) {
private val possible: Set[Int] = Set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)