Skip to content

Instantly share code, notes, and snippets.

View marcosblandim's full-sized avatar

marcosblandim

View GitHub Profile
@pedroblandim
pedroblandim / Notícia Completa com data no topo - Web Content Template (sem os campos adicionados).ftl
Last active September 17, 2023 21:35
Simplify Liferay - Vídeo: Entendendo conteúdo web em 10 minutos
<style>
.container {
display: flex;
flex-direction: column;
border-radius: 15px;
padding: 25px;
align-items: flex-start;
}
.content-text {
@pedroblandim
pedroblandim / Web Content DDM Structure - Notícia.json
Last active June 10, 2022 16:51
Simplify Liferay - Vídeo: Publicador de Conteúdos e Mídias
{
"availableLanguageIds": [
"pt_BR"
],
"contentType": "journal",
"dataDefinitionFields": [
{
"customProperties": {
"labelAtStructureLevel": true,
"confirmationErrorMessage": {
@pedroblandim
pedroblandim / getDDMFieldValue.groovy
Created May 10, 2022 22:50
Liferay: Get Journal Article's DDM Field value
import com.liferay.journal.service.JournalArticleLocalServiceUtil
import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil
import com.liferay.journal.model.JournalArticle
import com.liferay.portal.kernel.util.LocaleUtil
def fieldName = "field name"
def ja = JournalArticleLocalServiceUtil.fetchJournalArticle(id);
def entry = AssetEntryLocalServiceUtil.fetchEntry(JournalArticle.class.getName(), ja.getResourcePrimKey())
@pedroblandim
pedroblandim / getDLFilePreviewURL.java
Created May 10, 2022 22:04
Liferay get DL File preview URL
import com.liferay.document.library.kernel.service.DLAppLocalServiceUtil;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.document.library.util.DLURLHelperUtil;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.exception.PortalException;
public static String getDLEntryFileURL(long fileEntryId, ThemeDisplay themeDisplay)
throws PortalException {
@pedroblandim
pedroblandim / liferay.desktop
Created May 5, 2022 04:32
liferay.desktop file example
[Desktop Entry]
Type=Application
Name=Liferay IDE
Comment=Liferay Developer Studio
Icon=/path/to/icon.xpm
Exec=/path/to/DeveloperStudio
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Liferay IDE
@evaldeslacasa
evaldeslacasa / addParameterLiferay.java
Created February 21, 2020 22:43
Method to add parameters in URLs for Liferay
protected static String addParameterWithPortletNamespace(
String url, String name, String value) {
String portletId = HttpUtil.getParameter(url, "p_p_id", false);
if (Validator.isNotNull(portletId)) {
name = PortalUtil.getPortletNamespace(portletId) + name;
}
return HttpUtil.addParameter(url, name, value);
}
@baxtheman
baxtheman / web-content-template.ftl
Last active May 30, 2022 09:52
Liferay 7, web content template freemarker context variables
<#assign TITLE = .vars['reserved-article-title'].data />
<#assign DISPLAYDATE = .vars['reserved-article-display-date'].data?date('EEE, dd MMM yyyy HH:mm:ss Z') />
${DISPLAYDATE?string["dd MMMM yyyy"]}
<button type="button" class="btn btn-secondary btn-sm">
<@liferay_ui["message"] key="read-more"/>
</button>
@TheMatt2
TheMatt2 / walklevel.py
Last active April 13, 2023 22:12
A python function to do an os.walk(), but only to a certain depth. A negative depth indicates full depth.
# MIT License
#
# Copyright (c) 2021 Matthew Schweiss
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@planetsizebrain
planetsizebrain / liferay-freemarker-datetime-tricks.ftl
Created January 25, 2017 20:20
A simple Liferay Freemarker template that shows how the build-in datetime formatting works together with processing settings for locale and timezone
<#setting time_zone=timeZone.ID>
<#setting locale=locale.toString()>
<#setting datetime_format="MMM d, HH':'mm">
<ul>
<#list entries as entry>
<li><li>${entry.title} - ${entry.modifiedDate?datetime}</li></li>
</#list>
</ul>
@kelvinst
kelvinst / local-gitignore.md
Last active April 17, 2024 21:39
Como fazer um .gitignore local?

Como fazer um .gitignore local?

Bom, este é um recurso, como muitos outros, bem escondido do git. Então resolvi fazer um post para explicar a situação em que pode-se usar e como fazer essa magia negra. 👻

O problema

Você provavelmente já adicionou algum dia um arquivo no projeto que não deveria ser commitado certo? E como você fez para ignorar esse arquivo mesmo? Provavelmente adicionou no arquivo .gitignore.

OK então, aí você commitou esse arquivo .gitignore e pronto, mais ninguém poderá criar um arquivo com o mesmo nome e commitar. Mas espera aí! Não era isso que você queria! Você só queria ignorar esse arquivo na sua máquina, se alguém, algum dia por obséquio achar esse um nome bom para seu arquivo, que assim seja.