Skip to content

Instantly share code, notes, and snippets.

View jcreamer898's full-sized avatar
🏠
Working from home

Jonathan Creamer jcreamer898

🏠
Working from home
View GitHub Profile
public ActionResult NotFound()
{
ActionResult result;
object model = Request.Url.PathAndQuery;
if (!Request.IsAjaxRequest())
{
result = View("NotFound", model);
}
@jcreamer898
jcreamer898 / TheBestStyleGuideForJavaScriptThatExistsInTheWholeWorld.md
Created January 8, 2014 16:06
This is the best style guide for JavaScript in the whole world.

insert your style guide here, and follow it...

ALTER PROCEDURE [jobs].[spu_Job_List_Active_For_Recruiter] (
@recruiterId INT,
@pageNumber INT = 1,
@perPage INT = 5,
@paging BIT = 1
) AS
BEGIN
;WITH Jobs AS
(
SELECT
Z7777777Z
777777777777777Z
Z7777777777777777777
77777777777777777777777
7777777777777777777777777D
7777777777777Z$777777777777N
7777777777D 7777777777
777777777 $77777777
77777777 777777777
77777777 777777777
@{
// Setup the tabs for the profile page.
// The Href will also point to a view located at `MyProfileTabs/HREF.cshtml`.
var tabs = new[]
{
new
{
Href = "tab-profile",
Name = "Profile",
ClassName = "active",

The file I want to test is set up as an IIFE, which works great in the browser. I'm able to use the method renderInteractions like so:

var something = utils.renderInteractions(doc);

However, when I run the test suite I get the following error:

TypeError: Object #<Object> has no method 'renderInteraction'

I found this Stack Overflow post which seems to indicate that your JavaScript file HAS to export something that Mocha can tap into: http://stackoverflow.com/questions/10204021/how-do-i-test-normal-non-node-specific-javascript-functions-with-mocha

public class BaseDocument
{
public Document Document { get; set; }
public BaseDocument()
{
}
public BaseDocument(Document doc)
switch (invite.inviteType) {
case "connection":
inviteAction([invite], 'ignore').done(function () {
self.invitations.remove(invite);
TP.alert({ text: "Invite ignored!" });
});
return;
case "equipment":
GET({ url: '/ajax/equipment/invite-ignore', data: { inviteId: invite.id } }).done(function () {
self.invitations.remove(invite);
@jcreamer898
jcreamer898 / amd.js
Created October 25, 2013 03:50
Example of unit test issues in AMD
define([
'app/viewModels/user'
], function(User) {
var SomeViewModel = function() {
this.users = [];
this.addUser();
};
SomeViewModel.prototype.addUser = function() {
// Sometimes I wan't to fake this `User` or whatever. It's hard to do w/ AMD.
remote: npm WARN excluding symbolic link tests\browser\mocha.css -> ../../node_modules/mocha/mocha.css
remote: npm WARN excluding symbolic link tests\browser\mocha.js -> ../../node_modules/mocha/mocha.js
remote: npm http 200 https://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz
remote: npm http 200 https://registry.npmjs.org/i/-/i-0.3.2.tgz
remote: npm http 200 https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz
remote: ....
remote:
remote: > [email protected] install C:\DWASFiles\Sites\browserswarm-prod\VirtualDirectory0\site\wwwroot\node_modules\mongoose\node_modules\mongodb\node_modules\bson
remote: > (node-gyp rebuild 2> builderror.log) || (exit 0)
remote: