Skip to content

Instantly share code, notes, and snippets.

View csasbach's full-sized avatar

C. Scott Asbach csasbach

  • HCSS
  • Fremont, Nebraska
View GitHub Profile

Dart / Flutter

Why?

The fundamental reason we use Dart is simply that it is the language used to develop for Flutter. The reason we use Flutter is that it is a framework developed and supported by Google for

"building beautiful, natively compiled, multi-platform applications from a single codebase"

The Flutter platform provides Dart classes called Widgets that are used to describe elements that are rendered in the user interface. Beyond these, Dart is a statically typed language that is also used to write any other classes your application requires.

Testing

Why?

  • In order to test your code, your code must first be testable. If you write testable code from the beginning, you will be writing well-designed code or at least code that is more well designed than you would have otherwise written. If you are adding tests to an existing code base, you will be led by the hand into precisely the refactoring that code base needs. Testable code is, by virtue, loosely coupled code. Nearly all of the important design principles are geared towards keeping your code loosely coupled. If you only focused on making your tests easy to write and paid no attention to design principles at all, you will still have accomplished a pretty good design nearly by accident. The more loosely coupled your code is, the easier it is to change. The first virtue of good code is changeability, usability comes second. Code that is usable today but cannot be easily be changed may not be usable tomorrow and will only be made usable again with significant effort. Code that is easi

Design Principles

The resources below cover a lot of ground with regard to designing code that is easy to test and maintain in the first place, as well as how to refactor existing code to accomplish the same.

Good code design is a critical ingredient of a delivery pipeline with fast feedback loops. Fast feedback loops in turn enable us as developers to deliver stable software in a truly (not just in name) Agile team. When it is quick and easy to research, design, experiment, test, deliver, and repeat; development is exciting and rewarding and customers get the features they want and the fixes they need without delay.

By contrast, bad code design will eventually sabotage all efforts related to speed and stability until the technical debt accrued becomes so great that the entire project slows to a crawl. Releases will be less frequent, and what does get released will not be stable. Eventually, morale inside the team and confidence outside the team become damaged, and that's not a fun place to be.

S

@csasbach
csasbach / sqlListifier_values.html
Created March 11, 2016 17:51
Converts a newline delimited list of tab delimited multi-column values into the proper syntax for use in SQL VALUES statements. This can dramatically reduce the amount of time it takes to create scripts that must insert a great many values. It is designed to be deployed monolithically so that it may be run locally using just this single file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>SQL VALUES Listifier</title>
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAADl5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/8/Pz//Pz8//z8/P//////+Xl5v/l5eb/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf/z8/P/8/Pz///////l5eb/8/Pz/+Xl5v8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/8/Pz//Pz8///////5eXm//Pz8//z8/P/5eXm/wAACf8AAAn/8/Pz//Pz8//z8/P/8/Pz/+Xl5v8AAAn/AAAJ//Pz8//z8/P//////+Xl5v/z8/P/8/Pz/+Xl5v8AAAn/AAAJ//Pz8//z8/P/8/Pz//Pz8//z8/P/5eXm/wAACf/z8/P/8/Pz///////l5eb/8/Pz//Pz8//l5eb/AAAJ/wAACf/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8///////5eXm//Pz8//z8/P/5eXm/wAACf8AAAn/
@csasbach
csasbach / sqlListifier_like.html
Last active March 11, 2016 17:36
Converts a newline delimited list of values into properly formatted syntax for use in a series of SQL LIKE statements. This can dramatically reduce the amount of time it takes to create scripts that must filter on a great many values. It is designed to be deployed monolithically so that it may be run locally using just this single file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>SQL LIKE Listifier</title>
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAADl5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/8/Pz//Pz8//z8/P//////+Xl5v/l5eb/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf/z8/P/8/Pz///////l5eb/8/Pz/+Xl5v8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/8/Pz//Pz8///////5eXm//Pz8//z8/P/5eXm/wAACf8AAAn/8/Pz//Pz8//z8/P/8/Pz/+Xl5v8AAAn/AAAJ//Pz8//z8/P//////+Xl5v/z8/P/8/Pz/+Xl5v8AAAn/AAAJ//Pz8//z8/P/8/Pz//Pz8//z8/P/5eXm/wAACf/z8/P/8/Pz///////l5eb/8/Pz//Pz8//l5eb/AAAJ/wAACf/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8///////5eXm//Pz8//z8/P/5eXm/wAACf8AAAn/8/
@csasbach
csasbach / sqlListifier_in.html
Last active March 11, 2016 17:20
Converts a newline delimited list of values into properly quoted and comma delimited syntax for use in a SQL IN () statement. This can dramatically reduce the amount of time it takes to create scripts that must filter on a great many values. It is designed to be deployed monolithically so that it may be run locally using just this single file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>SQL Listifier</title>
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAADl5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/5eXm/+Xl5v/l5eb/8/Pz//Pz8//z8/P//////+Xl5v/l5eb/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf/z8/P/8/Pz///////l5eb/8/Pz/+Xl5v8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/AAAJ/wAACf8AAAn/8/Pz//Pz8///////5eXm//Pz8//z8/P/5eXm/wAACf8AAAn/8/Pz//Pz8//z8/P/8/Pz/+Xl5v8AAAn/AAAJ//Pz8//z8/P//////+Xl5v/z8/P/8/Pz/+Xl5v8AAAn/AAAJ//Pz8//z8/P/8/Pz//Pz8//z8/P/5eXm/wAACf/z8/P/8/Pz///////l5eb/8/Pz//Pz8//l5eb/AAAJ/wAACf/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8///////5eXm//Pz8//z8/P/5eXm/wAACf8AAAn/8/Pz//P
@csasbach
csasbach / Alerts.js
Last active February 16, 2016 17:25
An Angular Service for Queueing Alerts
/**
* An angular service for managing alerts.
* Alerts reference the action from which they were generated
* via an actionID. Alerts can be closed individualy, in
* groups by action ID, or all of them can be cleared at once.
*
* Designed primarily to work with Bootrstrap UI alerts but
* could easily be used with other alert paradigms.
*/
app.factory("alertService", function () {
@csasbach
csasbach / MY_form_helper.php
Created April 19, 2012 15:02
This is a custom helper file I created for use in CodeIgniter. It generates form elements with semantic and accessible HTML and CSS with the hooks needed to utilize error reporting in CodeIgniter and in jQuery.
<?php
/**
* SEMANTIC AND ACCESSIBLE FORMS HELPER FUNCTIONS
*
* Some more accesible and semantic form helpers. I utilize the default form helpers as
* much as possible to preserve the original syntax.
*
*/
/* FORM OPEN */
@csasbach
csasbach / Dice.cs
Created March 28, 2011 14:34
This module exposes static methods for rolling dice.
/**
* Dice
*
* @author C. Scott Asbach
*
* This module exposes static methods for rolling dice.
*/
using System;
namespace Dice
@csasbach
csasbach / tooltip.css
Created March 13, 2011 00:34
Create tooltips on mouseover or on click (for supporting touch interfaces).
abbr
{
border-bottom: 1px dotted #666;
cursor: help;
}
.tooltip
{
position:absolute;
background-color:#eeeefe;