let arr0 = [1, 3, 4, 5, [1]];
let arr1 = [1, 2, 3, [1, [2, { a: 3 }], 4, [2, 3, 4]]];
function flatten(input) {
const stack = [...input];
const res = [];
let i = 0;
while (stack.length) {
This file contains 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
model | |
from sqlalchemy.dialects.postgresql import JSON | |
class JSONModel(Model): | |
__bind_key__ = 'APP_DB' | |
__tablename__ = 'json_model' | |
id = Column(Integer, primary_key=True) |
This file contains 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 socket | |
HOST = '127.0.0.1' | |
PORT = 65432 | |
def send_command(conn, command): | |
conn.sendall(command.encode()) | |
while True: | |
data = conn.recv(1024) | |
if not data: |
This file contains 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 socket | |
import subprocess | |
HOST = '127.0.0.1' | |
PORT = 65432 | |
def handle_client(conn): | |
try: | |
while True: | |
# 接收数据 |
This file contains 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
img_gist |
This file contains 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
find ~/Desktop/xxx/ -name "*.ext" -exec mv -i {} -t ~/Desktop/xxx \; |
This file contains 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
Reassign const | |
const { type, title, description } = MAP[status]; | |
({ type, description } = MAP[status]); |
This file contains 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 calculate = function (s) { | |
const stackData = lexer(s); | |
// console.log({stackData}); | |
return run(stackData); | |
}; | |
function run(stack) { | |
let pos = 0; |
This file contains 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
// the function is to make sure the answer is correctly return | |
async function runSequentially(functions) { | |
const resolveLists = [] | |
for (const fu of functions) { | |
resolveLists.push(await fu()); | |
}; | |
return resolveLists; | |
} |
This file contains 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> | |
<ul> | |
<li | |
v-for="(todolist, index) in TodoLists" | |
:key="index" | |
> | |
<span class="name">{{todolist.name}}</span> | |
<span | |
class="delete" | |
@click="Delete(todolist.id)" |
NewerOlder