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
| import React, { useEffect } from "react"; | |
| import Header from "../components/Header"; | |
| import SiteMap from "../components/SiteMap"; | |
| import Link from "next/link"; | |
| const Index = ({ blogs }) => { | |
| console.log("This is a component"); | |
| useEffect(() => { | |
| console.log("Index mounted"); | |
| }); |
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
| # config_live_env.py | |
| URL = "https://now.vn" | |
| # config_test_env.py | |
| URL = "http://localhost" | |
| # config.py | |
| import os | |
| env = os.environ.get("APP_ENV", "TEST") |
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
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| ) | |
| var ( | |
| errInvalidID = errors.New("invalid id") | |
| ) |
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
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| "text/scanner" | |
| ) | |
| func test(str string) { | |
| fmt.Println(str, " ==> ", validate(str)) |
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
| # Add this to ~/.ssh/config | |
| Host <host_alias> | |
| HostName <server_ip> | |
| User <login_username> | |
| IdentityFile <ssh_key> |
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
| // Copyright 2019 LINE Corporation | |
| // | |
| // LINE Corporation licenses this file to you under the Apache License, | |
| // version 2.0 (the "License"); you may not use this file except in compliance | |
| // with the License. You may obtain a copy of the License at: | |
| // | |
| // http://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software | |
| // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
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
| //https://leetcode.com/problems/two-sum/description/ | |
| function twoSum(nums, target) { | |
| const reversedIndexMapping = {}; | |
| for (let i = 0; i < nums.length; i++) { | |
| const num = nums[i]; | |
| reversedIndexMapping[num] = i; | |
| } | |
| for (let i = 0; i < nums.length; i++) { |
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
| function parseFunctionSignature(s) { | |
| const typeRegex = "(int|string|float|bool|void)"; | |
| const nameRegex = "([a-zA-Z]\\w{0,19})"; | |
| const paramRegex = `${typeRegex}\\s+${nameRegex}`; | |
| const paramsListRegex = `(?:${paramRegex}(?:,\\s*${paramRegex})*)?`; | |
| const signatureRegex = `${paramRegex}\\(${paramsListRegex}\\)`; | |
| let matches = s.match(signatureRegex); | |
| matches = matches.filter(m => m !== undefined); | |
| const returnType = matches[1]; | |
| const functionName = matches[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
| // https://leetcode.com/problems/house-robber/description/ | |
| /** | |
| * @param {number[]} nums | |
| * @return {number} | |
| */ | |
| var rob = function(nums) { | |
| if (nums.length === 0) return 0; | |
| if (nums.length === 1) return nums[0]; | |
| const dynamicArray = [nums[0]]; |
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 express = require('express'); | |
| const http = require('http'); | |
| // Line 45 của em | |
| const app = express(); | |
| const server = http.Server(app); | |
| // Thay line 97 của em thành | |
| server.listen(port, () => console.log("...")); |