View flower-power.py
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
#!/usr/bin/python | |
# Udacity exercise. Just posted the code here to help anyone who wanted to see the work behind my posted result. | |
__author__ = 'Michael Rosata mrosata1984@gmail.com' | |
__package__ = '' | |
from random import random | |
import turtle | |
class TurtleArtist(turtle.Turtle): | |
_origin = (0, 0) |
View fp-either-monad.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
import is from './is-util'; | |
/** | |
* Either Monad class (from Functional Programming in JavaScript) | |
*/ | |
class Either { | |
constructor(value) { | |
this._value = value; | |
} | |
get value () { |
View la-ramda.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
const R = new LaRamda() | |
/** | |
* A subset of custom implementations of functions from | |
* the Ramda library. (all in Lamda form) | |
* - thanks to @xgrommx for uniq, intersection, where, evolve, | |
* applySpec, defaultTo, both, either, cond, zipWith | |
*/ | |
function LaRamda () { | |
const I = x => x |
View jsbin-functional-program.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
console.clear() | |
// The Ramda Library functions you need to breathe. | |
const Maybe = iJustMetYouThisIsCrazyImAMonadSoCallMeMaybe() | |
const { | |
map, chain, compose, reduce, filter, prop, curry | |
} = R | |
// fromEvent :: Str -> Elem -> Obs | |
const fromEvent = curry((eventType, elem) => { | |
return Rx.Observable.fromEvent(elem, eventType) |
View map-functional-args.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
// One suggestion I have on the way I wrote map in this video: | |
// https://www.youtube.com/watch?v=qTeeVd8hOFY | |
// Instead of passing the transform function as the last param | |
// and the array as the first... it would be better to pass the | |
// transformFn first and the array as the last parameter to map. | |
function map (transformFn, array) { | |
const rv = [] | |
for (let i = 0; i < array.length; i++) { |
View memioze-with-ttl.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
/** | |
* Memioze a function with a TTL | |
* @param func {function} The function to memioze (can return promise) | |
* @param ttl {number?} milliseconds to cache results (default = 30000) | |
* @param ttlError {number?} milliseconds to cache errors (default = ttl = 30000) | |
* @param initialValue {*} an optional value to return before initial func() result | |
* @return {{get: (function(...[*]=): Promise<*>), clear: (function(): void)}} | |
*/ | |
export function memoizeWithTTL ({ func, ttl = 30000, ttlError = ttl, initialValue }) { |
View gist:07b72ba0b7d08ab011eda483c7caadb4
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
Verifying my Blockstack ID is secured with the address 15TypPzhtG7tupJbtybU8p7oxjrYHsGkwf https://explorer.blockstack.org/address/15TypPzhtG7tupJbtybU8p7oxjrYHsGkwf |
View denode-aws-service-code.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
#!/usr/bin/node | |
//////////////////////////////////////////////////////////////////////////////// | |
//// Create AWS Service Promisified Functions | |
//// @author Michael Rosata | |
//// | |
//// @dependencies ramda, yargs | |
//// | |
//// @desc | |
//// Returns the code that would wrap every method from one AWS Service into | |
//// functions that return Promises rather than those returning Node style |
View .env.local
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
REACT_APP_FB_APP_ID="12345-abcde" | |
REACT_APP_FB_ACCOUNT_KIT_VERSION="v1.2" | |
REACT_APP_META_THEME_COLOR="#FAFEFA" | |
REACT_APP_HTML_TITLE="React/Redux/Reselect Starter" |
View csv_monster.py
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
""" | |
Merge together .csv files. I'm creating this because I have 30 .csv files which need to be concatenated | |
together. This uses the headers from 1 file and then will concate w/o headers 1 through n such as : | |
"customer-data.csv", "customer-data (1).csv" ... "customer-data (n).csv" | |
""" | |
# Todo: make use of the csv module and check headers from each file to make sure data lines up. | |
# Todo: allow explicit filenames to be passed in as well as lists of files | |
import csv | |
class CSV_Monster: |
NewerOlder