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 YellowStore { | |
String name; | |
String opens; | |
String time; | |
Double distance_away; | |
} |
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 DistanceUtil { | |
static Double toMeters(Double distance_away) { | |
Double newDistance = distance_away * 1000; | |
return newDistance; | |
} | |
} | |
// Usage | |
main() { | |
... |
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
extension YellowStoreExtensions on YellowStore { | |
Double toMeters() => this.distance_away * 1000; | |
} |
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
bool _numberInputIsValid = true; | |
Widget _buildNumberTextField() { | |
return TextField( | |
keyboardType: TextInputType.number, | |
style: Theme.of(context).textTheme.display1, | |
decoration: InputDecoration( | |
icon: Icon(Icons.attach_money), | |
labelText: 'Enter an integer:', | |
errorText: _numberInputIsValid ? null : 'Please enter an integer!', |
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
final _controller = TextEditingController(); | |
Widget _buildMultilineTextField() { | |
return TextField( | |
controller: this._controller, | |
maxLines: 10, | |
textCapitalization: TextCapitalization.sentences, | |
decoration: InputDecoration( | |
counterText: '${this._controller.text.split(' ').length} words', |
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
bool _showPassword = false; | |
Widget _buildPasswordTextField() { | |
return TextField( | |
obscureText: !this._showPassword, | |
decoration: InputDecoration( | |
labelText: 'password', | |
prefixIcon: Icon(Icons.security), | |
suffixIcon: IconButton( | |
icon: Icon( |
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'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Route Demo', | |
theme: ThemeData( |
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'; | |
import 'package:routing_prep/main.dart'; | |
class RouteGenerator { | |
static Route<dynamic> generateRoute(RouteSettings settings) { | |
//Get arguments passed in Navigator.pushNamed | |
final args = settings.arguments; | |
switch (settings.name) { | |
case '/': |
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
##----------------------------------------------------------------------------- | |
## creates Composite Cloudwatch Alarm on AWS for monitoring | |
##----------------------------------------------------------------------------- | |
resource "awscc_cloudwatch_composite_alarm" "composite_alarm" { | |
alarm_name = "example-composite-alarm" | |
alarm_description = "Example of a composite alarm with various actions" | |
alarm_actions = [aws_autoscaling_policy.example_scaling_policy.arn] | |
alarm_rule = "ALARM(${aws_cloudwatch_metric_alarm.cpu_gte_80.alarm_name}) OR ALARM(${aws_cloudwatch_metric_alarm.network_in.alarm_name})" |
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
#! bash | |
kubectl get pods | grep -E OutOfcpu\|Evicted\|OOMKilled\|Error\|ContainerStatusUnknown | awk '{print "kubectl delete pod " $1 }' |