Skip to content

Instantly share code, notes, and snippets.

View htmlr's full-sized avatar

Richard Lee htmlr

  • Melbourne, Australia
View GitHub Profile
@htmlr
htmlr / example.html
Created January 11, 2012 00:18
jQuery scroll paging script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Scroll Loader Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://gist.github.com/1592132.js?file=scrollLoader.js"></script>
</head>
<body>
<ol id="feed">
@htmlr
htmlr / example.html
Created January 11, 2012 00:23
jQuery FAQ list toogle plugin
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery FAQ Toggle Plugin Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://gist.github.com/1592157.js?file=faqToggle.js"></script>
<style type="text/css">
dl.faqToggle dt { color:#006F53; cursor:pointer; margin:0 0 .25em 0; display:block; }
dl.faqToggle dd { display:block; }
@htmlr
htmlr / example.html
Created January 11, 2012 00:38
jQuery simple image resize
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Simple Image Resize</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://gist.github.com/1592221.js?file=simpleImgResize.js"></script>
<style type="text/css">
#srcImg { border:1px solid red; }
#banner { border:1px solid green; width:200px;height:200px;overflow:hidden; }
@htmlr
htmlr / dabblet.css
Created January 19, 2012 03:51
Google Talk Embed Example
/**
* The first commented line is your dabblet’s title
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
font: 13px/1.4 Arial;
color:#666666;
}
@htmlr
htmlr / list_open_communities.vm
Created February 5, 2012 11:20
Liferay - List Open Communities
## Grab this service as MyPlaces only available to authenticated users
#set($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
## Get all Groups
#set($groupList = $groupLocalService.getGroups(-1, -1))
## Check if we have Groups before processing
#if($listTool.size($groupList)>0)
## Grab all groups that are Communities
@htmlr
htmlr / init_custom.vm
Created February 5, 2012 22:37
Liferay - Embed Web Contents for Global and Community level
#*
REQUIREMENTS:
journal.article.force.autogenerate.id must be set to false in portal-ext to allow custom ID
USAGE:
For global: simply create Web Content ID
For a specific community: subfix Community ID E.g. FOOTER-COPY-18
*#
## Example common footer copy
@htmlr
htmlr / portlet.vm
Created February 5, 2012 22:43
Liferay - Detecting portlet types to enable custom markup in portlet.vm
#parse ($init) ## REQUIRED to "parse" Velocity Vars
...
...
...
## Let's get the REAL portlet id, not the "56_INSTANCE_blahG" instance id
#set ($the_portlet_id = $getterUtil.getInteger($stringUtil.extractFirst($portlet_display.getId(),"_")))
...
...
...
@htmlr
htmlr / jqueryui.videolightbox.js
Created February 23, 2012 01:59
jQuery Video Lightbox (using jQuery UI dialog)
/* Video Lightbox */
jQuery('.video a').click(function(e) {
var videoUrl = jQuery(this).attr('href');
//console.log(videoUrl);
if (videoUrl) {
var videoTitle = jQuery(this).text();
var videoW = 640, videoH = 360;
var lightbox = jQuery('<iframe id="" src="' + videoUrl + '" width="' + videoW + '" height="' + videoH + '" frameborder="0" allowfullscreen></iframe>');
lightbox.dialog({
@htmlr
htmlr / init_custom.vm
Created March 6, 2012 01:21
Liferay - Mobile detection March 2012
#****************************************************
MOBILE DEVICE CHECK
adapted from http://detectmobilebrowsers.com/
(current devices as of 6/3/2012)
*****************************************************#
#set($userAgent = $request.getHeader("User-Agent").toLowerCase())
#set($isMobile = false)
#if($userAgent.matches(".*(android.+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino).*")||$userAgent.substring(0,4).matches("1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl
@htmlr
htmlr / init_custom.vm
Created March 6, 2012 01:24
Liferay - Maximized Sign-in Portlet Check
#****************************************************
Check if login maximized
*****************************************************#
#set ($is_login_maximized = false)
#if($is_maximized && $layoutTypePortlet.getStateMaxPortletId() == 58)
#set ($is_login_maximized = true)
#end
#* Example usage: