This file contains hidden or 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 std/num/int32 | |
| val player-size = 16 | |
| val pink = 10 | |
| // take a type that has a position, and a change in position, and update the position | |
| fun location/update<locatable>(a: locatable, dx: int, dy: int, | |
| ?x: locatable -> int, ?y: locatable -> int, | |
| ?@copy: (locatable, x: int, y: int) -> locatable): locatable | |
| a.@copy(x = a.x + dx, y = a.y + dy) |
This file contains hidden or 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 'package:flutter/material.dart'; | |
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
| import 'dart:math'; | |
| const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
| void main() { | |
| runApp(ProviderScope(child: MyApp())); | |
| } |
This file contains hidden or 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:async'; | |
| void main() { | |
| final s = Service(); | |
| Future.wait([for (final _ in [0, 1, 2, 3, 4 ]) s.setup()]); | |
| } | |
| class Service { | |
| Future<void> setup() async { | |
| if (_completer == null) { |
This file contains hidden or 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
| app "untitled-app" | |
| packages { base: "platform" } | |
| imports [ base.Task.{succeed, await}, base.Stdout ] | |
| provides [ main ] to base | |
| Option a : [ Some a, None ] | |
| Aggr : { numItems: Nat, first: Option Nat, second: Option Nat, third: Option Nat} |
This file contains hidden or 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
| extension Nullable<T extends Object> on T? { | |
| T unwrap([String message = '']) { | |
| if (this == null){ | |
| throw Exception('Null $T: $message'); | |
| } else { | |
| return this!; | |
| } | |
| } |
This file contains hidden or 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
| export IMAGE_FAMILY="pytorch-latest-gpu" | |
| export ZONE="us-west1-b" | |
| export INSTANCE_NAME="pytorch-colab-backend" | |
| gcloud compute instances create $INSTANCE_NAME \ | |
| --zone=$ZONE \ | |
| --image-family=$IMAGE_FAMILY \ | |
| --image-project=deeplearning-platform-release \ | |
| --maintenance-policy=TERMINATE \ | |
| --accelerator='type=nvidia-tesla-v100,count=1' \ | |
| --metadata='install-nvidia-driver=True' \ |