Skip to content

Instantly share code, notes, and snippets.

@minikin
minikin / framework.dart
Created November 29, 2020 22:10 — forked from guidezpl/framework.dart
Modified Flutter framework.dart to print widget counts (generic version)
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:async';
import 'dart:collection';
import 'dart:developer';
@minikin
minikin / main.dart
Last active November 20, 2020 10:52
Types Promotion: Dart vs Swift
void main() {}
abstract class Shape {}
class Square implements Shape {
String? id;
}
class Circle implements Shape {
String? name;
@minikin
minikin / Coffee.swift
Last active November 20, 2020 08:41
Working with optional fields in Swift vs Dart
struct Coffee {
var temperature: String?
mutating func heat() {
temperature = "hot"
}
mutating func chill() {
temperature = "iced"
}
@minikin
minikin / example.md
Created November 16, 2020 08:17 — forked from ericclemmons/example.md
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@minikin
minikin / main.dart
Created September 30, 2020 13:11
Result Type Dart
void main() {
final item = {'1': 'Apple'};
final operationSuccessed = Result.success(item);
final operationFailed = Result.error(Failure('Cannot catch data'));
print(operationSuccessed.result);
print(operationFailed.error);
}
class Result<Success, Error extends Failure> {
@minikin
minikin / main.dart
Created September 29, 2020 09:18
Flutter Widgets: Classes vs Methods
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
Launching lib/main_development.dart on iPhone SE (2nd generation) in debug mode...
CocoaPods' output:
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
- Flutter
- agora_rtc_engine
@minikin
minikin / models.md
Last active September 14, 2020 11:38
Models
auth_service:
  provider [string] (e.g. slack, google)
  id [RFC4122 v4]
  authorizedAt [string] (ISO8601)
  photoUrl [string]
  realName [string]

device:
 id [string] (device udid or e.g. 'Chrome')

fastlane/fastlane#13833

This script may be useful to you if you use fastlane for iOS CI builds and your Apple developer portal account uses 2-factor authentication. There is reason to suppose that Apple may not be persisting these sessions for as long as they used to, and hence you might find yourself needing to update FASTLANE_SESSION for your CI projects more often than usual.

This script is a way to mostly automate the process of updating FASTLANE_SESSION if you use CircleCI as your CI provider. It expects to find your Apple username in env as FASTLANE_USER, your Apple password as FASTLANE_PASSWORD, and your CircleCI API token as CIRCLE_API_TOKEN. It then executes fastlane spaceauth and waits for you to put in your 2FA code. From there, it parses out the session data and then uses the CircleCI API to populate the specified projects with the newly updated FASTLANE_SESSION. You'll

#!/bin/sh
CURRENT_DIR="$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1")"
echo "$CURRENT_DIR"
# Decrypt and Configure Local Environment
# --yes to assume "yes" for questions
function configure_local_environment() {
gpg --yes --decrypt --no-symkey-cache \
--output $CURRENT_DIR/lib/configurations/secrets.dart $CURRENT_DIR/secrets/secrets.dart.gpg