Skip to content

Instantly share code, notes, and snippets.

Working From Home

Rody Davis rodydavis

Working From Home
View GitHub Profile
View csv-to-material-table.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<input type="file" id="file-upload" />
<script type="module">
rodydavis / lit-2d-canvas.ts
Created Jan 3, 2021
Lit-Element 2d Canvas
View lit-2d-canvas.ts
import { html, LitElement, property, query } from 'lit-element';
export abstract class Lit2DCanvas extends LitElement {
@query('#base') canvas!: HTMLCanvasElement;
@property({ type: Number }) width: number | undefined;
@property({ type: Number }) height: number | undefined;
canvasWidth = 400;
canvasHeight = 400;
render() {
rodydavis /
Created Dec 21, 2020
Based on md2googleslides this will create a Amp Story from Markdown


Rody Davis

Welcome to my site

This is built with Lit-Element, Parcel and Web Components!

View flutter_resize_panel.dart
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
enum SplitMode { normal, leftExpand, rightExpand }
rodydavis / three_js_city.js
Created Oct 21, 2020
Procedual City in Three.js
View three_js_city.js
// build the base geometry for each building
var geometry = new THREE.CubeGeometry( 1, 1, 1 );
// translate the geometry to place the pivot point at the bottom instead of the center
geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0.5, 0 ) );
// get rid of the bottom face - it is never seen
geometry.faces.splice( 3, 1 );
geometry.faceVertexUvs[0].splice( 3, 1 );
// change UVs for the top face
// - it is the roof so it wont use the same texture as the side of the building
// - set the UVs to the single coordinate 0,0. so the roof will be the same color
rodydavis / dart_bloc_freezed.dart
Created Sep 28, 2020
Dart + Bloc + Freezed (Unions and Map to State)
View dart_bloc_freezed.dart
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'counter_bloc.freezed.dart';
class CounterBloc extends Bloc<CounterEvent, CounterState> {
CounterBloc() : super(CounterState.value(0));
Stream<CounterState> mapEventToState(CounterEvent event) async* {
rodydavis / flutter_analyzer_ast.dart
Created Sep 19, 2020
Flutter File Analyzer in Dart
View flutter_analyzer_ast.dart
import 'dart:convert';
import 'package:analyzer/dart/analysis/utilities.dart';
// import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
const kTestFlutterData = '''
import 'package:flutter/material.dart';
rodydavis / flutter_model_notification.dart
Created Sep 13, 2020
Inherited Widget + Notifications
View flutter_model_notification.dart
import 'package:flutter/material.dart';
void main() {
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
rodydavis / animated_indexed_stack.dart
Last active Sep 11, 2020
Flutter Animated IndexedStack
View animated_indexed_stack.dart
import 'package:flutter/material.dart';
class AnimatedIndexedStack extends StatelessWidget {
const AnimatedIndexedStack({
Key key,
@required this.index,
@required this.children,
@required this.duration,
}) : super(key: key);
rodydavis / dart_enum_description.dart
Created Sep 6, 2020
Add Descriptions to Enums in Dart
View dart_enum_description.dart
enum MyEnum {
extension MyEnumUtils on MyEnum {
String get description {
switch (this) {
case MyEnum.simple: