Skip to content

Instantly share code, notes, and snippets.

View long25vn's full-sized avatar
🌴
On vacation

Nguyễn Thành Long long25vn

🌴
On vacation
View GitHub Profile
@long25vn
long25vn / go-os-arch.md
Created September 4, 2019 09:17 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@long25vn
long25vn / template-literals-3-for-loops.js
Created June 6, 2019 17:23 — forked from wiledal/template-literals-3-for-loops.js
Template Literals example: For loops
/*
Template literals for-loop example
Using `Array(5).join(0).split(0)`, we create an empty array
with 5 items which we can iterate through using `.map()`
*/
var element = document.createElement('div')
element.innerHTML = `
<h1>This element is looping</h1>
${Array(5).join(0).split(0).map((item, i) => `
@long25vn
long25vn / gist:cb7cf7063054387f19f38da4f7e2d652
Created April 2, 2019 08:13 — forked from hSATAC/gist:5343225
Http Redirect in Golang
package main
import (
"log"
"net/http"
)
func redirect(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "http://www.google.com", 301)
http://laptrinhvien.bachkhoa-aptech.edu.vn/?utm_source=GA&utm_team=OP&utm_term=&utm_medium=Search&utm_campaign=HDSE&utm_content=aptech&&gclid=Cj0KCQjwyoHlBRCNARIsAFjKJ6AZ7k0kL9LyAghqqodB0J8rUues_WHFKe_IRnKJvtAGnRjmJkBDQAMaAiW1EALw_wcB&fbclid=IwAR3_GmEQ7MKTuoyVpEchAwkSTHgtbUhE9m-NJGCrKVXQRrEETnSbKgjyOKA
http://www.tranngocsinh.com/dutdiemdaday?fbclid=IwAR3E7eTBboHAZdjyUKEpj6NoQ-UK2nZPudY6rzBkqWGhOkBnlCD4sWuX5FY

Callback - JavaScript Higher-order Functions

Hàm Callback - Hàm nâng cao trong Javascript

Hàm Callback

Định nghĩa:

Trong javascript, các hàm là một first-class objects (hay gọi là các đối tượng định nghĩa sẵn), vì thế nên hàm là một instance của Object, và được sử dụng như các object khác như String,Array,Number,...Và vì chính nó là một đối tượng, Function có thể:

@long25vn
long25vn / README.md
Created February 12, 2019 01:27 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@long25vn
long25vn / Promise.md
Created January 1, 2019 15:07
Promise

Promise

Sử dụng Promise trong Nodejs với Bluebird

Định nghĩa:

Promise là đối tượng trong javascript mô tả sự hoàn thành hay thất bại của một tiến trình bất đồng bộ và trả về giá trị biểu hiện sự hoàn thành hay thất bại đó.

Syntax:

new Promise(/*hàm thực thi*/(resolve,reject)=>{
@long25vn
long25vn / __replit_main__
Created November 26, 2018 10:01
Doomsday created by long25vn - https://repl.it/@long25vn/Doomsday
//https://en.wikipedia.org/wiki/Doomsday_rule
#include <stdio.h>
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
main()
{
@long25vn
long25vn / Golang program stdin stdout interaction.md
Created November 19, 2018 07:22 — forked from jamesrr39/Golang program stdin stdout interaction.md
Using stdout and stdin from other programs in Golang

Go program interaction

Example of how to use stdout and stdin from other programs in golang

Requires go

Run

go run parentprocess.go
@long25vn
long25vn / main.go
Created November 19, 2018 07:19 — forked from eduncan911/main.go
Go/Reading Console Inputs
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {