Skip to content

Instantly share code, notes, and snippets.

View alexmercerind's full-sized avatar

Hitesh Kumar Saini alexmercerind

View GitHub Profile
@alexmercerind
alexmercerind / images.md
Created May 27, 2024 08:14
52°North Images

0 1 2

@alexmercerind
alexmercerind / note.md
Last active July 21, 2023 22:45
note.md

There's this free coffee at the office that you can get. Not the best but good enough to feed caffeine requirement. One day I leave to get coffee somewhere else... I no longer find the taste in the ones I was having daily. I feel like your random messages leave me too sensitised the same way. It gets hard to focus on regular life & not think about you. It's very hard for me. I don't have the courage to say directly, but you're making everything very difficult.

%%{
  init: {
    'themeVariables': {
      'fontFamily': 'BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji'
    }
  }
}%%
classDiagram
@alexmercerind
alexmercerind / whatever.dart
Last active November 15, 2022 16:17
whatever.dart
import 'dart:io';
import 'dart:async';
import 'dart:typed_data';
import 'package:path/path.dart';
/// Prefix needed on Windows for safely accessing local storage with long file path support.
const String _kWindowsLongFileSystemPathPrefix = '\\\\?\\';
/// Adds `\\?\` prefix to the path if it is not already added & ensures all separators are `\\` on Windows.
String _clean(String path) {
@alexmercerind
alexmercerind / main.dart
Last active January 5, 2023 13:29
crop image to square in Dart
import 'dart:io';
import 'dart:math';
import 'dart:isolate';
import 'package:image/image.dart';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import 'package:safe_local_storage/safe_local_storage.dart';
/// This method crops passed given [image] into square & returns it
/// as [Uint8List] in JPEG format.
@alexmercerind
alexmercerind / flutter_native_view.md
Last active March 12, 2022 20:51
flutter_native_view

Embedding native windows into Flutter window.

Description

A Flutter plugin / C++ library to embed other native Windows (HWND on Windows, GtkWidget* on Linux etc.) into Flutter window.

Current API design allows to embed any arbitrary HWND completely from Dart as a Widget. This can be a good choice when client code wants to embed any arbitrary third-party window (which is already opened) into the Flutter window. However, this is not ideal in most cases because there is almost no point of embedding a third-party window directly (which will lack programmatic control via some API).

import 'dart:math';
import 'package:flutter/material.dart';
class WindowsLoader extends StatefulWidget {
final double size;
final Color color;
WindowsLoader({@required this.size,@required this.color});
_WindowsLoaderState createState() => _WindowsLoaderState();
@alexmercerind
alexmercerind / main.cpp
Created March 2, 2021 15:04
Some of fine string methods I wish were in C++
#include <string>
#include <vector>
class String {
public:
static bool startsWith(std::string string, std::string subString) {
if (string.substr(0, subString.size()) == subString) return true;
else return false;
}
class WindowsLoader extends StatefulWidget {
final double size;
final Color color;
WindowsLoader({@required this.size,@required this.color});
_WindowsLoaderState createState() => _WindowsLoaderState();
}
class _WindowsLoaderState extends State<WindowsLoader> with TickerProviderStateMixin {
@alexmercerind
alexmercerind / main.dart
Created June 24, 2020 14:38
alexmercerind
import 'package:flutter/material.dart';
import 'dart:math';
import 'dart:async';
void main() {
runApp(new Application());
}
class WindowsLoader extends StatefulWidget {
final double size;