Skip to content

Instantly share code, notes, and snippets.

@hoodunit
Created June 27, 2018 13:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoodunit/d9bf7f125a64255aff7df7927ce92357 to your computer and use it in GitHub Desktop.
Save hoodunit/d9bf7f125a64255aff7df7927ce92357 to your computer and use it in GitHub Desktop.
RevealJS with PureScript Halogen hack
<script>
// More info https://github.com/hakimel/reveal.js#configuration
var waitForBody = setInterval(function(){
console.log('Initializing RevealJS');
if (document.getElementsByClassName('reveal').length === 0) {
return;
}
clearInterval(waitForBody)
Reveal.initialize({
history: true,
// Factor of the display size that should remain empty around the content
margin: 0.05,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.1,
maxScale: 1.5,
pdfMaxPagesPerSlide: 1,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js',
async: true,
callback: function() {
hljs.configure({
tabReplace: ' ',
useBR: false,
languages: ['haskell', 'javascript', 'typescript']
});
hljs.initHighlighting();
}
}
]
});
}, 100)
</script>
appComponent :: forall m. H.Component HH.HTML Query Unit Void m
appComponent = H.component
{ initialState: const {}
, render
, eval
, receiver: const Nothing
}
render :: State -> H.ComponentHTML Query
render _ =
div [HP.class_ (H.ClassName "reveal")]
[ div [HP.class_ (H.ClassName "slides")] $
[ section [] [ img [ CSS.style imgStyle, HP.src "img/leadership_and_self_deception.png" ] ]
, section [] [ img [ CSS.style imgStyle, HP.src "img/javascript_and_self_deception.png" ] ]
]
<> javaScriptSucksSection
<> betterJavaScriptSection
<> whatsNext
<> dataInJavaScript
<> dataInPureScript
<> changeInJavaScript
<> changeInPureScript
<> problemsInJavaScript
<> beyondJavaScript
]
main :: Eff _ Unit
main = HA.runHalogenAff do
body <- HA.awaitBody
runUI appComponent unit body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment