Skip to content

Instantly share code, notes, and snippets.

wada wadadanet

Block or report user

Report or block wadadanet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wadadanet
wadadanet / 00-sass-color-setting.scss
Last active May 23, 2019
css変数も出力できるsass設定
View 00-sass-color-setting.scss
$theme-colors: (
primary: #ffffff,
secondary: #cccccc,
success: #28a745,
info: #aaaaaa,
warning: #ffc107,
danger: #dc3545,
light: #f8f9fa,
dark: #343a40
);
@wadadanet
wadadanet / main.sass
Created Mar 15, 2019
Bootstrap4 Grid system 5,7 column
View main.sass
.col-c5
width: 20%
position: relative
min-height: 1px
padding-right: 15px
padding-left: 15px
.col-c7
width: #{(100% / 7)}
position: relative
min-height: 1px
View bootstrap gutter
// bootstrap gutter
// ex: .row.gutter-10
@for $num from 1 through 5
$v: $num * 5px / 2
.gutter-#{$num*5}
margin-left: #{$v * -1}
margin-right: #{$v * -1}
> [class*='col-']
padding-left: $v
padding-right: $v
View functions.php
/**
* lazysizes対応のattachment_image_attributes
*/
function lazysizes_attachment_image_attributes( $atts, $attachment ) {
if(!empty($atts['class'])){
if(strpos($atts['class'], 'lazyload') !== false){
$atts['data-src'] = $atts['src'];
$atts['src'] = 'data:image/gif;base64,R0lGODlhAQABAGAAACH5BAEKAP8ALAAAAAABAAEAAAgEAP8FBAA7';
$atts['data-srcset'] = $atts['srcset'];
$atts['srcset'] = false;
View functions.php
add_action( 'wp_enqueue_scripts', 'mb_scripts' );
function mb_scripts() {
wp_enqueue_script( 'lazysizes', get_template_directory_uri() . '/js/vendor/lazysizes.min.js', NULL, NULL, false );
}
@wadadanet
wadadanet / functions.php
Created Jun 7, 2018
wordpress 知りたい要素のファイルを一瞬で調べる方法
View functions.php
function echo_filename(){
if(WP_DEBUG){
$obj = debug_backtrace();
$parent = $obj[0];
$path = $parent['file'];
$filename = basename($path);
echo "<!-- $filename -->";
}
}
@wadadanet
wadadanet / optimize_90.bat
Created Jun 7, 2018
jpg画像を一括mozjpeg圧縮(Windows)
View optimize_90.bat
@echo off
cd /d "%~dp0"
if "%~1" == "" goto error
mkdir "%~dp1mozjpeg\"
:loop
if not "%~nx1"=="" (
echo ---- %~nx1 mozjpeg...
@wadadanet
wadadanet / webm_90.bat
Created Jun 7, 2018
FFmpegに複数ファイル圧縮してもらう
View webm_90.bat
@echo off
cd /d "%~dp0"
if "%~1" == "" goto error
mkdir "%~dp1webm\"
:loop
if not "%~nx1"=="" (
echo ---- %~nx1 ffmpeg...
View Print.js
/**
* 部分印刷
* @param {Element} element: 印刷する要素
*/
const Print = function(element = false){
if(!element) return
// 印刷用の要素を作成
var print_element=document.createElement('div')
print_element.id = "PrintArea"
View functions.php
// OGP
function the_ogp(){
// OGP =====================
// image
$OG_IMAGE_NAME = "/img/ogp.png";
$og_image = "";
// site_name
$og_site_name = get_bloginfo('name');
You can’t perform that action at this time.