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
/(["'`])(?:\\.|(?!\1).)*?\1/ |
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
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
const signalR = require('@aspnet/signalR'); | |
export default class Hub { | |
constructor (url, autoReloadTimeout = 1000) { | |
Object.assign(this, { | |
url, | |
autoReloadTimeout, |
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
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
export default class ServerTime { | |
constructor ({http = new Error('http parameter is required'), url = new Error('url is required'), thresholdDelay = 300, autoSynchronizeProbes = 0}) { | |
Object.assign(this, { | |
http, | |
url, | |
thresholdDelay, | |
best: null |
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
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
export default function debounce (action, delay) { | |
let handle; | |
return function (...args) { | |
if (handle) { | |
clearTimeout(handle); | |
handle = null; | |
} |
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
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
export default (...values) => Math.max(...values.map(value => | |
(value = (value + '').split(/[.,]/)).length > 1 && value.pop().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
function numberToOrdinal(n) { | |
const | |
number = Math.abs(n) || 0, | |
units = number % 10, | |
tens = ~~(number % 100 / 10), | |
suffix = new Map([ | |
[1, 'st'], | |
[2, 'nd'], | |
[3, 'rd'] | |
]); |
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
/* | |
There is a table in database. This table contains unduplicated natural numbers. There may be gaps in the sequence of natural numbers in the table. You need to output missing numbers. | |
Table of natural numbers: declare @values as table ([number] int not null). | |
Test data: insert into @values([number]) values (1), (2), (3), (5), (9). | |
Result: declare @missing as table ([left] int not null, [right] int not null). | |
*/ | |
DECLARE @values AS TABLE ([number] INT NOT NULL); | |
INSERT INTO @values([number]) VALUES (1), (2), (3), (5), (9); | |
DECLARE @missing AS TABLE ([left] INT NOT NULL, [right] INT NOT NULL) |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Extends the Array with the Flatten method | |
/// </summary> | |
public static class Flattener { | |
/// <summary> | |
/// Given a N-dimensional array, flattens it into a new one-dimensional array without modifying the elements' order |
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
{"lastUpload":"2021-11-02T08:34:50.367Z","extensionVersion":"v3.4.3"} |
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
EXEC sp_addlinkedserver @server='SERVER_ADDRESS'; | |
EXEC sp_addlinkedsrvlogin @rmtsrvname='SERVER_ADDRESS',@useself=false, @rmtuser='USER', @rmtpassword='PASSWORD'; | |
-------------- | |
INSERT INTO LOCAL_TABLE | |
SELECT * | |
FROM | |
[SERVER_ADDRESS].DATABASE.dbo.REMOTE_TABLE |