Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Allen mojavelinux

View GitHub Profile
View FormWithPostValidateEvent.xhtml
<h:form>
<f:event type="postValidate" listener="#{minMax.validate}"/>
<h:inputText id="min" value="#{bean.min}"
binding="#{minMax.minInput}"/> <h:message for="min"/>
<h:inputText id="max" value="#{bean.max}"
binding="#{minMax.maxInput}"/> <h:message for="max"/>
<h:commandButton value="Submit"/>
</h:form>
View MethodBindingMethodExpressionAdapter
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
View ManagedBeanAdapterExtension.java
package org.jboss.seam.bean;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AnnotatedConstructor;
@mojavelinux
mojavelinux / archiveusertimeline.groovy
Created Mar 31, 2010
A script to archive a user's twitter timeline incrementally
View archiveusertimeline.groovy
#!/usr/bin/env groovy
import groovyx.net.http.RESTClient
import groovy.xml.MarkupBuilder
import org.apache.commons.lang.StringEscapeUtils
def cli = new CliBuilder(usage: "archiveusertimeline [OPTION]")
cli.u(longOpt: "user", args: 1, required: true, "User to archive")
cli.p(longOpt: "pwd", args: 1, required: true, "Password of user")
View gist:353601
ClassLoader cl = new SecureClassLoader() {
@Override
protected URL findResource(final String name) {
final Asset a = archive.get(name);
if (a == null) {
return null;
}
try {
return new URL(null, "archive:/" + name, new URLStreamHandler() {
View ClientId.java
package org.jboss.seam.faces.component;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;
/**
View seam-svn2git-migration.sh
#!/bin/bash
# Program locations
xmlstarlet=/usr/bin/xmlstarlet
git=/usr/bin/git
phase1_dir=import-phase1
phase2_dir=import-phase2
get_modules=$(svn list --xml http://anonsvn.jboss.org/repos/seam/modules/ | xmlstarlet sel -T -t -m "//name" -c . -n)
get_parent=1
View update_scm_urls.groovy
#!/usr/bin/env groovy
def modifyFile(file, Closure processText) {
def text = file.text
file.write(processText(text))
}
def phase2_dir = 'import-phase2'
def root = new File(phase2_dir)
View build.gradle
apply plugin: 'java'
setBuildDir('target')
repositories {
mavenCentral()
mavenRepo urls: ["http://repository.jboss.org/nexus/content/groups/public/"]
}
dependencies {
@mojavelinux
mojavelinux / StartupBean.java
Created Oct 20, 2010
A sample CDI extension for eagerly instantiating @ApplicationScoped beans annotated @startup
View StartupBean.java
@ApplicationScoped
@Startup
public class StartupBean
{
@PostConstruct
public void onStartup()
{
System.out.println("Application starting up.");
}
}