Skip to content

Instantly share code, notes, and snippets.

@IgnacioFan
IgnacioFan / API.md
Created April 23, 2020 17:28 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

// O(n) 評估最糟的實際情況是 3(n-3)+3
function Max3(arr){
if(arr.length < 3) return undefined
let max3 = [arr[0], arr[1], arr[2]]
// 對max3進行排序
if (max3[0] < max3[1]) [max3[0], max3[1]] = [max3[1], max3[0]]
if (max3[1] < max3[2]) [max3[1], max3[2]] = [max3[2], max3[1]]
if (max3[0] < max3[1]) [max3[0], max3[1]] = [max3[1], max3[0]]
// 朝狀迴圈比較max3是否確實為前三個最大的數
package main
import(
"encoding/json"
"io/ioutil"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
package main
import(
"log"
"net/http"
"github.com/gorilla/mux"
)
func get(w http.ResponseWriter, r *http.Request){
w.Header().Set("Content-Type", "application/json")
@IgnacioFan
IgnacioFan / deploy_rails_app_on_ubuntu.md
Created July 30, 2019 07:03 — forked from he9lin/deploy_rails_app_on_ubuntu.md
Setup Rails application production environment on Ubuntu

Setup Rails application production environment on Ubuntu

Add deploy user

ssh root@YOURDOMAIN
adduser deploy
visudo # Add deploy ALL=(ALL) ALL

Install necessary libraries

@IgnacioFan
IgnacioFan / README-Template.md
Created July 20, 2019 05:49 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites