Skip to content

Instantly share code, notes, and snippets.

View shelane's full-sized avatar

Shelane French shelane

View GitHub Profile
@shelane
shelane / displaytime.php
Created July 7, 2023 02:54
generate times by half hour increments
<?php
// This should replace the DisplayPracticeTimes function.
$startTime = strtotime('08:00');
$endTime = strtotime('21:00');
$increment = 30 * 60; // 30 minutes in seconds
$times = array();
@shelane
shelane / range.php
Created July 7, 2023 03:29
replace display day, month, etc with range function
<?php
// This is leading zeros:
$n = 10; // The desired end number
$numbers = range(1, $n);
$numbersWithLeadingZeros = array_map(function ($number) {
return sprintf('%02d', $number);
}, $numbers);
@shelane
shelane / DrupalCallback.php
Created July 19, 2023 19:10 — forked from purushotamrai/DrupalCallback.php
Implementing Custom Pagination without Drupal Entity Query - Drupal 8
<?php
namespace Drupal\custom_module\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Pager\PagerManagerInterface;
class ListNonDrupalItems extends ControllerBase {
@shelane
shelane / gist:3e4edcab3a4224266f54d56bae3bb011
Created July 18, 2024 11:40
Best CSS trick: instead of position relative + position absolute; use grid to overlay children
.parent { display: grid; }
.child { grid-area: 1/1; }
Instead of:
.parent { position: relative }
.child { position: absolute; top: 0; left: 0; width: 100%; height: 100% }