Skip to content

Instantly share code, notes, and snippets.

@lobre
lobre / zig_type_system.md
Last active October 13, 2025 04:04
Zig type system illustrated using ascii diagrams

Zig Type System

Zig aims to be a simple language. It is not easy to define what simple exactly means, but zig is also a low-level programming language that aims for c-compatibility. To reach this goal, it needs good semantics in its type system so that developers have a complete toolbox to manipulate data.

So types in zig are composable, but this can become rapidly overwhelming. See those examples. Are you able to understand them at a glance, as soon as you read them?

*const ?u8
?*const u8
*const [2]u8
@slightfoot
slightfoot / anchor_scroll.dart
Last active January 27, 2021 00:28
Ever wanted to scroll down to a widget in a scroll view? Now you can, Anchor Scroll to the rescue! - by Simon Lightfoot - 15/11/2019
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@slightfoot
slightfoot / defer_init.dart
Last active July 19, 2023 12:51
Defer initialization of your UI based on a background service - by Simon Lightfoot - 29/12/2020 - Null Safe!
import 'dart:math' show Random;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show RendererBinding;
void main() {
runApp(MaterialApp(
home: Home(),
));
}
@flutter-clutter
flutter-clutter / overlay_with_hole.dart
Created June 27, 2020 12:08
Flutter overlay with a hole
import 'package:flutter/material.dart';
class OverlayWithHole extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Flutterclutter: Holes")),
body: _getExperimentOne()
);
}
@slightfoot
slightfoot / media_query_extension.dart
Last active July 29, 2021 13:32
Media Query Extension - by Simon Lightfoot
// MIT License
//
// Copyright (c) 2020 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@slightfoot
slightfoot / transitions_fun.dart
Created January 8, 2020 21:31
Fun with Route Animations - by Simon Lightfoot - #HumpDayQandA - 8th Janurary 2020
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@nobonobo
nobonobo / tips-for-beginners.md
Last active December 4, 2019 08:21
初級者のハマりがちな罠

(注:非推奨な事を列挙しています)

  • golang.jpを見に行ってしまう
  • depが最新推奨のパッケージマネージャだと勘違いする(Go標準のgo-modを使おう)
  • 「GO???」環境変数を理解せずに設定しまくる(わからない場合は一切設定しないのが正しい)
  • しょっぱなからgvm,gobrew,goenvなどのマルチバージョンのマネージャを入れようとしてエディタ連携環境構築に失敗する (複数バージョンのGoの運用は既に標準のGoだけでできるようになっている)
  • 測定もせずに固定値でもないスライスのキャパシティサイズを指定するチューニングを行う
  • インポートパスに相対パスを書いちゃう
  • mapを初期化し忘れる(参照操作ではpanicしないので気づくのが遅れる)
@souri-t
souri-t / Hieroglyph-Unicode.md
Last active July 13, 2025 20:17
ヒエログリフ変換表

ヒエログリフ変換表

ヒエログリフとは

ヒエログリフとは、紀元前3000年頃から紀元400年頃まで古代エジプトで使用された象形文字の一つ。現代でも使用されるアルファベットの原型。19世紀にフランスのシャンポリオンによって解読された。

この表について

ヒエログリフと現代文字の変換表を元に、Unicodeで記述した表です。
Unicode 5.2.0 (U+13000 - U+1342F Egyptian Hieroglyphs)に基づいています。

Unicode Egyptian Hieroglyphs

@letsar
letsar / variable_sized_grid_view.dart
Last active January 31, 2023 22:54
VariableSizedGridView for Flutter (Masonry style)
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
/// Signature for a function that creates a [TileSize] for a given index.
typedef TileSize IndexedTileSizeBuilder(int index);
/// Creates grid layouts with a fixed number of spans in the cross axis.
@aloisdeniel
aloisdeniel / flutter_spanablegrid.dart
Last active May 30, 2025 12:17
Custom GridView with various cell sizes in Flutter
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/src/rendering/sliver.dart';
import 'package:flutter/src/rendering/sliver_grid.dart';
class _CoordinateOffset {
final double main, cross;
_CoordinateOffset(this.main, this.cross);
}