import chalk from 'chalk'
import fuzzysort from 'fuzzysort'
const findWord = 'lorem'
const resource = ['lorem ipsum', 'lorei mpsum', 'ipsum dolor', 'ipsum lor', 'losum remip', 'lor', 'loiem iplor']
console.log(
[...fuzzysort.go(findWord, resource.map(a => ({title: a})), { keys: ['title'] })]
.map(a => fuzzysort.highlight(a[0], (m) => chalk.yellow(m)))
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
" vim-bootstrap 2024-07-02 04:39:38 | |
"***************************************************************************** | |
"" Vim-Plug core | |
"***************************************************************************** | |
let vimplug_exists=expand('~/.vim/autoload/plug.vim') | |
if has('win32')&&!has('win64') | |
let curl_exists=expand('C:\Windows\Sysnative\curl.exe') | |
else | |
let curl_exists=expand('curl') |
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
const edge = require('edge-js'); | |
const getProcedures = edge.func('sql', { | |
source: "SELECT TOP 10 name FROM sys.procedures", | |
connectionString: "Persist Security Info=False;Integrated Security=true;Initial Catalog=<database>;server=<server>" | |
}); | |
const init = async () => { | |
const res = await new Promise((res, rej) => { | |
getProcedures(null, function (error, result) { |
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 'package:flutter/material.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
import 'package:isar/isar.dart'; | |
import 'package:path_provider/path_provider.dart'; | |
part 'test.freezed.dart'; | |
part 'test.g.dart'; | |
@freezed | |
@Collection(ignore: {'copyWith'}) |
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 'package:flutter/material.dart'; | |
import 'package:shared_preferences/shared_preferences.dart'; | |
void main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
final prefs = await SharedPreferences.getInstance(); | |
runApp(App( | |
themeController: ThemeController(prefs), |
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
/** | |
* @typedef {Object} MyObject | |
* @property {string} knownProperty - Известное свойство | |
*/ | |
/** | |
* @returns {MyObject & { [key: string]: any }} | |
*/ | |
function createObject() { | |
const obj = { |
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
if (typeof Object.create !== "function") { | |
/** Polyfill {@link https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/create#polyfill} */ | |
Object.create = (function () { | |
/** @constructor */ | |
function Temp() {} | |
return function (proto) { | |
if (proto === null || (typeof proto !== "object" && typeof proto !== "function")) { | |
throw TypeError("Object prototype may only be an Object or null: " + proto); | |
} |