Skip to content

Instantly share code, notes, and snippets.

View danhollick's full-sized avatar

Daniel Hollick danhollick

View GitHub Profile
<Grid Alignment="Center" CellSpacing="10" >
<Each Count="5">
<Text Value="This is a Fruit list"/>
</Each>
</Grid>
Fruits: [
{
type: "Apple",
subtypes: [
"GrannySmith",
"Crab",
"Red",
"Toffee"
]
},
@danhollick
danhollick / FileFetch.js
Last active October 9, 2018 10:01
Async server request
var express = require('express')
var fetch = require('isomorphic-fetch')
const FigmaAPIKey = 'mysecretkey'
const FigmaFileID = 'VAyAHaZn1tHmjOFK79pbnMTj'
async function figmaFileFetch(fileId){
let result = await fetch('https://api.figma.com/v1/files/' + fileId , {
method: 'GET',
headers: {
@danhollick
danhollick / callMiddleware.js
Last active October 10, 2018 19:12
Call Middleware
app.use('/', async function (req, res, next) {
let result = await figmaFileFetch(FigmaFileID).catch(error => console.log(error))
res.send(JSON.stringify(result))
})
app.listen(3001, console.log("Holy shit, I'm a server and I am listening on port 3001"))
@danhollick
danhollick / filter.js
Last active October 9, 2018 10:01
filtering
async function figmaFileFetch(fileId){
let result = await fetch('https://api.figma.com/v1/files/' + fileId , {
method: 'GET',
headers: {
'X-Figma-Token': FigmaAPIKey
}
})
let figmaFileStruct = await result.json()
async function figmaFileFetch(fileId){
let result = await fetch('https://api.figma.com/v1/files/' + fileId , {
method: 'GET',
headers: {
'X-Figma-Token': FigmaAPIKey
}
})
let figmaFileStruct = await result.json()
app.use('/frames', async function (req, res, next) {
let result = await figmaFileFetch(FigmaFileID).catch(error => console.log(error))
res.send(result)
})
class App extends Component {
state = { images: [
{ name: '', url:'' }
]}
render() {
return (
);
}
class App extends Component {
state = { images: [
{ name: '', url:'' }
]}
render() {
return (
<div className="App" >
{this.state.images.map( //1
(frame,i) =>
class App extends Component {
state = { images: [
{ name: '', url:'' }
]}
componentDidMount() {//1
fetch('/frames')//2
.then(res => res.json())//3
.then(data => this.setState({ images: data }))//4
.catch(error => console.log(error));