Skip to content

Instantly share code, notes, and snippets.

View mdrideout's full-sized avatar

Matthew Rideout mdrideout

View GitHub Profile
@mdrideout
mdrideout / main.dart
Last active September 10, 2022 18:31
solar-arc-1468
class Author {
final String id;
final String handle;
String name;
Author({
required this.id,
required this.handle,
@mdrideout
mdrideout / creating_context_from_thin_air.dart
Last active October 15, 2021 19:50
Create context in a situation where you may not have access to it. For example, if need to pass a translated message (requiring context) using `AppLocalizations.of(context)!.message` to a SnackBar from a function where we have no context, we can make the SnackBar argument a function that takes BuildContext as a param, and later get that param fr…
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
/// Global Scaffold Messenger Key (SnackBars)
final GlobalKey<ScaffoldMessengerState> rootScaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();
void main() {
runApp(MyApp());
}
@mdrideout
mdrideout / futures.dart
Created August 17, 2019 05:08
Dart Futures Example
import 'dart:io';
void main() {
performTasks();
}
void performTasks() async {
task1();
String task2Result = await task2();
task3(task2Result);
@mdrideout
mdrideout / elementor-always-expanded-menu.css
Created April 22, 2019 17:00
Elementor - Prevent Menu From Collapsing On Mobile
// This CSS goes into the Advanced -> Custom CSS of the menu item
selector nav {
display:block;
}
selector .elementor-menu-toggle {
display: none;
}
@mdrideout
mdrideout / synchronousFunctions.js
Last active March 26, 2018 17:05
Demonstration of synchronously executed functions using reduce and promises
let myArray = ["beans", "soup", "peanuts", "artichokes"];
myArray.reduce((promise, item) => {
return promise.then(() => {
return itemsPromise(item);
});
}, Promise.resolve()).then(() => {
console.log("ALL DONE");
})
import React, {Component} from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';
import '@material/linear-progress/dist/mdc.linear-progress.css';
class LinearProgress extends Component {
render() {
// Get state of linear progress to control its display