Skip to content

Instantly share code, notes, and snippets.

@gatespace
gatespace / exclude-algolia-search.php
Last active January 14, 2022 08:39
WordPress + Algoliaで、Algoliaの検索対象から特定の投稿(固定ページ)を除外するプラグイン
<?php
/*
Plugin Name: Exclude Algolia search
Plugin URI:
Description: Algolia の検索結果から除外するフラグを追加。WP Search with Algolia プラグインが必要。
Version: 0.1
Author: gatespace
Author URI: https://gatespace.jp
License: GPLv2 or later
*/
@miya0001
miya0001 / tello.js
Last active January 30, 2019 18:36
Tello + Node.js example
#!/usr/bin/env node
'use strict'
const PORT = 8889;
const HOST = '192.168.10.1';
const dgram = require('dgram');
const client = dgram.createSocket('udp4');
@fumikito
fumikito / request.php
Created March 2, 2017 08:07
A typical jQuery request to WordPress REST API
<?php
/**
* Regsiter script
*/
add_action( 'wp_enqueue_scripts', function() {
// Set dependency to wp-api, which has nonce and endpoint root.
wp_enqueue_script( 'api-handler', '/path/to/api-handler.js', [ 'jquery', 'wp-adpi' ], '1.0', true );
} );
@miya0001
miya0001 / wp-update.sh
Last active January 4, 2017 10:18
wp-cli
#!/usr/bin/env bash
set -eu
wp @all core verify-checksums
wp @all vackup create
wp @all core update
wp @all core language update
wp @all plugin update --all
<?php
/**
* Get Google Page Speed Screenshot
*
* Uses Google's Page Speed API to generate a screenshot of a website.
* Returns the image as a base64 jpeg image tag
*
* Usage Example:
* echo getGooglePageSpeedScreenshot("http://ghost.org", 'class="thumbnail"');
*
@miya0001
miya0001 / gist:db3ce191e31871964a57
Last active October 21, 2017 02:14
テーマレビュワーのためのVCCW裏ワザ

初期設定

$ mkdir -p ~/vagrants/vccw
$ cd ~/vagrants/vccw
$ git clone git@github.com:miya0001/vccw.git .

次に以下のコードを~/.bash_profileに登録

@wokamoto
wokamoto / gist:5771b3b0b9b83d2e1642
Last active December 7, 2023 07:53
[PHP] Google Calendar API v3 から祝日取得
<?php
function get_holidays_this_month($year, $month){
// 月初日
$first_day = mktime(0, 0, 0, intval($month), 1, intval($year));
// 月末日
$last_day = strtotime('-1 day', mktime(0, 0, 0, intval($month) + 1, 1, intval($year)));
$api_key = 'YOUR API KEY HERE';
$holidays_id = 'outid3el0qkcrsuf89fltf7a4qbacgt9@import.calendar.google.com'; // mozilla.org版
@galengidman
galengidman / search.php
Last active September 26, 2021 16:45
WordPress search form & results for custom post type
<?php
// check to see if there is a post type in the URL
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] ) {
// save it for later
$post_type = $_GET['post_type'];
// check to see if a search template exists
if ( locate_template( 'search-' . $post_type . '.php' ) ) {

BASE API v1 ドキュメント (β版)

BASEのAPIの開発者向けのドキュメントです。

概要

このAPIを使うと、あなたのアプリケーションとBASEを連携させることができます。

例えば

  • BASEのアカウントでログインする
  • BASEのショップの商品情報を取得する
@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}