A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.
Running a local server for testing purposes:
| var a = { | |
| i: 1, | |
| // toString: function () { | |
| // return a.i++; | |
| // } | |
| valueOf: function () { | |
| return a.i++; | |
| } | |
| // When using loose equality, due to type coersion, if one of the operands is of a different type than the other, the engine will attempt to convert one to the other. In the case of an object on the left and a number on the right, it will attempt to convert the object to a number by first calling valueOf if it is callable, and failing that, it will call toString | |
| // every time one of these is called, i is being incemented. The == operator calls valueOf then toString |
| function hashCode(str) { | |
| var hash = 0; | |
| for (var i = 0; i < str.length; i++) { | |
| hash = str.charCodeAt(i) + ((hash << 5) - hash); | |
| } | |
| return hash; | |
| } | |
| function intToRGB(i) { | |
| var c = (i & 0x00FFFFFF) |
| const pipe = (...fns) => x => fns.reduce((acc, fn) => fn(acc), x); //x = form | |
| const curry = fn => (...args) => fn.bind(null, ...args); | |
| const map = curry((fn, arr) => arr.map(fn)); | |
| const join = curry((str, arr) => arr.join(str)); | |
| const toLowerCase = str => str.toLowerCase(); |
A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.
Running a local server for testing purposes:
| function toJSON(node) { | |
| node = node || this; | |
| var obj = { | |
| nodeType: node.nodeType | |
| }; | |
| if (node.tagName) { | |
| obj.tagName = node.tagName.toLowerCase(); | |
| } else | |
| if (node.nodeName) { | |
| obj.nodeName = node.nodeName; |
| /** @lint */ | |
| /** | |
| * @module orb/features/_orbevents | |
| */ | |
| define('orb/features/_orbevents', ['orb/lib/_event'], function (event) { | |
| 'use strict'; | |
| var win; | |
| (function () { | |
| var $, | |
| clockLoaded = false, | |
| _environment = null, | |
| _flagpoles = {}, | |
| labels = { | |
| searchSuggestion: "Search" | |
| }, | |
| // Oh what a tangled web we stare, when first we practice to declare | |
| // ---------------------------------------------------------------- | |
| // When var statement become longer than a page, there are some problems | |
| var a, | |
| b, | |
| c, <- take this line out and the rest vars are now global | |
| d, | |
| e; |
| /** | |
| @name getNearestAnchorElement | |
| @private | |
| @method | |
| @param {Object} startNode The node to start the scan from | |
| @param {Object} endNode The node to end on | |
| @description Find the ancestor of startNode that is an anchor link (keeps searching up until the endNode) | |
| */ | |
| function getNearestAnchorElement(startNode, endNode){ |
| function simulateClick(element) { | |
| var evt, | |
| oldOnclick = element.onclick; | |
| element.onclick = function() { | |
| if (typeof oldOnclick === 'function' ) { | |
| return oldOnclick.apply(element); | |
| } | |
| return false; | |
| }; |