Skip to content

Instantly share code, notes, and snippets.

@kylekatarnls
kylekatarnls / Phug.md
Last active March 7, 2023 09:40
Phug Watch
@kylekatarnls
kylekatarnls / yii2-pug-php3
Created October 24, 2017 12:42
Pg-php 3 for Yii2 adapter
<?php
namespace rmrevin\yii\pug;
use Pug\Pug;
use Yii;
use yii\base\View;
use yii\helpers\FileHelper;
/**
@kylekatarnls
kylekatarnls / silex-pug.php
Created December 12, 2017 15:38
Use Pug in a Silex app
<?php
// Install Pug with: composer require pug-php/pug
$app['view'] = function () {
return new Pug(array(
'cache' => './storage/cache',
'paths' => array(
// Here you can record differents root directories
// containing pug templates.
@kylekatarnls
kylekatarnls / roadmap.md
Last active March 8, 2019 13:13
Carbon 2 proposal

Carbon 2 (Draft)

Complete set of PHP Date classes extensions:

class extends comment
Carbon DateTime
CarbonImmutable DateTimeImmutable new
CarbonInterface DateTimeInterface new
CarbonTimeZone DateTimeZone new
@kylekatarnls
kylekatarnls / Carbon-Frequently-asked-questions.md
Last active December 2, 2022 18:59
Carbon: Frequently asked questions

Carbon: Frequently asked questions

@kylekatarnls
kylekatarnls / languages.php
Last active January 8, 2019 15:03
[PHP] Langages ISO 639-1 Code, Name And Native Name; And Regions ISO 3166-2 Codes
<?php return [
'ab' => [
'isoName' => 'Abkhazian',
'nativeName' => 'аҧсуа бызшәа, аҧсшәа',
],
'aa' => [
'isoName' => 'Afar',
'nativeName' => 'Afaraf',
],
'af' => [
new Date('2001-12-31T23:59:59.000000Z').toLocaleString('en-US', {
timeZone: 'Asia/Calcutta'
});
<?php
date_default_timezone_set('UTC');
<?php
$inputDateString = '2018-05-12 23:16:46.123456'; // get from DB or some API
$date = new DateTimeImmutable($inputDateString);
echo $date->format('Y-m-d\TH:i:s.u\Z');
dateString = '2018-05-12T23:16:46.123456Z'; // get from your PHP server (JSON API, data-* attribute, etc.)
date = new Date(dateString);
alert(date.toLocaleString());