outofcontrol, to php
@outofcontrol@phpc.social avatar

To everyone using Medium to post your free articles: If the article requires me to login, I lost me. I won’t create an account and login to Medium for a free article. Sorry to a lot of you out there.

ricmac, to php
@ricmac@mastodon.social avatar

My latest @TheNewStack article -> PHP popularity has dropped dramatically in recent years, coinciding with WordPress becoming "JavaScript-first" according to its co-creator Matt Mullenweg. https://thenewstack.io/why-php-usage-has-declined-by-40-in-just-over-2-years/

dgoosens, to random
@dgoosens@phpc.social avatar

Man... the things those devs from @cooptilleuls manage to do with @ApiPlatform !

So happy to work with (well actually learn) with @johnkrovitch & @vincentchalamon) !!

cc @dunglas

https://api-platform.com/

derickr, to php
@derickr@phpc.social avatar

📽 New video: "Writing PHP Extensions: Implementing the rdp_simplify function and adding a test case."

https://youtu.be/-Tb_f55fc0k

symfonystation, to Symfony
@symfonystation@newsletter.mobileatom.net avatar
Edent, to HowTo
@Edent@mastodon.social avatar

🆕 blog! “Server-Side Rendering of Embedded Markdown Code Snippets in WordPress”

Because I'm a grumpy old man, I don't use Gutenberg or Block themes on my WordPress. Instead, I write everything in Markdown. When I write code snippets in Markdown, they look like this: ```php $a = 1; echo $a; if ($a < 5) { // Do Something return thing( $a, true …

👀 Read more: https://shkspr.mobi/blog/2024/04/server-side-rendering-of-embedded-markdown-code-snippets/

blog, to python
@blog@shkspr.mobi avatar

Server-Side Rendering of Embedded Markdown Code Snippets in WordPress
https://shkspr.mobi/blog/2024/04/server-side-rendering-of-embedded-markdown-code-snippets/

Because I'm a grumpy old man, I don't use Gutenberg or Block themes on my WordPress. Instead, I write everything in Markdown.

When I write code snippets in Markdown, they look like this:

php$a = 1;echo $a;if ($a < 5) { // Do Something return thing( $a, true );}

But I want to render that with code highlighting. I was using the Prismatic Plugin. It is excellent and very customisable. But it uses JavaScript to do the code highlighting. I want to respect my readers' time and battery life; so I'm trying to reduce my dependency on Client-Side rendering.

I've switched to a modified version of WP-GeSHi-Highlight. That turns the above Markdown into:

$a = 1;echo $a;if ($a < 5) {   // Do Something   return thing( $a, true );}

Necessary Changes

When the JetPack Markdown pre-processor encounters a code block, it changes:

```php

into

<code class="language-php">

This means the WP-GeSHi-Highlight detection needs to be changed.

Old version:

return preg_replace_callback(    "/s*".    "(.*)</pre>s*/siU",   "wp_geshi_store_and_substitute",   $s);

New version:

return preg_replace_callback(    "/s*".    "(.*)</code>s*/siU",   "wp_geshi_store_and_substitute",   $s);

One of those matches looks for escaped= which can be true or false. I always want this to be true so, later in the code, I change a variable from:

$escaped = trim($match[3]);

To:

$escaped = true;

Style Changes

By default, everything looks pretty good - but there are a few changes I found necessary to make.

Firstly, there was something weird going on with the line-heights of my style, so I added this to my site's CSS:

/* GeSHI Highlighter Fixes */pre:has(> .wp-geshi-highlight-wrap5) {    line-height: 0;    padding: 0;    background: none;    filter: invert(1);}

The invert gives it a dark mode.

Secondly, in order to make any changes to the default styles of the highlighter, you need to add the bundled wp-geshi-highlight.css file into your style directory. The plugin will use that if it exists - so you can change font size and padding to be the same as your main theme.

Limitations

There are a few limitations with this approach.

