Skip to content

Instantly share code, notes, and snippets.

View mohitrajput's full-sized avatar

Mohit Rajput mohitrajput

View GitHub Profile
@mohitrajput
mohitrajput / Question.md
Last active November 13, 2024 05:31
Question

1. Create a duplicate function in JavaScriot with takes an array and duplicates within itself.

duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]


2. Create a printArrow function

printArrow('right', 3)

Output:
*
@mohitrajput
mohitrajput / index.ftl
Last active January 21, 2022 04:34
Fetch Document title in WCM template
<#assign dlFileEntryService = serviceLocator.findService('com.liferay.document.library.kernel.service.DLFileEntryService') />
<#assign counter = 0>
<#list "${media.getData()}"?split("/") as x>
<#if counter == 2><#assign groupId = x?number ></#if>
<#if counter == 5>
<#assign temp = x?split("?")>
<#assign uuId = temp[0]>
</#if>
<#assign counter = counter + 1 >
@mohitrajput
mohitrajput / adt.ftl
Created January 18, 2022 05:31
ADT: Title & ViewURL in asset publisher
<#if !entries?has_content>
<div class="alert alert-info">
<@liferay_ui["message"] key="there-are-no-results" />
</div>
</#if>
<#list entries as entry>
<#assign
entry = entry
@mohitrajput
mohitrajput / wc-embed.ftl
Created December 23, 2021 09:39
Embed Webcontent
<#if SelectAPRWebcontent?? && SelectAPRWebcontent.getData()?has_content>
<#assign
classname = SelectAPRWebcontent.getData()?eval.className
classpk = SelectAPRWebcontent.getData()?eval.classPK
/>
<@liferay_asset["asset-display"]
className=classname
classPK=getterUtil.getLong(classpk, 0)
template="full_content"
/>
<#if entries?has_content>
<ul>
<#list entries as entry>
<#if (getterUtil.getBoolean(showHiddenPages) || !entry.isHidden()) && layoutPermission.containsWithoutViewableGroup(permissionChecker, entry, "VIEW")>
<li class="results-header">
<a
<#assign layoutType = entry.getLayoutType() />
@mohitrajput
mohitrajput / table-configuration.json
Created June 19, 2020 10:47
Comparison Table Configuration Table
{"head":{"title" : "Accurate as of 08/08/2017" , "rows" : [{"name" : "Lending Stream", "className" : "small-logo"}, {"name" : "Wonga"}, {"name" : "Sunny"}, {"name" : "Quickquid"} ]},"body":{"rows" : [{"title" : "Loan Duration" ,"columns" : [{"name" : "6 months"}, {"name" : "3 months"}, {"name" : "6 months"}, {"name" : "1-3 months"} ]},{"title" : "New customers can apply for" ,"columns" : [{"name" : "£800"}, {"name" : "£500"}, {"name" : "£950"}, {"name" : "£1000"} ]},{"title" : "Existing customers can apply for up to" ,"columns" : [{"name" : "£1500"}, {"name" : "£1500"}, {"name" : "£950"}, {"name" : "£1500"} ]},{"title" : "Repay in installments" ,"columns" : [{"name" : "Yes"}, {"name" : "Yes"}, {"name" : "Yes"}, {"name" : "Yes"} ]},{"title" : "Fund transfer initiated within" ,"columns" : [{"name" : "15 minutes"}, {"name" : "5 minutes"}, {"name" : "15 minutes"}, {"name" : "10 minutes"} ]}],"ratings" : {"title" : "Star Rating" , "columns" : [{"score" : "9.6", "total" : "10"}, {"score" : "6.1", "total" : "10"}, {
@mohitrajput
mohitrajput / productlist.css
Created March 26, 2020 14:04
CSS for Product List
.productListingwrap .carousel ol.carousel-indicators li {
width: auto;
height: auto;
padding: 3px;
background: #e8e8e8;
border: 1px solid #e2e2e2;
margin: auto;
float: none;
display: inline-block;
}
@mohitrajput
mohitrajput / productlist.js
Created March 26, 2020 13:52
AL CR- Carousel
import Ajax from 'metal-ajax/src/Ajax';
import dom from 'metal-dom/src/dom';
import URLBuilder from './urlbuilder.es';
const Language = Liferay.Language;
const ThemeDisplay = Liferay.ThemeDisplay;
const Util = Liferay.Util;
const urlbuilder = new URLBuilder();
const PRODUCTLIST_PORTLET_NAMESPACE = '_com_al_product_list_portlet_ProductListPortlet_';
@mohitrajput
mohitrajput / resize.js
Created December 12, 2019 07:30
Script to handle responsive menu
/*this function is to resize menubar
* param logoConatiner : holds jquery element of logo Container.
* param navbarContainer : holds jquery element of navbar Container.
* param mainContainer : holds jquery element of mainContainer Container;
*/
function menuResize(logoConatiner,navbarContainer,mainContainer){
if(mainContainer < logoConatiner+navbarContainer){
trimLastChild(navbarContainer);
let newA = logoConatiner.width();
let newB = navbarContainer.width();
@mohitrajput
mohitrajput / script.js
Created September 4, 2019 05:05
EdgeVerve : Ajax Autocomplete
$(document).ready(function(){
$('#<portlet:namespace/>country').on('keydown keyup',function(){
var data = [];
var text = $(this).val();
$('#<portlet:namespace/>country').autocomplete({
source: function(request,response){
Liferay.Service('/country/get-countries', {
active: true
},