Skip to content

Instantly share code, notes, and snippets.

View rusintez's full-sized avatar
💭
🍝

vlspopov rusintez

💭
🍝
View GitHub Profile
@rusintez
rusintez / index.html
Created June 1, 2025 14:58
zero-deps-react
<div id="root"></div>
<script>
/**
* Poorman's jQuery
*/
const $ = document.querySelector.bind(document);
/**
@rusintez
rusintez / sessions.ts
Last active December 31, 2024 03:29
Hono JWT Sessions
import { createMiddleware } from "hono/factory";
import { sign, verify } from "hono/jwt";
import { IEnv, ISession } from "./types";
/**
* @usage
*
* const app = new Hono<{ Bindings: { JWT_SECRET:string } }>()
*
* .use("/*", sessions({ ttl: 86400 }))

Create Solana Action

  • Wrapper for solana actions / solana pay
  • Uses Hono (setup to be deployed to cloudflare)

Installation

npm install gist:c583db7577fc258570dfa2dbdb73be7e
@rusintez
rusintez / README.md
Last active June 27, 2024 12:53
Solana Actions Spec Ts

Solana Actions Spec

Installation

npm install gist:f6012a42dc0a360d2f999f7a647dc83c

Solana Pay Interface

Installation

npm install gist:cd5d9d57bcb435dc1147f26920b43ebb
@rusintez
rusintez / emitter.ts
Last active April 9, 2024 05:43
Typescript Event Emitter
/**
* Strongly typed event emitter
*
* @usage
*
* const emitter = createEmitter<{
* signature: [{ publicKey: number[]; signature: number[] }];
* }>();
*
* emitter.on("signature", ({ publicKey, signature }) => {
@rusintez
rusintez / sort-by.js
Last active May 30, 2019 09:11
sort array by multiple values
/**
* sort array (of objects) by multiple values
*/
function sort (order) {
return function by (head, ...tail) {
return function comparator (a, b) {
if (!head) return 0;
if (a[head] > b[head]) return order;
if (a[head] < b[head]) return -order;
@rusintez
rusintez / ffffound.js
Created April 17, 2017 11:25
ffffound is shutting down
const fs = require('fs');
const hyperquest = require('hyperquest');
const pump = require('pump');
const xray = require('x-ray');
const parse = require('json-parse-stream');
const through = require('through2').obj;
const x = xray().throttle(1, 300); // be considerate
const schema = [{
@rusintez
rusintez / svgtooltip.js
Last active July 15, 2016 08:00
svg tooltip
/**
* Print SVG that will render a rectangular tooltip with a tip at the bottom
*/
setTimeout(function() {
console.log(
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="' +
getTooltipPath(10, 10, 200, 80, 4, 10, 2, 'top').toString() +
'" fill="#777777"/></svg>'
);
@rusintez
rusintez / gist:7b2c5c35bdb571afed58
Created February 19, 2016 13:08
check docker containers memory consumption
for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do docker ps | grep $line | awk '{printf $NF" "}' && echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB ; done