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 / removeDuplicates.ts
Last active April 15, 2022 17:30
Remove Duplicated Items
/**
* Remove all duplicate items from an array in TypeScript
*/
function
@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 / 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) {
- 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 / 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={} />
@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