Espen Hovlandsdal rexxars
- San Francisco
- Sign in to view email
- https://espen.codes/
View blocksToHtml.vue
<template> | |
<div v-html="renderHtml(content)"></div> | |
</template> | |
<script> | |
const blocksToHtml = require("@sanity/block-content-to-html") | |
const h = blocksToHtml.h | |
const serializers = { |
View image-render.php
<?php | |
require_once './vendor/autoload.php'; | |
$client = new Sanity\Client([ | |
'projectId' => '3do82whm', | |
'dataset' => 'production', | |
'useCdn' => true, | |
]); | |
$doc = $client->getDocument('47abbe60-f184-4eff-99e0-3a85c5c07c3a'); | |
$html = Sanity\BlockContent::toHtml($doc['body'], [ |
View input.js
// Reduced/boiled down from a webpack bundle, obviously not the real thing | |
var zing = {}; | |
(function foo(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.default = sortableContainer; | |
function sortableContainer(WrappedComponent) { | |
var _class, |
View index.js
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') | |
); |
View example.php
<?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'], [ |
View jsondump.jsx
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> | |
} |
View gist:1336dead6f1f31d2c825
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 |
View gist:452a936fcc428273ae2c
<?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) | |
) | |
)); |
View gist:73862ece23195a84513c
<?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'] | |
], | |
View gist:8ce51e1b2dec75275919
'use strict'; | |
function deep(obj, prop) { | |
var segs = prop.split('.'); | |
while (segs.length) { | |
obj = obj[segs.shift()]; | |
} | |
return obj; | |
} |
NewerOlder