Skip to content

Instantly share code, notes, and snippets.

@shuliu
shuliu / print_r.js
Created September 2, 2016 10:50
js console style
/**
* pr
* 比較寬的console.log,
* 若代入兩個個參數則第二個參數會變成title並換行顯示第一個參數
* @param desc
* @param title
* @return boolean
*/
function pr(desc, title) {
if (!debug) return false;
@shuliu
shuliu / curl_get_json_and_remove_html_tag.php
Last active May 27, 2016 05:54
curl get json and remove html tag, \r\n
<?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);
@shuliu
shuliu / README.md
Last active April 7, 2016 06:22
PSR-2 Build System using Sublime Text

PSR-2 Build System using Sublime Text

Installation

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: