This file contains hidden or 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
| <?php | |
| /** | |
| * 'card_num' => '0444444444444441' | |
| * 'card1.id' => 'card-id-1' | |
| * 'card.#.id' => 'cardlist-id-1' | |
| * 'card.#.name' => 'cardlist-name-1' | |
| * 'card.#.id' => 'cardlist-id-2' | |
| * 'card.#.name' => 'cardlist-name-2' | |
| * 'card_name' => 'hoge' | |
| * |
This file contains hidden or 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
| ... | |
| config.vm.provider :virtualbox do |v| | |
| v.customize ["modifyvm", :id, "--memory", 4096] #<= 4096 equals 4GB total memory. | |
| v.customize ["modifyvm", :id, "--cpus", 1] | |
| v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
| v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] | |
| # Set the box name in VirtualBox to match the working directory. | |
| vvv_pwd = Dir.pwd | |
| v.name = File.basename(vvv_pwd) |
This file contains hidden or 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
| #!/bin/sh | |
| curl "http://elections.huffingtonpost.com/pollster/api/charts/2016-general-election-trump-vs-clinton.csv" > ~/test.csv |
This file contains hidden or 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
| <?php | |
| // woocommerceテンプレート呼び出しをフックする | |
| add_filter('wc_get_template', 'my_wc_get_template', 10, 5); | |
| function my_wc_get_template($located, $template_name, $args, $template_path, $default_path) | |
| { | |
| // 変更したいテンプレートを指定する | |
| $templates = [ | |
| 'myaccount/form-login.php', |
This file contains hidden or 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
| // [ PHP :: Bug #73322 :: mb_convert_variables detects recursive reference incorrectly ]( https://bugs.php.net/bug.php?id=73322 ) | |
| $ php -v | |
| PHP 7.1.0 (cli) (built: Dec 1 2016 08:13:15) ( NTS ) | |
| $ php -r '$x = ["a", "b"]; mb_convert_variables("UTF-8", "SJIS,EUC-JP", $x);' | |
| PHP Warning: mb_convert_variables(): Cannot handle recursive references in Command line code on line 1 |
This file contains hidden or 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
| <?php | |
| class MyPayment | |
| { | |
| protected static cards_config = [ | |
| [ | |
| 'type' => 'visaelectron', | |
| 'patterns' => [4026, 417500, 4405, 4508, 4844, 4913, 4917], | |
| 'format' => '/(\d{1,4})/', | |
| 'length' => [16], |
This file contains hidden or 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
| add_action('woocommerce_cart_tax_totals', 'check_taxes', 10, 2); | |
| function check_taxes($tax_total, $cart) | |
| { | |
| foreach($tax_totals as $k=>$v) { | |
| // Do translate all labels via wp-content/languages/plugins/woocommerce-ja.mo | |
| $v->label = __($v->label, 'woocommerce'); | |
| } | |
| return $tax_totals; | |
| } |
This file contains hidden or 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
| <?php | |
| function 問い詰める() | |
| { | |
| static $c = 0; | |
| if ($c >= 3) { | |
| return "実は私がやりました"; | |
| } | |
| $c++; | |
| } |
This file contains hidden or 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
| class My_Wc_Cart | |
| { | |
| protected $logger; | |
| public function __construct() | |
| { | |
| $this->logger = new WC_Logger(); | |
| add_action('woocommerce_cart_calculate_fees', [$this, 'check_fees'], 10, 1); | |
| } |
This file contains hidden or 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
| #!/usr/bin/env perl | |
| package MyValidator; | |
| use strict; | |
| use warnings; | |
| use FormValidator::Lite::Constraint; | |
| use Data::Dumper; | |
| rule 'CHECKBOX' => sub{ | |
| my $ages = $_; |