Skip to content

Instantly share code, notes, and snippets.

View amazingandyyy's full-sized avatar
🦄

Andy Chen amazingandyyy

🦄
View GitHub Profile
/**
* @param {number[]} prices
* @return {number}
*/
var maxProfit01 = function(prices) {
// time: O(N^2)
// space: O(1)
if(prices.length<=1) return 0;
// max = second - first; -6
let max = prices[1] - prices[0];
/**
* @param {number[]} nums
* @return {number}
*/
var maxSubArray01 = function(nums) {
// O(N^2), O(1)
let max = nums[0];
for(let i=0;i<nums.length; i++) {
let currentSum = 0;
for(let j=i;j<nums.length; j++) {
db.find({
$and: {
[`open_hour.${day}.from`]: { $lte: time },
[`open_hour.${day}.to`]: { $gte: time }
}
})
console.log("hello world")
const message: string = 'deno';
console.log('hello', message)
import Loader from '@amazingshellyyy/loader';
<Loader type='circle-spinner' color='success' size='sm/md/lg' speed='slow' />
<Loader type='square-spinner' color='danger' size='sm/md/lg' speed='normal' />

Linux

  • commands
  • system

Docker

  • Why docker/VM?
  • dockerfile & commands

Kubernetes

  • minikube
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Beef Burrito</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" ></script>
</head>
<body>
<div class="draggable" style="border: 1px solid black; width: 50px; height: 50px; position: absolute; top: 0px; left: 0px;">asdasd</div>
"1@23@@678@abc@".match(/(@*(\d|[abcd]){3,}@*)/g).join("").length === 13
const unix = Date.now()
const d = new Date(unix);
// try out
console.log('toDateString ', d.toDateString())
console.log('toTimeString ', d.toTimeString())
console.log('toLocaleDateString', d.toLocaleDateString())
console.log('toLocaleTimeString', d.toLocaleTimeString())
console.log('getMonth', d.getMonth())
console.log('getDate', d.getDate())
console.log('getHours', d.getHours())