No line-numbers. The plugin looks for something like line="13", but there's no way to add that in Markdown.

GeSHi hasn't received style updates on some languages for quite some time. It hasn't received any significant update since 2019. Which means bugs and security issues are likely.

Language definitions are quite strict. You can use javascript but not json.

The plugin doesn't have any options - nor an easy way to override its settings. So I've monkeypatched everything above. If the plugin updates, I'll need to change my code.

Demos

A few demos - just so you can see what it looks like.

Python

#!/usr/bin/env pythonfrom datetime import datetime, timedeltafrom mastodon import Mastodonfrom bs4 import BeautifulSoupimport config#  Set up accessmastodon = Mastodon( api_base_url=config.instance, access_token=config.access_token )#  Get user's infome = mastodon.me()my_id = me["id"]year_joined = me["created_at"].year

Bash

if [ "$(basename $2)" = "Image.gz" ] || [ "$(basename $2)" = "vmlinuz.efi" ]then# Compressed install  echo "Installing compressed kernel"  base=vmlinuzelse# Normal install  echo "Installing normal kernel"  base=vmlinuxfiif [ -f $4/$base-$1 ]; then  mv $4/$base-$1 $4/$base-$1.oldfi

Rust

// This is the main function.fn main() {    // Print text to the console.    println!("Hello World!");}

JavaScript

if (hour < 18) {  greeting = "Good day";  alert( greeting );} 

https://shkspr.mobi/blog/2024/04/server-side-rendering-of-embedded-markdown-code-snippets/

mikewink, to rust
@mikewink@mastodon.social avatar

Every day is a / day now. So far, the learning is wonderful. Coming from PHP and without a proper CS background, I learn a lot about the lower levels I normally do not care about much.

Especially, memory management and Unicode (UTF-8) are fascinating topics right now.

I am quite sure, that learning Rust will make me a better developer too. I am tempted to even look into later.

For now, I stick with Rust and the 10 more chapters in "The Book" ahead of me.

mattsches, to php German
@mattsches@phpc.social avatar

Wir suchen noch einen Talk für das nächste @phpugrhh Meetup im Juli in Mainz. Schwerpunkt soll im weitesten Sinne "Content Management" sein, wer also ein Thema aus diesem Bereich hat und davon erzählen möchte, darf sich sehr gern melden!

Bitte auch gern retröten!

ff3, to opensource
@ff3@fosstodon.org avatar

📢 Yay! A new version Firefly III Data Importer has been released. Version v1.5.1 is out. Check out the release notes and download it today!

https://github.com/firefly-iii/data-importer/releases/v1.5.1

cabbey, to php
@cabbey@phpc.social avatar

Does anyone have a better way to write the conditional calls to foo at lines 5-9 of this code? https://3v4l.org/fqCvv The goal is to have the default argument for bar trigger the default argument for foo, but they're different defaults (since one is nullable and the other isn't), and bar should not need to know what foo's default is. (obviously in my real code it's a much more complex signature, and separate classes.)

augustocc, to Java Portuguese
@augustocc@social.br-linux.org avatar

🔝 de hoje, mas em 2010, a linguagem C voltava ao topo do ranking da TIOBE, após 4 anos de crescimento contínuo, e ultrapassando o .

Hoje o está no topo, seguido por C, C++, Java, C#, JavaScript, Go e VB, nesta ordem. O , que há um ano estava no top 10, agora é o 17º.

xakan, to php French
@xakan@social.zdx.fr avatar

Moi ce que j'aime avec , c'est que c'est so 2024.

Genre strtoupper(), la fonction censée convertir les caractères en majuscules, ne gère pas du tout les accents.

Ainsi, strtoupper('très') retournera 'TRèS'.

Classe 😅

brotkrueml, to php
@brotkrueml@phpc.social avatar

Next talk at the User Group Rhein-Neckar: @skoop gave an introduction into Domain Driven Design. Very interesting.

