Skip to content

Instantly share code, notes, and snippets.

Sébastien Le Marchand slemarchand

View GitHub Profile
View diagnostic_unused_portlet.liferay62.groovy
import com.liferay.portal.util.*
import com.liferay.portal.service.*
import com.liferay.portal.model.*
PORTLET_ID = '56'
companyId = PortalUtil.getCompanyId(actionRequest)
groups = GroupLocalServiceUtil.getGroups(companyId, GroupConstants.ANY_PARENT_GROUP_ID, true)
View liferay_conspicuous_spa_loader.css
/* Reset properties used by the original loader */
.lfr-spa-loading .lfr-spa-loading-bar, .lfr-spa-loading-bar {
-moz-animation: none 0 ease 0 1 normal none running;
-webkit-animation: none 0 ease 0 1 normal none running;
-o-animation: none 0 ease 0 1 normal none running;
-ms-animation: none 0 ease 0 1 normal none running;
animation: none 0 ease 0 1 normal none running;
display: block;
-webkit-transform: none;
View inspect_request.liferay.groovy
import com.liferay.portal.util.PortalUtil
request = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest))
println("""
isSecure: ${request.isSecure()}
""")
View liferay_switch_company.js
(function() {
COMPANY_ID = "39524";
DOMAIN = "hostname";
document.cookie = "COMPANY_ID=" + COMPANY_ID + "; domain=" + DOMAIN + "; path=/";
document.location = "/";
})();
View print_all_variables.groovy
this.binding.variables.each {k,v -> println "$k = $v"}
View liferay_more_visible_spa_loading_bar.css
/* Make more visible the Liferay SPA loading bar */
.lfr-spa-loading-bar {
height: 6px;
background: #df4230;
}
View list-all-developers.git.sh
#
# http://stackoverflow.com/questions/9597410/list-all-developers-on-project-in-git
#
git shortlog -sne --all
View reindex-portlet.browser-console.js
var portletId = '15';
var authToken = Liferay.authToken;
var url = '/en_US/group/control_panel/manage?p_auth=' + authToken + '&p_p_id=137&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&refererPlid=565250&_137_struts_action=%2Fadmin_server%2Fedit_server';
var data = '_137_formDate=1472741233467&_137_cmd=reindex&_137_tabs1=server&_137_tabs2=&_137_tabs3=&_137_redirect=&_137_portletId=' + portletId + '&_137_tabs2TabsScroll='
var httpRequest = new XMLHttpRequest()
httpRequest.open('POST', url, true);
View delete_user_by_screenname.groovy
import com.liferay.portal.service.*;
import com.liferay.portal.util.*;
try {
user = UserLocalServiceUtil.getUserByScreenName(PortalUtil.getCompany(actionRequest).getCompanyId(), "someScreenName");
UserLocalServiceUtil.deleteUser(user);
} catch(e) {
You can’t perform that action at this time.