Skip to content

Instantly share code, notes, and snippets.

@whitemx
whitemx / pagination.jade
Created May 20, 2016 08:44
A Jade HTML mixin to render Bootstrap pagination
//- Pagination mixin
//- ----------------
//- start=# to start pagination at
//- numpages=# links to serve up
//- base=base url before num
//-
//- Example:
//- pagination(1,5,4,'/disc/','?keywords=test')
//- Yields: | < | 3 | 4 | 5 | 6 | 7 | > |
//- « = /disc/2, 3 = /disc/3, 4 = #, .. 7 = /disc/7, » = /disc/8
let
PageRange = {1..100},
Source = List.Transform(PageRange, each try {_, fnGetCollectionData(_)} otherwise null),
First = List.FirstN(Source, each _ <> null),
Table = Table.FromRows(First, {"Page", "Column1"}),
split = Splitter.SplitTextByDelimiter(","),
fieldnames = split(fnGetParameter("fields")),
Expanded = Table.ExpandTableColumn(Table, "Column1", fieldnames)
in
Expanded
let
fnGetCollectionData = (start as number) as table =>
let
endpoint = fnGetParameter("endpoint"),
count = fnGetParameter("count"),
start = start - 1,
apikey = fnGetParameter("apikey"),
Source = Json.Document(Web.Contents(endpoint,
[
Query=[
//Written by Ken Puls, FCPA, FCMA, MS MVP (Excel)
//Original Source: http://www.excelguru.ca/blog/2014/11/26/building-a-parameter-table-for-power-query/
(ParameterName as text) =>
let
ParamSource = Excel.CurrentWorkbook(){[Name="Parameters"]}[Content],
ParamRow = Table.SelectRows(ParamSource, each ([Parameter] = ParameterName)),
Value=if Table.IsEmpty(ParamRow)=true
then null
else Record.Field(ParamRow{0},"Value")
@whitemx
whitemx / doclinks.json
Created February 4, 2015 14:22
doclinks
@whitemx
whitemx / unpbootheader
Created January 5, 2015 14:17
UnpBootHeader
<unp:UnpBootHeader>
<unp:this.navitems><![CDATA[#{javascript:[
{label: "Dashboard", hasSubMenu: false, page: "/UnpMain.xsp", icon: "fa-dashboard"},
{label: "Lists", icon: "fa-list", children: [
{"label": "Flat", "icon": "fa-list-alt", "page": "/FlatView.xsp"},
{"label": "Detailed", "icon": "fa-list-alt", "page": "/DetailView.xsp"},
{"label": "Categorized", "icon": "fa-list", "page": "/Categorized.xsp"},
{"label": "Accordion", "icon": "fa-th-list", "page": "/Accordion.xsp"}
]},
{label: "Cards", hasSubMenu: false, page: "/BaseCards.xsp", icon: "fa-book"},
@whitemx
whitemx / ldcvia-remote.txt
Last active August 29, 2015 14:11
Sample LDC Via Migration Config
#The email address of the user running the migration (this will match the email of the super user account at LDC Via)
user.email = fred@ldcvia.com
#Language the tool will run in. Currently only EN is supported, if you need other languages please let us know
language = EN
#The server the source nsf files can be found on leave this empty to use the current server (which is the setting that you would use is you were running the utility on the actual Domino server)
nsf.sourceServerName = Apps/LDCVIA
#Multiple databases can be stipulated here separated by a "," , separate directories paths with "\\"
#At least one database must be provided
@whitemx
whitemx / ldcvia-local.txt
Created December 18, 2014 11:50
Sample LDC Via Migration Config
#The email address of the user running the migration (this will match the email of the super user account at LDC Via)
user.email = fred@ldcvia.com
#Language the tool will run in. Currently only EN is supported, if you need other languages please let us know
language = EN
#The server the source nsf files can be found on leave this empty to use the current server (which is the setting that you would use is you were running the utility on the actual Domino server)
nsf.sourceServerName = Apps/LDCVia
#Multiple databases can be stipulated here separated by a "," , separate directories paths with "\\"
#At least one database must be provided
@whitemx
whitemx / put-document.js
Created December 9, 2014 16:40
LDC Via PUT new document
function saveNewDocument() {
var data = {};
data.__form = "MainTopic";
data.Body = {
"type": "multipart",
"content": [{
"contentType": "text/plain; charset=UTF-8",
"data": "<p>Some HTML content</p>"
}]
};
@whitemx
whitemx / getdatabases.js
Created December 9, 2014 15:11
LDC Via get list of databases
var root = 'https://demo.ldcvia.com';
var apikey = '<ENTER YOUR API KEY HERE>';
$.ajax({
dataType: 'json',
type: 'GET',
url: root + '/1.0/databases',
data: data,
headers: {
'apikey': apikey
},