Skip to content

Instantly share code, notes, and snippets.

View deanhume's full-sized avatar
🎮
Gaming

Dean deanhume

🎮
Gaming
View GitHub Profile
@deanhume
deanhume / PDFjs.html
Created October 12, 2011 07:29
PDF.js File Includes
<!doctype html>
<html>
<head>
<!-- PDF.js-specific -->
<script type="text/javascript" src="../../pdf.js"></script>
<script type="text/javascript" src="../../metrics.js"></script>
<script type="text/javascript" src="../../fonts.js"></script>
<script type="text/javascript" src="../../glyphlist.js"></script>
@deanhume
deanhume / PDFjs-HelloWorld.html
Created October 12, 2011 07:33
PDF.js Hello World
<script type="text/javascript">
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
//
// See README for overview
//
'use strict';
@deanhume
deanhume / gist:1316935
Created October 26, 2011 16:40
Selenium Webdriver Explicit Wait
[Test]
public void Search_ShouldReturn_CorrectRestaurantName_WithExplicitWait()
{
_driver.Navigate().GoToUrl("http://www.bookatable.com/");
// Find the search box and type some text
IWebElement searchBox = _driver.FindElement(By.Name("ddRestaurants"));
searchBox.Click();
@deanhume
deanhume / gist:1316944
Created October 26, 2011 16:45
Selenium Webdriver Implicit Wait
[Test]
public void Search_ShouldReturn_CorrectRestaurantName_WithImplicitWait()
{
_driver.Navigate().GoToUrl("http://www.bookatable.com/");
// Find the search box and type some text
IWebElement searchBox = _driver.FindElement(By.Name("ddRestaurants"));
searchBox.Click();
@deanhume
deanhume / gist:1319242
Created October 27, 2011 10:33
Selenium Webdriver Element
[Test]
public void Search_ShouldReturn_CorrectRestaurantName()
{
_driver.Navigate().GoToUrl("http://www.bookatable.com/");
// Find the search box and type some text
IWebElement searchBox = _driver.FindElement(By.Name("ddRestaurants"));
searchBox.Click();
@deanhume
deanhume / WebWorkers.cs
Created November 29, 2011 11:09
HTML5 WebWorkers
namespace WebWorkersExample.Controllers
{
public class HomeController : Controller
{
public ActionResult WebWorkers()
{
return View();
}
}
}
@deanhume
deanhume / WebWorkersView.aspx
Created November 29, 2011 11:34
HTML5 WebWorkers
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE HTML>
<html>
<head>
<title>Web Worker Example</title>
<script src="<%= Url.Content("~/scripts/modernizr-1.7.min.js") %>"></script>
</head>
<body>
<p>Result: <output id="result"></output></p>
@deanhume
deanhume / logstats.js
Created November 29, 2011 14:12
Web Workers - Log Stats
var request = new XMLHttpRequest();
request.open('POST', '/home/UpdateStats', false);
request.send(null);
if (request.status == 200)
postMessage(request.responseText);
@deanhume
deanhume / UpdateStats.cs
Created November 29, 2011 14:31
Web Workers - Update Stats Controllker
public JsonResult UpdateStats()
{
Thread.Sleep(5000);
return Json("Success", JsonRequestBehavior.AllowGet);
}
@deanhume
deanhume / IndexAsync.cs
Created January 16, 2012 13:34
Async Controller - IndexAsync()
public void IndexAsync()
{
AsyncManager.OutstandingOperations.Increment(2);
Task.Factory.StartNew(() =>
{
// Perform some expensive operation
string uri = "http://www.deanhume.com";
WebClient client = new WebClient();