Skip to content

Instantly share code, notes, and snippets.

View lubieowoce's full-sized avatar

Janka Uryga lubieowoce

View GitHub Profile
@lubieowoce
lubieowoce / constrained_window.py
Created December 14, 2018 04:47
pyimgui window constraints -- problems with python callbacks in C code
# pyimgui version:
# https://github.com/lubieowoce/pyimgui/commit/62bd989bf3621df125f68d0e07423668a68bf9c9
def limit_aspect_ratio_2(position, current_size, desired_size) -> 'Tuple[float, float]':
print('limit_aspect_ratio_2(_, current_size={}, desired_size={})'.format(current_size, desired_size))
w, h = desired_size
return (h*2, h)
def draw():
@lubieowoce
lubieowoce / yoast_coauthors_integration.php
Last active June 1, 2023 01:17
Integrate Yoast with CoAuthors Plus
<?php
// Written against:
// - Yoast SEO 12.3
// - Co-Authors Plus 3.4
// - Wordpress 4.9.3
// - PHP 7.1
/*
"disassemble femtoLisp bytecode (kind of)"
"""
a serialized function looks like this:
#fn(
":000r1|Mc0<17702|M]<6@0|N\x8550|M;c1|NK;|N\x85@0c2|Mi10~N31L3;|\x84c3\x82W0e4e5|31316A0c6qe7e5|313141;c8qc93041;c:|Mc1|NKi10~N31L4;"
[
else begin or => 1arg-lambda? caddr
#fn("=000r1c0|~ML2L1c1|c2e3e4~3131Ki20i10N31L4L3;" [let if begin cddr caddr])
// 2020.02.25-r1
// url: .*reservise\.com/(?:calendar|clients).*
// F1 - add_benefit_card()
// F2 - edit_popup_price()
// F4 - click_popup_present()
// ShortKeys config
/*
// 2020.03.03-r3
/* eslint-env jquery */
/* eslint no-global-assign: "off" */
/* eslint no-unused-vars: ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }] */
/* eslint no-prototype-builtins: "off" */
/* global
ich
import asyncio
import bleak
# https://os.mbed.com/teams/Bluetooth-Low-Energy/wiki/UART-access-over-BLE
# https://www.mgsuperlabs.co.in/estore/IoT-pHAT-with-header-for-Raspberry-Pi
RBL_SERVICE_UUID = "713D0000-503E-4C75-BA94-3148F18D941E"
@lubieowoce
lubieowoce / react-latest.sh
Created June 28, 2023 19:38
A bash function that prints out the latest canary/experimental releases of React and links to the relevant commits
# Usage:
#
# react-latest [tag]
#
function react-latest {
local TAG=${1-experimental}
echo "react@$TAG"
echo
which jq > /dev/null || { echo 'please install jq'; return 1; }
npm view react versions --json \

Let's assume we wanna show a tree like this:

ServerRoot # RSC
  html
    body
      MyLayout # RSC
        main
          "Hello"
@lubieowoce
lubieowoce / babel-plugin-inline-actions.cjs
Last active October 28, 2023 22:07
a naive and WIP babel transform for inline "use server" closures
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */
const { declare: declarePlugin } = require("@babel/helper-plugin-utils");
const { addNamed } = require("@babel/helper-module-imports");
const crypto = require("node:crypto");
const { pathToFileURL } = require("node:url");
// TODO: handle inline actions calling each other...? sounds tricky...
@lubieowoce
lubieowoce / next+14.0.1.patch
Last active October 30, 2023 22:17
Next 14.0.1: log more details for "This is not allowed due to cyclic module graph between Server and Client"
diff --git a/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js b/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
index 59e02e7..0bf857b 100644
--- a/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
+++ b/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
@@ -43,6 +43,7 @@ function transformSource(source, sourceMap) {
// and we shouldn't error for that. In the future we might want to find a way
// to only throw when it's used.
if (!this.resourcePath.includes("node_modules")) {
+ console.log('uh oh:', this._module.resourceResolveData.context.issuer, '->', this._module.resource)
this.callback(new Error(`You're importing a Client Component ("use client") from another Client Component imported Server Action file ("use server"). This is not allowed due to cyclic module graph between Server and Client.\nYou can work around it by defining and passing this