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 | |
// } | |
// } |
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
<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
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
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
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 fs = require("fs"); | |
const file = fs.readFileSync("sample.txt", "utf-8"); | |
const data = file.split(" "); | |
const findProfit = (buyStats) => { | |
let bestBuyTime = 0; | |
let bestProfit = 0; | |
let currentHodl = 0; | |
let currentValue = 0; | |
let lastHodl = 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
(* Combinatorica contains HasseDiagram,so we need to load it. *) | |
<<Combinatorica`; | |
(* The set the partial order operates on. *) | |
nums = {1, 2, 4, 7, 8, 14, 30}; | |
(* Define our partial order. *) | |
pOrder[x_, y_] := Divisible[y, x]; | |
(* Generate a directed graph from the partial order. *) |
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 request = require('request'); | |
var options = { | |
uri: 'https://www.googleapis.com/urlshortener/v1/url', | |
method: 'POST', | |
json: { | |
"longUrl": "http://www.google.com/" | |
} | |
}; |
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 request = require('request'); | |
var options = { | |
uri: 'https://www.googleapis.com/urlshortener/v1/url', | |
method: 'POST', | |
json: { | |
"longUrl": "http://www.google.com/" | |
} | |
}; |
NewerOlder