Skip to content

Instantly share code, notes, and snippets.

@rodydavis
rodydavis / ltxml.js
Created April 5, 2023 17:26 — forked from xndcn/ltxml.js
/***************************************************************************
Copyright (c) Microsoft Corporation 2013.
This code is licensed using the Microsoft Public License (Ms-PL). You can find the text of the license here:
http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
Published at http://OpenXmlDeveloper.org
Resource Center and Documentation: http://openxmldeveloper.org/wiki/w/wiki/open-xml-sdk-for-javascript.aspx
@rodydavis
rodydavis / gist:8a819c292b39826382f242415dc19b21
Created July 24, 2022 03:58 — forked from jampajeen/gist:d19f36a7309d0ead0e1f9735a26d66f3
Disable/Enable Mac OSX sleep on lid closed
# 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
@rodydavis
rodydavis / dropzone.dart
Created February 13, 2020 19:35 — forked from mosheduminer/dropzone.dart
Implementation of a drag-and-drop zone for flutter web. Inspired by https://gist.github.com/PlugFox/ffe83a91ce50f9c78a5b1d6674e36d1b
import 'dart:async';
import 'dart:html';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
enum _DragState {
dragging,
notDragging,
}
@rodydavis
rodydavis / stream_widget.dart
Created February 13, 2020 08:29 — forked from rafa-js/stream_widget.dart
[Flutter] Reusable Widget to handle the common flows working with Streams
import 'package:flutter/material.dart';
class StreamWidget<T> extends StatelessWidget {
final Stream<T> stream;
final Widget Function() onLoading;
final Widget Function(T) onData;
final Widget Function(dynamic) onError;
const StreamWidget({
@required this.stream,
@rodydavis
rodydavis / dottedBorder.dart
Created December 27, 2019 00:28 — forked from PlugFox/dottedBorder.dart
Flutter Web simple file upload
import 'package:flutter_web/material.dart';
import 'dart:math' as math;
class DottedBorder extends StatelessWidget {
final Color color;
final double strokeWidth;
final double gap;
final Widget child;
final EdgeInsets padding;
@rodydavis
rodydavis / scratch_card.dart
Created June 13, 2019 22:06 — forked from slightfoot/scratch_card.dart
Scratch Card - Unfinished Flutter implementation of https://allu.io/react-scratchcard/
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:math' as math;
void main() => runApp(DemoApp());
class DemoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@rodydavis
rodydavis / programmatic-dynamic-images.m
Created June 8, 2019 23:32 — forked from timonus/programmatic-dynamic-images.m
Programmatically create iOS 13 dynamic images
- (UIImage *)dynamicImage
{
UITraitCollection *const baseTraitCollection = /* an existing trait collection */;
UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]];
UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark];
UITraitCollection *const darkTraitCollection = UITraitCollection *lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]];
__block UIImage *lightImage;
[lightTraitCollection performAsCurrentTraitCollection:^{
lightImage = /* draw image */;
@rodydavis
rodydavis / guide.txt
Created April 23, 2019 17:49 — forked from tomaszpolanski/guide.txt
Building Flutter for MacOS
- `flutter channel master && flutter doctor`
- `export ENABLE_FLUTTER_DESKTOP=true`
- `git clone git@github.com:google/flutter-desktop-embedding.git`
- Move your project inside the `flutter-desktop-embedding` folder
- Copy the `macos` folder from `flutter-desktop-embedding/example` to your project
- `cd flutter-desktop-embedding/my-project && flutter run -d macos`
@rodydavis
rodydavis / run_logged.dart
Last active April 18, 2019 11:56 — forked from slightfoot/run_logged.dart
Logging your app's print statements to a local file for later processing.
import 'dart:async';
import 'dart:core';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
void main() => runLoggedApp(App());
@rodydavis
rodydavis / README.md
Last active April 10, 2019 16:21 — forked from kasperpeulen/README.md
How to pretty-print JSON using Dart.