Skip to content

Instantly share code, notes, and snippets.

@DigiTec
DigiTec / event_init_dictionaries.webidl
Last active August 29, 2015 14:23
Samples for my event constructor series article at www.justrog.com
dictionary EventInit
{
boolean bubbles = false;
boolean cancelable = false;
};
dictionary UIEventInit : EventInit
{
Window? view = null;
long detail = 0;
@DigiTec
DigiTec / boilerplate.js
Last active August 29, 2015 14:23
Description of the FindNearbyWords Javascript Challenge
// @initialWord = DOMString
// @dictionary = sequence<DOMString>
// @@returns = sequence<DOMString>
var findNearbyWords = function (initialWord, dictionary) {
}
@DigiTec
DigiTec / readme.md
Last active August 29, 2015 14:23
FindNearbyWords Spoilers

Spoiler pages for the FindNearbyWords challenge

The goal of the exercise is to find an efficient way to take an existing word and lookup all words in a dictionary that differ from the original by only a single character. This is the kernel function for larger algorithmic problems like the Word Ladder, where you try to find the shortest route between two words, by changing one character at a time, and where each intermediate step must be in an intial dictionary of words.

Bruce Force

The simplest algorithm possible will take the input word and then compare it against every word in the dictionary, character by character, and count the differences. If the character differences between the word are just 1, then we add it to our list, otherwise we reject it. JavaScript has the Array.filter method which does precisely what we want and we just supply a function which returns true or false depending on if our criterion are met.

It is possible to optimize differsByOne further to get more benefits, but given t

@DigiTec
DigiTec / Flat_Data.json
Last active August 29, 2015 14:26
3 Days of Data Science Blog Entry Snippets
[
{ "iface" : "HTMLElement", "member": "className", "owner": "Jim" },
{ "iface" : "SVGElement", "member": "className", "owner": "Joe" },
{ "iface" : "SVGElement", "member": "style", "owner": "Jim" },
]
@DigiTec
DigiTec / webvr.Navigator.webidl
Last active December 20, 2015 23:13
Breakouts of the WebVR specification for embedding
partial interface Navigator
{
Promise<sequence<VRDevice>> getVRDevices();
}
@DigiTec
DigiTec / theme_incompatible_properties.css
Created December 23, 2015 02:52
List of properties which are theme incompatible for EdgeHTML. When setting these properties you will fall back from the Web Ruleset (read it as the modern control styling ruleset) to a much more basic set called the Base Ruleset with IE 11 mode specific overrides (Base+IE11) was our last set of updates, the two will be merged once a new update n…
/* At the time of first commit, each of thse properties was not immediately tested.
and each of the values using default is just to avoid typing a real value */
input {
/* pretty much any background change */
background: default;
background-color: default;
background-repeat: default;
background-position: default;
background-position-x: default;
background-position-y: default;
@DigiTec
DigiTec / settimeout.js
Created December 31, 2015 06:28
Source Code Links for my Blog Posting on Promises in EdgeHTML.
window.setTimeout(callback, 0); // Execute immediately!
@DigiTec
DigiTec / Potential Bug 1.cpp
Created February 15, 2016 21:31
Maybe a loophole/compiler bug in VS 2015 update 1 around static constexpr and embedding classes with vftable pointers
// Const Expr Playground.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
typedef void(*InitializeMethod)(int foo);
void InitMethod(int foo)
{
<html>
<body>
<script>
var currIter;
var iters;
var execNum;
var startedExecute;
var sch = 'sched';
var schNum = sch + ' ';
var exec = 'exec';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.