Skip to content

Instantly share code, notes, and snippets.

View nguyenit67's full-sized avatar
🚀
Aim for the best 💪💪💪

Nguyen Hoang Nguyen nguyenit67

🚀
Aim for the best 💪💪💪
View GitHub Profile
@nguyenit67
nguyenit67 / remove_accents.py
Created November 22, 2022 16:01 — forked from J2TEAM/remove_accents.py
Remove Vietnamese Accents - Xoá dấu tiếng việt in Python
s1 = u'ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯưẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ'
s0 = u'AAAAEEEIIOOOOUUYaaaaeeeiioooouuyAaDdIiUuOoUuAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYy'
def remove_accents(input_str):
s = ''
print input_str.encode('utf-8')
for c in input_str:
if c in s1:
s += s0[s1.index(c)]
else:
s += c
@nguyenit67
nguyenit67 / onKeyDown.jsx
Last active May 7, 2022 06:51
DOM#KeyboardEvent
const handleKeyUp = (event) => {
console.log(event.key)
}
<input type="text" className="zm-input-text__input" placeholder="Nhập tên bài hát, nghệ sĩ hoặc MV..." onKeyUp={} />
- lấy bài hát liên quan:
http://mp3.zing.vn/xhr/recommend?type=audio&id=ZW67OIA0
- lấy data thông qua key:
http://mp3.zing.vn/xhr/media/get-source?type=audio&key=kmJHTZHNCVaSmSuymyFHLH
http://mp3.zing.vn/html5xml/song-xml/kmJHTZHNCVaSmSuymyFHLH
- lấy info bài hát
https://mp3.zing.vn/xhr/media/get-info?type=audio&id=ZW8I7AAI
@nguyenit67
nguyenit67 / react-query.jsx
Last active May 3, 2022 17:05
manual hooks for fetching server state
// For most queries, it's usually sufficient to check for the isLoading state, then the isError state, then finally, assume that the data is available and render the successful state:
function Todos() {
const { isLoading, isError, data, error } = useQuery("todos", fetchTodoList);
if (isLoading) {
return <span>Loading...</span>;
}
if (isError) {
@nguyenit67
nguyenit67 / table.html
Created April 18, 2022 03:58
MDN table
<table>
<thead>
<tr>
<th colspan="2">The table header</th>
</tr>
</thead>
<tbody>
<tr>
<td>The table body</td>
<td>with two columns</td>
@nguyenit67
nguyenit67 / removeDuplicates.ts
Last active April 15, 2022 17:30
Remove Duplicated Items
/**
* Remove all duplicate items from an array in TypeScript
*/
function
async function searchManga(title) {
const result = await (await fetch(`https://api.mangadex.org/manga?title=${encodeURI(title)}`)).json();
return result.results.map(v => v.data)
}
async function getChapters(mangaID) {
const result = await (await fetch(`https://api.mangadex.org/chapter/?manga=${mangaID}&limit=50`)).json();
return result.results;
}
async function getChapterInfo(chapterID) {
const result = await (await fetch(`https://api.mangadex.org/chapter/${chapterID}`)).json();

Setting up Webpack for any Typescript project from Scratch

Welcome to step by step hands-on guide to setup webpack in your upcoming typescript project. Please follow the steps and you should be able to create your own webpack project. Please download the source code from github.

You will learn below things:

  1. ✅Create a Typescript node.js project.
  2. ✅Install Dependencies with webpack & typescripts.
  3. ✅Use Webpack CLI to crate webpack.config.js file and modify webpack.config.js based on our need.
@nguyenit67
nguyenit67 / Postman-big-json-viewer.js
Last active April 16, 2022 14:46
Postman visualizer for large JSON data in the browser.
const responseJson = pm.response.json();
const resJsonString = JSON.stringify(responseJson);
const template = `
<link rel="stylesheet" href="https://unpkg.com/big-json-viewer/dist/default.css">
<script src="https://unpkg.com/big-json-viewer/dist/browser-api.js"></script>
<style>
body {
height: 100vh;
@nguyenit67
nguyenit67 / Postman-JSONPathPicker.js
Created January 22, 2022 17:14
Postman JSON Path Picker visualizer
const responseJson = pm.response.json();
const resJsonString = JSON.stringify(responseJson);
const template = `
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsonpath-picker-vanilla@1.2.3/lib/jsonpath-picker.min.css">
<script src="https://cdn.jsdelivr.net/npm/jsonpath-picker-vanilla@1.2.3/lib/jsonpath-picker.min.js"></script>
<style>
pre {
height: 90vh;