Skip to content

Instantly share code, notes, and snippets.

View igabice's full-sized avatar
💭
pushing the narative...

Israel Gabice igabice

💭
pushing the narative...
View GitHub Profile
@igabice
igabice / extension-methods.dart
Last active January 3, 2020 10:37
data from YellowStoreFinder
class YellowStore {
String name;
String opens;
String time;
Double distance_away;
}
@igabice
igabice / extension-methods2.dart
Last active January 3, 2020 12:32
DistanceUtil
class DistanceUtil {
static Double toMeters(Double distance_away) {
Double newDistance = distance_away * 1000;
return newDistance;
}
}
// Usage
main() {
...
@igabice
igabice / extension-methods3.dart
Last active January 3, 2020 11:25
Our extension methods
extension YellowStoreExtensions on YellowStore {
Double toMeters() => this.distance_away * 1000;
}
@igabice
igabice / number_textfield_example.dart
Created January 8, 2020 09:38
Flutter TextField with number input type
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!',
@igabice
igabice / multiline_textfield_example.dart
Created January 8, 2020 09:42
Flutter textfield example with multiline
final _controller = TextEditingController();
Widget _buildMultilineTextField() {
return TextField(
controller: this._controller,
maxLines: 10,
textCapitalization: TextCapitalization.sentences,
decoration: InputDecoration(
counterText: '${this._controller.text.split(' ').length} words',
@igabice
igabice / password_textfield_example.dart
Created January 8, 2020 09:50
Flutter TextField with password input type and an icon to toggle visibility
bool _showPassword = false;
Widget _buildPasswordTextField() {
return TextField(
obscureText: !this._showPassword,
decoration: InputDecoration(
labelText: 'password',
prefixIcon: Icon(Icons.security),
suffixIcon: IconButton(
icon: Icon(
@igabice
igabice / main.dart
Last active January 23, 2020 14:39
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(
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 '/':
@igabice
igabice / composite_alarm.tf
Last active October 13, 2023 10:43
a CloudWatch Composite Alarm based on both CPUUtilization and NetworkIn metrics
##-----------------------------------------------------------------------------
## 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})"
@igabice
igabice / cleanup_failing_pods.sh
Created October 19, 2023 17:49
A bash script that deletes kubernetes pods in bad state
#! bash
kubectl get pods | grep -E OutOfcpu\|Evicted\|OOMKilled\|Error\|ContainerStatusUnknown | awk '{print "kubectl delete pod " $1 }'