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
-- find missing indexes | |
SELECT | |
conrelid::regclass, conname, reltuples::bigint | |
FROM | |
pg_constraint | |
JOIN pg_class | |
ON conrelid = pg_class.oid | |
WHERE | |
contype = 'f' | |
AND NOT EXISTS ( |
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
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
export default class NumericDirective { | |
constructor(input, binding) { | |
Object.assign(this, { | |
input, | |
binding | |
}); | |
input.addEventListener('keydown', this); |
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
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
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
-- 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); |
NewerOlder