Skip to content

Instantly share code, notes, and snippets.

const nums = [1,2,3,4,5,6]
// imperative, step by step //
var addOneToAll = (collection) => {
var output = [];
for (var i = 0, i < collection.length, i++ ){
output.push(collection[0] + 1);
}
return output;
}
@mrblueblue
mrblueblue / slim-redux.js
Created November 1, 2015 09:30 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
const isMethodNamed = (name) => ifElse(has('callee'),
ifElse(compose(isMemberExpression, prop('callee')),
compose(equals(name), prop('name'), prop('property'), prop('callee')),
F
),
F
)
//// assume we have a CallExpression
Unhandled exception at line 7, column 225 in http://www.dailymotion.com/
0x800a1391 - JavaScript runtime error: 'Modernizr' is undefined
SEC7117: Network request to http://www.dailymotion.com///s2.dmcdn.net/QHKJl.js did not succeed.
This Internet Explorer instance does not have the following capabilities: internetClient privateNetworkClientServer
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337

const filterTree(color1, color2)

# [Ⓣ][1]

Blend two colors together.

Arguments

  1. color1 (string): - The first color, in hexidecimal format.
  2. color2 (string): - The second color, in hexidecimal format.
import React from 'react';
import {throttle} from 'lodash';
import compose from 'recompose/compose';
import setPropTypes from 'recompose/setPropTypes';
import lifecycle from 'recompose/lifecycle';
const _propTypes = {
onScrolled:
limit:
frequency:
@mrblueblue
mrblueblue / Main.elm
Last active December 13, 2015 18:10
"hello world" with Elm ports and Html
import Signal
import Html
port message: Signal String
main : Signal Html.Html
main =
Signal.map view model
// a partially applied function, takes A, and returns a function that takes B, C
const PieChart = (crossFilter) => (chart, node) => {
const { width, height, dcValues } = chart;
const { elasticX, cap, othersGrouper, ticks } = dcValues;
const dimensions = crossFilter.dimension(chart.dimensions);
const group = dimensions.group().reduceCount();
const innerRadius = Math.min(width,height) * 0.2;
const PieChart = dc.pieChart(node);
@mrblueblue
mrblueblue / diy-start-app.elm
Created December 26, 2015 06:15
Using a DIY Start App
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
import Signal exposing (..)
import StartApp.Simple as StartApp
type alias Model =
{ events: List String }
initialModel : Model
@mrblueblue
mrblueblue / renderList.js
Created January 13, 2016 01:29
takes a mapProps function and applies it to a list with props
export const renderList = (mapProps) => (list, ...rest) => {
if (list) {
const propsMapper = [...rest].length ? mapProps(...rest) : mapProps
return list.map(propsMapper)
}
}