Skip to content

Instantly share code, notes, and snippets.

import React, { useEffect, useState, useRef, useMemo, useCallback } from 'react';
import { Text, Editor, createEditor, Node, Range, Point, Transforms } from 'slate';
import {
Slate,
Editable,
withReact,
useSelected,
useFocused,
useSlate } from 'slate-react';
import { withHistory } from 'slate-history';
  1. IOC (Inverse of Control) Container Or service container. In software engineering, inversion of control (IoC) describes a design in which custom-written portions of a computer program receive the flow of control from a generic, reusable library. A software architecture with this design inverts control as compared to traditional procedural programming: in traditional programming, the custom code that expresses the purpose of the program calls into reusable libraries to take care of generic tasks, but with inversion of control, it is the reusable code that calls into the custom, or task-specific, code.

  2. SQL Query Order of Execution https://www.periscopedata.com/blog/sql-query-order-of-operations

> db.web_hook_log.find({"created_at" : {"$gte": new Date("2019-04-19T03:00:00.000Z"), "$lte": new Date("2019-04-19T07:00:00.000Z")}}).sort({created_at: -1}).limit(10);
{ "_id" : ObjectId("5cb9718b3de6331b5b689400"), "is_sent" : 0, "thread_id" : 392511, "text" : "★購入完了のお知らせ★\r\n\r\nご購入いただき誠にありがとうございました。\r\n\r\n購入完了のメールが届いていなくても、このメッセージが届いた場合は、問題なくご注文が完了しています。\r\n\r\n会員のお客様は、MyLC(マイエルシー)からご注文履歴を確認することができるので、下記よりご確認ください。\r\n\r\nhttps://secure.lovecosmetic.net/lcmy/lcChum.php?apv1=\r\n\r\n商品お届けまで今しばらくお待ちください。何かご不明な点がございましたら、チャット・メールでお問合せください。", "updated_at" : ISODate("2019-04-19T06:58:19Z"), "created_at" : ISODate("2019-04-19T06:58:19Z") }
{ "_id" : ObjectId("5cb9718b3de6331b5b689401"), "is_sent" : 0, "thread_id" : 392511, "text" : "★購入完了のお知らせ★\r\n\r\nご購入いただき誠にありがとうございました。\r\n\r\n購入完了のメールが届いていなくても、このメッセージが届いた場合は、問題なくご注文が完了しています。\r\n\r\n会員のお客様は、MyLC(マイエルシー)からご注文履歴を確認することができるので、下記よりご確認ください。\r\n\r\nhttps://secure.lovecosmetic.net/lcmy/lcChum.php?apv1=\r\n\r\n商品お届けまで今しばらくお待ちください。何かご不明な点がございましたら、チャット・メールでお問合せください。", "
var fnInsertIframe = function(base_url, _args) {
var dfIframe = $.Deferred();
_args.param = "top"
var url = base_url + "/web?" + $.param(_args)
if ($("#hidden-chatbot").length == 0) {
var iframe = document.createElement("iframe");
iframe.style.display = "none";
iframe.setAttribute("id", "hidden-chatbot");
iframe.setAttribute('width', '0');
iframe.setAttribute('height', '0');
<script>
(function (c, s, p) {
if (typeof $ === "undefined") {
var e = document.createElement('script');
e.async = 1;e.src = s + "/js/jquery.min.js";
var t = document.getElementsByTagName('head')[0];
t.parentNode.appendChild(e);
}
var fnAfterJquery = function () {
package main
import (
"fmt"
)
// NewQueue returns a new queue with the given initial size.
func NewQueue(size int) *Queue {
return &Queue{
nodes: make([]*Node, size),
package main
import (
"fmt"
)
// MinMax comment
func MinMax(A []int) (int, int) {
min := A[0]
max := A[0]
package main
import (
"fmt"
"strings"
)
func convert(s string, numRows int) string {
length := int(len(s))
@phanngoc
phanngoc / gist:aa3498900e0a1391d3e1032b23b7b548
Created September 23, 2018 03:54
Giới thiệu thuật toán Kd Trees (Nearest neighbour search)
### Sơ lược:
![](https://images.viblo.asia/b3abf531-2cae-46f8-9ada-435a195c89ab.png)
![](https://images.viblo.asia/0d821119-6fcf-4580-8e1c-647047ae67b3.png)
- Kd-trees dùng để tìm kiếm các dữ liệu gần, liên quan nhất (neighbouring data points) trong miền không gian 2 chiều, hoặc nhiều chiều.
- Kd-trees thuộc họ **Nearest neighbor (NN) search**.
### Tóm tắt:
1) Cách build Kd-trees từ tranning data:
- chọn 1 chiều random, tìm toạ độ trung bình, chia data theo toạ độ đó, lặp lại.
2) Cách tìm các dữ liệu liên quan cho point (7,4)
{id: 847, targetable: "CuQnLGy7glkTRgCIuwlwJxyzpTUAbtO6U34xEkSO", targetable_type: 0, is_touch: 0,…}
1
:
{id: 319, targetable: "46", targetable_type: 3, is_touch: 0, in_time: 1, note: "", operator_id: 1,…}
2
:
{id: 1, targetable: "1", targetable_type: 1, is_touch: 0, in_time: 1, note: "", operator_id: 0,…}
3
:
{id: 775, targetable: "41N8d2IDwu264m6QIL9B48LNrNWzYungJ5R9kT92", targetable_type: 0, is_touch: 0,…}