Skip to content

Instantly share code, notes, and snippets.

View MaxGraey's full-sized avatar

Max Graey MaxGraey

View GitHub Profile
@MaxGraey
MaxGraey / Wasm-FAQ-2019.md
Last active January 19, 2024 22:26
WebAssembly FAQ для телеграм сообщества WebAssembly_ru

Введение

Данный FAQ был специально создан для телеграм сообщества https://t.me/WebAssembly_ru.

Он базируется на статье от Andre Weissflog, но так же содержит множество моих дополнений и мыслей, которые могут быть уже не слишком актуальны на момент прочтения. Прошу это учитывать.

0. Какие цели у WebAssembly?

@MaxGraey
MaxGraey / bench.js
Created January 6, 2024 17:44
"crypto-js" vs node's crypto bench
const crypto = require('node:crypto');
const CryptoJS = require("crypto-js");
const EMAILS = 200_000;
const MIN_EMAIL_LEN = 5;
const MAX_EMAIL_LEN = 23;
const emails = Array.from(
{ length: EMAILS },
@MaxGraey
MaxGraey / main.dart
Created July 22, 2022 08:14
unsolvable null-safety in Dart
class Holder {
List<String>? positions;
Holder(this.positions);
}
class Position {
String id = "";
}
void updateHolder(Holder holder, Position position) {
@MaxGraey
MaxGraey / sort_github_lang_collection.js
Last active March 27, 2021 20:37
Script which sort programming languages in Github Explore Collection Category
// TODO: next implement HITS ranking algorithm from: https://d-nb.info/1112813659/34
const https = require('https');
const url = require('url');
const fs = require('fs');
const LANGS_URL = 'https://raw.githubusercontent.com/github/explore/main/collections/programming-languages/index.md';
const MD_PROLOGUE = "---\nitems:\n";
const MD_EPILOGUE = (
@MaxGraey
MaxGraey / betainc.ts
Last active March 17, 2021 14:31
Calc beta incomleate function by Lentz's algorithm
type i32 = number;
type f64 = number;
function isNeg(x: f64): boolean {
return x < 0.0 && x == Math.floor(x);
}
// Returns the value ln(gamma(x)).
function logGamma(x: f64): f64 {
@MaxGraey
MaxGraey / index.js
Last active December 14, 2020 15:37
Ramda vs RxJS vs JS lambda calculus vs JS functional vs JS loop
/*
Test environment:
- node.js 10.5.0
- macOS 10.13.5
- MacBook Pro Late 2013
- Ramda 0.25.0
- RxJS 6.2.1
Results (Babel transpiled):
@MaxGraey
MaxGraey / Cargo.toml
Last active September 16, 2020 19:52
Benchmark different nearest functions for Rust
[package]
name = "bench"
version = "0.1.0"
authors = ["MaxGraey <maxgraey@gmail.com>"]
[profile.bench]
codegen-units = 1
opt-level = 3
lto = true
debug = false
@MaxGraey
MaxGraey / emscripten.rb
Created July 5, 2020 13:11
Try migrate to upstream
require "language/node"
class Emscripten < Formula
desc "LLVM bytecode to JavaScript compiler"
homepage "https://emscripten.org/"
stable do
url "https://github.com/emscripten-core/emscripten/archive/1.39.18.tar.gz"
sha256 "aa0df2828096d161636467d4fc062bbeea31e372c122a05c9685bb6cb2d4064e"
end
@MaxGraey
MaxGraey / toolbar.cson
Created September 15, 2017 20:58
config for atom-flex-toolbar
[
{
type: "button"
icon: "social-buffer"
callback: "application:add-project-folder"
tooltip: "Add Project"
iconset: "ion"
style: {
color: "rgba(255, 255, 255, 0.7)"
transform: "scale(1.2)"
@MaxGraey
MaxGraey / bench.js
Created May 17, 2020 13:38
getStringImpl join array of strings vs string concat
let buffer;
const LENGTH = 1024 * 4 + 17;
const WARMUP_COUNT = 8;
function createStringBuffer(len = LENGTH) {
buffer = new ArrayBuffer(len * 2);
const U16 = new Uint16Array(buffer);
const alphabet = 'A BCDE, FGHI JKLM.; (NOPQ- RSTU, VWXYZ. abcd; efgh,) ijkl mnop. qrst- uvwxy,( z0123 4567, 89.)';
for (var i = 0; i < len; i++) {
U16[i] = alphabet.charCodeAt(Math.floor(Math.random() * alphabet.length));