Skip to content

Instantly share code, notes, and snippets.

View jkodroff's full-sized avatar

Josh Kodroff jkodroff

View GitHub Profile
@jkodroff
jkodroff / gist:24d087b332994c1972d8
Last active August 29, 2015 14:16
Sample psake method to deploy an NServiceBus Endpoint
# Add this to your psake scripts to deploy NServiceBus endpoints and start the service.
function global:deploy_endpoint($name) {
$project = "$BaseDir\src\$name\$name.csproj"
$buildPath = "$DeployBaseDir\$name"
# The DataBus is at c:\NServiceBus_DataBus, so this naming makes things easy to see in Windows Explorer
$deployPath = "c:\NServiceBus_Endpoints\$name"
exec { msbuild $project "/p:Configuration=$Config;OutputPath=$buildPath" "/t:Build" }
if (Test-Path $buildPath\packages.config) {
var myFunction(someObject, the, arguments) {
};
// with tap
$('selector')
.tap(myFunction, the, arguments)
.hide();
// without tap
var $collection = $('selector')
POST file to /songs:
{
id: UUID,
bytes: byte[],
title: // blah blah
}
express method handle POST request:
put the POST data in the transcoding message queue with message type "encodeSong"
@jkodroff
jkodroff / handlebars_helpers.js
Created June 10, 2014 18:10
Some potentially useful handlebars helpers.
Handlebars.registerHelper('json', function(obj) {
return JSON.stringify(obj);
});
Handlebars.registerHelper('fixed', function(obj) {
return obj.toFixed(2);
});
Handlebars.registerHelper('encode', function(obj) {
return encodeURIComponent(obj);
@jkodroff
jkodroff / handlebars_helpers.js
Created June 10, 2014 18:10
Some handlebars helpers I find useful.
Handlebars.registerHelper('json', function(obj) {
return JSON.stringify(obj);
});
Handlebars.registerHelper('fixed', function(obj) {
return obj.toFixed(2);
});
Handlebars.registerHelper('encode', function(obj) {
return encodeURIComponent(obj);
package objsets
import common._
import TweetReader._
/**
* A class to represent tweets.
*/
class Tweet(val user: String, val text: String, val retweets: Int) {
override def toString: String = text
@jkodroff
jkodroff / gist:8561491
Created January 22, 2014 16:08
NServiceBus endpoint that handles email
using System;
using System.Configuration;
using System.Net;
using System.Text;
using NServiceBus;
using Newtonsoft.Json;
using RestSharp;
public class SendEmailHandler : IHandleMessages<SendEmail>
{
@jkodroff
jkodroff / gist:4999695
Created February 20, 2013 21:17
Psake snippet - Deploying an NServiceBus Endpoint
task ServiceEndpoints {
deploy_endpoint "RelocationMoverServices.Synergize.Handlers"
}
function global:deploy_endpoint($name) {
$project = "$BaseDir\src\$name\$name.csproj"
$buildPath = "$DeployBaseDir\$name"
$deployPath = "c:\ReloDotNet2_ServiceEndpoints\$name"
@jkodroff
jkodroff / gist:3751537
Created September 19, 2012 19:03
Using ASP.NET MVC with StructureMap
Global.asax.cs:
public class MvcApplication : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
// ...
ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory());
}
StructureMapControllerFactory.cs
@jkodroff
jkodroff / customerFindAsYouType.js
Created July 18, 2012 22:31
jQuery UI Autocomplete example with complex objects
/// <reference path="../../jquery-1.6.4-vsdoc.js" />
(function ($) {
WEBLINC.areas.add('customerFindAsYouType', function () {
(function () {
WEBLINC.widgets.add('customerFindAsYouType', function (scope) {
$('.customerfindasyoutype', scope)
.keypress(function (e) {
if (e.keyCode == 13) {