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
(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()
@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() {
-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>"
public class SeeThatRepository
{
private ISession _session;
public SeeThatRepository(ISession session)
{
_session = session;
}
public void Save(T entity)
@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 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)));
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