Skip to content

Instantly share code, notes, and snippets.

@gebeer
gebeer / summarize-method-hook.php
Last active December 20, 2016 07:41
Text Limiter Hook for ProcessWire - adds a new method summarize() to $page - add this code to site/ready.php
<?
// usage: $page->summaroze($fieldName, $maxLength)
$wire->addHook('Page::summarize', function($event) {
$fieldName = $event->arguments(0);
if(!$fieldName) throw new WireException("No field provided");
// get max length or use 300 as default if none provided
$maxLength = (int) $event->arguments(1);
if(!$maxLength) $maxLength = 300;
@gebeer
gebeer / readme.md
Last active March 29, 2017 06:38
landingpages that live off root ProcessWire
@gebeer
gebeer / README.md
Last active May 22, 2024 14:16
Simple Terminal Menu using ratatui for total Rust noob with the help of GPT-4o in Cursor editor

This is inspired by Chris Titus' video on setting up a terminal menu with Rust using the Cursor editor's AI features.

As a programmer who regularly uses the Cursor editor and its AI capabilities, I found the video somewhat challenging to watch. This is not meant as a critique of Chris Titus but rather a suggestion for a more efficient approach. Familiarizing oneself with Cursor's features and improving prompting skills can significantly enhance the experience.

My goal is not to criticize but to provide a more efficient strategy for achieving the same goal, hoping it will be beneficial to others.

I am primarily a PHP-focused web developer and have never worked with Rust before. I wanted to see if I could leverage the AI features in Cursor to set up the entire project quickly. Below are the steps I followed, along with the conversations I had until the basic menu was operational. I didn't need to read any documentation myself.

Steps I took: