Skip to content

Instantly share code, notes, and snippets.

@timlevett
timlevett / portletRebuild.sh
Last active February 15, 2016 18:12
Deploy a portlet to your local machine
#!/bin/bash
PROJECTS_HOME=$1
export UPHOME=$PROJECTS_HOME/uPortal/
echo Uportal home set to : $UPHOME
function upDeployPortlet()
{
pushd $UPHOME
ant deployPortletApp -DportletApp="$@"
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/0.8.54</center>
</body>
</html>
@timlevett
timlevett / co.sh
Last active October 20, 2015 17:07
Checkout a bunch of projects under a SVN repo
function look_and_co_if_trunk {
BASE_URL=$1
PARENT=$2
SUPER_BASE=${BASE_URL}${PARENT}
LIST=`svn list $SUPER_BASE`
if [ "`echo $LIST | grep trunk | wc -l`" = "1" ] ; then
@timlevett
timlevett / template-able.widgets.md
Last active August 29, 2015 14:16
Template-able Widgets

Custom Template Widgets

In this pull request we created the ability to have template widgets. This feature allows you to change only your entity file for portal to get a smart widget. The example I give is the payroll information portlet.

You need to add the following portlet-preferences to your portlet-definition file:

widgetURL

This is where we will get the data from (in a JSON format). If this is an external call outside of the portal container, you have to do some magic that I'll cover in another post.

<ul class='widget-list' ng-if='!isEmpty' >
<li ng-repeat="item in content.currentTermCourses.courses | limitTo:5">
<p class='bold'>{{item.title | truncate:36}}</p>
<p>{{item.courseDepartment.name}} {{item.code}}</p>
</li>
</ul>
<div style='padding: 10px; font-size: 14px; height: 200px; display: table-cell; vertical-align: middle; width: 100%;' ng-if='!content || content.length === 0 || isEmpty'>
<loading-gif data-object='content' data-empty='isEmpty' class='center'></loading-gif>
<div ng-if='isEmpty'>
<i class='fa fa-exclamation-triangle fa-3x pull-left' style='color: #b70101;'></i>
create table
key_val (
key varchar(30) primary key,
value varchar(4000)
);
/**
* The class <code>Date</code> represents a specific instant
* in time, with millisecond precision.
* <p>
* Prior to JDK&nbsp;1.1, the class <code>Date</code> had two additional
* functions. It allowed the interpretation of dates as year, month, day, hour,
* minute, and second values. It also allowed the formatting and parsing
* of date strings. Unfortunately, the API for these functions was not
* amenable to internationalization. As of JDK&nbsp;1.1, the
* <code>Calendar</code> class should be used to convert between dates and time
@timlevett
timlevett / redditwidget.html
Created May 7, 2015 15:46
Widget template for a subreddit
<div class='scroll-widget' ng-init='lim=3'>
<loading-gif data-object='content' data-empty='isEmpty'></loading-gif>
<div ng-if='isEmpty'>Issue loading reddit feed, click launch button to get feed.</div>
<ul class='widget-list' style='padding : 0'>
<li ng-repeat='item in content.data.children | limitTo:lim'>
<a href='{{item.data.url}}' target='_blank'>
<p class='bold'>{{item.data.title}}<span class='right'>score: {{item.data.score}}</span></p>
<p>{{item.data.selftext}}</p>
</a>
</li>
<div>
<div ng-repeat='item in content.data.children'>
{{item.data.title}}
</div>
</div>
@timlevett
timlevett / redditwidget.step-by-step.html
Last active August 29, 2015 14:20
See revisions for steps taken
<div style='max-height : 210px; overflow-y: scroll' ng-init='lim=3'>
<loading-gif data-object='content' data-empty='isEmpty'></loading-gif>
<ul class='widget-list' style='padding : 0'>
<li ng-repeat='item in content.data.children | limitTo:lim'>
<a href='{{item.data.url}}' target='_blank'>
<p class='bold'>{{item.data.title}}<span class='right'>score: {{item.data.score}}</span></p>
<p>{{item.data.selftext}}</p>
</a>
</li>
<li class='center' ng-hide='content.data.children.length <= lim' ng-click='lim=lim+5'>