Skip to content

Instantly share code, notes, and snippets.

View sunderee's full-sized avatar

Peter Aleksander Bizjak sunderee

View GitHub Profile
sunderee / expandable_bottom_sheet.dart
Created December 29, 2023 20:55
Adaptation of the expandable_bottom_sheet removing deprecated parameters + minor cleanups.
import 'package:flutter/material.dart';
/// [ExpandableBottomSheet] is a BottomSheet with a draggable height like the
/// Google Maps App on Android.
/// __Example:__
/// ```dart
/// ExpandableBottomSheet(
/// background: Container(
sunderee / equatable.dart
Created November 18, 2023 12:15
Miniature "equatable", good enough for majority of use cases
import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
const DeepCollectionEquality _equality = DeepCollectionEquality();
abstract class Equatable {
const Equatable();
List<Object?> get props;
sunderee / base.state.dart
Created October 23, 2023 11:17
Base state that can be used in Flutter apps using BLoC (inspired by Riverpod).
import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
sealed class BaseState<T> extends Equatable {
bool get isInitial;
bool get isLoading;
bool get isSuccessful;
bool get hasFailed;
T? get data;
Exception? get exception;
sunderee /
Last active February 16, 2024 08:01
Install stable version of Flutter on macOS (Apple Silicon chip)
#!/usr/bin/env bash
set -euo pipefail
readonly FLUTTER_VERSION="3.19.0"
readonly DIRECTORY="${HOME}/flutter"
# Function to download and extract flutter
download_flutter() {
local temp_file
sunderee /
Created October 14, 2023 16:19
Install ROS2 on Ubuntu
# Set Locale
echo "Setting Locale..."
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
# Setup Sources
sunderee / scope-functions.ts
Last active March 7, 2023 17:54
Scope functions in TypeScript
// Source:
declare global {
interface Object {
* Calls the specified function block with `this` value as its argument and returns its result
* @param block - The function to be executed with `this` as argument
* @returns `block`'s result
let<T, R>(this: T | null | undefined, block: (it: T) => R): R;
sunderee /
Last active August 26, 2023 19:52
Node.js scripts for macOS users
#!/usr/bin/env bash
echo -e "${GREEN}Listing global NPM packages...${CLEAR}"
npm list -g --depth=0
echo -e "${GREEN}...updating & upgrading global NPM packages...${CLEAR}"
sudo npx npm-check --global --update-all