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 fs = require("fs"); | |
| const file = fs.readFileSync("str.txt", "utf-8"); | |
| const removeDuplicateChar = (str) => { | |
| return str.filter((v, idx) => { | |
| const f = str.lastIndexOf(v);; | |
| if (f && idx !== f) { | |
| str.splice(f, 1); | |
| } | |
| return v; | |
| }); |
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 list = []; | |
| class Factor { | |
| constructor(factor, total) { | |
| this.factor = factor; | |
| this.total = total || []; | |
| this._findTotalFactor() | |
| } | |
| _findTotalFactor() { | |
| for(let i = 1; i <= this.factor; 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
| CREATE OR REPLACE FUNCTION distance(lat1 FLOAT, lon1 FLOAT, lat2 FLOAT, lon2 FLOAT) RETURNS FLOAT AS $$ | |
| DECLARE | |
| x float = 111.12 * (lat2 - lat1); | |
| y float = 111.12 * (lon2 - lon1) * cos(lat1 /92.215); | |
| BEGIN | |
| RETURN sqrt(x * x + y * y); | |
| END | |
| $$ LANGUAGE plpgsql; // km |
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
| <template> | |
| <div> | |
| </div> | |
| </template> | |
| <script> | |
| import CryptoJs from "crypto-js" | |
| export default { | |
| name: "", | |
| data(){ |
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" | |
| "sort" | |
| ) | |
| // var listInts []int = []int{9, 4, 5, 6, 7} | |
| var Pages = [][]string{ |
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
| // "Given any JSON object. Please write a function to convert it to dot-notation object. | |
| // { | |
| // ""key"": { | |
| // ""value1"": 100, | |
| // ""value2"": 200, | |
| // ""nested"": { | |
| // ""inside"": true | |
| // } | |
| // } |
OlderNewer