Skip to content

Instantly share code, notes, and snippets.

Avatar
I want to play catch!

Ko Takagi ko31

I want to play catch!
View GitHub Profile
@ko31
ko31 / sample.sh
Created May 13, 2021
How to send a reply text message from the console using the LINE Message API
View sample.sh
# via Messaging API reference
# https://developers.line.biz/en/reference/messaging-api/#text-message
# Send text message
curl -v -X POST https://api.line.me/v2/bot/message/push \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {your channel access token}' \
-d '{
"to": "{userId}",
"messages":[
@ko31
ko31 / how-to-send-an-email-manually-using-woocommerce-email-templates.php
Last active Oct 8, 2020
How to send an email manually using WooCommerce email templates.
View how-to-send-an-email-manually-using-woocommerce-email-templates.php
<?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 Sep 25, 2020
A sample code of user authentication with LDAP from PHP
View ldap.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 Oct 8, 2020
Add japanese providers for WooCommerce Shipment Tracking
View add-japanese-providers-for-woocommerce-shipment-tracking.php
<?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, [
View gosign.txt
______ _____ _______ _____ ______ __ _
| ____ | | |______ | | ____ | \ |
|_____| |_____| ______| __|__ |_____| | \_|
@ko31
ko31 / howto.md
Last active Apr 17, 2020
How to change file descriptor limit settings on Mac OS
View howto.md

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 Mar 16, 2020
[WordPress]Return value of get_queried_object()
@ko31
ko31 / install.md
Last active Jan 29, 2021
Installing Laravel Homestead on MacOS 🔧
View install.md

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 Mar 5, 2021
センバツ21世紀枠歴代出場校の geojson データ
View 21st_century.geojson
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 Jan 8, 2020
How to easily post to slack channel with shell script
View post_slack.sh
#!/bin/sh
curl -X POST https://slack.com/api/chat.postMessage \
-d "token=[REPLACE-YOUR-TOKEN]" \
-d "channel=#general" \
-d "text=Hello World!<!channel>"