Skip to content

Instantly share code, notes, and snippets.

@robsilva
robsilva / simple-pagination.js
Created July 16, 2018 19:22 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@robsilva
robsilva / distinct-values.xsl
Created November 30, 2016 18:29
Distinct values in XSLT 1.0
<xsl:key name="product" match="/items/item/products/product/text()" use="." />
<xsl:template match="/">
<xsl:for-each select="/items/item/products/product/text()[generate-id()
= generate-id(key('product',.)[1])]">
<li>
<xsl:value-of select="."/>
</li>
</xsl:for-each>
@robsilva
robsilva / ng2-custom-events.ts
Last active October 2, 2016 15:23
Raising custom events in Angular 2
// index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
@robsilva
robsilva / process-design.html
Created July 26, 2016 19:39
process design layout edit
<div class="step-pane sample-pane" data-step="3">
<div class="form-group">
<h4>When you produce Economy modules, what is the cycle time for each of your process steps? </h4>
<textarea name="InputMessage" rows="6" class="form-control" type="text" required></textarea>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<!--
Important:
Make sure all list fields are of type "Text" with no validation
-->
<div
class="form-container hbs-forminator"
id="paymentRequestForm"
data-method="list"