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 ReactDOM = require('react-dom'); | |
| var ReactMarkdown = require('react-markdown'); | |
| var input = '# This is a header\n\nAnd this is a paragraph'; | |
| ReactDOM.render( | |
| React.createElement(ReactMarkdown, {source: input}), | |
| document.getElementById('container') | |
| ); |
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
| <?php | |
| require_once './vendor/autoload.php'; | |
| $client = new Sanity\Client([ | |
| 'projectId' => '3do82whm', | |
| 'dataset' => 'production', | |
| ]); | |
| $doc = $client->getDocument('47abbe60-f184-4eff-99e0-3a85c5c07c3a'); | |
| $html = Sanity\BlockContent::toHtml($doc['body'], [ |
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 React from 'react'; | |
| class JsonDump extends React.Component { | |
| static propTypes = { | |
| children: React.PropTypes.any | |
| } | |
| render() { | |
| return <pre>{JSON.stringify(this.props.children, null, 4)}</pre> | |
| } |
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
| 2 bokser kokosmelk | |
| 4 dl vann | |
| 7-8 teskjer green curry paste | |
| 1 sjalottløk | |
| 1 rødløk | |
| 3 fedd hvitløk | |
| "En god dæsj" fiskesaus (1 ss? 2 ss?) | |
| 4 chili | |
| 1 gulerot |
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
| <?php | |
| $postData = array(); // Fill this with your JSON/JS | |
| $context = stream_context_create(array( | |
| 'http' => array( | |
| 'method' => 'POST', | |
| 'header' => 'Content-Type: application/json'. "\r\n", | |
| 'content' => json_encode($postData) | |
| ) | |
| )); |
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
| <?php | |
| new AuthArrayAdapter([ | |
| // Shorthand/old style access (read+write for all endpoints) | |
| 'oldPubKey' => 'oldPrivKey', | |
| 'pubKey1' => [ | |
| 'someRoPrivateKey' => ['images.get', 'image.get', 'metadata.get'], | |
| 'someRwPrivateKey' => ['images.post', 'image.put', 'metadata.post'] | |
| ], | |
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
| 'use strict'; | |
| function deep(obj, prop) { | |
| var segs = prop.split('.'); | |
| while (segs.length) { | |
| obj = obj[segs.shift()]; | |
| } | |
| return obj; | |
| } |
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
| // In some app (say, a flickr-image-app): | |
| appApi.emit('image-selected-for-upload', { url: someUrl, source: 'flickr' }) | |
| appApi.on('image-uploaded', function(e) { | |
| if (e.data.source !== 'flickr') { | |
| return; | |
| } | |
| alert('Image uploaded'); | |
| }); |
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 imbo = new Imbo.Client('host', 'pub', 'priv'); | |
| var fileInput = document.querySelector('input[type=file]'); | |
| fileInput.addEventListener('change', uploadFiles, false); | |
| function uploadFiles() { | |
| async.mapSeries( | |
| fileInput.files, | |
| imbo.addImage.bind(imbo), | |
| onFilesUploaded |
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
| <?php | |
| // Now: | |
| $externalRelatedArticles = $relatedArticlesService->prepare(array('scope' => 'external', | |
| 'articleId' => $article->getId(), | |
| 'tagId' => $tagId, | |
| 'limitByDomain' => 2 | |
| )); | |
| // Suggested: | |
| $externalRelatedArticles = $relatedArticlesService->prepare(array( |