// /swr/project.js
import useSWR, { mutate } from 'swr'
export async function fetchProject (id) {
mutate(`/api/project/${id}`, fetch(`/api/project/${id}`))
}
export default function useProject (id) {
// don't pass the fetcher so it won't fetch
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| body { | |
| height: 100%; | |
| margin: 0; | |
| width: 100%; | |
| overflow: hidden; | |
| } |
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
| //**dataURL to blob** | |
| function dataURLtoBlob(dataurl) { | |
| var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], | |
| bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); | |
| while(n--){ | |
| u8arr[n] = bstr.charCodeAt(n); | |
| } | |
| return new Blob([u8arr], {type:mime}); | |
| } |
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 XLSX = require('xlsx') | |
| function Workbook() { | |
| this.SheetNames = ['Report']; | |
| this.Sheets = {}; | |
| } | |
| var wb = new Workbook(); | |
| var ws = { |
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
| function getUUID() { | |
| const canvas = document.createElement('canvas'); | |
| const ctx = canvas.getContext('2d'); | |
| ctx.fillStyle = '#ff0000'; | |
| ctx.fillRect(0,0,8,10); | |
| const b64 = canvas.toDataURL().replace('data:image/png;base64,', ''); | |
| const bin = window.atob(b64); | |
| return bin2hex(bin.slice(-16, -12)); | |
| } |
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 path = require('path'); | |
| var webpack = require('webpack'); | |
| var autoprefixer = require('autoprefixer'); | |
| var Clean = require('clean-webpack-plugin'); | |
| var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
| var jsBuildPath = path.resolve(__dirname, 'build'); | |
| var config = { | |
| entry: { |
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 EventListener = require('react/lib/EventListener'); | |
| var partition = require('linear-partitioning'); | |
| var TileLayout = React.createClass({ | |
| getDefaultProps: function() { | |
| return { | |
| gutter: 0, | |
| photos: [] | |
| } |