Skip to content

Instantly share code, notes, and snippets.

Amir Hardon amirh

Block or report user

Report or block amirh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View generate_pushid.dart
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 2048_gesture_detector.dart
return new GestureDetector(
behavior: HitTestBehavior.opaque,
onHorizontalDragEnd: (DragEndDetails d) {
if (d.primaryVelocity > 0) {
GameRedux.dispatch(context, moveRight());
} else {
GameRedux.dispatch(context, moveLeft());
}
},
//...
View state_test.dart
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],
You can’t perform that action at this time.