View index.js
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 | |
} |
View GetEarliestFSharpFileModifiedDate.fsx
open System.IO | |
let sourceDir = [ __SOURCE_DIRECTORY__ ] | |
let getFiles searchPattern dir = | |
seq { | |
yield! Directory.EnumerateFiles(dir, searchPattern) | |
} | |
let log x = |
View validation.fsx
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 |
View scripts.yml
# 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 |
View addScriptsToPackage.ts
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) |
View object-transform-example.ts
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) |