Skip to content

Instantly share code, notes, and snippets.

View blaugold's full-sized avatar

Gabriel Terwesten blaugold

View GitHub Profile
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@blaugold
blaugold / quadratic_bezier.dart
Created December 16, 2019 10:51
Util for smoothing of line joins, with quadratic beziers.
import 'dart:ui';
class QuadraticBezier {
final Offset p0;
final Offset p1;
final Offset p2;
/// Returns a list of [QuadraticBezier]s which represent smooth line joins between knots.
///
/// To reduce the smoothing at the joins reduce [maxJoinSegmentLength].
@blaugold
blaugold / cubic_bezier_spline.dart
Last active December 16, 2019 10:47
Creating smooth curves, which pass through points in a path, with cubic bezier curves.
import 'dart:ui';
/// Returns control points which can be used to create a bezier path which is smooth at the joins between [knots].
///
/// The result contains one less set of control points than there are [knots]. To construct a path start by moving to
/// the first knot and add cubic bezier segments for the other knots.
///
/// Ported from https://www.codeproject.com/Articles/31859/Draw-a-Smooth-Curve-through-a-Set-of-2D-Offsets-wit
List<List<Offset>> bezierSplineControlOffsets(List<Offset> knots) {
assert(knots != null);
import { FirebaseDatabase } from '@blaugold/angular-firebase'
import 'rxjs/add/operator/map'
/**
* This example demonstrates the type checking ability when the database is used with a schema.
* Open this file with an ide like VS Code or WebStorm and you should see error highlighting.
*/
interface DBSchema {
todoLists: {
@blaugold
blaugold / typescript-firebase-database-rules.ts
Last active August 10, 2023 07:11
Firebase Database Rules with TypeScript
// Use the TypeScript compiler to check your database rules.
// You'll get the most out of type checking if you define a database schema
// through interfaces and use it both in the web client and with the database rules.
// The compiler will catch misspellings and structural errors.
// It won't check for completeness since all properties are optional.
// Only works with TypeScript 2.1 and up because of mapped types being used.
interface DatabaseRuleSet {
'.read'?: string | boolean
'.write'?: string | boolean