Skip to content

Instantly share code, notes, and snippets.

@yuchi
yuchi / examples.js
Created December 12, 2016 22:56
Missing getters on Metal
class DropArea extends JSXComponent {
render() {
const validEntries = this.entries.filter(entry => entry.valid);
if (validEntries) return (
<ul>
{ entries.map(
({title}) =>
<li>{ title }</li>
@yuchi
yuchi / Liferay_Web_Resources.md
Last active February 5, 2020 20:40
Runtime Front-end (Web) Resources and Dependencies

Runtime Front-end (Web) Resources and Dependencies

During Liferay DEVCON 2015 some interesting topics spurred out of the new Liferay Theme build process.

This document, and the expected following discussion, is here to understand how we can guarantee for web front-end engineers a friendly development environment and a de-facto standards adherent runtime.

Synopsis

At Liferay DEVCON 2015 a [new way to build Liferay Themes][ltt] has been announced. It is built around [gulp][gulp] tasks and offers the concept of Themelets, composable features distributable through [npm][npm]. Themelets are then merged in your own theme at build time.

@yuchi
yuchi / tmp.properties
Created April 16, 2015 14:56
auth.public.paths
#
# Enter a list of comma delimited paths that do not require authentication.
#
auth.public.paths=\
/asset/get_categories,\
\
/blogs/find_entry,\
/blogs/rss,\
/blogs/trackback,\
@yuchi
yuchi / tele.md
Last active August 29, 2015 14:19
Comparison of telepresence software
@yuchi
yuchi / session_data.js
Created April 7, 2015 14:11
Liferay Connector Snippet #3 (session data)
// You know the company you’re working with:
session.companyId = 4567;
// You have full user object
session.user = {};
// and that includes:
session.user.userId = 5432;
session.user.screenName = 'pierpaolo.ramon';
session.user.emailAddress = 'pierpaolo.ramon@smc.it';
session.user.portraitId = 8765;
@yuchi
yuchi / authenticate_promise.js
Created April 7, 2015 13:56
Liferay Connector Snippet #2 (callback authentication)
liferay.authenticate('http://localhost:8080', {
login: 'test@liferay.com',
password: 'test'
}).then(function (session) {
console.log("Yay! I got a session!");
});
@yuchi
yuchi / authenticate.js
Last active August 29, 2015 14:18
Liferay Connector Snippet #1 (callback authentication)
liferay.authenticate(
// The Portal URL
'http://localhost:8080',
// The authentication parameters
{
login: 'test@liferay.com',
password: 'test'
},
// The callback
function (err, session) {
@yuchi
yuchi / gist:f84762a3743c117f2938
Created March 8, 2015 17:15
Multiple requests with promises
var Promise = require('bluebird');
function provider(param) {
// questa funzione ritorna una promessa
}
// Tutte o il primo errore
Promise.all([ 'some', 'different', 'urls' ].map(provider));
// Un oggetto { value(), reason() } per ogni promessa
@yuchi
yuchi / APIs.js
Last active August 29, 2015 14:16
Multiple requests
module.exports = doRequest;
function doRequest(url, callback) {
var client = Ti.Network.createHTTPClient({});
client.onerror = function (err) {
callback(err, null);
}
client.onload = function () {
@yuchi
yuchi / dynamic_templates.js
Created February 4, 2015 23:06
Multiple dynamic template children
// views
var templates = {};
// Up to 5 dynamic elements
var maxDynamicImages = 5;
// get an array in the form [ 0, 1, 2, ... n ]
range(maxDynamicImages)
// number -> template