Skip to content

Instantly share code, notes, and snippets.

View IchordeDionysos's full-sized avatar

Dennis Kugelmann IchordeDionysos

View GitHub Profile
@IchordeDionysos
IchordeDionysos / main.dart
Created February 12, 2024 10:28
Flutter Web scrolling problem
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@IchordeDionysos
IchordeDionysos / index.ts
Last active November 1, 2023 21:30
Parse Records from Firestore Backup file
import {CRC32C} from '@google-cloud/storage';
const CRC_INIT = 0;
const BLOCK_SIZE = 32 * 1024;
const CRC_HEADER_LENGTH = 4;
const LENGTH_HEADER_LENGTH = 2;
const RECORD_TYPE_HEADER_LENGTH = 1;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@IchordeDionysos
IchordeDionysos / main.dart
Last active July 8, 2020 10:02
Null check on class members not considered for NNBD
void main() {
Example example = Example();
String? prop;
final list = [
if (example.prop != null)
// Guaranteed to be not-null, but I still have to force it to be not null
// Only this would work:
// generateString(example.prop!),
// This does not work:
generateString(example.prop),
@IchordeDionysos
IchordeDionysos / main.dart
Created June 18, 2020 07:20
Table example using Colums and Rows
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' as math;
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
@IchordeDionysos
IchordeDionysos / firebase.json
Last active May 25, 2020 06:43
Configuration auto rules generation Firestore (Medium article)
{
...
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json",
"predeploy": [
"node generate_rules.js"
]
},
"storage": {
@IchordeDionysos
IchordeDionysos / generate_rules.js
Last active May 24, 2020 08:49
Rules import resolver Medium Article
const fs = require("fs");
const path = require("path");
// TODO: Add your exact paths
const srcFile = path.join(__dirname, "rules", "index.rules");
const destFile = path.join(__dirname, "firestore.rules");
fs.writeFileSync(destFile, resolveImports(srcFile));
function resolveImports(filePath) {
@IchordeDionysos
IchordeDionysos / functions.rules
Created May 20, 2020 20:29
Include function file improved Medium Article
function isAdmin(request) {
return request.auth.token.admin == true;
}
@IchordeDionysos
IchordeDionysos / functions.rules
Created May 20, 2020 20:28
Include function file Medium Article
function isAdmin() {
return request.auth.token.admin == true;
}
@IchordeDionysos
IchordeDionysos / index.rules
Created May 20, 2020 20:27
Include Defintion Medium Article
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
include "functions.rules";
match /someCollection/{someDocument} {
allow read, write: if isAdmin();
}
}
}