Skip to content

Instantly share code, notes, and snippets.

View artoodetoo's full-sized avatar
:octocat:
gitting

Alexandr Materukhin artoodetoo

:octocat:
gitting
View GitHub Profile
@artoodetoo
artoodetoo / result.txt
Created January 21, 2018 11:46
Flatten PHP array
C:\>php flatten.php
array(4) {
[0]=>
int(11)
[1]=>
int(12)
[2]=>
int(13)
[3]=>
int(14)
@artoodetoo
artoodetoo / readme.txt
Last active May 23, 2018 23:11
DST problem demo
For timezone 'Australia/Melbourne':
2018-03-31 10:00:00
+ 24*60*60 == 2018-04-01 09:00:00
strtotime(+1 day) == 2018-04-01 10:00:00
DateTime->add(1d) == 2018-04-01 10:00:00
2018-10-06 10:00:00
+ 24*60*60 == 2018-10-07 11:00:00
strtotime(+1 day) == 2018-10-07 10:00:00
DateTime->add(1d) == 2018-10-07 10:00:00
@artoodetoo
artoodetoo / app.js
Last active January 20, 2019 10:12
Example webpack config to concat jQuery plugins but use external jQuery instance
window.moment = require('moment');
require('daterangepicker');
require('bootstrap-select');
@artoodetoo
artoodetoo / example.php
Created January 20, 2019 10:27
Laravel: run standalone console script without touching the project code
<?php
/*
* The code mostly peeped in artisan executable file.
* Put this file to project root (one level above DocumentRoot) and run
* $ php example.php
*/
if (php_sapi_name() !== 'cli') {
die('This file can be executed from console only');
}
<?php
class JpegSectionIterator implements \Iterator
{
const
UNKNOWN = 'unknown',
SOI = 'SOI', // Start Of Image
SOF0 = 'SOF0', // Start Of Frame (baseline DCT)
SOF1 = 'SOF1', // Start Of Frame (extended DCT)
SOF2 = 'SOF2', // Start Of Frame (progressive DCT)