Skip to content

Instantly share code, notes, and snippets.

View gist:2995520
objects
.map(&method(:shared_map_method))
.select(&method(:shared_select_method))
.compact
def shared_map_method(x)
...
end
def shared_select_method(x)
View gist:2879903
function refreshData(time){
if(time != undefined){
clearTimeouts();
}
refreshNextMatch(time);
refreshGPSData(time);
refreshTopNews(time);
}
@jagregory
jagregory / gist:1825592
Created Feb 14, 2012
Ways of handling null collections and AddRange
View gist:1825592
// a)
if (items != null)
collection.AddRange(items)
// b)
collection.AddRange(items ?? new Foo[0])
View gist:1660192
HasManyToMany(x => x.Something)
.Component(c =>
{
c.Map(x => x.F1);
c.Map(x => x.F2);
});
View fluentindex.patch
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 Jul 9, 2011
Recently read fiction
View gist:1073743
Judas Unchained
Zoo City
Raft (Xeelee)
Snow Crash
Rivers of London
The Atrocity Archives
Pandora's Star
Speaker for the Dead
2001
Cryptonomicon
View Example.cs
public Response Post(string email) {
bus.publish(new CreateUserCommand(email));
User newUser = repo.query(new FindUserByEmailAddress(email));
return Response.created("/users/"+newUser.Id);
}
View IP tables
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
View gist:985963
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
*/* ->
View TeamCity error
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)