Skip to content

Instantly share code, notes, and snippets.

View fernandocamargo's full-sized avatar
💀
I am the beast I worship

Fernando Camargo Del Buono fernandocamargo

💀
I am the beast I worship
View GitHub Profile
var _ = require('lodash');
module.exports.arrayDiffToHtmlTable = function () {
var occurrences = _.flatten(_.toArray(arguments));
var cache = {};
var results = occurrences.reduce(function (stack, item) {
var rewrite = {};
var flatten = Object.assign(_.omit(item, ['meta']), item.meta);
var data = rewrite[item._id] = flatten;
cache[item._id] = (cache.hasOwnProperty(item._id) ? cache[item._id] : flatten);
const test = [[1, [2, [3]]], 4];
const dig = (stack, object) =>
Array.isArray(object) ? flatten(object, stack) : stack.concat(object);
const flatten = (input, output = []) => input.reduce(dig, output);
console.clear();
console.log(flatten(test)); // [1, 2, 3, 4]
/*
Write a program in JavaScript that prints the numbers from 1 to 100.
But for multiples of seven print "Sou" instead of the number and for
the multiples of eleven print "Dev". For numbers which are multiples
of both seven and eleven print "SouDev".
(note: printing with console.log() is fine)
*/
console.clear()
import first from 'lodash/first';
import get from 'lodash/get';
import React from 'react';
import { isEmail } from 'validator';
import { TEXT, CHECKBOX } from 'constants/fields';
import { SUBMIT } from 'constants/controls';
import ValidationMessages from 'messages/validation';
import styles from './styles.css';
import PropTypes from 'prop-types';
export const component = ({ title, description }) => (
<dl>
<dt>{title}</dt>
<dd>{description}</dd>
</dl>
);
export default Object.assign(component, {
import { pick } from 'ramda';
import {
ALREADY_EXISTS,
COMMUNICATION_ID_NOT_FOUND,
GENERAL_SIGNUP_ERROR,
} from 'constants/signUp';
import {
ATTRACTION_ALREADY_ASSIGNED_TO_COMMUNICATION_ID as ALREADY_EXISTS_ERROR_CODE,
COMMUNICATION_ID_NOT_FOUND as COMMUNICATION_ID_NOT_FOUND_ERROR_CODE,
const selectActivationStatus = createSelector(
selectActivationInProgress,
selectResendActivationInProgress,
selectActivationError,
selectResendActivationError,
selectActivationSuccess,
selectResendActivationSuccess,
(
activateInProgress,
resendInProgress,
@function spacing($amount = 1){
@return ($amount * 2) + 'rem';
}
/* after */
.my-module {
padding: spacing();
margin: spacing(2);
}
import React, { Component } from 'react';
import { intlShape } from 'react-intl';
import PropTypes from 'prop-types';
import { SettingsPropType } from 'common/propTypes';
import compose from './composition';
import Render from './render';
import ErrorNotification from './render/error-notification';
import React, { Component } from 'react';
import { intlShape } from 'react-intl';
import PropTypes from 'prop-types';
import noop from 'lodash/noop';
import { forEach } from 'utils/rendering';
import Public from 'components/pages/public';
import Tab from 'components/Tab';
import Form from 'components/Form';
import GenericMessages from 'messages/generic';