Skip to content

Instantly share code, notes, and snippets.

View GregOnNet's full-sized avatar
🎸
Rock On & Code

Gregor Woiwode GregOnNet

🎸
Rock On & Code
View GitHub Profile
public HttpResponseMessage Get(int id)
{
HttpResponseMessage response;
var customer = CustomerRepository.GetBy(id);
if (customer == null)
response = Request.CreateErrorResponse(
HttpStatusCode.NotFound,
string.Format("There is no customer having the ID '{0}'", id));
else
public HttpResponseMessage Get(int id)
{
return CustomerRepository.GetBy(id)
.Match(
c => Request.CreateResponse(
HttpStatusCode.Found,
c),
() => Request.CreateErrorResponse(
HttpStatusCode.NotFound,
String.Format("There is no customer having the ID '{0}'", id)));
@GregOnNet
GregOnNet / RefactoredUsingOfTransaction.cs
Created May 10, 2013 10:47
Refactored the using-Statement to a seperate method. Reduced code smell in DAO-methods.
public class EntityOperation : IEntityOperation
{
readonly ISession _session;
public EntityOperation(ISession session)
{
_session = session;
}
public void Save(object entity)
public class SeeThatRepository
{
private ISession _session;
public SeeThatRepository(ISession session)
{
_session = session;
}
public void Save(T entity)
-Dhttp.proxyHost=<HTTP_PROXY>
-Dhttp.proxyPort=<HTTP_PROXY_PORT>
-Dhttps.proxyHost=<HTTPS_PROXY>
-Dhttps.proxyPort=<HTTPS_PROXY_PORT>
-Dhttp.nonProxyHosts="localhost|127.0.0.1|<OTHER>"
-Dhttps.nonProxyHosts="localhost|127.0.0.1|<OTHER>"
@GregOnNet
GregOnNet / git-commit-prefixin.sh
Last active February 3, 2016 11:42
Prefixing a commit
#!/bin/sh
#
# Usage
# workOnIssue <issue-number>
#
# Sample
# workOnIssue issue-999
#
function workOnIssue() {
(function($) {
'use strict';
// 1. Zwei requests parallel abstimmen
// 2. Für jedes Request ein callback auslösen
// 3. Wenn beide callbacks abgeschlossen sind, soll ein drittes ausgelöst
// werden.
var rq1 = firstRequest()
public override void OnBeginRequest(HttpContextBase context, IWindsorContainer container)
{
var parameters = new Arguments(new
{
response = context.Response,
pdfFormatter = container.Resolve<IFormatPdfResponse>()
});
container.Resolve
<IDispatchPdfReponses>(parameters)
@GregOnNet
GregOnNet / FreeStockCharts-full-width.css
Created January 17, 2016 16:37
Nutzt rechte Spalte der Werbebanner für die Charts
/* In Stylish einfügen */
#SilverlightControl1 {
width: 100% !important;
}
@GregOnNet
GregOnNet / pull-request.sh
Created February 16, 2016 08:52
Fetches commits of a pull request
git fetch origin pull/1/head:<target-branch>