Skip to content

Instantly share code, notes, and snippets.

View ko31's full-sized avatar
I want to play catch!

Ko Takagi ko31

I want to play catch!
View GitHub Profile
@ko31
ko31 / how-to-send-an-email-manually-using-woocommerce-email-templates.php
Last active August 25, 2023 20:32
How to send an email manually using WooCommerce email templates.
<?php
// Load the WooCommerce email templates.
$wc_emails = WC()->mailer()->get_emails();
/**
* You can specify which template mail is to be sent from the following array elements.
* 'WC_Email_New_Order'
* 'WC_Email_Cancelled_Order'
* 'WC_Email_Failed_Order'
* 'WC_Email_Customer_On_Hold_Order'
@ko31
ko31 / ldap.php
Created September 25, 2020 14:35
A sample code of user authentication with LDAP from PHP
<?php
// LDAP settings
const LDAP_HOST = "ldap-host";
const LDAP_PORT = 389;
const LDAP_DC = "dc=example,dc=com";
const LDAP_CN = "admin";
const LDAP_PASS = "password";
// Connect
$ldap_conn = ldap_connect(LDAP_HOST, LDAP_PORT);
@ko31
ko31 / add-japanese-providers-for-woocommerce-shipment-tracking.php
Last active October 8, 2020 00:06
Add japanese providers for WooCommerce Shipment Tracking
<?php
/**
* Add japanese providers for WooCommerce Shipment Tracking
*
* @param array $providers
*
* @return array
*/
add_filter( 'wc_shipment_tracking_get_providers', function ( $providers ) {
$providers = array_merge( $providers, [
@ko31
ko31 / gosign.txt
Last active December 21, 2023 14:40
Gosign
______ _____ _______ _____ ______ __ _
| ____ | | |______ | | ____ | \ |
|_____| |_____| ______| __|__ |_____| | \_|
@ko31
ko31 / howto.md
Last active April 17, 2020 02:47
How to change file descriptor limit settings on Mac OS

I got a "too many open files" error.

Error: EMFILE: too many open files, open '/path/to/filename'

I solved the problem by changing the file descriptor limit setting.

Environment

@ko31
ko31 / memo.md
Last active March 16, 2020 02:41
[WordPress]Return value of get_queried_object()
@ko31
ko31 / install.md
Last active January 29, 2021 11:56
Installing Laravel Homestead on MacOS 🔧

Laravel Homestead is official local development environment.
It is a great tool that allows you to easily create an environment with all the functions required for development.

The following is the steps for installing Laravel 6.x on MacOS with Homestead.

Install VirtualBox.

Install Vagrant.

@ko31
ko31 / 21st_century.geojson
Last active March 5, 2021 14:05
センバツ21世紀枠歴代出場校の geojson データ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ko31
ko31 / post_slack.sh
Created January 8, 2020 23:59
How to easily post to slack channel with shell script
#!/bin/sh
curl -X POST https://slack.com/api/chat.postMessage \
-d "token=[REPLACE-YOUR-TOKEN]" \
-d "channel=#general" \
-d "text=Hello World!<!channel>"
@ko31
ko31 / post_slack.php
Created January 8, 2020 23:57
How to easily post to slack channel with PHP
<?php
// Your slack token
$token = 'YOURTOKEN';
// Your slack channel (e.g. #general)
$channel = '#general';
// Post message
$text = "<!channel>Hello World!";