Skip to content

Instantly share code, notes, and snippets.

View ehudthelefthand's full-sized avatar

Pongneng ehudthelefthand

  • Pair-Co Software, ODDS
  • Chiang Mai
View GitHub Profile
// package.json
{
"name": "todo-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon todos.js"
},
const express = require('express')
const { v4: uuid } = require('uuid')
const app = express()
// Product
// - ID: UUID (String)
// - Name: String
// - Type: String
// - Price: Number
@ehudthelefthand
ehudthelefthand / main.js
Created June 6, 2022 13:12
PEA Node.js Class
console.log('hello world'.length)
console.log('hello world'.charAt(0))
console.log('hello world'.split(' '))
console.log('hello world'.substring(1, 7))
// 012345678910
console.log(1)
console.log(1.1)
console.log(1.1 + 1.3)
@ehudthelefthand
ehudthelefthand / index.html
Created March 23, 2021 04:51
Post and Comment with Fetch
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,700;1,400&display=swap"
@ehudthelefthand
ehudthelefthand / index.html
Created March 22, 2021 09:08
Post & Comment with Callback
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
ul {
list-style: none;
@ehudthelefthand
ehudthelefthand / index.html
Created March 22, 2021 06:39
เฉลย การ get ข้อมูลมาโชว์
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id="click">click me</button>
@ehudthelefthand
ehudthelefthand / LayoutConstraints.swift
Last active March 10, 2021 13:42
Constraint Compare
// VFL (View Format Language) จริงๆดูดีนะ แต่น่าจะไม่รองรับทุกเคส
let views = [
"redView": redView,
"greenView": greenView
]
let metrics = [
"padding": padding,
"spacing": spacing
@ehudthelefthand
ehudthelefthand / setting.tsx
Created January 29, 2021 02:12
The elegant of javascript object dynamic key
ก่อนอื่นต้องให้เครดิตเจ้าของไอเดียก่อนนะครับ ซึ่งก็คือน้องบอสที่เป็นเทพ Javascript ในทีมนะครับ ถึงแม้น้องแม่งจะกวนตีนเหี้ยๆ ก็ตาม ผมก็ดีใจที่ได้ทำงานกับน้องเค้านะครับ
โอเค เรามาเริ่มที่หน้างานกันเลยดีกว่า งานของเราเป็นการทำหน้า setting ที่จะให้ user เชื่อม account ของตัวเองกับ Social Network Provider แต่ละเจ้าผ่าน Firebase นะครับ
type Server {
e: *echo.Echo
// เพิ่ม shared dependencies
// ไว้ต่อจากนี้ครับ
// ..
}
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
e.ServeHTTP(w, r)
}