Skip to content

Instantly share code, notes, and snippets.

View gastaldi's full-sized avatar
🏠
Working from home

George Gastaldi gastaldi

🏠
Working from home
View GitHub Profile
/*
* JBoss, Home of Professional Open Source
* Copyright 2011, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
@gastaldi
gastaldi / gist:2403701
Created April 17, 2012 05:27
Converting to Unicode
/*
* Converts unicodes to encoded \uxxxx and escapes special characters
* with a preceding slash
*/
private static String saveConvert(String theString, boolean escapeSpace, boolean escapeUnicode) {
int len = theString.length();
int bufLen = len * 2;
if (bufLen < 0) {
bufLen = Integer.MAX_VALUE;
}
@gastaldi
gastaldi / gist:2293781
Created April 3, 2012 17:14
FacesPluginTest.java
package org.jboss.forge.spec.javaee.jsf;
import junit.framework.Assert;
import org.jboss.forge.project.Project;
import org.jboss.forge.test.AbstractShellTest;
import org.junit.Test;
public class FacesPluginTest extends AbstractShellTest
{
/*
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gastaldi
gastaldi / gist:1028557
Created June 16, 2011 02:22
First draft from Bean Conversion API
package javax.convert;
public interface Converter<F, T> {
public T convert(F obj, ConverterContext context);
}
package javax.convert;
/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
@gastaldi
gastaldi / gist:1016948
Created June 9, 2011 15:18
Forge Maven hasDependency Test
import static org.junit.Assert.assertTrue;
import org.jboss.forge.project.Project;
import org.jboss.forge.project.dependencies.DependencyBuilder;
import org.jboss.forge.project.facets.DependencyFacet;
import org.jboss.forge.test.AbstractShellTest;
import org.junit.Before;
import org.junit.Test;
public class MavenDependencyTest extends AbstractShellTest
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
03/06/2011 01:12:07
Modeshape ANT script for unsigning jars
This script must be run before assembly:single. Check MODE-1081
George Gastaldi
====================================================================== -->
<project name="modeshape-unsignedjars" default="default">
package org.jboss.seam.reports.jasperreports.qualifiers.test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/*
* ModeShape (http://www.modeshape.org)
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership. Some portions may be licensed
* to Red Hat, Inc. under one or more contributor license agreements.
* See the AUTHORS.txt file in the distribution for a full listing of
* individual contributors.
*
* ModeShape is free software. Unless otherwise indicated, all code in ModeShape
* is licensed to you under the terms of the GNU Lesser General Public License as