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
# scripts run with npm. to build to package.json | |
# in command line in directory `.../mobiledlr/dist` | |
# `node ./tasks/buildPackage` | |
scripts: | |
# bring together api.yml file with d.ts definitions | |
# print to public | |
api: | | |
cpx "../ts/api/**" api | |
&& node ./tasks/api-generator.js |
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 getCleanUrlPath() { | |
let url = new URL(document.location.href) | |
return url.pathname.replace(/\/$/, "") | |
} | |
window.addEventListener('beforeunload', () => { | |
let active = document.activeElement | |
localStorage.pageLocation = JSON.stringify({ | |
href: getCleanUrlPath(), | |
y: window.scrollY, |
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
open Microsoft.FSharp.Quotations.Patterns | |
open System | |
open Microsoft.FSharp.Reflection | |
open Microsoft.FSharp.Quotations | |
module P = Microsoft.FSharp.Quotations.Patterns | |
// http://www.fssnip.net/h1 | |
let rec eval = function | |
| Value(v,t) -> v | |
| Coerce(e,t) -> eval e |
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 r = require('ramda') | |
import yaml = require('js-yaml') | |
import {readFile, writeFile} from 'fs' | |
var package = require('../package.json') | |
readFile('../scripts.yml', 'utf-8', (err, file) => { | |
if (err) { | |
console.log('Error reading scripts.yml', err) | |
return process.exit(1) |
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 fs = require('fs'), | |
cheerio = require('cheerio'), | |
fetch = require('node-fetch') | |
// https://gist.github.com/endel/321925f6cafa25bbfbde | |
const Pad = size => number => { | |
let s = String(number) | |
while (s.length < (size || 2)) { s = "0" + s } | |
return s | |
} |
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
open System.IO | |
let sourceDir = [ __SOURCE_DIRECTORY__ ] | |
let getFiles searchPattern dir = | |
seq { | |
yield! Directory.EnumerateFiles(dir, searchPattern) | |
} | |
let log x = |
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 objectTransform = r.curry(function OT_(template, obj) { | |
let originalObject = obj | |
function OT(template, obj) { | |
let o = obj | |
const | |
t = template, | |
keys = r.keys(template) | |
const | |
result = r.reduce((acc, key: string) => { | |
const mapT = t[key], val = <any> r.path([key], o) |