Skip to content

Instantly share code, notes, and snippets.

View starckio's full-sized avatar
🍼
Baby boy !

Christopher Boutillé starckio

🍼
Baby boy !
View GitHub Profile
@lennardv2
lennardv2 / 1. Building PHP-MAMP on Apple Silicon M1.md
Last active February 29, 2024 07:57
Native PHP development / MAMP stack on Apple silicon M1

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

Update! This tutorial is outdated. Nowadays brew installes m1 binaries just fine. Also use valet: https://laravel.com/docs/9.x/valet. It's 10x easier.

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
@zulhfreelancer
zulhfreelancer / send_email_on_mac_mamp_hotmail.md
Last active January 16, 2023 10:22
How to send e-mail on Mac using MAMP (not PRO version) and Hotmail SMTP

How to send e-mail on Mac using MAMP (not PRO version) and Hotmail SMTP

Requirements

  1. A Mac running OSX 10.11.6
  2. MAMP v3.5
  3. PHP 7.0.0 (comes inside the MAMP v3.5 above)

Note

<img src="<?php $page->image()->crop(300, 200)->url() ?>" alt="Cropped by width and height">
<img src="<?php $page->image()->crop(300)->url() ?>" alt="Cropped box">
<img src="<?php $page->image()->resize(300, 200)->url() ?>" alt="Resized by width and height">
<img src="<?php $page->image()->resize(300)->url() ?>" alt="Resized by width only">
<img src="<?php $page->image()->resize(false, 200)->url() ?>" alt="Resized by height only">
git submodule add https://github.com/getkirby/kirby.git
git submodule add https://github.com/getkirby/panel.git
git submodule update --init --recursive
<?php if($folder = page('clients/' . $site->user(get('username')))): ?>
The folder exists
<?php else: ?>
The folder does not exist
<?php endif ?>
@bastianallgeier
bastianallgeier / dataURI.php
Created January 5, 2015 10:54
You can create a dataURI for all your images and other files in Kirby's templates, snippets or plugins. This is super useful for inline CSS for example.
<?php echo $page->image('someimage.jpg')->dataURI() ?>
<?php $zeiten = page('oeffnungszeiten') ?>
<?php if($zeiten->status() == 'normal'): ?>
<!-- hier werden die öffnungszeiten abhängig vom tag angezeigt -->
<?php else if($zeiten->status() == 'open'): ?>
<!-- hier wird einfach nur angezeigt dass geöffnet ist -->
<?php else: ?>
<!-- hier wird angezeigt dass geschlossen ist -->
<?php endif ?>
<meta name="description" content="<?php echo $page->description()->or($site->description()) ?>">
@bastianallgeier
bastianallgeier / multilangcontent.php
Last active September 17, 2015 02:25
In Kirby's multi-lang version it is super easy to fetch content from different languages in a template.
<?php snippet('header') ?>
<h2>English Version</h2>
<h3><?php echo $page->content('en')->title()->html() ?></h3>
<?php echo $page->content('en')->text()->kirbytext() ?>
<h2>German Version</h2>
<h3><?php echo $page->content('de')->title()->html() ?></h3>
@bastianallgeier
bastianallgeier / controllers--contact.php
Created October 1, 2014 19:36
Plain contactform example for Kirby 2
<?php
return function($site, $pages, $page) {
$alert = null;
if(get('submit')) {
$data = array(
'name' => get('name'),