Skip to content

Instantly share code, notes, and snippets.

<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 / 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'>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<portlet-definition xmlns="https://source.jasig.org/schemas/uportal/io/portlet-definition" xmlns:ns2="https://source.jasig.org/schemas/uportal" xmlns:ns3="https://source.jasig.org/schemas/uportal/io/portlet-type" xmlns:ns4="https://source.jasig.org/schemas/uportal/io/event-aggregation" xmlns:ns5="https://source.jasig.org/schemas/uportal/io/stylesheet-descriptor" xmlns:ns6="https://source.jasig.org/schemas/uportal/io/permission-owner" xmlns:ns7="https://source.jasig.org/schemas/uportal/io/subscribed-fragment" xmlns:ns8="https://source.jasig.org/schemas/uportal/io/user" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.0" xsi:schemaLocation="https://source.jasig.org/schemas/uportal/io/portlet-definition https://source.jasig.org/schemas/uportal/io/portlet-definition/portlet-definition-4.0.xsd">
<title>Reddit Feed</title>
<name>Reddit Feed</name>
<fname>my-subreddit</fname>
<desc>News feed portlet for reddit feed.</desc>
<t
{
"nodeId":"u23l1n234",
"title":"/r/uwmadison",
"description":"The UW-Madison subreddit. We do not monitor this feed.",
"url":"https://www.reddit.com/r/uwmadison",
"iconUrl":null,
"faIcon":"fa-reddit",
"fname":"uwmadison-sub-reddit",
"target": "_blank",
"widgetURL": "/web/api/uwmadisonreddit.json",