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
use std::fmt::Debug; | |
use std::mem; | |
use crate::quad_tree::shape::{Point, Rectangle}; | |
pub struct QuadTree<TValue: Debug> { | |
root: HeapQuadTreeNode<TValue>, | |
} | |
impl<TValue: Debug + Copy + Clone> QuadTree<TValue> { | |
pub fn new() -> Self { |
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
// Database Language SQL (SQL-92) | |
// A | |
pub const ABSOLUTE : &str = "ABSOLUTE"; | |
pub const ACTION : &str = "ACTION"; | |
pub const ADD : &str = "ADD"; | |
pub const ALL : &str = "ALL"; | |
pub const ALLOCATE : &str = "ALLOCATE"; | |
pub const ALTER : &str = "ALTER"; | |
pub const AND : &str = "AND"; |
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
function toFormUrlencodedParams(obj) { | |
return Object.keys(obj) | |
.map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(obj[key])) | |
} | |
export default toFormUrlencodedParams |
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
function genRandomString (length) { | |
let text = '' | |
let possible = | |
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | |
for (let i = 0; i < length; i++) { | |
text += possible.charAt(Math.floor(Math.random() * possible.length)) | |
} | |
return text | |
} |
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
type FunctionTypeAsKey = number | string; | |
type ClusterFuncSignature<T> = (e: T) => FunctionTypeAsKey; | |
type Group<T> = { | |
[k in FunctionTypeAsKey] : Array<T> | |
} | |
function groupBy<T> (arr : Array<T>, func : ClusterFuncSignature<T>) { | |
const result = Object.create(null) as Group<T>; | |
arr.forEach(elem => { |