Skip to content

Instantly share code, notes, and snippets.

View ocidique's full-sized avatar
❄️

Juho Pekkala ocidique

❄️
View GitHub Profile
// es6 map test
// Double array numbers
const numbers = [1, 5, 10, 15];
const doubled = numbers.map(x => {
return x * 2;
});
console.log(doubled);
int a = 100;
int b = 200;
if (int == 100){
if (int == 200) {
// do something
} else {
// do something else
}
// do something in the end
@ocidique
ocidique / nested_input_template.ftl
Created December 30, 2015 08:13
Example of Liferay freemarker template snippet that gets nested inputs from structured article
# In structured article nested fields are something like this:
#
# Parent input field: <parentInputValue>
# -- Child input field: <childInputValue>
# Loop through the values and set values as a link where childInputValue is url and parentInputValue as label
<#if parentInputValue.getSiblings()?has_content>
<#list parentInputValue.getSiblings() as current_parentInputValue>
@ocidique
ocidique / go_to_parent_page.ftl
Created September 25, 2015 10:09
Liferay - Go to parent page snippet
<#assign parentLayout = layoutService.getLayout(layout.getParentPlid()) />
<#assign parentURL = parentLayout.getFriendlyURL(theme_display.getLocale()) />
<#if validator.isNotNull(parentURL)>
<a href="/web/site${parentURL}">Go to parent page</a>
</#if>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<style>
img.scalable-image {
width: 100%;
height: auto;
}
</style>
<img src="..." class="scalable-image">
<#--
*
* Useful snippets using init_custom.ftl
*
-->
<#-- Get Liferay site description -->
<#assign site_description = htmlUtil.escape(page_group.getDescription()) />
<#-- Get Liferay journal article using custom field with expando bridge -->
@ocidique
ocidique / custom_look_and_feel_setting.ftl
Last active August 29, 2015 14:27
Liferay - get custom look and feel setting in freemarker template
${nav_item.getLayout().getTypeSettingsProperty("lfr-theme:regular:custom-setting")}
@ocidique
ocidique / .gitignore
Last active September 13, 2015 16:30
.gitignore foundation
# Editors and runners
.idea/
bin/
tmp/
node_modules/
bower_components/
.settings/
.sass-cache/
resources/