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 | |
/** | |
* A very simple test of FormData API with a very simple | |
* PHP backend. | |
* | |
* Usage: | |
* | |
* 1. Save this file to a folder. | |
* 2. Open your terminal and cd to this folder. |
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 | |
/** | |
* http_parse_response_header() | |
* Parse $http_response_header produced by file_get_contents(). | |
* | |
* @param array $header | |
* Supposed $http_response_header or array alike. | |
* @param array | |
* Assoc array of the parsed version. |
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 | |
include_once 'getGooglePageSpeedScreenshot.php'; | |
echo getGooglePageSpeedScreenshot($_GET['url']); | |
// Output: <img src="..." border="1" style="width: 80px; height: 80px" /> | |
echo getGooglePageSpeedScreenshot($_GET['url'], [ | |
'class' => 'thumbnail', | |
'style' => ['width: 80px;', 'height: 80px;'] |
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 | |
/** | |
* Build HTML tag attributes string with a given array. | |
* | |
* Usage Example: | |
* echo '<img ' . http_build_attributes([ | |
* 'src' => 'some-image-url', | |
* 'class' => ['img-responsive', 'decorative'], | |
* ]); |
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
# Variables that might be modified by maintainer easily. | |
%define name tick5 | |
%define version 0.1 | |
%define release 1 | |
%define systemdinstalldir /etc/systemd/system | |
%define message come on, James | |
# Some metadata required by an RPM package | |
Name: %name | |
Summary: Print a message every 5s |
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
Package: tick5 | |
Maintainer: Koala Yeung | |
Architecture: all | |
Version: 0.1 | |
Description: Print a message every 5s | |
. | |
tick5 is a simple useless script that echos a message every 5 seconds. |
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
# Some metadata required by an RPM package | |
Name: tick5 | |
Summary: Print a message every 5s | |
Version: 0.1 | |
Release: 1 | |
License: MIT | |
%description | |
tick5 is a simple useless script that echos a message every 5 seconds. |
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
[Unit] | |
StopWhenUnneeded=true | |
[Install] | |
WantedBy=multi-user.target | |
[Service] | |
ExecStart=/usr/bin/tick5 | |
Restart=always | |
RestartSec=5 |
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
# Some metadata required by an RPM package | |
Name: tick5 | |
Summary: Print a message every 5s | |
Version: 0.1 | |
Release: 1 | |
License: MIT | |
%description | |
tick5 is a simple useless script that echos a message every 5 seconds. |
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
#!/bin/bash | |
# say something, with timestamp, every 5 seconds | |
while echo "$@"; do | |
sleep 5s | |
done |