This file contains 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 arr = {{ dataset.data }} | |
const summ = summarizeProperties(arr, ['name']) | |
let res = '' | |
for(let p in summ){ | |
const fp = `The property ${p} can have` | |
const ps = Array.isArray(summ[p]) | |
? ` the following values: ${summ[p].toString()}.` | |
: ` values between ${summ[p].min} and ${summ[p].max}.` |
This file contains 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 data = {{ dataset.data }} | |
const openai = {{ openai.data }} | |
const { sql } = openai || {sql:'SELECT * FROM ?'} | |
const res = alasql(sql,[data]) | |
return res |
This file contains 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
window.summarizeProperties = (data, excluded = []) => { | |
const result = {}; | |
data.forEach(obj => { | |
for (const key in obj) { | |
if (excluded.indexOf(key) === -1) { | |
let value = obj[key]; | |
let valueIsDate = false; | |
// Check if the value is a date |
This file contains 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 distance = (lat1,lon1,lat2,lon2) => { | |
lon1 = lon1 * Math.PI / 180 | |
lon2 = lon2 * Math.PI / 180 | |
lat1 = lat1 * Math.PI / 180 | |
lat2 = lat2 * Math.PI / 180 | |
let dlon = lon2 - lon1; | |
let dlat = lat2 - lat1; | |
let a = Math.pow(Math.sin(dlat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon / 2),2) |
This file contains 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 Service from '@ember/service'; | |
const has = () => true; | |
const { console, WeakMap, Proxy, Symbol } = window; | |
const get = (target, key) => key === Symbol.unscopables ? undefined : target[key]; | |
export default Service.extend({ |
This file contains 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
/** | |
* Convert PDFDocument to Base64 | |
*/ | |
const PDFDocument = require('pdfkit'); | |
const stream = require('./stream'); | |
// crate document and write stream | |
let doc = new PDFDocument(); | |
let writeStream = new stream.WritableBufferStream(); |
This file contains 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
col.append('<div class="item" style="flex:'+flex_value_row+';background-color:'+color+';margin-bottom:'+border_bottom+'px;"></div>') |
This file contains 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 col = $('<div class="col" style="flex:'+flex_value_col+';"></div>') |
This file contains 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 gen(){ | |
$('body').empty() | |
var number_column = parseInt(Math.random()*6) + 2 | |
for(var i=0; i<number_column; ++i){ | |
var number_rows = parseInt(Math.random()*50) + 5 |
This file contains 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 async id="__bs_script__" | |
src="http://localhost:3000/ browser-sync/ browser-sync-client.js?v=2.18.8 "> | |
</script> |
NewerOlder