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
void main() { | |
for (int i = 0; i < 5; i++) { | |
print('hello ${i + 1}'); | |
} | |
} | |
Map<Letters, List<int>> getSubjectInSchedule() {} | |
class Subject { |
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 "package:flutter/material.dart"; | |
enum Sport {baseball, basketball, hockey, tennis, volleyball, soccer} | |
const Map<String, Sport> stringToSports = { | |
"baseball": Sport.baseball, | |
"basketball": Sport.basketball, | |
"hockey": Sport.hockey, | |
"tennis": Sport.tennis, | |
"volleyball": Sport.volleyball, |
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 "package:flutter/material.dart"; | |
@immutable | |
class Time { | |
/// The hour in 24-hour format. | |
final int hour; | |
/// The minutes. | |
final int minutes; |
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 "package:flutter_web/material.dart"; | |
import "package:flutter_web/cupertino.dart"; | |
import "package:flutter_web_ui/ui.dart" as ui; | |
// Lines like these are comments (only read by people, ignored by computer) | |
/// Lines like these (three slashes) explain only the class/function/variable right underneath them | |
// Any part of a comment in [brackets] are either defined here in this file or | |
// can be searched for at https://api.flutter.dev |
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
class Range { | |
final num buy, sell; | |
const Range(this.buy, this.sell); | |
} | |
Range maxProfit(List<double> points) { | |
// We want to find a range by examining a list of local minima and maxima | |
// We can assign a new list (think about what type it would hold) of those minima and maxima | |
// To find that list, we go through the list of points, two at a time, watching | |
// for changes in whether the points are increasing or decreasing. |
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
#define echo 2 | |
#define trigger A0 | |
#define threshold 6 | |
long getDistance() { | |
// This function returns the distance of an object from the sensor in cm | |
// | |
// An ultrasonic sensor sends a sound wave pulse outwards, and then waits for it to hit an | |
// object and bounce back to the sensor. | |
// |
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
// These "#define" statements are *like* variables, but not really | |
// Variables can be changed to any other value, but these cannot | |
// They don't even stay in memory! What happens is, when you press compile, | |
// the Arduino replaces all the times the name comes up in the code with the | |
// value before sending it to the Arduino board. So it's not really a variable | |
// you can control, but rather just another name for a value. | |
// | |
// The define statement looks like this: #define NAME VALUE. Note that NAME can | |
// not contain spaces, because then it would be interpreted as VALUE. |
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
enum Subject {history, english} // ... | |
enum Reviewer {teacher, student} | |
class User { | |
String first, last; | |
int rating; | |
} | |
class Tutor extends User { | |
int yearGraduated; |
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
/* | |
This script is for one NRF to send data to the other. The NRF sending the data | |
called the server, and the device receiving the data is called the client. | |
The setup for both devices is the same, the looping is what's different. | |
Here is a pinout for both devices: | |
* CE --> 9 | |
* CSN --> 10 | |
* MOSI --> 11 |
NewerOlder