Skip to content

Instantly share code, notes, and snippets.

View ndugger's full-sized avatar

Nick Dugger ndugger

  • Minneapolis, MN
View GitHub Profile
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
class App extends StatefulWidget {
final Widget root;
const App({
super.key,
required this.root
});
import 'package:flutter/widgets.dart';
import '../utilities/navigation.dart';
typedef PathMiddleware = Future<bool> Function(BuildContext);
class Path {
final String name;
final WidgetBuilder builder;
final List<PathMiddleware> middleware;
@ndugger
ndugger / appStore.ts
Last active July 22, 2022 16:00
Redux Cheat Sheet (w/ Redux Toolkit)
import { configureStore } from '@reduxjs/toolkit'
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
import { counterSlice } from './counterSlice'
export const appStore = configureStore({
reducer: {
counter: counterSlice.reducer
}
})
@ndugger
ndugger / Introduction.md
Last active August 7, 2021 06:36
webmake

webmake

WebMake is an opinionated TypeScript (w/ JSX) -> HTML compiler. It works by allowing you to embed an HTML document in your TypeScript modules. This signals to the compiler to invert your code by placing the encompassing TypeScript source code in a <script type="module"> tag within the embedded document.

Ok, but why?

There are a few key proposals that I've got my eyes on:

@ndugger
ndugger / App.tsx
Last active May 12, 2021 03:30
Example Todo App
import { $, Component } from 'yuzu/dom'
import { nanoid } from 'nanoid'
import { Icon } from './Icon'
import { Task } from './Task'
/**
* Example task application
*/
export class App extends Component {
import { Document } from './Document'
import { Node } from './Node'
import { Style } from './Style'
/**
* Symbol which represents a flag to determine whether a component is connected
*/
const connected = Symbol('connected')
/**
import {
Application,
Fetch,
Route,
Router,
Theme,
Viewport,
createElement,
createStyleSheet
} from 'yuzu'
import { Fetch, Program, Route, Router, Viewport } from 'yuzu'
import { createElement, provideContext } from 'yuzu/tools'
import { Content } from '~/services/Content'
import { Flexbox } from './components/Flexbox'
import { AboutPage } from './pages/AboutPage'
import { ArticlePage } from './pages/ArticlePage'
import { AuthorPage } from './pages/AuthorPage'
import { ContactPage } from './pages/ContactPage'
import { Component, Fragment, createElement } from 'cortex'
import { useRoute } from 'cortex-router'
import { useArticles } from '~/hooks/useArticles'
import { useAuthor } from '~/hooks/useAuthor'
import { Avatar } from '~/views/components/Avatar'
import { Card } from '~/views/components/Card'
import { Container } from '~/views/components/Container'
import { Flexbox } from '~/views/components/Flexbox'
import { Component, createElement } from 'cortex'
import { createStyleSheet, selector } from 'cortex-css'
import { DateTime } from 'luxon'
import { Theme } from '~/contexts/Theme'
import { Button } from './Button'
import { Container } from './Container'
import { Divider } from './Divider'
import { Flexbox } from './Flexbox'