Skip to content

Instantly share code, notes, and snippets.

import { Layout } from '../components/layout.tsx' export default Layout import { WordCloudComponent as WordCloud } from '../components/WordCloud' import { words } from '../wordcloudWords'

Hi!

I'm a developer from Linköping, Sweden. I love web development and have been building rich web and mobile applications for around 6 years now. It's amazing how much there is to learn and do in this space.

Recently I've been building a mobile app for selling fishing permits, an app for getting notifications during GDQ, and an Inbox by GMail replacement.

@Maistho
Maistho / datetime_iso_week_of_year.dart
Last active March 22, 2023 21:52
Calculate the iso week of year in dart
extension DateWeekExtensions on DateTime {
int get isoWeekOfYear {
// Get the monday of week 1
final DateTime mondayWeek1 = _isoWeek1Monday();
// If this date is before the first week of the year, it is the same week as the last week of the previous year.
if (isBefore(mondayWeek1)) {
return DateTime(year - 1, 12, 31).isoWeekOfYear;
}
@Maistho
Maistho / Format-String-Ics.ps1
Created February 16, 2022 02:29
Powershell scripts to export calendar events from outlook to ics
function Format-String-Ics([string] $Body) {
$Str = $Body.Replace("`n", "\n").Replace("`r", "")
$Result = ""
[Int]$i = 0
while (($Str.Length - $i) -gt 60) {
$next = [math]::Min($i + 60, $Str.Length - 1)
$Result = "$Result$($Str.Substring($i, $next - $i))`r`n "
$i = $next
}
if ($i -eq 0) {
@Maistho
Maistho / main.dart
Created April 10, 2022 19:26
Dart mapWithIndex()
typedef _Transformation<S, T> = T Function(S value, int index);
abstract class EfficientLengthIterableWithIndex<T> extends Iterable<T> {
const EfficientLengthIterableWithIndex();
/**
* Returns the number of elements in the iterable.
*
* This is an efficient operation that doesn't require iterating through
* the elements.
*/
@Maistho
Maistho / main.dart
Last active May 7, 2022 22:01
Crash reproduction for flutter bug
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
void main() {
Test();
}
class Test {
static late final TestInstance staticLateFinal = TestInstance('static late final');
static final TestInstance staticFinal = TestInstance('static final');
static TestInstance static = TestInstance('static');
Test() {

Flutter Application Deployment Guide

Prerequisites

  • Flutter SDK installed on your local machine
  • A code editor of your choice (e.g. Visual Studio Code)
  • Familiarity with the terminal or command line
  • A remote repository for your code (e.g. GitHub, GitLab)

Building the Flutter Application

  1. Clone your Flutter project from your remote repository to your local machine