Skip to content

Instantly share code, notes, and snippets.

import com.liferay.portal.kernel.exception.PortalException
import com.liferay.portal.kernel.model.User
import com.liferay.portal.kernel.service.UserLocalServiceUtil
try {
// You can replace 'userId' with the actual user's ID
def user = UserLocalServiceUtil.getUser(44386)
def companyId = user.getCompanyId()
println "Company ID for User ${user.getScreenName()}: $companyId"
} catch (PortalException e) {
@000benniu
000benniu / related_asset_fetch_sample.ftl
Created April 6, 2022 06:17 — forked from yasuflatland-lf/related_asset_fetch_sample.ftl
Fetch Related Assets in Web Content Template
<#-- dump.ftl
--
-- Generates tree representations of data model items.
--
-- Usage:
-- <#import "dump.ftl" as dumper>
--
-- <#assign foo = something.in["your"].data[0].model />
--
-- <@dumper.dump foo />
@000benniu
000benniu / Brewfile
Last active March 8, 2021 07:14
Brewfile for initial setup
# Place this file in an arbitrary directory and run.
# brew bundle
#
# You need to install these manually. depend on the version of XCode, so these have to be installed at first.
# 1. XCode (use xcode-select --install command to install)
# 2. XCode command line tool (This is reqired for anyenv)
# 3. mas (brew install mas)
# 4. anyenv (brew install anyenv)
# 5. nodenv (brew install nodenv)
#