Skip to content

Instantly share code, notes, and snippets.

View trkhanh's full-sized avatar

Tran Khanh trkhanh

View GitHub Profile
@trkhanh
trkhanh / clọck.html
Created September 24, 2019 14:27
Clock
<!DOCTYPE html>
<html>
<body>
<canvas id="canvas" width="400" height="400"
style="background-color:#333">
</canvas>
<script>
var canvas = document.getElementById("canvas");
@trkhanh
trkhanh / go_client.go
Created January 12, 2020 14:24
go_client.go
package main
import (
"fmt"
"net"
"strconv"
"time"
)
func CheckError(err error) {
@trkhanh
trkhanh / History.js
Last active February 3, 2020 03:22
History Single Page
function supports_history_api() {
return !!(window.history && history.pushState);
}
function swapPhoto(href) {
var req = new XMLHttpRequest();
req.open("GET",
"http://diveintohtml5.info/examples/history/gallery/" +
href.split("/").pop(),
false);
@trkhanh
trkhanh / cleancode.md
Created February 13, 2020 15:58
Cleancode summary

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@trkhanh
trkhanh / gist:8649507abd37fd353ec7ad7ac19b2a2a
Created March 22, 2020 09:34
Remote, Office Not Required
# Remote, Office Not Required
## The Time is Right for Remote Work
### Why work doesn't happen at work
The office during the day has become the last place people want to be when then
really want to get work done.
Offices have become interruption factories: it's just one interruption after
@trkhanh
trkhanh / remotework.md
Last active April 26, 2020 08:06
Từ xa, không cần văn phòng

Từ xa, không cần văn phòng

Thời gian phù hợp cho công việc từ xa

Tại sao công việc không xảy ra tại nơi làm việc

Văn phòng vào ban ngày đã trở thành nơi cuối cùng mọi người muốn đến thực sự muốn hoàn thành công việc

Các văn phòng đã trở thành các nhà máy bị gián đoạn: đó chỉ là một gián đoạn sau

@trkhanh
trkhanh / todos.cs
Last active April 26, 2020 05:14
TodoC#
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
@trkhanh
trkhanh / khoasuabai.cs
Last active May 17, 2020 04:52
KhoaSuaBai
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.IO;
using System.Text;
using System.Threading.Tasks;
var build = [];
var anwPool = [];
var _RANDOM_QUESTION_EXTEND_ = 2;
var QUES_COL = 2
var ANS_COL = 0
var EX_COL = 1
function random_sort(a, b) {
return 0.5 - Math.random();
}