Open a new terminal and install Composer:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Once that has finished installing and moved, install the PHP-CS-Fixer Composer package globally:
Open a new terminal and install Composer:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Once that has finished installing and moved, install the PHP-CS-Fixer Composer package globally:
| <?php | |
| $url = 'http://scare.senao.com.tw/api/post/list/?category=latest'; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json']); | |
| $output = curl_exec($ch); | |
| curl_close($ch); | |
| $json = json_decode($output, true); |
| /** | |
| * pr | |
| * 比較寬的console.log, | |
| * 若代入兩個個參數則第二個參數會變成title並換行顯示第一個參數 | |
| * @param desc | |
| * @param title | |
| * @return boolean | |
| */ | |
| function pr(desc, title) { | |
| if (!debug) return false; |
| # ================================= | |
| # [設定] 修改"位置"時調整 proxy (start) | |
| # 來源文章 http://qiita.com/uetchy/items/b9991d1f86b23f4a184d | |
| # 寫在 .bash_profile 或是 .zshrc | |
| # 觸發時間點為切換後開啟終端機或是 iTerm 這類工具讓他讀取到這段 code | |
| # ================================= | |
| proxy=這邊放proxy名稱 | |
| switch_trigger=這邊放位置的名稱 |
| collection = [ | |
| { "Id": 1, "color": "blue" }, | |
| { "Id": 2, "color": "green" }, | |
| { "Id": 3, "color": "yellow" }, | |
| { "Id": 4, "color": "green" }, | |
| { "Id": 5, "color": "blue" }, | |
| { "Id": 6, "color": "yellow" } | |
| ] | |
| <div class="pulldownChange-group triggerStoreZipCode"> | |
| <input type="hidden" class="pulldownChange-zip" id="cartZip3" name="cartZip3"> | |
| <select class="pulldownChange-city" data-val="<?php echo $cartMaster['cart_receipt_city'] ?>" ></select> | |
| <select class="pulldownChange-town" data-val="<?php echo $cartMaster['cart_receipt_district'] ?>" ></select> | |
| </div> |
| $('#credit card').on('keyup keypress change', function () { | |
| var start = this.selectionStart; | |
| var end = this.selectionEnd; | |
| var oldleft = this.value.substr(0,start).replace(/[^ ]/g, '').length; | |
| this.value = this.value.replace(/\W/gi, '').replace(/(.{4})/g, '$1 ').substr(0, 19); | |
| var newleft = this.value.substr(0,start).replace(/[^ ]/g, '').length; | |
| start += newleft - oldleft; | |
| end += newleft - oldleft; | |
| this.setSelectionRange(start, end); | |
| }); |
| Object.defineProperty(HTMLSelectElement.prototype, 'emptyOptions', {get: function () { | |
| // empty options | |
| this.options.length = 0; | |
| }}); |
| (function(){ | |
| // https://www.googleapis.com/urlshortener/v1/url?shortUrl=https://goo.gl/tzn9Hx&key=AIzaSyCRIa3jCZ1C25iOaCqg7KnU8T2dlK5HPeo | |
| // https://developer.mozilla.org/zh-TW/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest | |
| var getLongUrl = function() { | |
| var ajax = new XMLHttpRequest(); | |
| ajax.addEventListener("progress", updateProgress, false); | |
| ajax.addEventListener("load", transferComplete, false); | |
| ajax.addEventListener("error", transferFailed, false); | |
| ajax.addEventListener("abort", transferCanceled, false); | |
| ajax.open('get', 'http://my.sample.path.com/'); |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>textarea rows</title> | |
| </head> | |
| <body> | |
| <textarea name="" id="ta" cols="30" rows="5"></textarea> | |
| <br> | |
| <button id="submit">submit</button> |