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 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 higher-order-lamda.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
// If we wrote a multiply function: | |
const multiply = (n, m) => n * m | |
// If we wrote an expression: | |
[ 1, 2, 3, 4, 5 ].map( (m) => multiply(10, m) ) | |
// It would evaluate to: | |
[ 10, 20, 30, 40, 50 ] | |
// But we could also write that example like: | |
const multBy = (n) => (m) => n * m | |
// And then if we wrote an expression: |
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 snippet-video-download-link.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
/** | |
* Create a download link for video displayed on current page and | |
* put the link into either window.SELECTOR if set, or body, or if | |
* site is reconized by script it should add download link under the | |
* video. | |
*/ | |
(function(decoratee) { | |
// Tries to get and display a link | |
attemptToGetAndRenderDownloadLink(); |
View explaination.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
/* Explaination for the code around 25mins of | |
* https://www.youtube.com/watch?v=4ECoOX5QZEg&lc=z13jjdxj3waze5aam04cdre5llyaspvi25c.1486236089300698 | |
*/ | |
// We have 4 helper functions | |
const mult = (a, b) => a * b; | |
const sum = (a, b) => a + b; | |
// this is how the curried "apply" behaves. | |
const apply = (fn) => (...args) => fn.apply(null, args); | |
// we don't need to mess up the gist with zip. | |
const zip = `fahghetttaahhh booowwwwttt it`; |
View controllers.application.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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Email Message Demo' | |
}); |
NewerOlder