Skip to content

Instantly share code, notes, and snippets.

@developerdizzle
developerdizzle / index.html
Last active April 20, 2017 18:21
const predicate inside vs outside method scope (http://jsbench.github.io/#5115034c61a45940f7d022b9d94a5811) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>const predicate inside vs outside method scope</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@developerdizzle
developerdizzle / svg2font.js
Created December 3, 2015 03:18
WIP SVG to Ligature Font gulp task
var si2sf = require('svgicons2svgfont');
var svg2ttf = require('svg2ttf');
var fs = require('fs');
function toUnicode(theString) {
var unicodeString = '';
for (var i=0; i < theString.length; i++) {
var theUnicode = theString.charCodeAt(i).toString(16).toUpperCase();
while (theUnicode.length < 4) {
theUnicode = '0' + theUnicode;
@developerdizzle
developerdizzle / primus-ws-reconnect-client.html
Created September 28, 2014 15:35
Primus WS Reconnect client
<!doctype html>
<html lang="en" ng-app>
<head>
<title>Primus WS Reconnect Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-responsive.min.css">
<style>
body {
padding-top: 60px;
@developerdizzle
developerdizzle / primus-ws-reconnect-server.js
Last active August 29, 2015 14:07
Primus WS Reconnect server
/* server.js */
//
// # SimpleServer
//
// A simple chat server using Socket.IO, Express, and Async.
//
var http = require('http');
var path = require('path');
@developerdizzle
developerdizzle / bootstrap-typeahead-repeated.js
Last active August 29, 2015 14:05
Bootstrap Typeahead repeated/multiple suggestions
/*
While trying to figure out how to get typeahead to allow multiple suggestions/matches per textbox,
I found bassjobsen's awesome Bootstrap-3-Typeahead repo - https://github.com/bassjobsen/Bootstrap-3-Typeahead.
I was able to use that to accomplish what I wanted. I wasn't able to get it working with the latest typeahead.js.
It will let you continue typing after the first suggestion, and append future suggestions into the textbox.
*/
@developerdizzle
developerdizzle / bootstrap.filter.js
Created June 27, 2014 21:03
Bootstrap Filter plugin
(function ($) {
var lists = {};
function filterList($list) {
var shouldShow = function ($item) {
var filters = lists[$item.id];
for (var filter in filters) {
var className = filters[filter];
@developerdizzle
developerdizzle / IIS Rewrite Cheat Sheet
Last active September 18, 2023 08:22
IIS Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />
@developerdizzle
developerdizzle / ajax-loading.js
Last active December 18, 2015 10:19
jQuery/UpdatePanel busy/loading cursor
// html.ajax-loading { cursor: wait; }
define(['jquery'], function ($) {
$(function () {
var $html = $('html');
var $document = $(document);
var cssClass = 'ajax-loading';
var requests = 0;
function setBusy() {
@developerdizzle
developerdizzle / IEnumerable.Extensions.cs
Last active October 12, 2015 19:07
Dynamic OrderBy (similar to SQL ORDER BY)
public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> items, string sortExpression)
{
IEnumerable<T> sortedItems = items;
Action<string> orderBy = delegate(string orderByExpression) {
string[] temp = orderByExpression.Split(' ');
string property = String.Empty;
string direction = String.Empty;
if (temp.Length > 0)
@developerdizzle
developerdizzle / AutomaticGlassWindow
Created March 7, 2012 04:52
Base class for a WPF Window that automatically enables Aero/Glass effects (if available on Windows)
using System;
using Microsoft.WindowsAPICodePack.Shell;
namespace System.Windows
{
public class AutomaticGlassWindow : GlassWindow
{
public AutomaticGlassWindow() {
this.AeroGlassCompositionChanged += new EventHandler<AeroGlassCompositionChangedEventArgs>(AutomaticGlassWindow_AeroGlassCompositionChanged);
}