Skip to content

Instantly share code, notes, and snippets.

View pseudorandoom's full-sized avatar
👾

Fabian Lopez pseudorandoom

👾
  • Colombia
  • 05:20 (UTC -05:00)
  • LinkedIn in/floppy
View GitHub Profile
Indexer indexer = IndexerRegistryUtil.getIndexer(LibertyProgram.class); SearchContext searchContext = SearchContextFactory.getInstance(request); searchContext.setAttribute("paginationType", "regular"); searchContext.setEnd(searchContainer.getEnd()); searchContext.setKeywords(keywords); searchContext.setStart(searchContainer.getStart()); Hits results = indexer.search(searchContext);
if( value ) { } //will evaluate to true if value is not:
null
undefined
NaN
empty string ("")
0
false
void setExpandoAttributesAndValues(
Set<ExpandoItem> incomingExpandoSet, long companyId,
long classPKId, Class klass, ExpandoBridge expandoBridge, boolean indexable)
throws PortalException, SystemException {
ExpandoTable tbl = null;
CompanyThreadLocal.setCompanyId(companyId);
try {
tbl = ExpandoTableLocalServiceUtil.getDefaultTable(klass.getName());
} catch (NoSuchTableException e) {
tbl = ExpandoTableLocalServiceUtil.addDefaultTable(klass.getName());
@pseudorandoom
pseudorandoom / new_gist_file
Created November 19, 2013 20:58
liferay mail send test script (beanshell)
import com.liferay.util.mail.MailEngine; import javax.mail.internet.InternetAddress; MailEngine.send(new InternetAddress("[email protected]"), new InternetAddress("[email protected]"), "your-appointment-has-been-scheduled", "hola", false);
@pseudorandoom
pseudorandoom / new_gist_file
Created November 20, 2013 21:16
script para enviar en correos en liferay (el remitente tiene que coincidir con el correo para enviar notificaciones)
import com.liferay.util.mail.MailEngine; import javax.mail.internet.InternetAddress; import com.liferay.portal.kernel.util.PropsUtil; import com.liferay.portal.kernel.util.PropsKeys; MailEngine.send(new InternetAddress("[email protected]"), new InternetAddress("[email protected]"), "correo de prueba", /*PropsUtil.get(PropsKeys.ADMIN_EMAIL_FROM_ADDRESS)*/PropsUtil.get(PropsKeys.MAIL_SESSION_MAIL_SMTP_USER), false);
@pseudorandoom
pseudorandoom / gist:e4161a9f1bea311163f9
Created October 22, 2014 16:07
watch the response of a given url
watch -n 60 'wget --quiet https://demo-eu08-prod.apigee.net/vehicles/models -O -'
@pseudorandoom
pseudorandoom / gist:12dc298490686641611d
Created October 22, 2014 16:35
maven exec plugin config
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
@pseudorandoom
pseudorandoom / SassMeister-input.scss
Created February 4, 2015 19:26
Generated by SassMeister.com.
// ----
// Sass (v3.4.11)
// Compass (v1.0.3)
// ----
@mixin animation-number($duration, $time){
animation: fadein#{$duration} #{$time}s;
-moz-animation: fadein#{$duration} #{$time}s;
-webkit-animation: fadein#{$duration} #{$time}s;
-o-animation: fadein#{$duration} #{$time}s;
@pseudorandoom
pseudorandoom / RestHighLevelClientAggregationExample.java
Created September 26, 2019 23:32
Shows how to do aggregations in Elasticsearch via the Java api
import org.apache.http.HttpHost;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
import org.elasticsearch.search.builder.SearchSourceBuilder;