Skip to content

Instantly share code, notes, and snippets.

View arsduo's full-sized avatar

Alex Koppel arsduo

View GitHub Profile
@arsduo
arsduo / history-export-metadata-0.19.js
Created September 16, 2018 13:43
Elm 0.19 History Export Metadata
{
"metadata": {
"versions": {
"elm": "0.19.0"
},
"types": {
"message": "Main.Msg",
"aliases": {},
"unions": {
"Main.Msg": {
@arsduo
arsduo / history-export-complete-0.19.js
Created September 16, 2018 13:27
Elm 0.19 History Export
{
"$": 0,
"a": {
"metadata": {
"versions": {
"elm": "0.19.0"
},
"types": {
"message": "Main.Msg",
"aliases": {},
@arsduo
arsduo / elmrings-sanitize-example.js
Last active September 16, 2018 13:24
Sanitizing History - example
watchWords: ["MySecretData", "password"],
historySanitizer: function(elmObjectOrRecord) {
// in 0.18, replace $ with ctor and a with _0
if (elmObjectOrRecord.$ == "MySecretData") {
// replace the access token
// make sure to return the updated object!
return { …elmObjectOrRecord, a: "[FILTERED]" };
else {
// we have a record, replace the password field
@arsduo
arsduo / elmrings-new-options.js
Created June 17, 2018 13:10
Sanitizing History - New Options
// Any Elm object constructor names or record keys that contain sensitive data.
// These will be passed to a sanitizing function you provide.
// See the next section for more details.
watchWords: termsForSensitiveData,
historySanitizer: mySanitizingFunction
@arsduo
arsduo / elmrings-init.js
Created June 17, 2018 13:09
Sanitizing History - ElmRings Configuration
app = MyElmApp.fullscreen()
myHistoryRecorder = new ElmRings({
allowDownload: true,
trackingFrequency: 60 * 1000, // 60 seconds by default
shouldSendHistory: isLoggedIn(), // or whatever's appropriate, defaults to true
storeHistory: historyData => {
// process, upload, make confetti from your history data
}
})
myHistoryRecorder.startTracking();
@arsduo
arsduo / history-export-list.js
Created June 12, 2018 15:53
Elm History Export (list)
{
"ctor": "::",
"_0": {
"title": "Too Like the Lightning"
},
"_1": {
"ctor": "::",
"_0": {
"title": "The Fear of Barbarians"
},
@arsduo
arsduo / history-export-complete.js
Created June 12, 2018 15:10
Complete Elm history export
{
"metadata": {
"versions": {
"elm": "0.18.0"
},
"types": {
"message": "Main.Msg",
"aliases": {},
"unions": {
"Main.Msg": {
@arsduo
arsduo / Example.elm
Last active June 12, 2018 15:04
Simple Sample Program
-- MODEL
model = 0
-- UPDATE
type Msg
= Increment Int
| Decrement Int
@arsduo
arsduo / history-export-history.js
Last active June 12, 2018 15:06
Elm History Export (history)
{
"history": [
{
"ctor": "Decrement",
"_0": 1
},
{
"ctor": "Increment",
"_0": 2
},
@arsduo
arsduo / history-export-metadata.js
Last active June 12, 2018 15:07
Elm History Export Format (metadata)
{
"metadata": {
"versions": {
"elm": "0.18.0"
},
"types": {
"message": "Main.Msg",
"aliases": {},
"unions": {
"Main.Msg": {