Skip to content

Instantly share code, notes, and snippets.

@ClementBeal
ClementBeal / py
Created April 5, 2024 07:32
Optimize flutter web build
from collections import Counter
from decimal import Decimal
import gzip
from pathlib import Path
import re
from fractions import Fraction
file_data = Path(r"./my_app/build/web/main.dart.js").read_text()
initial_file_size = len(file_data)
@timnew
timnew / IndexedTrackingScrollController.dart
Last active January 2, 2024 13:54
Flutter Scrollable Controller which jump to given index
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:timnew_reader/features/App/common.dart';
class IndexedTrackingScrollController extends TrackingScrollController {
final GlobalKey sliverListKey = GlobalKey();
@kus
kus / fixIOSAudioContext.js
Last active May 22, 2025 16:45
Fix iOS AudioContext on Safari not playing any audio. It needs to be "warmed up" from a user interaction, then you can play audio with it as normal throughout the rest of the life cycle of the page.
// Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1
// MIT license
(function() {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if (window.AudioContext) {
window.audioContext = new window.AudioContext();
}
var fixAudioContext = function (e) {
if (window.audioContext) {
// Create empty buffer
@gokulkrishh
gokulkrishh / media-query.css
Last active May 22, 2025 10:31
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */