Skip to content

Instantly share code, notes, and snippets.

View mathieuancelin's full-sized avatar

Mathieu ANCELIN mathieuancelin

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<iframe id="myAppframe" src="http://xxx.xxx.xxx.xxx/myApp"></iframe>
<script>
$(document).ready(function() {
$("#myAppframe").contents().find("myAppFooter").remove();
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
import services.*;
import javax.enterprise.inject.*;
import javax.enterprise.context.*;
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
import services.*;
import javax.enterprise.context.*;
@mathieuancelin
mathieuancelin / Recipient.java
Created July 13, 2012 10:40
A Java Cagette implementation based on Guava
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
take 2.pills of chloroquinine in 6.hours
move left by 30.centimeters
# build the modified Weld API
# we're using Ales Justin (JBoss Weld lead) branches because he does a very good job at keeping everything up to date with Weld upstream
git clone https://github.com/alesj/api.git
git checkout -b osgi origin/osgi
cd ${START}/api
mvn clean install
# build Weld core with Weld-OSGi included
git clone https://github.com/alesj/core.git
git checkout -b osgi origin/osgi
public class MyBean extends Application {
@Inject HelloService service;
public void displayHello() {
display( service.hello();
}
}
public class MyBean extends Application {
private HelloService service;
@Inject Service<SocialProvider> providers;
public List<Post> getTimeline() {
List<Post> timeline = new ArrayList<Post>();
for (SocialProvider provider : providers) {
    timeline.addAll(provider.getTimeline());
}
Collections.sort(timeline, new Comparator<Post>() {
public int compare(Post post1, Post post2) {
return post1.timestamp().compare(post2.timestamp());
public interface SocialProvider {
UserProfile getUserProfile();
OAuthService getOAuthService();
List<Post> getTimeline();
void post(Post post);
@Stateless
public class ShortenService {
@PersistenceContext EntityManager em;
public List<Shorten> all() {
return em.createQuery("select o from Shorten o").getResultList();
}
public long count() {