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
<?php | |
/** | |
* @file classes/search/ArticleSearchDAO.php | |
* | |
* Copyright (c) 2014-2021 Simon Fraser University | |
* Copyright (c) 2003-2021 John Willinsky | |
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | |
* | |
* @class ArticleSearchDAO |
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
<?php | |
print_r(optimizeCountQuery( | |
'SELECT (SELECT drop FROM expensive WHERE true = ?) AS subquery | |
FROM table | |
WHERE (SELECT ?) = param | |
ORDER BY not_needed_for_count, drop = ?', | |
[true,'param', true] | |
)); | |
/* |
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
-- Convert | |
SELECT CONVERT(CAST(CONVERT('São Paulo' USING latin1) AS BINARY) USING utf8) -- São Paulo | |
-- Our lovely friends celebrate ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö \o/ | |
-- Poor man's bad encoding detection (in my case there was LATIN1 data mixed with UTF8 in the database and I just wanted to find when things started to get mixed up) | |
-- When trying to convert, normally the amount of characters decrease... | |
SELECT field | |
FROM table | |
WHERE LENGTH(CONVERT(CAST(CONVERT(field USING latin1) AS BINARY) USING utf8)) < LENGTH(field) |
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
var value = 0.1230000000000000M; | |
Console.WriteLine(value); | |
Console.WriteLine(value / 1.0000000000000000000000000000M); |
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 comparer = new Intl.Collator('ru', { numeric: true }).compare; | |
console.log(comparer('ф', 'в')); //returns -1, 0, 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
export default class TooltipOnOverflowDirective { | |
static install (Vue) { | |
Vue.directive('tooltip-on-overflow', this.directive); | |
} | |
static directive = { | |
bind (el) { | |
for (const event of ['mouseover', 'mouseout']) { | |
el.addEventListener(event, TooltipOnOverflowDirective[event]); | |
} |
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
export default { | |
install: Vue => Vue.filter('format-number', (value, { thousand = ' ', decimal = '.', decimals = null, maxDecimals = decimals, minDecimals = decimals, normalize = true, roundToEven = true } = {}) => { | |
value = normalize ? normalizeNumber(value) : `${value != null ? value : ''}`; | |
let pieces = value.split('.'); | |
if (!pieces[0].length) { | |
return; | |
} | |
if (minDecimals > 0) { | |
pieces[1] = (pieces[1] = pieces[1] || '').padEnd(minDecimals, '0'); |
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 | |
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
namespace JonasRaoni | |
{ |
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
[\x00-\x7F] # ASCII | |
|[\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | |
|\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | |
|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | |
|\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | |
|\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | |
|[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | |
|\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 |
NewerOlder