image/jpeg
image/jpeg
image/jpeg

brotkrueml, to php
@brotkrueml@phpc.social avatar

On the User Group Rhein-Neckar Oliver Kossin demystified with Starfleet as example

image/jpeg
image/jpeg

cedric_anne, to opensource French
@cedric_anne@mastodon.zaclys.com avatar

Mastonautes, j'ai besoin de vous.

En temps que développeur en chez de l'outil , je recrute un développeur expert en qui saura intervenir sur la modernisation du code bien ancien qui tourne sur un framework maison.

Les locaux sont sur , mais le est possible, même à 100%. Le temps partiel aussi est possible.

Idéalement, c'est pour un CDI.

Contactez moi en direct ici si vous êtes intéressés.

toflar, to Symfony German
@toflar@phpc.social avatar

Today I was looking for the docs of a feature I contributed to and found a blog post where I am mentioned that I haven’t even seen yet :-D Eh, in case you need to execute a command with inherited CLI settings: Here you go https://symfony.com/blog/new-in-symfony-6-4-subprocess-handler ^^

symfonystation, to Symfony
@symfonystation@newsletter.mobileatom.net avatar
joachim, to Symfony
@joachim@drupal.community avatar

Released a new version of Dorgflow, which updates the dependencies (so no more deprecation warnings!) I thought I'd have retired this tool ages ago once .org introduced MRs, but there are still lots of patches in the issue queues, so I still use it from time to time. https://github.com/joachim-n/dorgflow

cooptilleuls, to php French
@cooptilleuls@mastodon.online avatar

[Nouvel article] Notre coopérateur Clément, développeur spécialisé initialement en , vous propose une plongée dans le langage de programmation .

Découvrez avec lui ses concepts clés, son fonctionnement, sa syntaxe ainsi qu'un benchmark des performances proposées par ce langage.

Vous verrez ainsi que Go est un langage très accessible, avec une documentation qualitative et une multitude d'outils aidant à développer des applications de qualité.

https://les-tilleuls.coop/blog/a-la-decouverte-du-langage-go-creation-dun-outil-pas-a-pas

SenseException, to php German
@SenseException@phpc.social avatar

#PHP talks 10 years ago: "Use value objects instead of arrays."

PHP talks nowadays: "Use value objects instead of arrays."

watzon, to golang
@watzon@watzonmanor.com avatar

Ok peeps, we're 4 months into 2024 and I've been without work this whole time so we're going to try this again. If you know of any senior software engineering positions that are actually being hired for, please drop them below.

I have 12 cumulative years of experience, so that shouldn't be an issue, and I know most of the languages in use nowadays well enough to be dangerous, but I am extremely proficient in TypeScript, Python, and Ruby. What I'd rather do more than anything though is have an opportunity to use Go professionally.

ramsey, to security
@ramsey@phpc.social avatar

I just received word that someone found code in ramsey/uuid on their server that had been compromised to provide a back door into their system. The good news is that ramsey/uuid itself has not be affected. This appears to be a hacker who gained access to their system and modified code (locally) in ramsey/uuid to provide a back door.

I’m asking for more details to share, and I’ll update this thread, as I’m able.

Skye, to php German
@Skye@chaos.social avatar

Gargh, I got really used to Laravel Dusk letting me write super simple browser testing tests with / but now I need that kinda test in a non-Laravel project.

I guess my best bet is straight up Selenium? :/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag4
  • kavyap
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • cubers
  • modclub
  • Youngstown
  • slotface
  • tacticalgear
  • cisconetworking
  • ethstaker
  • Durango
  • rosin
  • provamag3
  • osvaldo12
  • everett
  • mdbf
  • normalnudes
  • thenastyranch
  • JUstTest
  • tester
  • khanakhh
  • GTA5RPClips
  • Leos
  • lostlight
  • anitta
  • relationshipadvice
  • All magazines