Skip to content

Instantly share code, notes, and snippets.

View llCorvinSll's full-sized avatar

Dmitry Pronin llCorvinSll

View GitHub Profile
@llCorvinSll
llCorvinSll / new_gist_file.sql
Created March 25, 2015 12:59
T-SQL LEAD() example select rows with time interval between more then 1 hour
select *, DATEDIFF(second,StartTime,NextStart) from (SELECT data.Id, data.RawValue, data.RawName, data.StartTime, LEAD(data.StartTime) OVER (ORDER BY data.StartTime) NextStart, data.EndTime FROM [UsageEventDatas] as data where data.ObjectId = '00000000-0000-0000-0000-000000000000' and data.RawName LIKE 'CPUPercentUtilization-A%' and data.StartTime > CONVERT(datetime, '2015-02-27') and data.EndTime < CONVERT(datetime, '2015-03-01') ) as data where DATEDIFF(second,StartTime,NextStart) > 3600
@llCorvinSll
llCorvinSll / waitfor_condition.js
Created December 11, 2014 09:49
wait for some condition resolved in JS ugly hack ):
//**********************************************************************
// function waitfor - Wait until a condition is met
//
// Needed parameters:
// test: function that returns a value
// expectedValue: the value of the test function we are waiting for
// msec: delay between the calls to test
// callback: function to execute when the condition is met
// Parameters for debugging:
// count: used to count the loops
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text.RegularExpressions;
/// <summary>
/// Provides advanced migrations by providing a seeding platform for each migration.