Skip to content

Instantly share code, notes, and snippets.

Jon Nyman jon49

Block or report user

Report or block jon49

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jon49
jon49 / index.js
Created Jan 30, 2018
Last youtube videos on the survival podcast
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
}
@jon49
jon49 / GetEarliestFSharpFileModifiedDate.fsx
Last active Dec 3, 2017
See the earliest F# file you have written
View GetEarliestFSharpFileModifiedDate.fsx
open System.IO
let sourceDir = [ __SOURCE_DIRECTORY__ ]
let getFiles searchPattern dir =
seq {
yield! Directory.EnumerateFiles(dir, searchPattern)
}
let log x =
@jon49
jon49 / validation.fsx
Last active Nov 27, 2016
Using lists in validation in F#
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
@jon49
jon49 / scripts.yml
Created Apr 12, 2016
YAML Script Example File
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
@jon49
jon49 / addScriptsToPackage.ts
Created Nov 23, 2015
Use yaml for npm command line scripts and merge with package.json
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)
You can’t perform that action at this time.