Skip to content

Instantly share code, notes, and snippets.

View tonis2's full-sized avatar
🐼

Tonis tonis2

🐼
  • Paysure
  • Estonia
View GitHub Profile
@sma
sma / custom_analyzer_plugin_tutorial.md
Created December 11, 2025 11:15
A tutorial how to create custom plugins for the Dart analyzer.

Analyzer Plugin Demo

This explains how to write a simple analyzer plugin.

Create a Dart project called demo_plugin and add these dependencies to pubspec.yaml. The versions shown below should work with Dart 3.11. You might need to adapt them to your Dart version.

dependencies:
  analysis_server_plugin: ^0.3.4
  analyzer: ^9.0.0

analyzer_plugin: ^0.13.11

@Memresable
Memresable / rotational-dynamics.md
Last active September 4, 2025 16:40
Demystifying Rotational Dynamics in Rigid Bodies

Demystifying Rotational Dynamics in Rigid Bodies

Rigid bodies mainly have 6 degrees of freedom in 3 dimensions (3 translational and 3 rotational), you can represent the particles as rigid bodies with only 3 translational degrees which is straightforward and their equations of motion aren't difficult to formalize, but what if you want to extend from particles to much more than that? Say... system of particles connected to each other to create a whole body!

First, let's suppose you have two particles, one that has an infinite mass which cannot represent motion unless an infinite force is applied, and the other one which has some finite amount of mass which is able to move around, but now let's actually link them together by a massless rigid rod or an infinitely stiff spring like so

rigid-rod

Here because the rigid rod is infinitely stiff and

@faustinoaq
faustinoaq / myAngular.html
Last active December 25, 2025 23:54
Front-end libraries (React, Vue, Angular) and the basic principles of how they work, all in a single file using pure JavaScript (VanillaJS).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Angular from Scratch</title>
<style>
.my-component {
font-family: Arial, sans-serif;
@SashaKryzh
SashaKryzh / flutter_extension_methods.dart
Last active May 6, 2025 10:27
List of my favorite extension methods in Flutter.
import 'package:flutter/material.dart';
extension BuildContextExtensions on BuildContext {
ThemeData get theme => Theme.of(this);
TextTheme get textTheme => theme.textTheme;
ColorScheme get colorScheme => theme.colorScheme;
DefaultTextStyle get defaultTextStyle => DefaultTextStyle.of(this);
@p4bl0-
p4bl0- / 00_readme.md
Last active December 1, 2025 16:13
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

@onlurking
onlurking / programming-as-theory-building.md
Last active December 26, 2025 00:20
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@hasenj
hasenj / app_metal.c
Created December 30, 2019 12:46
Pure C Cocoa Application with Window and Metal
// How to build:
// # compile the metal shaders
// xcrun -sdk macosx metal -c shaders.metal -o shaders.air
// xcrun -sdk macosx metallib shaders.air -o shaders.metallib
// # compile the c file
// clang app_metal.c -framework Cocoa -framework Metal -o metal_c.app
//
//
// Draw a triangle using metal
// Metal tutorial followed here: https://www.raywenderlich.com/7475-metal-tutorial-getting-started

Autoupdates for Electron App

This guide will show you how to prepare sample Electron application for publishing from scratch:

  • create a new app
  • build distos
  • publish release to GitHub
  • set up autoupdating

Your app's updates may be stored on GitHub repo's releases page. It is free and user-friendly.

@zironycho
zironycho / portainer-agent-stack-traefik.yml
Last active June 30, 2019 23:00
portainer stack with traefik
version: '3.2'
services:
agent:
image: portainer/agent
environment:
# REQUIRED: Should be equal to the service name prefixed by "tasks." when
# deployed inside an overlay network
AGENT_CLUSTER_ADDR: tasks.agent
# AGENT_PORT: 9001
@iffy
iffy / .gitignore
Last active May 19, 2025 13:56
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot