Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working From Home

Rody Davis rodydavis

:octocat:
Working From Home
View GitHub Profile
View gist:8a819c292b39826382f242415dc19b21
# disable sleep
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1
# re-enable sleep
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0
View flutter_animations.dart
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
@rodydavis
rodydavis / flutter_xcode_cloud_script.sh
Created Jun 6, 2022
flutter script to build app on Xcode Cloud ci_scripts/ci_post_install.sh
View flutter_xcode_cloud_script.sh
#!/bin/sh
# Install CocoaPods using Homebrew.
brew install cocoapods
# Install Flutter
brew install --cask flutter
# Run Flutter doctor
flutter doctor
@rodydavis
rodydavis / flutter_master_detail.dart
Last active Apr 9, 2022
Flutter Master Detail View
View flutter_master_detail.dart
import 'package:flutter/material.dart';
class MasterDetail<T> extends StatefulWidget {
const MasterDetail({
Key? key,
required this.listBuilder,
required this.detailBuilder,
required this.onPush,
this.emptyBuilder,
}) : super(key: key);
View theme-adapter.css
:root {
--mdc-theme-primary: var(--md-sys-color-primary);
--mdc-theme-on-primary: var(--md-sys--coloron-primary);
--mdc-theme-background: var(--md-sys--colorbackground);
--mdc-theme-on-background: var(--md-sys--coloron-background);
--mdc-theme-on-surface-variant: var(--md-sys--coloron-surface-variant);
--mdc-theme-surface-variant: var(--md-sys--colorsurface-variant);
--mdc-theme-on-surface: var(--md-sys--coloron-surface);
--mdc-theme-surface: var(--md-sys--colorsurface);
--mdc-theme-text-primary-on-background: var(--md-sys--coloron-surface-variant);
@rodydavis
rodydavis / material_outlined_card.dart
Created Mar 9, 2022
Flutter Material Outlined Card
View material_outlined_card.dart
import 'package:flutter/material.dart';
class OutlinedCard extends StatefulWidget {
const OutlinedCard({
Key? key,
required this.child,
}) : super(key: key);
final Widget child;
@rodydavis
rodydavis / controller.ts
Last active Mar 1, 2022
HTML Canvas Controls with painting, zoom at cursor, clicking and keyboard shortcuts
View controller.ts
import { drawInfiniteGrid } from "./infinite-grid";
import {
CanvasTransformer,
CanvasTransformerOptions,
defaultOptions,
} from "./transformer";
import { color } from "./utils";
export class CanvasController<
T extends CanvasWidget
@rodydavis
rodydavis / color-input.ts
Last active Feb 24, 2022
Color input with lit
View color-input.ts
import { html, css, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
/** Color Input */
@customElement("color-input")
export class ColorInput extends LitElement {
static override styles = css`
main {
--input-size: 48px;
--padding: 4px;
@rodydavis
rodydavis / action.dart
Created Feb 17, 2022
Action manager example for flutter
View action.dart
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../model.dart';
abstract class AppAction extends Intent {
LogicalKeySet? get keys => null;
void action(AppModel model);
String get label;
@rodydavis
rodydavis / app.js
Created Feb 10, 2022
Material You on the Web
View app.js
import * as utils from "https://cdn.skypack.dev/@guidezpl/material-color-utilities";
function themeFromSeed(seed) {
const palette = utils.CorePalette.of(seed);
return {
seed: seed,
schemes: {
light: utils.Scheme.light(seed),
dark: utils.Scheme.dark(seed),
},