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
$.fn.serializeObject = function() | |
{ | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function() { | |
if (o[this.name]) { | |
if (!o[this.name].push) { | |
o[this.name] = [o[this.name]]; | |
} | |
o[this.name].push(this.value || ''); |
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
.arrow { | |
height: 15px; | |
width: 0px; | |
border-top: 15px solid rgba(0,0,0,0.75); | |
border-right: 15px solid transparent; | |
border-left: 15px solid transparent; | |
bottom: -15px; | |
content: ''; | |
display: block; | |
} |
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
class Client | |
{ | |
public static TClient CreateInst<TClient, TInterface>(string url, string domain, string username, string password) | |
where TClient : System.ServiceModel.ClientBase<TInterface> | |
where TInterface : class | |
{ | |
BasicHttpBinding binding = new BasicHttpBinding(); | |
binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; | |
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; |
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
include( ../common.pri ) | |
TEMPLATE = app | |
SOURCES += main.cpp | |
LIBS += -L../logic -llogic \ | |
-L../gui -lgui | |
# Will build the final executable in the main project directory. |
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
Func<FakeEnumType, string> getName = en => | |
{ | |
var type = typeof(FakeEnumType); | |
var memInfo = type.GetMember(en.ToString()); | |
var attributes = memInfo[0] | |
.GetCustomAttributes(typeof(DisplayAttribute), false); | |
return ((DisplayAttribute)attributes[0]).Name; | |
} |
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
public static string GeneratePassword(string secret, long iterationNumber, int digits = 6) | |
{ | |
byte[] counter = BitConverter.GetBytes(iterationNumber); | |
if (BitConverter.IsLittleEndian) | |
Array.Reverse(counter); | |
byte[] key = Encoding.ASCII.GetBytes(secret); | |
HMACSHA1 hmac = new HMACSHA1(key, 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
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. |
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 countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); | |
} | |
function countSheet(sheet) { |
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 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 |
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
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 |
OlderNewer