Skip to content

Instantly share code, notes, and snippets.

@jagregory
jagregory / gist:2995520
Created June 26, 2012 12:19
Improvements?
objects
.map(&method(:shared_map_method))
.select(&method(:shared_select_method))
.compact
def shared_map_method(x)
...
end
def shared_select_method(x)
function refreshData(time){
if(time != undefined){
clearTimeouts();
}
refreshNextMatch(time);
refreshGPSData(time);
refreshTopNews(time);
}
@jagregory
jagregory / gist:1825592
Created February 14, 2012 10:27
Ways of handling null collections and AddRange
// a)
if (items != null)
collection.AddRange(items)
// b)
collection.AddRange(items ?? new Foo[0])
HasManyToMany(x => x.Something)
.Component(c =>
{
c.Map(x => x.F1);
c.Map(x => x.F2);
});
Index: src/FluentNHibernate.Testing/DatabaseObjects/FluentIndex/FluentIndexBaseTests.cs
===================================================================
--- src/FluentNHibernate.Testing/DatabaseObjects/FluentIndex/FluentIndexBaseTests.cs (revision 0)
+++ src/FluentNHibernate.Testing/DatabaseObjects/FluentIndex/FluentIndexBaseTests.cs (revision 0)
@@ -0,0 +1,64 @@
+using System.Text.RegularExpressions;
+using FluentNHibernate.Cfg;
+using FluentNHibernate.Cfg.Db;
+using FluentNHibernate.DatabaseObjects.FluentIndex;
+using FluentNHibernate.Testing.DomainModel;
@jagregory
jagregory / gist:1073743
Created July 9, 2011 16:57
Recently read fiction
Judas Unchained
Zoo City
Raft (Xeelee)
Snow Crash
Rivers of London
The Atrocity Archives
Pandora's Star
Speaker for the Dead
2001
Cryptonomicon
public Response Post(string email) {
bus.publish(new CreateUserCommand(email));
User newUser = repo.query(new FindUserByEmailAddress(email));
return Response.created("/users/"+newUser.Id);
}
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy DROP)
target prot opt source destination
@jagregory
jagregory / gist:985963
Created May 22, 2011 22:17
Jersey error
SEVERE: A message body writer for Java class conman.entities.User, and Java type class conman.entities.User, and MIME media type application/json was not found
May 22, 2011 11:17:06 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
application/json ->
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$App
com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$App
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
SEVERE: Exception starting filter addCacheHeadersFilter
java.lang.ExceptionInInitializerError
at jetbrains.buildServer.web.AddCacheHeadersFilter.<clinit>(AddCacheHeadersFilter.java:6)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:255)