Skip to content

Instantly share code, notes, and snippets.

View Grubba27's full-sized avatar
:shipit:

Gabriel Grubba Grubba27

:shipit:
View GitHub Profile
@Grubba27
Grubba27 / table.md
Created April 5, 2024 18:12
Meteor <> MongoDB compat table
Meteor MongoDB Driver Earliest Compatible MongoDB MongoDB with all features Oldest supported MongoDB
3.0-beta.7 4.17.2 7.0 6.0 3.6
2.15 4.17.2 7.0 6.0 3.6
2.14 4.17.2 7.0 6.0 3.6
2.13.3 4.16.0 7.0 6.0 3.6
2.12 4.16.0 7.0 6.0 3.6
2.11 4.14.0 7.0 6.0 3.6
2.10 4.12.1 7.0 6.0
@Grubba27
Grubba27 / async.go
Last active March 4, 2024 01:14
Async/Await implementation in Go with generics for better IDE support
package async
// This snippet is an update on what we see in
// https://hackernoon.com/asyncawait-in-golang-an-introductory-guide-ol1e34sg
// Also this one follows this assumptions from this article: https://appliedgo.net/futures/
// Assumption #1: It is ok that the spawned goroutine blocks after having calculated the result.
// Assumption #2: The reader reads the result only once.
// Assumption #3: The spawned goroutine provides a result within a reasonable time.
@Grubba27
Grubba27 / settings.json
Created January 22, 2024 18:49
vscode config
{
"json.schemaDownload.enable": true,
"workbench.colorTheme": "Night Wolf (black)",
"workbench.iconTheme": "symbols",
"files.autoSave": "afterDelay",
"editor.fontSize": 14,
"editor.fontFamily": "'Jetbrains Mono', 'FiraCode-Retina', 'Fira Code', Monocraft , Menlo, Monaco, 'Courier New', monospace",
"editor.tabSize": 2,
"editor.cursorBlinking": "phase",
@Grubba27
Grubba27 / meteor-type-rpc.ts
Created January 3, 2024 20:16
dead simple trpc like api for meteor
import { Meteor } from "meteor/meteor";
const setProxySettings = (
{
call,
filter,
}: {
call: ({ path, args }: { path: unknown; args: unknown[] }) => any;
filter: (path: string[]) => unknown;
} = {
@Grubba27
Grubba27 / generic-proxy.ts
Created January 3, 2024 19:56
create your own tRPC-like api with JavaScript proxy and a little bit of ts magic
const setProxySettings = (
{
call,
filter,
}: {
call: ({ path, args }: { path: unknown; args: unknown[] }) => any;
filter: (path: string[]) => unknown;
} = {
call: ({ path, args }) => {
return {
@Grubba27
Grubba27 / meteor-packages
Last active December 4, 2023 23:48
All packages in the core of meteor
accounts-2fa logging
accounts-base logic-solver
accounts-facebook meetup-config-ui
accounts-github meetup-oauth
accounts-google meteor
accounts-meetup meteor-base
accounts-meteor-developer meteor-developer-config-ui
accounts-oauth meteor-developer-oauth
accounts-password meteor-platform
accounts-passwordless meteor-tool
@Grubba27
Grubba27 / install-node-14.21.4.sh
Created August 23, 2023 17:24
installing Node.js 14.21.4
#!/bin/bash
# Set environment variables
NODE_VERSION="14.21.4"
NODE_URL="https://static.meteor.com/dev-bundle-node-os/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz"
DIR_NODE="/usr/local"
# Download and install Node.js using wget
wget -qO- "$NODE_URL" | tar -xz -C "$DIR_NODE"/ && mv "$DIR_NODE"/node-v${NODE_VERSION}-linux-x64 "$DIR_NODE"/v$NODE_VERSION
@Grubba27
Grubba27 / tester.js
Created July 24, 2023 04:22
dead simple testing framework in js
/**
*
* @param {string} name
* @param {(assert: typeof assert) => void} callback
*/
function assement(name, callback) {
let counter = 0,
failed = 0,
errorList = [];
@Grubba27
Grubba27 / index.js
Last active July 24, 2023 04:01
find possiblities
// given a string, list the possible cenarios for each character, given that if the word has a
// ? it should be either "E" or "U"
// example: "???" -> ["EEE", "EEU", "EUE", "EUU", "UEE", "UEU", "UUE", "UUU"]
// example: "??U" -> ["EEU", "EUU", "UEU", "UUU"]
// example "fo?" -> ["foE", "foU"]
/**
*
* @param {string} str
* @returns {string[]}
@Grubba27
Grubba27 / cripto.go
Created June 21, 2023 20:31
Generate public address using message and private from metamask
package cripto
import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
// from: https://gist.github.com/dcb9/385631846097e1f59e3cba3b1d42f3ed#file-eth_sign_verify-go
func VerifySig(from, sigHex string, msg []byte) bool {