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 breaks code for parts with span tags and according styles, but skips &*; html-symbol combinations and tag <br> | |
* | |
* @param string | |
* String to parse. | |
* @returns {string} | |
* Parsed string. | |
*/ | |
this.highlightHTML = function(string) { | |
return string.replace(/(\/\*.*?(?=\*\/)\*\/)|([0-9]+\.?[0-9]+?)|(((<|&|&#)|(\^%?)|\/|\${0,3}|#{0,2}|%|\.|(\.\.))?[A-Za-z0-9]+[;>]?)|[{}\]\[\(\)!_'\\#\?\+\-\*\/=<>,]|("[^"]*")/g, |
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
/** | |
* Converts any date to "DD.MM.YYYY, hh:mm:ss" string. | |
* Workaround for NodeJS Date.toLocaleString implementation. | |
* | |
* @param {Date} date - Date to format. | |
* @returns {string} - Formatted date string. | |
*/ | |
var formatDate = function (date) { | |
return date.toISOString().replace(/(\d+)\-(\d+)\-(\d+)T\s?([^\.]*)\..*/, "$3.$2.$1, $4"); | |
}; |
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
/* | |
Pure CSS solution for centering content always on middle center of parent relative block. | |
*/ | |
.central { | |
position: absolute; | |
left: 0; | |
top: 0; | |
width: 100%; | |
height: 100%; |
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
/** | |
* Returns the cell of the table by given (x;y) coordinates considering colSpan and rowSpan of the cells. | |
* @param {HTMLElement} table - HTML table | |
* @param {number} x - X position in table matrix | |
* @param {number} y - Y position in table matrix | |
* @returns {HTMLElement|null} | |
*/ | |
var getTableCell = function (table, x, y) { | |
var m = [], row, cell, xx, tx, ty, xxx, yyy; | |
for(yyy = 0; yyy < table.rows.length; yyy++) { |
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
/** | |
* Code snippet for students ^^ | |
* Tarnavsky used this function to find t^-1 from prime number t and m. | |
* Usage: var tMinusOne = getRevT(m, t); | |
* Test case 1: getRevT(121, 5) === 97 | |
* Test case 2: getRevT(9, 7) === 13 | |
*/ | |
function getRevT (m, t) { | |
function stage (a, b) { | |
var r = a % b, q = Math.floor(a/b); |
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
<Routes> | |
<!-- Self-documenting links variant: allow <Route> tag to nest additional info --> | |
<Route Url="/posts" Method="GET" Call="ShowPosts"> | |
<!-- One of many variants, most applicable for Caché XData scheme on my opinion --> | |
<!-- Nested <Link>s tell what we can do with the current element --> | |
<Link rel="add" method="POST" href="/posts"/> | |
<Link rel="next" method="POST" href="/posts/:page"/> | |
<!-- Nested <LinkGroup>s tell what we can do with the content on the page --> | |
<LinkGroup name="post"> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2016.2 (Build 590U)" ts="2016-03-15 00:40:16"> | |
<Class name="MyPackage.Installer"> | |
<CompileAfter>MyPackage.REST</CompileAfter> | |
<Super>%Projection.AbstractProjection</Super> | |
<TimeChanged>63992,1953.207424</TimeChanged> | |
<TimeCreated>63992,1916.587195</TimeCreated> | |
<Parameter name="WebAppName"> | |
<Type>%String</Type> |
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
/** | |
* Semantic versioning versions compare. | |
* @param {string} high | |
* @param {string} low | |
* @returns {boolean} | |
* @author ZitRo ([email protected]) | |
* @license MIT http://www.opensource.org/licenses/mit-license.php | |
*/ | |
function versionGT (high, low) { | |
let v1 = high.split(/[\-\.]/g), |
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
/// Original: https://github.com/eduard93/Utils/blob/master/Utils/REST.cls.xml | |
Class Utils.REST Extends %CSP.REST | |
{ | |
XData UrlMap | |
{ | |
<Routes> | |
<Route Url="/file" Method="GET" Call="GET"/> | |
</Routes> | |
} |
OlderNewer