Skip to content

Instantly share code, notes, and snippets.

View thaycacac's full-sized avatar
🎨
Artist

Thaycacac thaycacac

🎨
Artist
View GitHub Profile
@thaycacac
thaycacac / keybase.md
Created September 12, 2019 02:15
keybase.md

thaycacac

Keybase proof

I hereby claim:

  • I am thaycacac on github.
  • I am thaycacac (https://keybase.io/thaycacac) on keybase.
  • I have a public key ASDeGPdl9vdaj5m2wykedNEpLjWyizbW5xpJk7VCotpBRAo

To claim this, I am signing this object:

@thaycacac
thaycacac / react.js
Created March 24, 2020 16:36
build-your-react
function createElement(type, props, ...children) {
return {
type,
props: {
...props,
children: children.map(child =>
typeof child === "object" ? child : createTextElement(child)
)
}
};
@thaycacac
thaycacac / Repository.js
Last active June 6, 2020 08:13
[VueJS] API Pattern
import axios from 'axios'
const baseDomain = 'https://example.com'
const baseUrl = `${baseDomain}/api/v1`
export default axios.create({
baseUrl,
header: { "Authorization": "Bearer yourToken" }
})
@thaycacac
thaycacac / grid-system.css
Created August 9, 2020 03:30
Grid System
.grid {
width: 100%;
display: block;
padding: 0;
}
.grid.wide {
max-width: 1200px;
margin: 0 auto;
}
@thaycacac
thaycacac / fetch-api.js
Last active December 1, 2020 09:47
Example Promise Javascript
const fetchData = async () => {
const res = await fetch("https://restcountries.eu/rest/v2/alpha/col"); // fetch() returns a promise, so we need to wait for it
const country = await res.json(); // res is now only an HTTP response, so we need to call res.json()
console.log(country); // Columbia's data will be logged to the dev console
};
fetchData();
@thaycacac
thaycacac / tests.js
Created January 5, 2021 04:57
Set environment token
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("token", jsonData.data.token);
@thaycacac
thaycacac / regex.js
Created February 1, 2021 08:27
Regex
// Phone number
const re = /((09|03|07|08|05)+([0-9]{8})\b)/g
@thaycacac
thaycacac / slider-home.vue
Created October 17, 2021 10:27
KungFu Tech
<template>
<div class="container">
<header class="header">
<el-row :gutter="30">
<el-col :sm="24" :md="24" :lg="14" class="header__left">
<h1 class="header__left__title">
Học lập trình
<span class="header__left__title--blue">Ngay từ ngày hôm nay</span>
</h1>
@thaycacac
thaycacac / techmely.md
Last active February 27, 2022 07:01
Reduce trong Javascript

Tính tổng và tích của array sử dụng reduce javascript

function accumulation(...array) {
    return array.reduce((prev, next) => prev + next, 0);
}

function multiplication(...array) {
    return array.reduce((pre, next) => pre * next, 1);
}
@thaycacac
thaycacac / promise.js
Last active February 10, 2023 17:24
promise javascript
// callback hell
const eat = food => console.log(food)
const collectOrder = (order, cb) => {
console.log(order)
cb("eat rice")
}
const placeOrder = (toppings, cb) => {