Skip to content

Instantly share code, notes, and snippets.

View maks's full-sized avatar

Maksim Lin maks

View GitHub Profile
@sma
sma / forth.dart
Last active August 4, 2023 02:07
a tiny forth interpreter
import 'package:flutter/material.dart';
void main() {
Forth().run('V: count 5 ! : inc dup @ 1 + ! ; '
'[ [ text ] count builder [ count inc ] " Increment text button ] '
'list column app run');
}
typedef Impl = void Function(Forth f);
@dsandler
dsandler / gist:1f94e95b9ea6cc7d5ec338c41e4b0bcd
Created November 18, 2022 00:31
sloppy static webfinger for apache
# www/.htaccess
RewriteRule ^[.]well-known/webfinger.*$ /profile/me [L]
# www/profile/.htaccess
Header set Content-Type: application/jrd+json
Header set Access-Control-Allow-Origin: "*"
# www/profile/me
{
"subject": "acct:dsandler@dsandler.org",
@repi
repi / crate-health.md
Last active February 22, 2024 01:17
Guidelines on evaluating health & quality of third-party crates at Embark

What to evaluate and consider before adding usage of new third-party crates.

These are not exact requirements but questions to investigate and discuss to help reason around the health, safety, maintainability, and more around crates.

This can also be read as an opinionated guide for crate authors of what our (Embark's) guidelines and recommendations are, though should not be taken too literally.

Legend: 🔒 Must have, ⭐️ Should have, 👍 Nice to have, ℹ️ Info

@ftsf
ftsf / transposeinkey.lua
Created January 27, 2022 08:39
Synthesizer V - Transpose In Key Script
function getClientInfo()
return {
name = "Transpose In Key",
author = "impbox",
versionNumber = 1,
minEditorVersion = 0
}
end
function getTranslations(langCode)
@chmanie
chmanie / connectall.rb
Created January 26, 2021 18:02
Connect all MIDI inputs to all MIDI outputs (except themselves). Supports multi-port devices
#!/usr/bin/ruby
t = `aconnect -i -l`
$devices = {}
$device = 0
t.lines.each do |l|
match = /client (\d*)\:((?:(?!client).)*)?/.match(l)
# we skip empty lines and the "Through" port
unless match.nil? || match[1] == '0' || /Through/=~l
$device = match[1]
@mhadaily
mhadaily / Update website if there is new servicer worker update found.md
Created November 14, 2020 14:14
Use it in your index.html file in Flutter Web.
function invokeServiceWorkerUpdateFlow() {
  // you have a better UI here, reloading is not a great user experince here.
  const confirmed = confirm('New version of the app is available. Refresh now');
  if (confirmed) {
    window.location.reload();
  }
}
async function handleServiceWorker() {
@slightfoot
slightfoot / order_progress.dart
Last active July 1, 2023 16:02
Custom Order progress bar example - by Simon Lightfoot - 26/10/2020 - Using keys to access other parts of the UI in your RenderObject
// MIT License
//
// Copyright (c) 2020 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:
@chimon2000
chimon2000 / base_command.dart
Created October 22, 2020 00:54
Command Pattern in Dart (Cubit + GetIt)
import 'package:get_it/get_it.dart';
abstract class BaseCommand<T> {
GetIt getIt = GetIt.instance;
D locate<D>() => getIt.get<D>();
Future<T> run();
}
@chimon2000
chimon2000 / base.command.dart
Last active July 30, 2021 14:41
Command Pattern in Dart
abstract class BaseCommand<T> {
BuildContext _context;
BaseCommand(BuildContext context) {
/// Get root context
/// If we're passed a context that is known to be root, skip the lookup, it will throw an error otherwise.
_context = (context == _lastKnownRoot) ? context : context.read();
_lastKnownRoot = _context;
}