type | min | max |
---|---|---|
i8 | -128 | 127 |
i16 | -32768 | 32767 |
i32 | -2147483648 | 2147483647 |
i64 | -9223372036854775808 | 9223372036854775807 |
u8 | 0 | 255 |
u16 | 0 | 65535 |
u32 | 0 | 4294967295 |
u64 | 0 | 18446744073709551615 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media screen and (min-width:100px) { /* Screen >= 100 */ | |
body { font-weight:bold; } | |
} | |
@media screen and (min-width:200px) { /* Screen >= 200 */ | |
body { color:#555; } | |
} | |
@media screen and (max-width:100px) { /* Screen <= 100 */ | |
body { font-weight:bold; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IE >= 11 | |
function triggerEvent(el, eventName, options) { | |
var event, | |
opts = {detail: options}; | |
event = newEvent(eventName, opts); | |
el.dispatchEvent(event); | |
} | |
function newEvent(eventName, options) { |
SplPriorityQueue is advertised as a prioritized queue. Ideally, as a queue, when adding items of the same priority, the items should retain the same order as how they were registered (FIFO). In PHP the order is unexpected:
<?php
$queue = new SplPriorityQueue();
$queue->insert('1',0);
$queue->insert('2',0);
$queue->insert('3',0);
$queue->insert('4',0);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$image = imagecreatefrompng( 'trees.png' ); | |
$width = imagesx( $image ); | |
$height = imagesy( $image ); | |
// Create | |
$output = imagecreatetruecolor($width, $height); | |
for( $y = 0; $y < $height; $y++ ){ | |
for( $x = 0; $x < $width; $x++ ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf syntax | |
%[parameter][flags][width][.precision][length]type | |
https://carlalexander.ca/php-string-formatting/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function compose_url(array $server){ | |
// Scheme | |
$scheme = ''; | |
if (isset($server['SERVER_PROTOCOL'])) { | |
$scheme = explode('/', $server['SERVER_PROTOCOL']); | |
$scheme = strtolower($scheme[0]); | |
if (isset($server['HTTPS']) && 'off' != $server['HTTPS']) { | |
$scheme .= 's'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | |
slug | |
version | |
author | |
author_profile | |
contributors | |
requires | |
tested | |
compatibility | |
rating |