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
static const API_KEY = "ENTER YOUR API KEY"; | |
static const GIF_LIMIT = 7; | |
class { | |
onCreate() { | |
this.state = { | |
page: 0, | |
search: "", | |
images: [], |
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
<div.count class=(state.count > 0 ? "positive" : "negative")> | |
${state.count} | |
</div> | |
<button on-click('increment', -1)> | |
-1 | |
</button> | |
<button on-click('increment', 1)> | |
+1 |
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
static var isBrowser = typeof window !== "undefined"; | |
static var LOADING = 0; | |
static var RESOLVED = 1; | |
static var REJECTED = 2; | |
static function isPromise(val) { | |
return val && val.then; |
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
-- Email de test ! C'est génial ça (test accents) |
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
import marko from "@marko/rollup"; | |
const commonPlugins = [...]; | |
export default { | |
input: "src/index.js", | |
plugins: [ | |
marko.server({ | |
browser: { | |
// before passing to rollup would add the Marko plugin in hydrate mode. |
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
const END_MARKER = `#${Math.random()}`; | |
const END_COMMENT = `<!${END_MARKER}>`; | |
function streamInto(container, url) { | |
const doc = document.implementation.createHTMLDocument(""); // Using a detached document as a streaming html parser. | |
const xhr = new XMLHttpRequest(); | |
let pos = 0; | |
doc.write("<body>"); // We don't expect a head, so we flush the body to begin parsing in that context. | |
const streamRoot = document.adoptNode(doc.body); // We adopt the body into the main document, this overrides the document for the subsequent writes which flags scripts as executable in the main document. |
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
$ const mockData = [{ | |
id: 1, | |
title: "Comment", | |
content: "Content", | |
comments: [{ | |
id: 2, | |
title: "Nested Comment", | |
content: "Nested Content" | |
}] | |
}] |
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> | |
// Prolyfill for watching for loading tags and shuffeling around dom. | |
// Could potentially come on first flush. | |
</script> | |
<body> | |
<header> | |
<h1>Hello world!</h1> | |
</header> | |
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
const body = document.body | |
const container = document.createElement('div') | |
container.style.visibility = 'hidden' | |
container.style.position = 'absolute' | |
container.style.zIndex = -1 | |
export default function htmlLog (html) { | |
// Add html to a container to get its height. | |
const width = window.innerWidth - 46 // Account for console padding. | |
container.innerHTML = html |
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
// Create your jsx 'templates' | |
class NameTag extends React.Component { | |
render () { | |
return <div>My Name is {this.props.name}</div> | |
} | |
} | |
// Create the element. | |
const myNameTag = <NameTag name="Dylan"/> |