Skip to content

Instantly share code, notes, and snippets.

View zbarbuto's full-sized avatar

zbarbuto

View GitHub Profile
@zbarbuto
zbarbuto / main.dart
Created November 29, 2023 21:24
Flutter tap/double-tap delay
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@zbarbuto
zbarbuto / karma.conf.js
Last active September 10, 2020 23:02
Angular Karma Config for Remote Debugging
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: "",
frameworks: ["jasmine", "@angular-devkit/build-angular"],
plugins: [
require("karma-jasmine"),
require("karma-chrome-launcher"),
@zbarbuto
zbarbuto / launch.json
Last active October 4, 2021 21:52
Angular Karma launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "attach",
"name": "Attach to Karma",
"address": "localhost",
"restart": true,
"port": 9222,
@zbarbuto
zbarbuto / drawer_routes.dart
Created January 13, 2020 22:52
Flutter Drawer Routes
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Nav Demo 3',
@zbarbuto
zbarbuto / ionic-fab-example.html
Created July 25, 2019 07:17
Example from the Ionic docs of a more complex FAB
<ion-fab vertical="center" horizontal="center" slot="fixed">
<ion-fab-button>
<ion-icon name="share"></ion-icon>
</ion-fab-button>
<ion-fab-list side="top">
<ion-fab-button><ion-icon name="logo-vimeo"></ion-icon></ion-fab-button>
</ion-fab-list>
<ion-fab-list side="bottom">
<ion-fab-button><ion-icon name="logo-facebook"></ion-icon></ion-fab-button>
</ion-fab-list>
@zbarbuto
zbarbuto / angular-template-projection.ts
Last active July 25, 2019 07:03
Template projection as a workaround for component restrictions
@Component({
selector: 'my-page',
template: `
<ion-content>
<ion-list><ion-item>My List</ion-item></ion-list>
<my-reusable-fab (templateOutput)="rootContent = $event"></my-reusable-fab>
<ng-template [ngTemplateOutlet]="rootContent"></ng-template>
</ion-content>
`
})
@zbarbuto
zbarbuto / ionic-example-page.html
Last active July 25, 2019 06:49
For a medium article
<!-- my-page.component.html -->
<ion-content>
<ion-list>
<my-item-component *ngFor="let item of items" [item]="item"></my-item-component>
<ion-list>
<my-reusable-fab></my-reusable-fab>
</ion-content>
<!-- my-reusable-fab.component.html -->
<ion-fab vertical="bottom" horizontal="right" slot="fixed">
@zbarbuto
zbarbuto / tslint.json
Created November 15, 2018 08:26
Some TSLint rules that I like
{
"rulesDirectory": [
"tslint-no-focused-test"
],
"rules": {
"array-type": [true, "array"],
"arrow-return-shorthand": [true, "multiline"],
"class-name": true,
"comment-format": [true, "check-space"],
"indent": [true, "spaces"],
@zbarbuto
zbarbuto / developer-functions-component.ts
Last active May 28, 2018 01:35
Developer function list
@Component({
template: `
<div *ngFor="let component of components">
<h4>{{ component.name }}</h4>
<button
*ngFor="let devFun of component.developerFunctions"
(click)="callMethod(component.componentInstance, devFun)">
{{ devFun.name }}
</button>
</div>
@zbarbuto
zbarbuto / developer-function.ts
Created May 21, 2018 06:25
Basics of the DeveloperFunction decorator
export const DEV_FUN_KEY = `DEVELOPER_FUNCTIONS`;
export function DeveloperFunction(opts: any) {
return function(target: any, key: string) {
const metaTarget = target.constructor;
const developerFunctions = getOwnMetadata(DEV_FUN_KEY, metaTarget) || [];
if (Array.isArray(opts)) {
opts.forEach(opt => {
developerFunctions.push({
key,
...opt