Skip to content

Instantly share code, notes, and snippets.

View jacobheric's full-sized avatar

Jacob Heric jacobheric

View GitHub Profile
@jacobheric
jacobheric / hibernate-search-criteria-paging-total.java
Created March 13, 2011 16:15
A sample hibernate search using criteria, disjunction, projection and paging
public List<Recipe> search(RecipeCriteria recipeCriteria) {
Criteria c = this.getSessionFactory().getCurrentSession().createCriteria(Recipe.class);
//
//Property restrictions
if (recipeCriteria.getQuery() != null) {
Disjunction d = Restrictions.disjunction();
d.add(Restrictions.like("name", recipeCriteria.getQuery().trim(), MatchMode.ANYWHERE));
@jacobheric
jacobheric / gist:5289586
Last active December 15, 2015 16:29
example server side publication of collections in meteor
// Publish complete set of lists to all clients.
Meteor.publish('lists', function () {
return Lists.find();
});
// Publish all items for requested list_id.
Meteor.publish('things', function (id) {
return Things.find({list_id: id});
});
@jacobheric
jacobheric / gist:5289606
Last active December 15, 2015 16:29
an example Meteor model.js with minimal security
// collection contains a list of things
Things = new Meteor.Collection("things");
Lists = new Meteor.Collection("lists");
Things.allow({
insert: function() {
return true;
},
update: function() {
return true;
@jacobheric
jacobheric / gist:5292339
Last active December 15, 2015 16:49
A couple example meteor client collection subscriptions
// Subscribe to 'lists' collection on startup.
// Select a list once data has arrived.
var listsHandle = Meteor.subscribe('lists', function () {
//
//Check for our show guide token
if (Session.get('list_id')){
var l = Lists.findOne(Session.get('list_id'));
if (l && l.showGuide && l.showGuide == true){
Session.set('showGuide', true);
@jacobheric
jacobheric / gist:5292407
Last active December 15, 2015 16:50
An example Meteor view template
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<title>Heric List</title>
</head>
<body>
<div id="outer">
{{> list}}
</div>
</body>
@jacobheric
jacobheric / gist:5292450
Created April 2, 2013 14:04
An example tying hammer.js gesture support into a meteor managed template element via the template.rendered event
Template.thing.rendered = function(template){
var element = this.find('.thingContainer');
var id = this.data._id;
if (element) {
Hammer(element).on("dragleft", dragLeft);
Hammer(element).on("dragright", dragRight);
}
}
@jacobheric
jacobheric / gist:5460651
Last active December 16, 2015 16:09
Maven pom flex snippet
<!-- See module poms for more detail. -->
<modules>
<module>flex</module>
<module>java-web</module>
</modules>
@jacobheric
jacobheric / gist:5460682
Last active December 16, 2015 16:09
some Maven pom flex configs
<configuration>
<parameters>
<swf>${project.artifactId}-${youbrew.version}</swf>
<title>You Brew your own software</title>
</parameters>
<outputDirectory>${basedir}/../java-web/src/main/webapp/</outputDirectory>
<services>${basedir}/../java-web/src/main/webapp/WEB-INF/flex/services-config.xml</services>
<htmlName>index</htmlName>
<contextRoot>/youbrew</contextRoot>
<locales>
@jacobheric
jacobheric / gist:5460688
Last active December 16, 2015 16:09
a spring blazeds amf remoting channel config
<services>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
</services>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://localhost:8080/youbrew/messagebroker/amf"
@jacobheric
jacobheric / gist:5460703
Last active December 16, 2015 16:09
flex servlet config
<servlet>
<servlet-name>flex</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>flex</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>