View cachebuster-gruntfile.js
//using https://www.npmjs.com/package/grunt-cachebuster
module.exports = function(grunt) {
grunt.initConfig({
cachebuster: {
//appears you need a sub-task
'generate-hashes': {
options: {
//basedir: 'src/EHRSim.Web'
//basedir replacement does NOT work on windows, need to handle replacement on your own
formatter: function(hashes) {
View runalltests.cs
//All.Tests program.cs
public static int Main(string[] args)
{
var basepath = "./";
if (args.Length > 0)
{
basepath = args[0];
}
View gist:b99f3ba7898b99dac68f
public bool IsSignatureValid(HttpRequestBase request, string oauthSecret)
{
var context = _contextBuilder.FromHttpRequest(request);
//this is for when we are behind a load balancer that handles SSL duties
//client contacts https://oursite but load balancer directs request to http://oursite on the actual server
//this fundamentally changes the signature base of the request, forcing us to try validating both ways
var maybeSignedWithHttpsNotHttpUrlContext = _contextBuilder.FromHttpRequest(request);
maybeSignedWithHttpsNotHttpUrlContext.RawUri = new Uri(context.NormalizedRequestUrl.Replace("http:", "https:"));
View index.html
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<title>jQuery UI Example Page</title>
<link href="css/custom-theme/jquery-ui-1.10.1.custom.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.1.custom.js"></script>
<script>
$(function() {
View NullableIntegerAttribute.cs
using System.ComponentModel.DataAnnotations;
namespace Project.MvvmFramework.ValidationAttributes
{
public class NullableIntegerAttribute : ValidationAttribute
{
private readonly int _maxDigits;
private readonly string _propertyName;
const string MessageFormat = "{0} can only contain up to {1} numeric characters.";
View kernel.placeholder.js
(function () {
$.support.placeholder = false;
var test = document.createElement('input');
if ('placeholder' in test) {
$.support.placeholder = true;
return function () { }
} else {
return function () {
$(function () {
var active = document.activeElement;
View GithubTicketImporter.cs
using System;
using System.Collections.Generic;
using RestSharp;
namespace GithubTicketImporter {
class Program {
static IAuthenticator authenticator = new HttpBasicAuthenticator("uname", "pwd");
static string assemblaBaseUrl = "https://www.assembla.com/spaces/BrewTelligence/";
static string githubBaseUrl = "https://api.github.com/";
View DatabaseReCollatorMcJawn.sql
--desired collation for (var)char columns:
DECLARE @collationName VARCHAR(30)
SET @collationName = 'Latin1_General_CS_AI'
--build tables containing drop/create index queries
--http://www.sqlservercentral.com/scripts/Indexing/31652/
SELECT
REPLICATE(' ',4000) AS COLNAMES ,
OBJECT_NAME(I.ID) AS TABLENAME,
I.ID AS TABLEID,
View BuildAuthorizationKey.cs
/// <summary>
/// generates key to include in the "Authorization" request header
/// </summary>
/// <param name="accessKey">AWS access key</param>
/// <param name="secretKey">AWS secret key</param>
/// <param name="dateString">string included in the "x-amz-date" request header</param>
/// <returns>string to be used for signing request</returns>
static string BuildSignature(string accessKey, string secretKey, string dateString) {
var hmacSha1 = new HMACSHA1(Encoding.UTF8.GetBytes(secretKey));
var hashedDate = Convert.ToBase64String(hmacSha1.ComputeHash(Encoding.UTF8.GetBytes(dateString)));
View NHibernatePartialCollection.cs
[Test]
public void Limit_Collection_Contents_Criteria() {
var pepperoni = new Topping { Name = "pepperoni", Type = "meat" };
var cheese = new Topping { Name = "mozzarella", Type = "dairy" };
var cheesePizza = new Pizza() { Crust = "deep dish", Sauce = "red" }
.WithTopping(cheese);
var pepperoniPizza = new Pizza() { Crust = "deep dish", Sauce = "red" }
.WithTopping(cheese)