Skip to content

Instantly share code, notes, and snippets.

View nsbingham's full-sized avatar

Nathan Bingham nsbingham

  • optional
  • United States
View GitHub Profile
/*
* Original Sample: http://craftycodeblog.com/2010/05/15/asp-net-mvc-render-partial-view-to-string/
*/
public class HomeController : Controller
{
public ActionResult Index()
{
string MyModelData = "";
@nsbingham
nsbingham / gist:5014456
Created February 22, 2013 16:04
How to set your core editor to Sublime text on Windows 8
git config --global core.editor "'C:\Program Files\Sublime Text 2\sublime_text.exe'"
# Check that it worked by listing all your config variables
git config --global -l
@nsbingham
nsbingham / tidy-config.txt
Created March 31, 2013 15:56
Clean up a HTML generated by Word with HTML Tidy on OSX
# Install tidy
brew install tidy
# Export the Word doc as HTML
# Create a config file named tidy-config.txt like below
# Find more at http://tidy.sourceforge.net/
tidy -config tidy-config.txt -o cleaned.html -i dirty.htm
// Sniffing for IE
var isIE = navigator.userAgent.match( /MSIE\s(\d)/ );
if ( isIE && parseInt( isIE[ 1 ], 10 ) >= 9 ) {
executeAwesome();
} else {
alert( "This feature is not supported!" );
}
@nsbingham
nsbingham / gist:6284049
Created August 20, 2013 16:50
Example module with singletons
module ConfigManager {
export class Browser {}
export class Config {
name:String;
}
browser
.get(pageUrl)
.then(function(){
return browser.elementById("url");
})
.then(function(scaninput){
return browser.type(scaninput,'microsoft');
})
.then(function(){
return browser.elementById("check_site");
Uncaught Error: Error response status: 13.
at webdriver._newError (/usr/local/lib/node_modules/brewie/node_modules/wd/lib/webdriver.js:74:13)
at webdriver._callbackWithDataBase (/usr/local/lib/node_modules/brewie/node_modules/wd/lib/webdriver.js:150:25)
at Request.webdriver._jsonWireCall [as _callback] (/usr/local/lib/node_modules/brewie/node_modules/wd/lib/webdriver.js:345:5)
at Request.init.self.callback (/usr/local/lib/node_modules/brewie/node_modules/wd/node_modules/request/index.js:148:22)
at Request.EventEmitter.emit (events.js:99:17)
at Request.onResponse (/usr/local/lib/node_modules/brewie/node_modules/wd/node_modules/request/index.js:876:14)
at Request.EventEmitter.emit (events.js:126:20)
at IncomingMessage.Request.onResponse.buffer (/usr/local/lib/node_modules/brewie/node_modules/wd/node_modules/request/index.js:827:12)
at IncomingMessage.EventEmitter.emit (events.js:126:20)
Should we do ...
it("should do", function(done){
return class.hasTitle(browser, "home", done);
});
-- or --
it("should do", function(done){
var should = require('chai').should(),
config = require('config'),
http = require('http');
module.exports = function(){
var pageUrl = "http://www.cnn.com/testing";
console.log('loaded?');
@nsbingham
nsbingham / anatomy-of-a-brewie-test.js
Last active December 22, 2015 05:28
This example show the structure of a base brewie test.
// Anatomy of a brewie test
// The test below will check whether the form on the bottom of modern.IE's homepage
// triggers a test when the URL www.microsoft.com is entered and the 'Scan' button
// is clicked.
// Import chai.js's should module
var should = require('chai').should();
// Tests follow mocha's BDD-style syntax