- `https://www.linkedin.com/in/charl-marais-9168b84
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function advancedFilter(collection, match) { | |
const keysOf = obj => Object.keys(obj) | |
const toKeyValue = obj => key => ({key, value: obj[key]}); | |
const matchKeyValue = keyValue1 => keyValue2 => | |
keyValue1.key === keyValue2.key && | |
keyValue1.value === keyValue2.value; | |
const matchOnAll = keyValues => keyValue => keyValues.some(matchKeyValue(keyValue)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get(/^(\\/what\\/get|\\/why\\/get|\\/who\\/get|\\/how\\/get)(?:\\/(?=$))?$/i, function(req, res, next) { | |
//get the requested page | |
var page = getPage(req.url); | |
var contentPanel = getParsedPage(page); | |
var data = {'contentPanel' : contentPanel}; | |
res.send(stringify(data, null, 2)); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Helper functions | |
var getPage = function() { | |
var urlparts = document.location.href.split("/"); | |
var page = urlparts[urlparts.length-1]; | |
return page; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loadContent = function(name, success, fail){ | |
$.ajax({ | |
url:name+ "/get", | |
type:"GET", | |
dataType:"json", | |
success: function(data) { success(name, data); }, | |
error: fail | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react'); | |
var Header = require('../Components/Header.jsx').Header; | |
var Menu = require("../Components/Menu.jsx").Menu; | |
var ContentPanel = require("../Components/ContentPanel.jsx").ContentPanel; | |
var $ = require("jquery"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script(src="/JavaScripts/highlight.pack.js") | |
script(type='text/JavaScript'). | |
var initialData=!{initialData} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script(src='/JavaScripts/main.js') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
highlight: function() { | |
$('pre code').each(function(i, block) { | |
hljs.highlightBlock(block); | |
}); | |
}, | |
//React lifecycle methods | |
componentDidUpdate : function() { | |
this.highlight() | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setContent : function(content) { | |
this.setState({content : content}); | |
var node = React.findDOMNode(this).parentNode; | |
node.firstChild.style.visibility = "initial"; | |
node.className = node.className.substr(0, node.className.length - " contentImageShow".length); | |
}, | |
setLoading: function(){ | |
var node = React.findDOMNode(this).parentNode; | |
node.firstChild.style.visibility = "hidden"; |
NewerOlder