Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob Halff rhalff

  • RobbertHalff
  • Netherlands
View GitHub Profile
@rhalff
rhalff / main.dart
Last active Jun 20, 2021
Generics oddness
View main.dart
class A {}
class B extends A {
String b() {
return 'b';
}
}
class C<T extends A> {
const C(this.c);
View add_local_trusted_ca_for_valid_https.md

Generating SSL keys for development

Installation

Thanks to minica it is very easy to create trusted SSL certificates that have a very long expiration date.

In order to get started you have to have the go tools installed and set up correctly in your environment.

Setup

@rhalff
rhalff / .osx
Created Nov 20, 2020 — forked from ryanpcmcquen/.osx
.osx
View .osx
#!/usr/bin/env bash
# curl -o ~/.osx https://gist.githubusercontent.com/ryanpcmcquen/b2e608311f286a4ab3e1/raw/.osx && bash ~/.osx
###############################################################################
# General UI/UX #
###############################################################################
# Disable smart dashes as they’re annoying when typing code.
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
@rhalff
rhalff / jwt-payload-parse.dart
Created Oct 28, 2020 — forked from hjJunior/jwt-payload-parse.dart
Get payload of JWT token in Dart language
View jwt-payload-parse.dart
import 'dart:convert';
Map<String, dynamic> parseJwt(String token) {
final parts = token.split('.');
if (parts.length != 3) {
throw Exception('invalid token');
}
final payload = _decodeBase64(parts[1]);
final payloadMap = json.decode(payload);
@rhalff
rhalff / flutter_github_ci.yml
Created Oct 20, 2020 — forked from rodydavis/flutter_github_ci.yml
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
View flutter_github_ci.yml
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
@rhalff
rhalff / typeSails.js
Created Sep 13, 2020
Generate Type Definitions for Sails Models
View typeSails.js
#!/usr/bin/env node
// Usage: node ./typeSails.js --models ./api/models -t ./typings -f
// This generates an index.d.ts in ./typings which enables Intellisense for your Sails models.
// Based on: https://github.com/jacobhenke/waterline2ts
const program = require("commander");
const chalk = require("chalk");
const includeAll = require("include-all");
const fs = require("fs");
@rhalff
rhalff / main.dart
Last active Aug 28, 2020
Microtask
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: Scaffold(body: Center(child: MicroTask())));
}
}
View fuchsia emulator
fuchsia git:(master) ✗ fx emu -N
sudo follows to configure the tap interface:
Creating disk image...done
+ /Volumes/Fuchsia/fuchsia/prebuilt/third_party/aemu/mac-x64/emulator -feature VirtioInput,GLDirectMem,HVF,Vulkan -window-size 1280x800 -gpu auto -fuchsia -kernel /Volumes/Fuchsia/fuchsia/out/default/multiboot.bin -initrd /var/folders/89/38yds5s56613bmsc4yrd_6zm0000gn/T/tmp.x1ru1xpD/fuchsia-ssh.zbi -m 8192 -serial stdio -vga none -device virtio-keyboard-pci -device virtio_input_multi_touch_pci_1 -smp 4,threads=2 -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -enable-hvf -cpu Haswell -netdev type=tap,ifname=tap0,id=net0,script=/Volumes/Fuchsia/fuchsia/tools/devshell/lib/emu-ifup-macos.sh -device e1000,netdev=net0,mac=52:54:00:4d:27:96 -drive file=/var/folders/89/38yds5s56613bmsc4yrd_6zm0000gn/T/tmp.x1ru1xpD/fvm.blk,format=raw,if=none,id=vdisk -device virtio-blk-pci,drive=vdisk -append 'TERM=xterm-256color kernel.serial=legacy kernel.entropy-mixin=d9ec8927ffa9b8d1344389d717cfe46ec1560a882cd
View fuchsia.log
curl -s "https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT" | base64 --decode | bash
cipd bootstrapped to path:"/Volumes/Extra/fuchsia/.jiri_root/bin/cipd"
Please add /Volumes/Extra/fuchsia/.jiri_root/bin to your PATH
[22:40:21.603] WARN: Please opt in or out of analytics collection. You will receive this warning until an option is selected.
To check what data we collect run: jiri init -show-analytics-data
To opt-in run: jiri init -analytics-opt=true "/Volumes/Extra/fuchsia"
To opt-out run: jiri init -analytics-opt=false "/Volumes/Extra/fuchsia"
[22:40:21.608] WARN: Please opt in or out of analytics collection. You will receive this warning until an option is selected.
To check what data we collect run: jiri init -show-analytics-data
View equatable_annotation.dart
import 'package:collection/collection.dart';
import 'package:meta/meta.dart' show immutable;
//////////////////////////////////////////////
// Public Api
//////////////////////////////////////////////
@immutable
@equatableProps
class SomeObject extends $_SomeObjectEquatable {
final int one;