Skip to content

Instantly share code, notes, and snippets.

💯
🤠 coder

Kurt Milam kurtmilam

💯
🤠 coder
Block or report user

Report or block kurtmilam

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
View machine.js
const getOtherContactsAction = () => fetch('google.com')
const load_email_details_machine = Machine({
id: 'load_contact_details_machine',
initial: 'loading',
context: {
contactData: {}
},
states: {
loading: {
@kurtmilam
kurtmilam / QuickCheck-Laws-Links.md
Last active May 25, 2019
Minimal example of using `purescript-quickcheck-laws` to verify a type class instance on a custom type
View QuickCheck-Laws-Links.md
@kurtmilam
kurtmilam / slenderize_flatten_javascript_object_.js
Last active Jul 31, 2018
Underscore/Lodash slenderize / flatten object mixin
View slenderize_flatten_javascript_object_.js
/* Copyright (C) 2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/kurtmilam/7006dc1c2123787f9679
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTI
@kurtmilam
kurtmilam / deep_extend_javascript_objects_underscore_mixin.js
Last active Apr 13, 2018
Deep Extend / Merge Javascript Objects - underscore.js Mixin
View deep_extend_javascript_objects_underscore_mixin.js
/* Copyright (C) 2012-2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This mixin now has its own github repository: https://github.com/kurtmilam/underscoreDeepExtend
* It's also available through npm and bower
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFR
@kurtmilam
kurtmilam / make promise wait for property
Last active Nov 6, 2017
Make a promise wait for a specific object property to be set
View make promise wait for property
// Semi reusable factory for promises waiting on an object property to be defined
function waitForIt (objectToObserve, propertyToObserve) {
return new Promise(function (resolve, reject) {
var checkIt = function (objectToObserve, propertyToObserve){
if (typeof objectToObserve[propertyToObserve] == 'undefined'){
setTimeout(checkIt, 500, objectToObserve, propertyToObserve)
} else {
resolve(objectToObserve[propertyToObserve])
}
}
@kurtmilam
kurtmilam / objectInitializer.js
Last active Oct 29, 2017
What is a POJO in JavaScript?
View objectInitializer.js
// Object initializer notation (also known as Object literal notation)
const mediumArticle = {
title: "What is a POJO in JavaScript?",
subTitle: "The Plain Old JavaScript Object",
tldr: "In JavaScript, a POJO is any object that can be created using the Object initializer notation."
}
@kurtmilam
kurtmilam / RoseTreeToPaths.js
Last active Aug 9, 2017
JavaScript: Get a list of all paths from root to leaves (rose tree)
View RoseTreeToPaths.js
// The rose tree is a data structure that's used to represent hierarchical
// data like XML / HTML documents or filesystems (directory and file structures).
// See this in action on the Ramda REPL: https://goo.gl/XeToZt
// R = Ramda :: http://ramdajs.com/docs/
// much cleaner solution, thanks to @syaiful6 in Ramda's Gitter channel ( https://gitter.im/ramda/ramda )
const listPathsFromRoseTree =
tree =>
!is( Array, tree[ 1 ] )
|| isEmpty( tree[ 1 ] )
View _prepare_and_set_new_atom.js
const obsv = someObservable // stream, atom, etc.
const record = U.view( 'record', obsv )
const nameDefault = 'nobody'
const nameL = 'name'
const defaultsTemplate = { /* some defaults*/ }
obsv.onValue(
R.pipe( L.transform( [ nameL
, L.when( R.isNil )
@kurtmilam
kurtmilam / examples.js
Created Jun 16, 2017
calmm input example
View examples.js
<LabeledTextAreaInput lens="CONTACT_DETAILS"
formAtom={ formAtom }
{ ...props.opportunity }
/>
<LabeledTextAreaInput lens={ [ 'path', 'to', 'CONTACT_DETAILS' ] }
formAtom={ formAtom }
validAtom={ validAtom }
disabled={ disabled }
/>
@kurtmilam
kurtmilam / labeled-text-input.js
Last active May 30, 2017
calmm labeled text input
View labeled-text-input.js
// View the lensToLabel function in the partial.lenses playground at https://goo.gl/A0BRWa
import * as R from "ramda"
import * as L from "partial.lenses"
import * as React from "karet"
import * as U from "karet.util"
import TextInput from "./text-input"
const uCFirst =
You can’t perform that action at this time.