Skip to content

Instantly share code, notes, and snippets.

@DigiTec
DigiTec / ResourceTimingArbiter.js
Created December 16, 2012 00:35
Utilize the new PerformanceResourceTiming specification in order to figure out programmatically which resources in your website are misnamed by case only. This can help reduce redundant requests. This is a first crack at the API and only limited testing has been done. There may be URL canonicalization steps that could be made and restriction of …
"use strict";
Object.defineProperties(this, {
"ResourceTimingArbiter": {
value: (function () {
var _oldResources = [];
var _allDupes = [];
var _resourceArbiter = {};
var _escape = function(str) {
return "".replace.call(str, /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
@DigiTec
DigiTec / ServiceWrapper.js
Created December 2, 2012 04:21
A sample service wrapper that I'm using for wrapping all of my GET based Azure services.
"use strict";
if (typeof(Services) === "undefined")
{
Object.defineProperties(this, {
Services: {
value: {},
configurable: false,
writable: false
}
@DigiTec
DigiTec / PolyfillTransform.js
Created November 28, 2012 03:59
Quick and optimized poly-fill for transform that has fallbacks for IE 9 and WebKit based browsers.
(function () {
if (CSSStyleDeclaration.prototype.hasOwnProperty("transform")) {
}
else if (CSSStyleDeclaration.prototype.hasOwnProperty("msTransform")) {
Object.defineProperties(CSSStyleDeclaration.prototype, {
transform: {
get: function get_transform() {
return this.msTransform;
},
set: function set_transform(transform) {
@DigiTec
DigiTec / PackImages.cs
Created November 26, 2012 06:40
CSS Image Sprite Packer
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
public class PackImagesApplication
{
private static string cssFormat =
@DigiTec
DigiTec / UnsafeOverride.js
Created November 7, 2012 07:08
Polyfills unsafe functions in WWA so you can inject any content you want without security exceptions
"use strict";
if (window.MSApp && window.MSApp.execUnsafeLocalFunction) {
(function () {
var _originalWrite = Document.prototype.write;
var _originalWriteln = Document.prototype.writeln;
Object.defineProperties(Document.prototype, {
write: {
value: function write() {
@DigiTec
DigiTec / ImportWebSiteToWWA.cs
Created November 6, 2012 06:59
Imports files from a web site project into a WWA application to enable deploying to both without copying files.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.IO;
public class ImportWebSiteToWWA
{
private static void Main(string[] args)
{