Skip to content

Instantly share code, notes, and snippets.

View jpsullivan's full-sized avatar

Josh Sullivan jpsullivan

  • Microsoft
  • Virginia
View GitHub Profile
@jpsullivan
jpsullivan / BundleConfig.cs
Created April 11, 2013 18:01
Precompile Handlebars templates using BundleTransformer
using System.Collections.Generic;
using System.Web.Optimization;
using BundleTransformer.Core.Orderers;
using BundleTransformer.Core.Transformers;
using BundleTransformer.Core.Translators;
using Ember;
namespace MyApp.App_Start
{
public class BundleConfig
package com.atlassian.stash.internal.hibernate;
import org.hibernate.CallbackException;
import org.hibernate.EmptyInterceptor;
import org.hibernate.type.Type;
import java.io.Serializable;
/**
* Hibernate interceptor that guards against any empty strings being stored in the database. Empty strings are
@jpsullivan
jpsullivan / gist:7587899
Last active December 29, 2015 00:39
Service class example w/ Dapper usage for SProcs.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
using Dapper;
...
namespace Services {
@jpsullivan
jpsullivan / gist:a745c48294ac43414e45
Created May 18, 2015 18:51
Destiny Item Manager HoW Engrams Overview
var summary = {
items: {
primary: $('div[alt~="Engram"][drag-channel="Primary"]>div.img.how').length,
special: $('div[alt~="Engram"][drag-channel="Special"]>div.img.how').length,
heavy: $('div[alt~="Engram"][drag-channel="Heavy"]>div.img.how').length,
helmet: $('div[alt~="Engram"][drag-channel="Helmet"]>div.img.how').length,
gauntlets: $('div[alt~="Engram"][drag-channel="Gauntlets"]>div.img.how').length,
chest: $('div[alt~="Engram"][drag-channel="Chest"]>div.img.how').length,
leg: $('div[alt~="Engram"][drag-channel="Leg"]>div.img.how').length,
classItem: $('div[alt~="Engram"][drag-channel="ClassItem"]>div.img.how').length
@jpsullivan
jpsullivan / gist:87f9bb6b8ee092f97f2b
Created July 7, 2015 16:23
JS - Switch with no breaks
var user = "approach";
switch(user) {
case 'approach':
console.log('1');
case 'does':
console.log('2');
case 'threes':
console.log('3');
}
@jpsullivan
jpsullivan / gist:24c6fbe528fa93a72ecf
Created July 7, 2015 16:24
JS - Switch with breaks
var user = "approach";
switch(user) {
case 'approach':
console.log('1');
break;
case 'does':
console.log('2');
break;
case 'threes':
console.log('3');
var user = prompt("As you walk through a forest, you come across a Buckethead on the ground, woozy from hunger. Do you APPROACH, RUN AWAY, or CALL OUT?").toUpperCase();
switch(user) {
case 'APPROACH':
var offended = prompt("Are you offended by her state of attire? (YES or NO)?").toUpperCase();
var foodTho = prompt("Do you give her food? (YES or NO)?").toUpperCase();
if(offended === 'NO' || foodTho === 'YES') {
console.log("You only need one of the two! She leaps up and befriends you with enthusiasm!");
} else {
console.log("wow, a busybody AND a tightwad. You're kind of a jerk. Its okay Buckethead becomes your friend anyway, whether you want it or not.");
@jpsullivan
jpsullivan / .NET Runtime Error
Last active August 29, 2015 14:24
Love [Windows] Crash Details
Application: Love [Fullscreen].exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 0F2F032D
Stack:
@jpsullivan
jpsullivan / gist:15b1a7d13306e7b3c5b0
Created July 17, 2015 15:10
javascript functions
$('.dropdown-toggle').click(function() {
$('.dropdown-menu').toggle();
});
or ...
var toggleDropdown = function () {
$('.dropdown-menu').toggle();
};
@jpsullivan
jpsullivan / package.json
Created June 25, 2017 17:02
eslint integration w/ commits and tests
{
"name": "ThousandFaces",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"pretest": "npm run lint",
"precommit": "lint-staged"
},
"lint-staged": {