Skip to content

Instantly share code, notes, and snippets.

View stevenaw's full-sized avatar

Steven Weerdenburg stevenaw

  • Toronto, Canada
  • 07:19 (UTC -04:00)
View GitHub Profile
using System;
public class Program
{
public static void Main()
{
var fun = Enum.Parse(typeof(TestEnum), "B,C").ToString();
Console.WriteLine($"Result: {fun}");
}
@stevenaw
stevenaw / AODASearcher
Created February 1, 2016 16:06
Find all images on page missing alt tags
(function() {
var imgs = document.getElementsByTagName("img");
for(var i = 0, len = imgs.length; i<len; i++) {
var img = imgs[i];
var alt = img.getAttribute("alt");
var src = img.getAttribute("src");
if(!alt) {
console.warn("Image '" + src + "' has no alt tag!");
@stevenaw
stevenaw / gist:1305672
Created October 22, 2011 05:22
Convert a string to XML Node Structure
// Convert a string to XML Node Structure
// Returns null on failure
function textToXML ( text ) {
try {
var xml = null;
if ( window.DOMParser ) {
var parser = new DOMParser();
xml = parser.parseFromString( text, "text/xml" );
@stevenaw
stevenaw / gist:1252599
Created September 30, 2011 03:57
Absolute/relative positioning
<html>
<body>
<div style="position: absolute; top: 50px; left: 50px; width: 70px; height: 70px; background-color: blue">
<span style="position: relative; top: 10px; left: 10px; color: red;">Hi</span>
</div>
</body>
</html>
@stevenaw
stevenaw / Twitter pollsubscribe
Created September 24, 2011 05:48
Twitter poll/subscribe
<html>
<head>
<style type="text/css">
.selectedClass {
background-color: red;
}
#testTable {
cursor: pointer;
}
@stevenaw
stevenaw / Cookie management
Created September 17, 2011 16:47
Cookies
@stevenaw
stevenaw / HTML "Video" Wrapper
Created March 18, 2011 23:12
Mimicking the HTMLMediaElement Interface
<!DOCTYPE html>
<html>
<head>
<title>Custom HTML Video Wrapper</title>
<script>
var undef;
var numTicks = 0;
var msDelay = 250;
var MediaElement = {