This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class MessageQueueExt | |
{ | |
/// <summary> | |
/// Return number of messages in the MSMQ. | |
/// from: http://stackoverflow.com/questions/3869022/is-there-a-way-to-check-how-many-messages-are-in-a-msmq-queue | |
/// </summary> | |
public static int Count(this MessageQueue queue) | |
{ | |
var queueCounter = new System.Diagnostics.PerformanceCounter( | |
"MSMQ Queue", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
var path = require('path'); | |
// ugly error handling | |
app.use(function(err, req, res, next){ | |
console.error(err.stack); | |
res.send(500, 'Bad things'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import MapKit | |
// source: http://stackoverflow.com/questions/25460310/swift-mapkit-example-project | |
class ViewController: UIViewController, MKMapViewDelegate { | |
@IBOutlet weak var mappy: MKMapView! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SQLite | |
class QuestionSet { | |
var id: Int = 0 | |
var title: String = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://forums.xamarin.com/discussion/5934/ios-newb-how-do-you-get-rid-of-the-keyboard | |
var g = new UITapGestureRecognizer(() => View.EndEditing(true)); | |
View.AddGestureRecognizer(g); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
// ADD ACTION TO routeTemplate BELOW!!! | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{action}/{id}", | |
defaults: new { id = RouteParameter.Optional } | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IHello | |
{ | |
string Message(); | |
} | |
[Export(typeof(IHello))] | |
public class Hello : IHello | |
{ | |
public string Message() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomerManager : ICustomerManager | |
{ | |
[Import] | |
public ICustomerAccessor CustomerAccessor { get; set; } | |
public void Upgrade(string customerId) | |
{ | |
// To upgrade a customer we must first find the customer. | |
var customer = CustomerAccessor.Find(customerId); | |
// Set Pro equal to true. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyTests | |
{ | |
TransactionScope _testTransactionScope; | |
#region transaction scope | |
[TestInitialize] | |
public void TestInitialize() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccessorFactory | |
{ | |
public virtual T Create<T>() | |
where T : class | |
{ | |
if (typeof(T).Name == "CustomerAccessor") | |
return new CustomerAccessor() as T; | |
return null; | |
} |
OlderNewer