Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ykmnkmi's full-sized avatar
🎯
Focusing

Olzhas Suleimen ykmnkmi

🎯
Focusing
  • Kazakhstan, Almaty
  • 21:18 (UTC +05:00)
View GitHub Profile
@espresso3389
espresso3389 / flutter-ffi-async-nativeport.md
Last active April 5, 2024 11:30
Async messaging between Flutter and C++ using Dart ffi NativePort

C++

  • Copy Dart SDK (${FLUTTER_DIR}/bin/cache/dart-sdk/include) to your project, e.g. ios/Classes/
  • Add your own code like the following fragment
#include "dart_api_dl.h"

// Receives NativePort ID from Flutter code
static Dart_Port_DL dart_port = 0;
const std = @import("std");
const Allocator = std.mem.Allocator;
pub const Error = error{
EndOfStream,
Utf8InvalidStartByte,
} || std.fs.File.ReadError || std.fs.File.SeekError || std.mem.Allocator.Error;
pub fn Parser(comptime Value: type, comptime Reader: type) type {
return struct {
@sma
sma / parser_combinator.md
Last active March 3, 2024 13:00
A toy parser combinator using Dart 3

Parser Combinator

I wrote a toy parser combinator using Dart 3.

[Warning, the current Dart compiler crashes when running this!]

To enable inline classes, add these lines to your analysis_options.yaml file:

enable-experiment:
  - inline-class
@PlugFox
PlugFox / bad_blocs.md
Last active February 13, 2024 12:26
БИНГО ошибок при создании BLoC'а

БИНГО ошибок при создании BLoC'а

❗❗❗ОБНОВЛЕННАЯ ВЕРСИЯ СТАТЬИ НАХОДИТСЯ ТУТ ❗❗❗

ОШИБКИ:

  1. Начать писать логику непосредственно в mapEventToState,
    он у вас быстренько превратится в нечитаемую портянку и придете жаловаться на бойлерплейт.
    Если правильно готовить блок, то бойлерплейтом там и не пахнет,
    эвенты + стейты + блок умещаются все вместе на 1-2 экранах.
@slightfoot
slightfoot / bubble_effect.dart
Created March 18, 2021 00:42
3D Style Bubble Magnifying Effect - by Simon Lightfoot and Wilson Wilson @wilsonowilson - 18/03/2021
// MIT License
//
// Copyright (c) 2021 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:
@chinmaygarde
chinmaygarde / FlutterEmbedderGLFW.cc
Last active November 23, 2023 16:26
Flutter Embedder API Example (GLFW with OpenGL)
#include <assert.h>
#include <chrono>
#include <embedder.h>
#include <glfw3.h>
#include <iostream>
static_assert(FLUTTER_ENGINE_VERSION == 1, "");
static const size_t kInitialWindowWidth = 800;
const std = @import("std");
const Allocator = std.mem.Allocator;
const Parser = @import("parser.zig").Parser;
const Error = @import("parser.zig").Error;
pub fn Literal(comptime Reader: type) type {
return struct {
parser: Parser([]u8, Reader) = .{
._parse = parse,
},
@munificent
munificent / parameter_kinds.dart
Created February 17, 2022 22:55
Scrape script to look at what kinds of parameters are most common
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
import 'package:scrape/scrape.dart';
void main(List<String> arguments) {
Scrape()
..addHistogram('Signatures')
..addHistogram('Parameters')
@PlugFox
PlugFox / keyboard_observer.dart
Last active January 15, 2023 16:32
Dart Virtual Key Codes table and KeyboardObserver for win32 package, hotkey
import 'dart:async';
import 'dart:ffi' show Uint8, Uint8Pointer;
import 'package:ffi/ffi.dart' show calloc; // , malloc
import 'package:win32/win32.dart'
show GetKeyboardState, GetKeyState; // , GetAsyncKeyState;
import 'virtual_key_codes.dart';
/// Key - Virtual Key codes
@PlugFox
PlugFox / timer_bloc.dart
Last active December 24, 2021 08:54
Timer BLoC
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:bloc_concurrency/bloc_concurrency.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'timer_bloc.freezed.dart';
@freezed
class TimerEvent with _$TimerEvent {