Skip to content

Instantly share code, notes, and snippets.

@WalrusSoup
WalrusSoup / ur-prompt.md
Created October 6, 2026 18:36 — forked from minimaxir/ur-prompt.md
ur-prompt-20260919

Optimize the Rust and Python bindings in this Rust crate to its maximum potential. Specifically, you MUST make a breakthrough from this current implementation that uses modern concepts and knowledge as of 2026 to further improve this crate without causing ANY significant regressions.

First, before making any library changes, run the Rust and Python benchmarks (and any competitor benchmarks if applicable) to establish a True Performance Baseline for both speed and metric performance. Return the absolute and relative results to the True Performance Baseline to the user as a Markdown table.

Then, optimize the Rust and Python library code such that these benchmarks are atleast 1.2x faster from the True Performance Baseline; ideally as fast as possible, without any significant regressions on quality and prediction error. NEVER hack the benchmarks to accomplish this speed increase, only iterate on the library code. Ensure all benchmark iterations are independent, e.g. NEVER reuse a cache built in

@WalrusSoup
WalrusSoup / laravel-pint-with-sail-phpstorm.md
Last active September 23, 2024 10:10
Run laravel pint from Phpstorm with WSL on save

Saving this so I dont forget later.

Run Laravel Pint from Phpstorm with WSL on save with Laravel Sail

  1. create custom file watcher
  2. For tool to Run on Changes add the full path to vendor/bin/sail via WSL like so \\wsl$\Ubuntu\home\ozen\projects-sail\MYPROJECT\vendor\bin\sail
  3. Arguments bin pint $/FileRelativePath$
  4. Output paths to refresh $FilePath$
  5. Working Directory $ProjectFileDir$
@WalrusSoup
WalrusSoup / LazyLoadFacebook.js
Created October 29, 2021 18:07
Lazy Load facebook pixel
var facebookLoader = function() {
window.removeEventListener('scroll', facebookLoader);
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
@WalrusSoup
WalrusSoup / LazyLoadIntercom.js
Created October 29, 2021 17:58
Lazy load intercom on scroll to help speed up PageSpeed Insights
// replace YOUR_INTERCOM_URL_HERE with your app_id
var intercomLoader = function() {
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/YOUR_INTERCOM_URL_HERE';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
window.Intercom('boot', {
app_id: 'YOUR_INTERCOM_URL_HERE'
})
window.removeEventListener('scroll', intercomLoader);
}
window.addEventListener('scroll', intercomLoader);
@WalrusSoup
WalrusSoup / MarketoLazyLoader.js
Last active October 28, 2021 18:10
Lazily load marketo forms without additional libraries
// Include this at some point in your wordpress install. It's pretty helpful!
function dynamicScriptInserter(scriptSource, args) {
let script = document.createElement('script');
script.src = scriptSource;
Object.keys(args).forEach(key => {
script.setAttribute(key, args[key]);
})
document.getElementsByTagName('head')[0].appendChild(script);
}
@WalrusSoup
WalrusSoup / YiiTinkerwellDriver.php
Last active September 18, 2020 19:57
Yii 1.1 Tinkerwell Driver
<?php
// Put this into the .tinkerwell folder alongside of tinker_bootstrap.php to allow yii 1.1 to work within tinker
use Tinkerwell\ContextMenu\Label;
use Tinkerwell\ContextMenu\Submenu;
use Tinkerwell\ContextMenu\SetCode;
use Tinkerwell\ContextMenu\RunCode;
use Tinkerwell\ContextMenu\OpenURL;
class YiiTinkerwellDriver extends LaravelTinkerwellDriver {