This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Obviously for educative purposes only. | |
Furthermore, this DOESN'T activate BabelEdit permanently. | |
If you like the software, buy it, the devs deserve it. | |
Since I have no money to buy it, I discovered a workaround for unlimited trials. | |
It's quite a annoying workaround, but ... it works! | |
Firstly go to "c:\windows\system32\drivers\etc\" and open the "hosts" file in Notepad/Notepad++/VSCode/Sublime/Atom/whatever as admin (if you don't open it as admin, it won't let you save it). | |
Add this line at the end of the file: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.4 | |
import urllib.request | |
import asyncio | |
def return_response(url): | |
return urllib.request.urlopen(url).read() | |
@asyncio.coroutine | |
def read_page(loop, url): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 - Autos & Vehicles | |
1 - Film & Animation | |
10 - Music | |
15 - Pets & Animals | |
17 - Sports | |
18 - Short Movies | |
19 - Travel & Events | |
20 - Gaming | |
21 - Videoblogging | |
22 - People & Blogs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var time = function(length) { | |
return new Promise (function (resolve, reject) { | |
setTimeout(function () { | |
if(length > 10000) { | |
reject ('Quá lâu để chờ đợi! \n Thời gian thực hiện là ' + length/1000 + ' giây!'); | |
} | |
else { | |
resolve ('Thời gian thực hiện ' + length/1000 + ' giây!'); | |
} | |
}, length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generator function là một function, có khả năng tạm ngưng thực thi trước khi hàm kết thúc, và có thể tiếp tục chạy ở 1 thời điểm khác. | |
// --------- Ví dụ đơn giản | |
function* Op(name) { | |
yield name * 5; // Thực thi lần thứ 1 | |
yield name; // Thực thi lần thứ 2 | |
} | |
const call = Op(4); | |
console.log(call.next().value); // Lần gọi thứ 1 | |
console.log(call.next().value); // Lần gọi thứ 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .split(); | |
//=>String -> Array | |
var str = 'Tran Duc Linh'; | |
var words = str.split(' '); | |
console.log(words[2]); | |
// "Linh" | |
// Khi tạo khoảng trắng bên trong ngoặc đơn, mỗi index là 1 cụm từ. | |
var chars = str.split(''); | |
console.log(chars[5]); | |
// "D" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MAP | |
let arr1 = [1,2,4]; | |
let arr2 = arr1.map(X=>X*2); | |
console.log(arr2); //[2, 4, 8] | |
console.log(arr1); //[1, 2, 4] | |
//Việc thực thi mảng sẽ diễn ra theo trình tự clone rồi mới sửa (tránh phá nát mảng ban đâu), sau đó đưa kết quả cho arr2. | |
//FILTER | |
let arr1 = [1,2,4]; | |
let arr2 = arr1.filter(X=>X>3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7]; | |
console.log(a, b); // 1, 2 | |
console.log(arr); // [3, 4, 5, 7] | |
// => a = [0], tương tự vậy b[1], nhưng ...arr sẽ lấy hết các phần còn lại bao gồm arr[n++] tiếp theo sau đó. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tách các phần tử của Array hoặc Object thành nhiều biến chỉ bằng một đoạn code duy nhất. | |
//Array [a,b,c] | |
let date_Array = [20,06,1997] | |
let [,, c] = date_Array; | |
console.log(c); | |
//Object {d,m,y} | |
let date_Object = { day : 20, month : 06, year : 1997 } | |
let {day : d, month : m, year : y} = date_Object; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var abc = ['a','b','c'], def = ['d','e','f']; | |
var sum = [...abc, ...def]; | |
console.log(sum); | |
//Result: ["a", "b", "c", "d", "e", "f"] |
NewerOlder