Skip to content

Instantly share code, notes, and snippets.

@Schwusch
Schwusch / blog_arrow_widget.dart
Last active November 23, 2023 19:16
blog_arrow_widget.dart
import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
body: Stack(
children: [
@Schwusch
Schwusch / selection_transformer.dart
Last active April 11, 2024 01:49 — forked from schultek/selection_transformer.dart
A widget that transforms the text selection when copied.
import 'package:collection/collection.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
typedef SelectionTransform = String Function(Iterable<String>);
/// A widget that transforms the text selection when copied.
///
/// This uses the [SelectionContainer] with a custom [SelectionContainerDelegate] to override the
/// [getSelectedContent] method with a custom implementation.
Hello everyone, the submarine podcast is with you, its presenter Egor Tolstoy, this is
me and Ekaterina Petrova, hello everyone, if you turned on this episode, you already know
what it is about by the way. I don’t know why, in general, every time in eyeliners we
try to guess some kind of riddle for those who are listening, as if they didn’t see the title of
the release, it seems to me that we ourselves are trying to warm up a little just to tune
in to normal questions, and this is the time where we are dragging time with our
eyeliners, as we are now just trying to get into the flow maybe maybe but in short it
doesn't matter today a new episode in the category of your favorite episodes this is
not food episodes it's a category on. these are issues about programming languages and
today we will talk about dart, not to be confused with dark, we also wrote about dark, but
@Schwusch
Schwusch / main.dart
Created December 14, 2022 18:41
quintessential-glacier-6695
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@Schwusch
Schwusch / super_editor_syntax_highlighting.dart
Last active June 20, 2021 22:04
Simple experiment to combine package:highlight with package:super_editor in Flutter
import 'package:super_editor/super_editor.dart';
import 'package:highlight/highlight.dart' show highlight;
import 'package:flutter_highlight/themes/github.dart';
Widget superEditorHighlighter(String code, String language, TextStyle defaultStyle) {
var result = highlight.parse(code, language: language);
var charCount = 0;
final myDoc = MutableDocument(nodes: [
ParagraphNode(
void main() {
Foo? foo;
foo?.bar ??= 666;
print(foo);
foo = Foo()..bar = 666;
print(foo.bar);
extension ScopingFunctions<T> on T {
/// Calls the specified function [block] with `this` value
/// as its argument and returns its result.
R let<R>(R Function(T) block) => block(this as T);
/// Calls the specified function [block] with `this` value
/// as its argument and returns `this` value.
T also(void Function(T) block) {
block(this as T);
return this as T;
@Schwusch
Schwusch / dangerous_update.kt
Created November 5, 2019 14:46
A hacky way of updating an object with another objects data. This is a really bad pattern kids
/**
* Loops through all fields in the receiving object and looks for fields
* with the same name in the sending object. Then it tries to copy non-null
* values to the receiving object, and silently fails when something goes wrong
*
* Don't use this
*/
fun Any.update(new: Any) = javaClass.declaredFields.forEach { field ->
try {
field.isAccessible = true
@Schwusch
Schwusch / runnable_tilt_example.dart
Last active December 5, 2019 10:01
blog_examples
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
home: TiltedPyramid(),
);
}
@Schwusch
Schwusch / adbwificonnect.sh
Created August 17, 2019 10:11 — forked from amanshuraikwar/adbwificonnect.sh
Shell script to connect a USB connected device via adb over WiFi
# Purpose: Shell script to connect a USB connected device via adb over WiFi
#
# Author: Amanshu Raikwar
#
# Assumptions:
# 1. USB debugging is enabled in the Android device
# 2. The Android device is connected to the computer via USB
# 3. The Android device is connected to the same wifi as the computer
# 4. The Android device is accessible through port 5555 over the wifi network
#