Skip to content

Instantly share code, notes, and snippets.

View hampusn's full-sized avatar

Hampus Nordin hampusn

View GitHub Profile
@hampusn
hampusn / svv
Created June 4, 2016 23:58
Bash-script to get the current SiteVision version for a URL
#!/usr/bin/env bash
####################################################
# Script to get the SiteVision version of a URL.
# This depends on the linked assets having the
# version number in their URLs.
####################################################
if [ -z "$1" ]; then
echo "Missing argument (URL)"
@hampusn
hampusn / dummy
Created June 9, 2016 21:22
Bash-script to download an image from placehold.it
#!/usr/bin/env bash
####################################################
# Script to download a dummy/placeholder image.
####################################################
if [ -z "$1" ]; then
echo "Missing argument with the pixel dimensions (try 'dummy 250x200')"
exit 1
fi
@hampusn
hampusn / script-module-client.js
Last active December 15, 2016 13:48
script-module
/**
* [MODULE NAME]
*
* Limepark AB, 2016
*/
(function (window, document, $) {
// ...
// Document Ready
@hampusn
hampusn / query.vm
Last active February 4, 2017 09:19
sv-fb-predefined-search-portlet-velocity-example
#set( $propertyUtil = $sitevisionUtils.propertyUtil )
#set( $currentPage = $sitevisionUtils.portletContextUtil.currentPage )
#set( $metadataValue = $propertyUtil.getString($currentPage, 'META', '') )
#if( "$!metadataValue" != "" )
+metadata.META:"$metadataValue"
#end
@hampusn
hampusn / queryobject.js
Last active September 29, 2017 12:17
Get query parameters as literal object.
// Get query parameters as literal object.
var queryObject = (function (queryParams, k, v) {
return queryParams.reduce(function (params, p) {
if ((p = p.split('=')).length) {
k = p[0];
v = p[0];
params[k] = (typeof params[k] !== 'undefined') ? (Array.isArray(params[k]) ? params[k] : [params[k]]).concat(v) : v;
}
return params;
}, {});
@hampusn
hampusn / predefinedsearch-hits-template.vm
Created April 3, 2019 11:01
Söklistning: Standardmall med "skapad av"
##
## Utility API
#set ($outputUtil = $sitevisionUtils.outputUtil)
#set ($portletContextUtil = $sitevisionUtils.portletContextUtil)
#set ($resourceLocatorUtil = $sitevisionUtils.resourceLocatorUtil)
#set ($scriptUtil = $sitevisionUtils.scriptUtil)
#set ($docTypeUtil = $sitevisionUtils.docTypeUtil)
##
## Portlet properties