Skip to content

Instantly share code, notes, and snippets.

View vgashic's full-sized avatar

Vladimir Gasic vgashic

  • Belgrade, Serbia
View GitHub Profile
@vgashic
vgashic / formatNumber.js
Created April 9, 2017 01:14
JavaScript format number based on pattern
function formatNumber(numbers, pattern){
//var pattern = '(999) 999-9999';
var patternArray = pattern.split('').map(function(x) { return isNumber(x) ? null : x; });
var resultArray = [];
var pos = 0;
for (var i = 0; i < patternArray.length; i++) {
if (patternArray[i] === null) {
@vgashic
vgashic / new_gist_file.sql
Last active March 10, 2016 14:40
All tables row count (SQL Server)
SELECT SUBSTRING(obj.name, 1, 50) AS Table_Name
,ind.rows AS Number_of_Rows
FROM sysobjects AS obj
INNER JOIN sysindexes AS ind ON obj.id = ind.id
WHERE obj.xtype = 'U'
AND ind.indid < 2
AND ind.rows > 0
ORDER BY obj.name