Skip to content

Instantly share code, notes, and snippets.

View jules0x's full-sized avatar
🔥

Jules jules0x

🔥
View GitHub Profile
@jules0x
jules0x / dateRange.php
Created April 10, 2022 20:02
Date range display value
<?php
/**
* Determine the best way to render the date based on conditions
*
* @return string | null
*/
public function getEventDate()
{
$start = DBDate::create()->setValue($this->owner->StartDate);
@jules0x
jules0x / imagefrommapfunction.php
Created September 29, 2022 22:34
Image from Map
<?php
$url = 'https://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&key=' . Config::inst()->get(GeocodeService::class, 'google_api_key');
$folder = Folder::find_or_make('maps');
$map = new Image();
$map->setFromString(file_get_contents($url), 'map.png');
$map->ParentID = $folder->ID;
$map->write();
@jules0x
jules0x / raygun-test.php
Last active June 4, 2024 22:36
raygun-error-manual
<?php
namespace App\Tasks;
use Psr\Log\LoggerInterface;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\BuildTask;
/**
* BuildTask to cause Raygun to fire. This can be used to test Slack/Raygun integration.