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
# -*- coding: utf-8 -*- | |
import re | |
import json | |
import requests | |
url = 'https://store.nintendo.co.jp/customize.html' | |
content = requests.get(url).text | |
if re.search(r'\bSOLD\s+OUT\b', content): | |
print('Nintendo Switch SOLD OUT.') |
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
function my_acf_load_field( $field ) { | |
if ( ! empty ( $_GET[$field['name']] )) { | |
$field['default_value'] = $_GET[$field['name']]; | |
} | |
return $field; | |
} | |
add_filter('acf/load_field', 'my_acf_load_field'); | |
remove_filter( 'the_content', 'wpautop' ); |
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
// this will effect all relationship fields | |
// if you only want to effect specific fields | |
// see https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/ | |
add_filter('acf/fields/relationship/query', 'relationship_only_own_posts', 10, 3); | |
function relationship_only_own_posts($args, $field, $post_id) { | |
// ACFのcourseの値で、表示する前提条件を絞る | |
$args['meta_key'] = 'course'; | |
$post = get_fields($post_id); | |
$post_course = $post["course"]; |
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
function my_acf_load_field( $field ) { | |
if ( ! empty ( $_GET[$field['name']] )) { | |
$field['default_value'] = $_GET[$field['name']]; | |
} | |
return $field; | |
} | |
add_filter('acf/load_field', 'my_acf_load_field'); | |
remove_filter( 'the_content', 'wpautop' ); |
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
// Register a REST route | |
add_action( 'rest_api_init', function () { | |
//Path to meta query route | |
register_rest_route( 'boardgame/v2', '/fedrated_query/', array( | |
'methods' => 'GET', | |
'callback' => 'custom_meta_query' | |
) ); | |
}); | |
// Do the actual query and return the data |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=640, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>サービス名</title> | |
<style> | |
html, body { | |
padding: 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
function closest(node, selector) { | |
// IEや一部ブラウザでは.closet()が実装されていないので自前も用意 | |
return (node.closest || function (_selector) { | |
do { | |
// nodeとselectorがマッチしたら返す | |
if ((node.matches || node.msMatchesSelector).call(node, _selector)) { | |
return node; | |
} | |
// マッチしなかったら親要素を代入 |
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
const devices = require('puppeteer/DeviceDescriptors'); | |
let fetch = require('node-fetch'); | |
let FormData = require('form-data'); | |
let fs = require('fs'); | |
let opener = require('opener'); | |
it('スマートフォン版のスクリーンショットを撮影', async function () { | |
this.timeout(20000); | |
await page.emulate(devices['iPhone 6']); | |
await page.screenshot({ |
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
var fs = require('fs') | |
var sass = './src/sass/menu.sass'; | |
fs.readFile(sass, 'utf8', function (err,data) { | |
if (err) { | |
return console.log(err); | |
} | |
// console.log(data) | |
var result = data.replace(/rem\((.*?)\)/g, function(match) { | |
console.log(match) | |
var m = match.match(/[\d+\.]+/); |
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
(1.2 / 0.625 / 100) * 100 | |
https://www.google.com/search?&q=(1.2+/+0.625+/+100)+*+100 |