Skip to content

Instantly share code, notes, and snippets.

Monty Rasmussen montyr75

  • Utah, USA
Block or report user

Report or block montyr75

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
montyr75 / main.dart
Created Sep 12, 2019
static object builder
View main.dart
void main() async {
final cache = await Cache.createCache();
class Cache {
static Db myDb;
static createCache() async {
if (myDb == null) {
myDb = await Future.delayed(Duration(seconds: 1));;
montyr75 / obj-search.ts
Last active May 31, 2018
Searching for all instances of "key" in an object with TypeScript.
View obj-search.ts
class Utils {
static search(name: String, obj: any, results: Array<any>) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
const value = obj[key];
if (key == name) {
else if (typeof value === 'object') {
montyr75 / hangman_assets.dart
Created Apr 16, 2018
Words and images for a Dart Hangman game.
View hangman_assets.dart
const List<String> imageList = const [
montyr75 / big_o.dart
Created Jan 4, 2018
Big O notation, with Dart examples.
View big_o.dart
// O(1)
// constant
bool isFirstElementNull(List<String> elements) {
return elements.first == null;
// O(n)
// growth is linear in direct proportion to the size of the data set
bool containsValue(List<String> elements, String value) {
for (String element in elements) {
montyr75 / empty.dart
Last active Sep 27, 2016
An empty place to start.
We couldn’t find that file to show.
montyr75 / safe_inner_html.dart
Last active May 31, 2018
Angular 2 directive to safely inject HTML.
View safe_inner_html.dart
import 'dart:html' show Element, NodeTreeSanitizer;
import 'package:angular2/core.dart'
show Directive, Input, OnChanges, SimpleChange;
@Directive(selector: '[safeInnerHtml]')
class SafeInnerHtml implements OnChanges {
Element _el;
montyr75 / wait_for_config.dart
Last active Jun 9, 2016
Angular service that acquires information asynchronously, but has dependents waiting for that info. (Pattern)
View wait_for_config.dart
class ConfigService {
var _config;
Completer _waitForConfig = new Completer();
ConfigService() {
doHttpCall().then((result) {
_config = result;
montyr75 / download_string.dart
Last active Jun 17, 2016
Automatically send a string in the form of a downloaded file to a browser client using new HTML5 anchor attributes.
View download_string.dart
void downloadFileToClient(String filename, String text) {
AnchorElement tempLink = document.createElement('a');
..attributes['href'] = 'data:text/plain;charset=utf-8,${Uri.encodeComponent(text)}'
..attributes['download'] = filename;
montyr75 / gist:09b5dc9a20ba01955872
Last active Sep 30, 2019
Find the last day of the current month with Dart's DateTime class.
View gist:09b5dc9a20ba01955872
DateTime now = new;
DateTime lastDayOfMonth = new DateTime(now.year, now.month + 1, 0);
montyr75 / gist:2078bdc941d22ab0d131
Created Dec 6, 2014
Dynamically create an HTML element from a String in Dart.
View gist:2078bdc941d22ab0d131
new Element.html("YOUR HTML STRING HERE");
// You may need to pass a NodeValidator to get everything to render, like:
NodeValidator nodeValidator = new NodeValidatorBuilder()
// ..allowHtml5()
// ..allowElement('Button', attributes: ['ng-disabled']);
new Element.html("YOUR HTML STRING HERE", validator: nodeValidator);
You can’t perform that action at this time.