View state_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('move right', () { | |
BoardState state = new BoardState([ | |
[0, 2, 0, 0], | |
[0, 2, 0, 2], | |
[8, 0, 4, 4], | |
[2, 2, 0, 2], | |
]); | |
expect(state.moveRight().tiles, [ | |
[0, 0, 0, 2], |
View 2048_gesture_detector.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new GestureDetector( | |
behavior: HitTestBehavior.opaque, | |
onHorizontalDragEnd: (DragEndDetails d) { | |
if (d.primaryVelocity > 0) { | |
GameRedux.dispatch(context, moveRight()); | |
} else { | |
GameRedux.dispatch(context, moveLeft()); | |
} | |
}, | |
//... |
View generate_pushid.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' as math; | |
const String _kPushChars = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; | |
typedef String StringCallback(); | |
StringCallback generatePushId = () { | |
int lastPushTime = 0; | |
final List<int> randomSuffix = new List<int>(12); | |
final math.Random random = new math.Random.secure(); |
View mdlink.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(s) { navigator.clipboard.writeText('[' + document.title + '](' + window.location.href + ')'); })(); |