fancybox(v3)

fancybox(v3)

fancyboxのダウンロード

画像のポップアップ

<a href="image.jpg" data-fancybox="images" data-caption="My caption">
    <img src="thumbnail.jpg" alt="" />
</a>

YouTube

<a data-fancybox href="https://www.youtube.com/watch?v=_sI_Ps7JSEk">
    YouTube video
</a>

MP4

<a data-fancybox data-width="640" data-height="360" href="video.mp4">
    Direct link to MP4 video
</a>

iframe

<a data-fancybox data-type="iframe" data-src="http://codepen.io/fancyapps/full/jyEGGG/" href="javascript:;">
    Webpage
</a>

Inline

<a data-fancybox data-src="#hidden-content" href="javascript:;">
    Trigger the fancybox
</a>

Callbacks

onInit: $.noop, // When instance has been initialized

beforeLoad: $.noop, // Before the content of a slide is being loaded
afterLoad: $.noop, // When the content of a slide is done loading

beforeShow: $.noop, // Before open animation starts
afterShow: $.noop, // When content is done loading and animating

beforeClose: $.noop, // Before the instance attempts to close. Return false to cancel the close.
afterClose: $.noop, // After instance has been closed

onActivate: $.noop, // When instance is brought to front
onDeactivate: $.noop, // When other instance has been activated

Core methods

// Start new fancybox instance
$.fancybox.open( items, opts, index );

// Get refrence to currently active fancybox instance
$.fancybox.getInstance();

// Close currently active fancybox instance (pass `true` to close all instances) 
$.fancybox.close();

// Close all instances and unbind all events
$.fancybox.destroy();

Starting fancybox

{
    src  : '' // Source of the content
    type : '' // Content type: image|inline|ajax|iframe|html (optional)
    opts : {} // Object containing item options (optional)
}

Example of opening image gallery programmatically:

$.fancybox.open([
    {
        src  : '1_b.jpg',
        opts : {
            caption : 'First caption',
            thumb   : '1_s.jpg'
        }
    },
    {
        src  : '2_b.jpg',
        opts : {
            caption : 'Second caption',
            thumb   : '2_s.jpg'
        }
    }
], {
    loop : false
});

お気に入りのcomposer

image_barcode2

安定板(stable)が見つからないと言われるので、「:dev-master」が必要。
pear/image_barcode2:dev-master
GITHUB

PHPMailer

SMTPサーバを利用してメールを送信するためのPHPのライブラリ
phpmailer/phpmailer
GITHUB

Twig

フロントエンドとバックエンドの両方で使えるテンプレートエンジン
twig/twig
公式

TCPDF

PDF生成
tecnickcom/tcpdf
公式

PhpSpreadsheet

サーバー上でエクセルファイルを生成する
※php5.6以上

phpoffice/phpspreadsheet
[GITHUB](https://github.com/PHPOffice/PhpSpreadsheet "GITHUB"

curl -sS https://getcomposer.org/installer | php

Twigを使用する

インストール

Composerが必要

php composer.phar require "twig/twig"

基本

プリント

{{ title }}
{{ message }}

コメント

{# タイトル #}
{# メッセージ #}

条件式

if文

{% if 条件式A and 条件式B %}
{% elseif 条件式 %}
{% else %}
{% endif %}

for文

{% for i in 1..100 %}
{% endfor %}

foreach文( ループ, for in で代用 )

{% for hoge in array %}
{% endfor %}

for内でのループ

loop.index ループの現在の反復。(1 インデックス付き)
loop.index0 ループの現在の反復。(0 インデックス付き)
loop.revindex ループの最後からの反復回数 (1 のインデックス付き)
loop.revindex0 ループの終わりからの反復回数 (インデックスは 0)
loop.first 最初の反復の場合は True
loop.last 最後の反復の場合は True
loop.length シーケンス内の項目の数
loop.parent 親コンテキスト

その他

三項演算子

{{ 条件文 ? 処理A : 処理B }}

文字列省略(Twig1.6以降)

{{# 32文字目まで表示して残りは...にする #}}
{{ name | length > 32 ? name | slice(0, 32) ~ '…' : name }}

HTML参照文字エスケープ

{{ html | e }}
{{# または、#}}
{{ html | e("html") }}

改行文字をbrに

{{ text | nl2br }}

SELinuxのステータスおよびモードの変更

SELinuxの状態の確認

getenforce

より詳しい情報

sestatus

SELinuxの無効化
状態をpermissiveモードへ変更

setenforce 0

恒久的に設定を無効化したい場合

vi /etc/selinux/config

を設定する「SELINUX=」の部分を編集する

  • enforcingを恒久設定 SELINUX=enforcing
  • permissiveを恒久設定 SELINUX=permissive
  • disabledを恒久設定 SELINUX=disabled

WEBMINをインストール

yum -y install perl-Net-SSLeay

このページのリストから最新版を確認する。
http://download.webmin.com/download/yum/

yum -y install http://download.webmin.com/download/yum/webmin-2.021-1.noarch.rpm
systemctl start webmin

もしくは

/etc/init.d/webmin start

UNIX系の最新インストール法

参考
https://webmin.com/download/

Setup

curl -o webmin-setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/webmin-setup-repos.sh
sh webmin-setup-repos.sh

Install

dnf install webmin

MySQLでタイムゾーンを設定する

タイムゾーンデータは、MySQLのサイトよりPOSIX standard版のファイルをダウンロードします。
https://dev.mysql.com/downloads/timezones.html

timezone_2021a_posix_sql.zip
を解凍して
timezone_posix.sql
をインポートする。

/etc/my.cnf
に下記の設定を追加

[mysqld]
default-time-zone = 'Asia/Tokyo'