<commit_before>import _curry1 from './internal/_curry1';
import nAry from './nAry';

/**
 * Wraps a function of any arity (including nullary) in a function that accepts
 * exactly 2 parameters. Any extraneous parameters will not be passed to the
 * supplied function.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Function
 * @sig (* -> c) -> (a, b -> c)
 * @param {Function} fn The function to wrap.
 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
 *         arity 2.
 * @see R.nAry, R.unary
 * @example
 *
 *      const takesThreeArgs = function(a, b, c) {
 *        return [a, b, c];
 *      };
 *      takesThreeArgs.length; //=> 3
 *      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
 *
 *      const takesTwoArgs = R.binary(takesThreeArgs);
 *      takesTwoArgs.length; //=> 2
 *      // Only 2 arguments are passed to the wrapped function
 *      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
 * @symb R.binary(f)(a, b, c) = f(a, b)
 */
var binary = _curry1(function binary(fn) {
  return nAry(2, fn);
});
export default binary;
<commit_msg>optimize binary signature<commit_after>import _curry1 from './internal/_curry1';
import nAry from './nAry';

/**
 * Wraps a function of any arity (including nullary) in a function that accepts
 * exactly 2 parameters. Any extraneous parameters will not be passed to the
 * supplied function.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Function
 * @sig (* -> c) -> ((a, b) -> c)
 * @param {Function} fn The function to wrap.
 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
 *         arity 2.
 * @see R.nAry, R.unary
 * @example
 *
 *      const takesThreeArgs = function(a, b, c) {
 *        return [a, b, c];
 *      };
 *      takesThreeArgs.length; //=> 3
 *      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
 *
 *      const takesTwoArgs = R.binary(takesThreeArgs);
 *      takesTwoArgs.length; //=> 2
 *      // Only 2 arguments are passed to the wrapped function
 *      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
 * @symb R.binary(f)(a, b, c) = f(a, b)
 */
var binary = _curry1(function binary(fn) {
  return nAry(2, fn);
});
export default binary;
<|endoftext|>


<commit_before>import React, { Component, PropTypes } from 'react'
if (process.env.BROWSER) {
      require("./Footer.css");
}

export default class Footer extends Component {
    constructor(props) {
        super(props)
    }
    render() {
        return (

                                關於我們

                                聯絡我們

                                隱私政策

                                贊助我們

                                 除另有註明，網站內容皆採用創用CC姓名標示-非商業性-禁止改作授權條款

                                 github.com/twreporter

        )
    }
}

<commit_msg>Update Footer.js<commit_after>import React, { Component, PropTypes } from 'react'
if (process.env.BROWSER) {
      require("./Footer.css");
}

export default class Footer extends Component {
    constructor(props) {
        super(props)
    }
    render() {
        return (

                                關於我們

                                聯絡我們

                                隱私政策

                                贊助我們

                                 除另有註明，網站內容皆採用創用CC姓名標示-非商業性-禁止改作授權條款

                                 github.com/twreporter

        )
    }
}

<|endoftext|>


<commit_before>
var mp_old_id = '';

/*
  Initialize the view on document ready
 */
$(document).ready(function(){

    // proceed only if selectbox_ exists (i.e. edit page)
    if($('[id^=selectbox_]').length > 0) {

        // initialize the model program listbox
        build_selectbox();

        // set the initial selection
        set_model_program_selection();

        // build metadata table (ajax query)
        show_model_details();
    }

});

/*
  Sets the selected item in the selectbox if a ModelProgram foreign key relationship has previously been set in the
  database.
 */
function set_model_program_selection(){

        // get the value stored in the model_name hidden field
        var mp_id = $('[id^=selectbox_]').attr('id').split('_').pop();

        // set the initial selection
        var model_name = document.getElementById('id_model_name');
        model_name.value = mp_id;

        // get the selectbox
        var options = $('[id^=selectbox_]').find('option');

        if (mp_id != "")
        {
            for (var i = 0; i< options.length; i++){
                var o = options[i];
                if (o.value == mp_id) {
                    $(o).attr("selected", 1);
                    break;
                }
            }
        }
        else {
            // set selected to 'Not Specified' if mp_id is empty
            $(options[0]).attr("selected", 1);
        }
}

/*
 Constructs a select box for the ModelProgram elements using JQuery.  This selectbox is used to define the
 ModelProgram foreign key relationship.
 */
function build_selectbox(){

    // destroy any existing multiselect widgets
    $('.selectbox').multiselect('destroy');

    // rebuild the multiselect elements
    $('.selectbox').multiselect({

        // specify a max height in case there are lots of models
        maxHeight: 200,

        /*
         Add any other selectbox attributes here.
         http://davidstutz.github.io/bootstrap-multiselect/
         e.g.
            dropRight: true,
            buttonWidth: '400px',
         */

        // bind to mulitselect box events
        onDropdownHide: function(event, checked){
            // populate a table of model program metadata when the selectbox closes
            show_model_details();

        }

    });

}

/*
    Queries for ModelProgram metadata using AJAX.  Populates a table on the edit page that displays this data.  If the
    selected ModelProgram has changed, the Save button is activated.
 */
function show_model_details() {

    // get the short id of the selected item
    var shortid = $('[id^=selectbox_]').parent().find("option:selected").val();

    // call django view to get model program metadata
    $.ajax({
        type: "GET",
        url: '/hsapi/_internal/get-model-metadata/',
        data: {resource_id:shortid},
        success: function (data) {

            // if the data is empty, hide the table
            if (Object.keys(data).length == 0){
                // set the visibility of the table element (hide)
                table = document.getElementById('program_details_div');
                table.style.display = 'none';
            }
            // if the data is not empty, populate the model details table
            else {
                // set the visibility of the table element (visible)
                table_div = document.getElementById('program_details_div');
                table_div.style.display = 'block';

                // create and ordered list of keys to access input data
                var keys = ["description", "date_released", "software_version", "software_language", "operating_sys", "url"];

                // populate metadata inside description div
                var rows = document.getElementById('program_details_table').rows;
                for (i = 0; i < rows.length; i++) {

                    // get the current row element
                    var row = rows[i];

                    // get the second cell in the row
                    var cell = row.cells[1];

                    if (keys[i] != "url") {
                        // set the text for this cell
                        cell.innerText = data[keys[i]]
                    }
                    else {
                        // insert an href for the url item
                        cell.innerHTML = "Resource Landing Page"
                    }
                }

                // set the modelprogram id of the selected value
                set_hidden_model_name(shortid);

                // enable/disable the save button if the value has been changed to something new
                if (shortid != mp_old_id)
                    $('#id-executedby').find('.btn-primary').show();
                else
                    $('#id-executedby').find('.btn-primary').hide();

            }
        },
        error: function (data) {
            console.log('There was an error with model instance GET.')
        }
        //complete: function(data){
        //
        //    //var mp_old_id = $('#id_model_name').val();
        //
        //    // set the modelprogram id of the selected value
        //    set_hidden_model_name(shortid);
        //
        //    // enable/disable the save button if the value has been changed to something new
        //    //var mp_old_id = $('[id^=selectbox_]').attr('id').split('_').pop();
        //    if (shortid != mp_old_id)
        //        $('#id-executedby').find('.btn-primary').show();
        //    else
        //        $('#id-executedby').find('.btn-primary').hide();
        //}
    });

}

/*
    Sets the ModelProgram shortid to the hidden model_name field.  This field is submitted to django and used to set
    database fields ModelName and ModelForeignKey.
 */
function set_hidden_model_name(id){

    var model_name = document.getElementById('id_model_name');
    model_name.value = id;
}

/*
    Save the submitted id globally
 */
$(document).bind("submit-success", function(event){
    mp_old_id = $('[id^=selectbox_]').parent().find("option:selected").val();
});<commit_msg>cleaned modelinstance.js [#548]<commit_after>
// variable to store the last submitted model program id
var mp_old_id = '';

/*
  Initialize the view on document ready
 */
$(document).ready(function(){

    // proceed only if selectbox_ exists (i.e. edit page)
    if($('[id^=selectbox_]').length > 0) {

        // initialize the model program listbox
        build_selectbox();

        // set the initial selection
        set_model_program_selection();

        // build metadata table (ajax query)
        show_model_details();

        // set the initial value of the mp_old_id
        mp_old_id = $('[id^=selectbox_]').attr('id').split('_').pop();
    }

});

/*
  Sets the selected item in the selectbox if a ModelProgram foreign key relationship has previously been set in the
  database.
 */
function set_model_program_selection(){

        // get the value stored in the model_name hidden field
        var mp_id = $('[id^=selectbox_]').attr('id').split('_').pop();

        // set the initial selection
        var model_name = document.getElementById('id_model_name');
        model_name.value = mp_id;

        // get the selectbox
        var options = $('[id^=selectbox_]').find('option');

        if (mp_id != "")
        {
            for (var i = 0; i< options.length; i++){
                var o = options[i];
                if (o.value == mp_id) {
                    $(o).attr("selected", 1);
                    break;
                }
            }
        }
        else {
            // set selected to 'Not Specified' if mp_id is empty
            $(options[0]).attr("selected", 1);
        }
}

/*
 Constructs a select box for the ModelProgram elements using JQuery.  This selectbox is used to define the
 ModelProgram foreign key relationship.
 */
function build_selectbox(){

    // destroy any existing multiselect widgets
    $('.selectbox').multiselect('destroy');

    // rebuild the multiselect elements
    $('.selectbox').multiselect({

        // specify a max height in case there are lots of models
        maxHeight: 200,

        /*
         Add any other selectbox attributes here.
         http://davidstutz.github.io/bootstrap-multiselect/
         e.g.
            dropRight: true,
            buttonWidth: '400px',
         */

        // bind to mulitselect box events
        onDropdownHide: function(event, checked){
            // populate a table of model program metadata when the selectbox closes
            show_model_details();

        }

    });

}

/*
    Queries for ModelProgram metadata using AJAX.  Populates a table on the edit page that displays this data.  If the
    selected ModelProgram has changed, the Save button is activated.
 */
function show_model_details() {

    // get the short id of the selected item
    var shortid = $('[id^=selectbox_]').parent().find("option:selected").val();

    // call django view to get model program metadata
    $.ajax({
        type: "GET",
        url: '/hsapi/_internal/get-model-metadata/',
        data: {resource_id:shortid},
        success: function (data) {

            // if the data is empty, hide the table
            if (Object.keys(data).length == 0){
                // set the visibility of the table element (hide)
                table = document.getElementById('program_details_div');
                table.style.display = 'none';
            }
            // if the data is not empty, populate the model details table
            else {
                // set the visibility of the table element (visible)
                table_div = document.getElementById('program_details_div');
                table_div.style.display = 'block';

                // create and ordered list of keys to access input data
                var keys = ["description", "date_released", "software_version", "software_language", "operating_sys", "url"];

                // populate metadata inside description div
                var rows = document.getElementById('program_details_table').rows;
                for (i = 0; i < rows.length; i++) {

                    // get the current row element
                    var row = rows[i];

                    // get the second cell in the row
                    var cell = row.cells[1];

                    if (keys[i] != "url") {
                        // set the text for this cell
                        cell.innerText = data[keys[i]]
                    }
                    else {
                        // insert an href for the url item
                        cell.innerHTML = "Resource Landing Page"
                    }
                }
            }
        },
        error: function (data) {
            console.log('There was an error with model instance GET.')
        },
        complete: function(data){

            // set the modelprogram id of the selected value
            set_hidden_model_name(shortid);

            // enable/disable the save button if the value has been changed to something new
            if (shortid != mp_old_id)
                $('#id-executedby').find('.btn-primary').show();
            else
                $('#id-executedby').find('.btn-primary').hide();
        }
    });

}

/*
    Sets the ModelProgram shortid to the hidden model_name field.  This field is submitted to django and used to set
    database fields ModelName and ModelForeignKey.
 */
function set_hidden_model_name(id){

    var model_name = document.getElementById('id_model_name');
    model_name.value = id;
}

/*
    Save the submitted id globally
 */
$(document).bind("submit-success", function(event){
    mp_old_id = $('[id^=selectbox_]').parent().find("option:selected").val();
});<|endoftext|>


<commit_before>var detective = require('detective'),
    fs   = require('fs'),
    path = require('path'),
    resolve = require('resolve')

var filePath = path.join(process.cwd(), './foo.js')
var file = fs.readFileSync(filePath, 'utf8')
//var evalObj = eval('(function() { ' + file + '  })();');

//console.log(evalObj)
console.log("filePath", filePath)
var requires = detective(file)
console.log("requires", requires)
filePath = filePath.split('/')
filePath.pop()
filePath = filePath.join('/')
console.log("filePath", filePath)

requires.forEach(function(item) {
  console.log(path.join(filePath, item))
})
//console.dir(requires);

var res = resolve.sync('./foo', { basedir: path.resolve(__dirname) })
console.log("res", res)
<commit_msg>dont need this<commit_after><|endoftext|>


<commit_before>var _ = require('lodash');
var moment = require('frozen-moment');
var periodTools = require('./periodTools');
var ressourcesMap = require('./ressources');
var individuSchema = require('./individu');
var menageSchema = require('./menage');
var familleSchema = require('./famille');
var foyerSchema = require('./foyerFiscal');
var common = require('./common');
var PRESTATIONS = require('../prestations');

var isNotValidValue = function(value) {
    return _.isNaN(value) || _.isUndefined(value) || value === null;
};

var getPeriods = function(dateDeValeur) {
    dateDeValeur = moment(dateDeValeur).freeze();
    return {
        thisMonth: {
            key: dateDeValeur.format('YYYY-MM')
        },
        lastMonth: {
            key: dateDeValeur.subtract(1, 'months').format('YYYY-MM')
        },
        // array containing the last 12 months (taken individually)
        last12Months: _.map(_.range(1, 12 + 1), function(monthIndex) {
            return {
                key: dateDeValeur.subtract(monthIndex, 'months').format('YYYY-MM')
            };
        }),
       rollingYear: {
            debut: dateDeValeur.subtract(1, 'years').subtract(1, 'months'),
            fin: dateDeValeur,
            key: 'year:' + dateDeValeur.subtract(1, 'years').format('YYYY-MM')
        },
        referenceFiscalYear: {
            key: dateDeValeur.subtract(2, 'years').year()
        },
        rollingTrimester: {
            debut: dateDeValeur.subtract(3, 'months').subtract(1, 'months'),
            fin: dateDeValeur,
            key: dateDeValeur.subtract(3, 'months').format('YYYY-MM') + ':3'
        }
    };
};

var applyRessources = function(mesAidesEntity, openFiscaEntity, mappingSchema, situation) {
    var dateDeValeur = situation.dateDeValeur;
    var periods = getPeriods(dateDeValeur);

    function isPeriodWithin(agregatKey, periode) {
        return periode.isAfter(periods[agregatKey].debut, 'month') && periode.isBefore(periods[agregatKey].fin, 'month');
    }

    var ressourcesByType = _.groupBy(mesAidesEntity.ressources, 'type');

    _.forEach(mappingSchema, function(definitions, openFiscaKey) {
        if (! _.isArray(definitions)) {
            definitions = [definitions];
        }

        _.forEach(definitions, function(definition) {

            var srcKey = definition.src || definition;
            var fn = definition.fn;

            if (ressourcesByType[srcKey]) {
                var result = {};
                var agr = {};

                _.forEach(ressourcesByType[srcKey], function(item) {
                    if (item.periode) {
                        // Période d'origine
                        if (!result[item.periode]) result[item.periode] = 0;
                        result[item.periode] += item.montant;

                        // Aggrégats
                        _.keys(periods).forEach(function (agregatKey) {
                            if (agregatKey != 'referenceFiscalYear' && isPeriodWithin(agregatKey, moment(item.periode, 'YYYY-MM'))) {
                                if (!(agregatKey in agr)) agr[agregatKey] = 0;
                                agr[agregatKey] += fn ? fn(item.montant) : item.montant;
                            }
                        });
                    }
                });

                _.forEach(result, function(montant, periode) {
                    // Applique la transformation
                    if (fn) montant = fn(montant);
                    result[periode] = montant;
                });

                // On prolonge la ressource perçue quand c'est possible
                if (result[periods.lastMonth.key] && !_.contains(mesAidesEntity.interruptedRessources, srcKey)) {
                    result[periods.thisMonth.key] = result[periods.lastMonth.key];
                }

                if (_.size(result) > 0) {
                    if (_.size(openFiscaEntity[openFiscaKey]) > 0) {
                        openFiscaEntity[openFiscaKey] = _.extend(openFiscaEntity[openFiscaKey],result);
                    } else {
                        openFiscaEntity[openFiscaKey] = result;
                    }
                }

                _.forEach(agr, function (value, agregatKey) {
                    openFiscaEntity[openFiscaKey][periods[agregatKey].key] = value;
                });

                // On suppose que les revenus pour l'année fiscale de référence sont les mêmes que pour les 12 derniers mois, si ces revenus n'ont pas encore
                // été renseignés
                var rollingYearKey = periods.rollingYear.key,
                    referenceFiscalYearKey = periods.referenceFiscalYear.key;
                if (! situation.ressourcesYearMoins2Captured) {
                    openFiscaEntity[openFiscaKey][referenceFiscalYearKey] = openFiscaEntity[openFiscaKey][rollingYearKey];
                }
            }
        });
    });
};

var setNonInjectedPrestationsToZero = function(openFiscaEntity, dateDeValeur) {
    var periods = getPeriods(dateDeValeur);
    var concernedPeriods = periods.last12Months.concat([periods.rollingYear]);

    _.forEach(concernedPeriods, function(period) {
        var prestations = _.pick(PRESTATIONS, function(definition) {
            return definition.type == Number;
        });

        _.forEach(prestations, function(definition, prestationName) {
            openFiscaEntity[prestationName] = openFiscaEntity[prestationName] || {};
            openFiscaEntity[prestationName][period.key] = openFiscaEntity[prestationName][period.key] || 0;
        });
    });
};

var buildOpenFiscaEntity = function(mesAidesEntity, mappingSchema, situation) {
    var result = {};
    _.forEach(mappingSchema, function(definition, openFiscaKey) {
        var params = _.isString(definition) ? { src: definition } : definition;

        if (params.values) {
            result[openFiscaKey] = params.values[mesAidesEntity[params.src]];
        } else if (params.fn) {
            result[openFiscaKey] = params.src ? params.fn(mesAidesEntity[params.src], mesAidesEntity, situation) : params.fn(mesAidesEntity, situation);
        } else {
            result[openFiscaKey] = mesAidesEntity[params.src];
        }

        if (params.round && _.isNumber(result[openFiscaKey])) {
            result[openFiscaKey] = Math.round(result[openFiscaKey]);
        }

        // Supprime les null (mal supportés par OpenFisca)
        if (isNotValidValue(result[openFiscaKey])) {
            if ('default' in params) result[openFiscaKey] = params.default;
            else delete result[openFiscaKey];
        }
    });
    return result;
};

var mapIndividus = exports.mapIndividus = function (situation) {
    var individus = _.filter(situation.individus, function(individu) {
        return common.isIndividuValid(individu, situation);
    });

    return _.map(individus, function(individu) {
        if (individu.role === 'demandeur') {
            _.extend(individu, situation.patrimoine);

            var revenusLocatifs = situation.patrimoine.revenusLocatifs.map(function(revenu) {
                revenu.type = 'revenusLocatifs';
                return revenu;
            });

            var revenusDuCapital = situation.patrimoine.revenusDuCapital.map(function(revenu) {
                revenu.type = 'revenusDuCapital';
                return revenu;
            });

            individu.ressources = individu.ressources.concat(revenusLocatifs, revenusDuCapital);
        }
        var openFiscaIndividu = buildOpenFiscaEntity(individu, individuSchema, situation);
        applyRessources(individu, openFiscaIndividu, ressourcesMap.individu, situation);
        return openFiscaIndividu;
    });
};

var mapFamille = function(situation) {
    var famille = buildOpenFiscaEntity(situation, familleSchema, situation);
    var ressources = [];
    _.forEach(situation.individus, function(individu) {
        ressources = ressources.concat(individu.ressources);
    });
    applyRessources({ ressources: ressources }, famille, ressourcesMap.famille, situation);
    setNonInjectedPrestationsToZero(famille, situation.dateDeValeur);

    return famille;
};

var mapFoyerFiscal = exports.mapFoyerFiscal = function(situation) {
    var foyerFiscal = buildOpenFiscaEntity(situation, foyerSchema, situation);
    var ressources = [];
    _.forEach(situation.individus, function(individu) {
        ressources = ressources.concat(individu.ressources);
    });
    applyRessources({ ressources: ressources }, foyerFiscal, ressourcesMap.foyerFiscal, situation);

    return foyerFiscal;
};

exports.buildOpenFiscaRequest = function(situation, debug) {
    return {
        intermediate_variables: debug,
        labels: true,
        base_reforms: ['aides_ville_paris'],
        scenarios: [{
            test_case: {
                familles: [ mapFamille(situation) ],
                foyers_fiscaux: [ mapFoyerFiscal(situation) ],
                individus: mapIndividus(situation),
                menages: [ buildOpenFiscaEntity(situation, menageSchema, situation) ]
            },
            period: 'month:' + periodTools.toOpenFiscaFormat(situation.dateDeValeur)
        }],
        variables: _.keys(PRESTATIONS)
    };
};
<commit_msg>concernedPeriods => targetPeriods<commit_after>var _ = require('lodash');
var moment = require('frozen-moment');
var periodTools = require('./periodTools');
var ressourcesMap = require('./ressources');
var individuSchema = require('./individu');
var menageSchema = require('./menage');
var familleSchema = require('./famille');
var foyerSchema = require('./foyerFiscal');
var common = require('./common');
var PRESTATIONS = require('../prestations');

var isNotValidValue = function(value) {
    return _.isNaN(value) || _.isUndefined(value) || value === null;
};

var getPeriods = function(dateDeValeur) {
    dateDeValeur = moment(dateDeValeur).freeze();
    return {
        thisMonth: {
            key: dateDeValeur.format('YYYY-MM')
        },
        lastMonth: {
            key: dateDeValeur.subtract(1, 'months').format('YYYY-MM')
        },
        // array containing the last 12 months (taken individually)
        last12Months: _.map(_.range(1, 12 + 1), function(monthIndex) {
            return {
                key: dateDeValeur.subtract(monthIndex, 'months').format('YYYY-MM')
            };
        }),
       rollingYear: {
            debut: dateDeValeur.subtract(1, 'years').subtract(1, 'months'),
            fin: dateDeValeur,
            key: 'year:' + dateDeValeur.subtract(1, 'years').format('YYYY-MM')
        },
        referenceFiscalYear: {
            key: dateDeValeur.subtract(2, 'years').year()
        },
        rollingTrimester: {
            debut: dateDeValeur.subtract(3, 'months').subtract(1, 'months'),
            fin: dateDeValeur,
            key: dateDeValeur.subtract(3, 'months').format('YYYY-MM') + ':3'
        }
    };
};

var applyRessources = function(mesAidesEntity, openFiscaEntity, mappingSchema, situation) {
    var dateDeValeur = situation.dateDeValeur;
    var periods = getPeriods(dateDeValeur);

    function isPeriodWithin(agregatKey, periode) {
        return periode.isAfter(periods[agregatKey].debut, 'month') && periode.isBefore(periods[agregatKey].fin, 'month');
    }

    var ressourcesByType = _.groupBy(mesAidesEntity.ressources, 'type');

    _.forEach(mappingSchema, function(definitions, openFiscaKey) {
        if (! _.isArray(definitions)) {
            definitions = [definitions];
        }

        _.forEach(definitions, function(definition) {

            var srcKey = definition.src || definition;
            var fn = definition.fn;

            if (ressourcesByType[srcKey]) {
                var result = {};
                var agr = {};

                _.forEach(ressourcesByType[srcKey], function(item) {
                    if (item.periode) {
                        // Période d'origine
                        if (!result[item.periode]) result[item.periode] = 0;
                        result[item.periode] += item.montant;

                        // Aggrégats
                        _.keys(periods).forEach(function (agregatKey) {
                            if (agregatKey != 'referenceFiscalYear' && isPeriodWithin(agregatKey, moment(item.periode, 'YYYY-MM'))) {
                                if (!(agregatKey in agr)) agr[agregatKey] = 0;
                                agr[agregatKey] += fn ? fn(item.montant) : item.montant;
                            }
                        });
                    }
                });

                _.forEach(result, function(montant, periode) {
                    // Applique la transformation
                    if (fn) montant = fn(montant);
                    result[periode] = montant;
                });

                // On prolonge la ressource perçue quand c'est possible
                if (result[periods.lastMonth.key] && !_.contains(mesAidesEntity.interruptedRessources, srcKey)) {
                    result[periods.thisMonth.key] = result[periods.lastMonth.key];
                }

                if (_.size(result) > 0) {
                    if (_.size(openFiscaEntity[openFiscaKey]) > 0) {
                        openFiscaEntity[openFiscaKey] = _.extend(openFiscaEntity[openFiscaKey],result);
                    } else {
                        openFiscaEntity[openFiscaKey] = result;
                    }
                }

                _.forEach(agr, function (value, agregatKey) {
                    openFiscaEntity[openFiscaKey][periods[agregatKey].key] = value;
                });

                // On suppose que les revenus pour l'année fiscale de référence sont les mêmes que pour les 12 derniers mois, si ces revenus n'ont pas encore
                // été renseignés
                var rollingYearKey = periods.rollingYear.key,
                    referenceFiscalYearKey = periods.referenceFiscalYear.key;
                if (! situation.ressourcesYearMoins2Captured) {
                    openFiscaEntity[openFiscaKey][referenceFiscalYearKey] = openFiscaEntity[openFiscaKey][rollingYearKey];
                }
            }
        });
    });
};

var setNonInjectedPrestationsToZero = function(openFiscaEntity, dateDeValeur) {
    var periods = getPeriods(dateDeValeur);
    var targetPeriods = periods.last12Months.concat([periods.rollingYear]);

    _.forEach(targetPeriods, function(period) {
        var prestations = _.pick(PRESTATIONS, function(definition) {
            return definition.type == Number;
        });

        _.forEach(prestations, function(definition, prestationName) {
            openFiscaEntity[prestationName] = openFiscaEntity[prestationName] || {};
            openFiscaEntity[prestationName][period.key] = openFiscaEntity[prestationName][period.key] || 0;
        });
    });
};

var buildOpenFiscaEntity = function(mesAidesEntity, mappingSchema, situation) {
    var result = {};
    _.forEach(mappingSchema, function(definition, openFiscaKey) {
        var params = _.isString(definition) ? { src: definition } : definition;

        if (params.values) {
            result[openFiscaKey] = params.values[mesAidesEntity[params.src]];
        } else if (params.fn) {
            result[openFiscaKey] = params.src ? params.fn(mesAidesEntity[params.src], mesAidesEntity, situation) : params.fn(mesAidesEntity, situation);
        } else {
            result[openFiscaKey] = mesAidesEntity[params.src];
        }

        if (params.round && _.isNumber(result[openFiscaKey])) {
            result[openFiscaKey] = Math.round(result[openFiscaKey]);
        }

        // Supprime les null (mal supportés par OpenFisca)
        if (isNotValidValue(result[openFiscaKey])) {
            if ('default' in params) result[openFiscaKey] = params.default;
            else delete result[openFiscaKey];
        }
    });
    return result;
};

var mapIndividus = exports.mapIndividus = function (situation) {
    var individus = _.filter(situation.individus, function(individu) {
        return common.isIndividuValid(individu, situation);
    });

    return _.map(individus, function(individu) {
        if (individu.role === 'demandeur') {
            _.extend(individu, situation.patrimoine);

            var revenusLocatifs = situation.patrimoine.revenusLocatifs.map(function(revenu) {
                revenu.type = 'revenusLocatifs';
                return revenu;
            });

            var revenusDuCapital = situation.patrimoine.revenusDuCapital.map(function(revenu) {
                revenu.type = 'revenusDuCapital';
                return revenu;
            });

            individu.ressources = individu.ressources.concat(revenusLocatifs, revenusDuCapital);
        }
        var openFiscaIndividu = buildOpenFiscaEntity(individu, individuSchema, situation);
        applyRessources(individu, openFiscaIndividu, ressourcesMap.individu, situation);
        return openFiscaIndividu;
    });
};

var mapFamille = function(situation) {
    var famille = buildOpenFiscaEntity(situation, familleSchema, situation);
    var ressources = [];
    _.forEach(situation.individus, function(individu) {
        ressources = ressources.concat(individu.ressources);
    });
    applyRessources({ ressources: ressources }, famille, ressourcesMap.famille, situation);
    setNonInjectedPrestationsToZero(famille, situation.dateDeValeur);

    return famille;
};

var mapFoyerFiscal = exports.mapFoyerFiscal = function(situation) {
    var foyerFiscal = buildOpenFiscaEntity(situation, foyerSchema, situation);
    var ressources = [];
    _.forEach(situation.individus, function(individu) {
        ressources = ressources.concat(individu.ressources);
    });
    applyRessources({ ressources: ressources }, foyerFiscal, ressourcesMap.foyerFiscal, situation);

    return foyerFiscal;
};

exports.buildOpenFiscaRequest = function(situation, debug) {
    return {
        intermediate_variables: debug,
        labels: true,
        base_reforms: ['aides_ville_paris'],
        scenarios: [{
            test_case: {
                familles: [ mapFamille(situation) ],
                foyers_fiscaux: [ mapFoyerFiscal(situation) ],
                individus: mapIndividus(situation),
                menages: [ buildOpenFiscaEntity(situation, menageSchema, situation) ]
            },
            period: 'month:' + periodTools.toOpenFiscaFormat(situation.dateDeValeur)
        }],
        variables: _.keys(PRESTATIONS)
    };
};
<|endoftext|>


<commit_before>import React from "react";

export const {Provider: LaunchDarklyProvider, Consumer: LaunchDarklyConsumer} = React.createContext();<commit_msg>fix: disable eol for last file line<commit_after>/* eslint-disable eol-last */
import React from "react";

export const {Provider: LaunchDarklyProvider, Consumer: LaunchDarklyConsumer} = React.createContext();<|endoftext|>


<commit_before>var validator = require('validator');

module.exports = function(config, callback){
  var errors = [];
  if (!config.currencies) {
    errors.push({ field: 'currencies', message: 'please provide currencies' });
  }
  if (!config.ripple_address) {
    errors.push({ field: 'ripple_address', message: 'please provide ripple_address' });
  }
  if (!config.ripple_rest_url) {
    errors.push({ field: 'ripple_rest_url', message: 'please provide ripple_rest_url' });
  }
  if (!config.postgres_url) {
    errors.push({ field: 'postgres_url', message: 'please provide postgres_url' });
  }

  if(errors.length > 0){
    callback(errors, null);
  } else {
    callback(null, config);
  }
}<commit_msg>[TEST] postgres URL, ripple-rest URL and ripple address<commit_after>var validator = require('validator');
var UInt160 = require('ripple-lib').UInt160;

module.exports = function(config, callback){

  var errors = [];

  if (!config.currencies) {
    errors.push({ field: 'currencies', message: 'please provide currencies' });
  }
  if (!config.ripple_address) {
    errors.push({ field: 'ripple_address', message: 'please provide ripple_address' });
  }
  if (!config.ripple_rest_url) {
    errors.push({ field: 'ripple_rest_url', message: 'please provide ripple_rest_url' });
  }
  if (!config.postgres_url) {
    errors.push({ field: 'postgres_url', message: 'please provide postgres_url' });
  }

  var validPostgresUrl = validator.isURL(config.postgres_url, {
    protocols: ['postgres']
  });

  var validRippleRestUrl = validator.isURL(config.ripple_rest_url);

  if (!validPostgresUrl){
    errors.push({ field: 'invalid_postgres_url', message: 'please provide a valid postgres_url' });
  }

  if (!validRippleRestUrl){
    errors.push({ field: 'invalid_ripple_rest_url', message: 'please provide a valid ripple_rest_url' });
  }

  if (!UInt160.is_valid(config.ripple_address)) {
    errors.push({ field: 'invalid_ripple_address', message: 'please provide a valid ripple_address' });
  }

  if(errors.length > 0){
    callback(errors, null);
  } else {
    callback(null, config);
  }

}<|endoftext|>


<commit_before>view = function(model) {
    var win = new Window({ id: 'VenueMapWindow' });
    win.add(AirView('titleBar', {
        left: AirView('homeButton', win),
        title: 'Venue Map'
    }));
    return win;
};<commit_msg>Added map of venue<commit_after>view = function(model) {
    var win = new Window({ id: 'VenueMapWindow' });
    win.add(AirView('titleBar', {
        left: AirView('homeButton', win),
        title: 'Venue Map'
    }));
    win.add(Titanium.Map.createView({
        top: 45,
        mapType: Titanium.Map.STANDARD_TYPE,
        region: {
            latitude: 50.8683, longitude: 6.0818,
            latitudeDelta: 0.01, longitudeDelta: 0.01
        },
        animate: true,
        regionFit: true,
        userLocation: true,
        annotations: [
            Titanium.Map.createAnnotation({
                latitude: 50.8683,
                longitude: 6.0818,
                title: 'Rolduc Abbey',
                subtitle: 'Kerkrade, Netherlands',
                pincolor: Titanium.Map.ANNOTATION_RED,
                animate: true
            })
        ]
    }));
    return win;
};<|endoftext|>


<commit_before>import React, { Component } from 'react'
import styled from 'react-emotion'

import GithubIcon from './icons/Github'
import TwitterIcon from './icons/Twitter'
import LinkedinIcon from './icons/Linkedin'

const FooterContainer = styled('footer')`
  background-color: #20232a;
  color: #ffffff;
  padding-top: 30px;
  padding-bottom: 50px;
  position: relative;
`

const FooterBorder = styled('span')`
  position: absolute;
  width: 100%;
  top: 0;
  height: 2px;
  display: block;
  transform-origin: left center 0px;
  transform: scaleX(1);
  z-index: 50;
  transition: transform 400ms ease 100ms;
  background: linear-gradient(90deg, #46c9e5, #d26ac2);
`

const FooterWrapper = styled('div')`
  padding-left: 20px;
  padding-right: 20px;
  max-width: 1260px;
  margin-left: auto;
  margin-right: auto;

  @media (min-width: 780px) {
    width: 90%;
  }
`

const FooterColumns = styled('div')`
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
`

const FooterColumn = styled('div')`
  flex: 1 auto;
  margin-bottom: 1em;
  padding-right: 1em;
`

const FooterFullColumn = styled('div')`
  flex: 1 auto;
  margin-bottom: 1em;
  padding-right: 1em;
  width: 100%;

  @media (min-width: 780px) {
    width: auto;
  }
`

const List = styled('div')`
  display: inline-flex;
  flex-direction: column;
`

const ListTitle = styled('div')`
  color: #d26ac2;
  font-size: 14px;
  font-weight: bold;
  line-height: 3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
`

const ListLink = styled('a')`
  color: inherit;
  line-height: 2;
  text-decoration: none;

  &:hover {
    color: #46c9e5;
  }
`

const Copyright = styled('p')`
  font-size: 0.8em;
  padding: 4px 0 0 0;
  color: #ccc;

  a {
    color: inherit;
    font-weight: bold;
    text-decoration: none;
  }

  a:hover {
    color: #46c9e5;
    text-decoration: underline;
  }
`

const Heart = styled('span')`
  color: #d26ac2;

  &:hover {
    color: red;
  }
`

class Footer extends Component {
  render () {
    const year = new Date().getFullYear()
    return (
      <FooterContainer>
        <FooterBorder />
        <FooterWrapper>
          <FooterColumns>
            <FooterFullColumn>
              <ListTitle style={{ color: '#46c9e5' }}>Loige.co</ListTitle>
              <Copyright>
                Copyright © Luciano Mammino 2014-
                {year}.
              </Copyright>
              <Copyright>
                Built with{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://www.gatsbyjs.org"
                >
                  Gatsby
                </a>
                , Coffee and a lot of <Heart>❤</Heart>.
              </Copyright>
              <Copyright>
                Hosted on{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://github.com/lmammino/loige.co"
                >
                  GitHub
                </a>
                .
              </Copyright>
              <Copyright>
                Theme inspired by{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://reactjs.org/docs/"
                >
                  React documentation.
                </a>
              </Copyright>
              <Copyright>
                Icons by{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://fontawesome.com/"
                >
                  Font Awesome
                </a>
                .
              </Copyright>
            </FooterFullColumn>
            <FooterColumn>
              <List>
                <ListTitle>Explore</ListTitle>
                <ListLink href="/">Blog</ListLink>
                <ListLink href="/speaking">Speaking</ListLink>
                <ListLink href="/about">About</ListLink>
                <ListLink href="/comment-policy">Comment Policy</ListLink>
              </List>
            </FooterColumn>
            <FooterColumn>
              <List>
                <ListTitle>My Projects</ListTitle>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://www.nodejsdesignpatterns.com"
                >
                  Node.js Design Patterns
                </ListLink>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://serverlesslab.com"
                >
                  ServerlessLab
                </ListLink>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://fullstackbulletin.com"
                >
                  FullStack Bulletin
                </ListLink>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://middy.js.org"
                >
                  Middy
                </ListLink>
              </List>
            </FooterColumn>
            <FooterColumn>
              <List>
                <ListTitle>Follow me</ListTitle>
                <ListLink
                  rel="nofollow noopener noreferrer"
                  href="https://twitter.com/loige"
                >
                  <TwitterIcon /> Twitter
                </ListLink>
                <ListLink
                  rel="nofollow noopener noreferrer"
                  href="https://github.com/lmammino"
                >
                  <GithubIcon /> GitHub
                </ListLink>
                <ListLink
                  rel="nofollow noopener noreferrer"
                  href="https://www.linkedin.com/in/lucianomammino"
                >
                  <LinkedinIcon /> Linkedin
                </ListLink>
              </List>
            </FooterColumn>
          </FooterColumns>
        </FooterWrapper>
      </FooterContainer>
    )
  }
}

export default Footer
<commit_msg>Added MOAR mentions in the footer<commit_after>import React, { Component } from 'react'
import styled from 'react-emotion'

import GithubIcon from './icons/Github'
import TwitterIcon from './icons/Twitter'
import LinkedinIcon from './icons/Linkedin'

const FooterContainer = styled('footer')`
  background-color: #20232a;
  color: #ffffff;
  padding-top: 30px;
  padding-bottom: 50px;
  position: relative;
`

const FooterBorder = styled('span')`
  position: absolute;
  width: 100%;
  top: 0;
  height: 2px;
  display: block;
  transform-origin: left center 0px;
  transform: scaleX(1);
  z-index: 50;
  transition: transform 400ms ease 100ms;
  background: linear-gradient(90deg, #46c9e5, #d26ac2);
`

const FooterWrapper = styled('div')`
  padding-left: 20px;
  padding-right: 20px;
  max-width: 1260px;
  margin-left: auto;
  margin-right: auto;

  @media (min-width: 780px) {
    width: 90%;
  }
`

const FooterColumns = styled('div')`
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
`

const FooterColumn = styled('div')`
  flex: 1 auto;
  margin-bottom: 1em;
  padding-right: 1em;
`

const FooterFullColumn = styled('div')`
  flex: 1 auto;
  margin-bottom: 1em;
  padding-right: 1em;
  width: 100%;

  @media (min-width: 780px) {
    width: auto;
  }
`

const List = styled('div')`
  display: inline-flex;
  flex-direction: column;
`

const ListTitle = styled('div')`
  color: #d26ac2;
  font-size: 14px;
  font-weight: bold;
  line-height: 3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
`

const ListLink = styled('a')`
  color: inherit;
  line-height: 2;
  text-decoration: none;

  &:hover {
    color: #46c9e5;
  }
`

const Copyright = styled('p')`
  font-size: 0.8em;
  padding: 4px 0 0 0;
  color: #ccc;

  a {
    color: inherit;
    font-weight: bold;
    text-decoration: none;
  }

  a:hover {
    color: #46c9e5;
    text-decoration: underline;
  }
`

const Heart = styled('span')`
  color: #d26ac2;

  &:hover {
    color: red;
  }
`

class Footer extends Component {
  render () {
    const year = new Date().getFullYear()
    return (
      <FooterContainer>
        <FooterBorder />
        <FooterWrapper>
          <FooterColumns>
            <FooterFullColumn>
              <ListTitle style={{ color: '#46c9e5' }}>Loige.co</ListTitle>
              <Copyright>
                Copyright © Luciano Mammino 2014-
                {year}.
              </Copyright>
              <Copyright>
                Built with{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://www.gatsbyjs.org"
                >
                  Gatsby
                </a>
                , Coffee and a lot of <Heart>❤</Heart>.
              </Copyright>
              <Copyright>
                Loige logo designed by{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="http://andreamangano.com"
                >
                  Andrea Mangano
                </a>
                .
              </Copyright>
              <Copyright>
                Hosted on{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://github.com/lmammino/loige.co"
                >
                  GitHub
                </a>
                , accelerated by{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://www.cloudflare.com"
                >
                  Clouflare
                </a>
                .
              </Copyright>
              <Copyright>
                Theme inspired by{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://reactjs.org/docs/"
                >
                  React documentation.
                </a>
              </Copyright>
              <Copyright>
                Icons by{' '}
                <a
                  rel="nofollow noopener noreferrer"
                  target="_blank"
                  href="https://fontawesome.com/"
                >
                  Font Awesome
                </a>
                .
              </Copyright>
            </FooterFullColumn>
            <FooterColumn>
              <List>
                <ListTitle>Explore</ListTitle>
                <ListLink href="/">Blog</ListLink>
                <ListLink href="/speaking">Speaking</ListLink>
                <ListLink href="/about">About</ListLink>
                <ListLink href="/comment-policy">Comment Policy</ListLink>
              </List>
            </FooterColumn>
            <FooterColumn>
              <List>
                <ListTitle>My Projects</ListTitle>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://www.nodejsdesignpatterns.com"
                >
                  Node.js Design Patterns
                </ListLink>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://serverlesslab.com"
                >
                  ServerlessLab
                </ListLink>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://fullstackbulletin.com"
                >
                  FullStack Bulletin
                </ListLink>
                <ListLink
                  target="_blank"
                  rel="nofollow noopener noreferrer"
                  href="https://middy.js.org"
                >
                  Middy
                </ListLink>
              </List>
            </FooterColumn>
            <FooterColumn>
              <List>
                <ListTitle>Follow me</ListTitle>
                <ListLink
                  rel="nofollow noopener noreferrer"
                  href="https://twitter.com/loige"
                >
                  <TwitterIcon /> Twitter
                </ListLink>
                <ListLink
                  rel="nofollow noopener noreferrer"
                  href="https://github.com/lmammino"
                >
                  <GithubIcon /> GitHub
                </ListLink>
                <ListLink
                  rel="nofollow noopener noreferrer"
                  href="https://www.linkedin.com/in/lucianomammino"
                >
                  <LinkedinIcon /> Linkedin
                </ListLink>
              </List>
            </FooterColumn>
          </FooterColumns>
        </FooterWrapper>
      </FooterContainer>
    )
  }
}

export default Footer
<|endoftext|>


<commit_before>$("form").submit(function(e){
    var errors=false;
    $('.commitment-indicator').each(function(indicator){
        var commitmentval = $('#'+$(this).attr('id') + ' .commitment-indicator-value').val();
        if (!checkNumeric(commitmentval)){
            errors = true;
            $('#'+$(this).attr('id') + " .control-group").addClass('error');
        } else {
            $('#'+$(this).attr('id') + " .control-group").removeClass('error');
        }
    });
    if (errors) {
        e.preventDefault();
        $('#dataConfirmModal').modal({show:false});
        if (!$('#dataConfirmModal').length) {
            $('body').append('

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
Errors in your survey input

<button class="btn" data-dismiss="modal" aria-hidden="true">OK</button>

');
        }
        warning_text = "Commitment indicators must have numerical scores. Please correct errors above.";
        $('#dataConfirmModal').find('.modal-body').text(warning_text);
        $('#dataConfirmModal').modal({show:true});
    }
});

function checkNumeric(n){
    return !isNaN(parseFloat(n)) && isFinite(n);
}
$("#submit").click(function(e){
    e.preventDefault();
    if (!$('#dataConfirmModal').length) {
        $('form').append('

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
Confirm submit survey

<button class="btn" data-dismiss="modal" aria-hidden="true">OK</button><input type="submit" name="submit" class="btn btn-success" id="dataConfirmOK" value="Submit data" />

');
        warning_text = "Are you sure you want to submit this survey? You cannot make any changes once you have submitted.";
        $('#dataConfirmModal').find('.modal-body').text(warning_text);
        $('#dataConfirmModal').modal({show:true});
    }
});
<commit_msg>Use correct Bootstrap hide call for modal<commit_after>$("form").submit(function(e){
    var errors=false;
    $('.commitment-indicator').each(function(indicator){
        var commitmentval = $('#'+$(this).attr('id') + ' .commitment-indicator-value').val();
        if (!checkNumeric(commitmentval)){
            errors = true;
            $('#'+$(this).attr('id') + " .control-group").addClass('error');
        } else {
            $('#'+$(this).attr('id') + " .control-group").removeClass('error');
        }
    });
    if (errors) {
        e.preventDefault();
        $('#dataConfirmModal').modal('hide');
        if (!$('#dataConfirmModal').length) {
            $('body').append('

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
Errors in your survey input

<button class="btn" data-dismiss="modal" aria-hidden="true">OK</button>

');
        }
        warning_text = "Commitment indicators must have numerical scores. Please correct errors above.";
        $('#dataConfirmModal').find('.modal-body').text(warning_text);
        $('#dataConfirmModal').modal({show:true});
    }
});

function checkNumeric(n){
    return !isNaN(parseFloat(n)) && isFinite(n);
}
$("#submit").click(function(e){
    e.preventDefault();
    if (!$('#dataConfirmModal').length) {
        $('form').append('

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
Confirm submit survey

<button class="btn" data-dismiss="modal" aria-hidden="true">OK</button><input type="submit" name="submit" class="btn btn-success" id="dataConfirmOK" value="Submit data" />

');
        warning_text = "Are you sure you want to submit this survey? You cannot make any changes once you have submitted.";
        $('#dataConfirmModal').find('.modal-body').text(warning_text);
        $('#dataConfirmModal').modal({show:true});
    }
});
<|endoftext|>


<commit_before>/**
 * React Starter Kit (https://www.reactstarterkit.com/)
 *
 * Copyright © 2014-present Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import React from 'react';
import cx from 'classnames';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './map.css';

class Map extends React.Component {
  render() {
    return (

In hac habitasse platea dictumst. Duis sagittis dui ac ex suscipit maximus.
Morbi pellentesque venenatis felis sed convallis. Nulla varius, nibh vitae
placerat tempus, mauris sem elementum ipsum, eget sollicitudin nisl est vel
purus. Fusce malesuada odio velit, non cursus leo fermentum id. Cras pharetra
sodales fringilla. Etiam quis est a dolor egestas pellentesque. Maecenas non
scelerisque purus, congue cursus arcu. Donec vel dapibus mi. Mauris maximus
posuere placerat. Sed et libero eu nibh tristique mollis a eget lectus. Donec
interdum augue sollicitudin vehicula hendrerit. Vivamus justo orci, molestie
ac sollicitudin ac, lobortis at tellus. Etiam rhoncus ullamcorper risus eu
tempor. Sed porttitor, neque ac efficitur gravida, arcu lacus pharetra dui, in
consequat elit tellus auctor nulla. Donec placerat elementum diam, vitae
imperdiet lectus luctus at.

MAP!!!

    );
  }
}

export default withStyles(s)(Map);
<commit_msg>first<commit_after>/**
 * React Starter Kit (https://www.reactstarterkit.com/)
 *
 * Copyright © 2014-present Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import React from 'react';
import cx from 'classnames';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './map.css';

class Map extends React.Component {
  render() {
    return (

In hac habitasse platea dictumst. Duis sagittis dui ac ex suscipit maximus.
Morbi pellentesque venenatis felis sed convallis. Nulla varius, nibh vitae
placerat tempus, mauris sem elementum ipsum, eget sollicitudin nisl est vel
purus. Fusce malesuada odio velit, non cursus leo fermentum id. Cras pharetra
sodales fringilla. Etiam quis est a dolor egestas pellentesque. Maecenas non
scelerisque purus, congue cursus arcu. Donec vel dapibus mi. Mauris maximus
posuere placerat. Sed et libero eu nibh tristique mollis a eget lectus. Donec
interdum augue sollicitudin vehicula hendrerit. Vivamus justo orci, molestie
ac sollicitudin ac, lobortis at tellus. Etiam rhoncus ullamcorper risus eu
tempor. Sed porttitor, neque ac efficitur gravida, arcu lacus pharetra dui, in
consequat elit tellus auctor nulla. Donec placerat elementum diam, vitae
imperdiet lectus luctus at.

In hac habitasse platea dictumst. Duis sagittis dui ac ex suscipit maximus.
Morbi pellentesque venenatis felis sed convallis. Nulla varius, nibh vitae
placerat tempus, mauris sem elementum ipsum, eget sollicitudin nisl est vel
purus. Fusce malesuada odio velit, non cursus leo fermentum id. Cras pharetra
sodales fringilla. Etiam quis est a dolor egestas pellentesque. Maecenas non
scelerisque purus, congue cursus arcu. Donec vel dapibus mi. Mauris maximus
posuere placerat. Sed et libero eu nibh tristique mollis a eget lectus. Donec
interdum augue sollicitudin vehicula hendrerit. Vivamus justo orci, molestie
ac sollicitudin ac, lobortis at tellus. Etiam rhoncus ullamcorper risus eu
tempor. Sed porttitor, neque ac efficitur gravida, arcu lacus pharetra dui, in
consequat elit tellus auctor nulla. Donec placerat elementum diam, vitae
imperdiet lectus luctus at.

MAP!!!

    );
  }
}

export default withStyles(s)(Map);
<|endoftext|>


<commit_before>$(function () {
    $(document).on('click', '.add-list-item', function (event) {
        var cList  = $(this).siblings('.collection-fields-list'),
            cCount = cList.children().length;
            widget = cList.attr('data-prototype').replace(/__name__/g, cCount++);

        $('

').html(widget).appendTo(cList);

        return false;
    });

    $(document).on('click', '.removeRow', function (event) {
        name = $(this).attr('data-related');

        $('*[data-content="' + name + '"]').remove();

        return false;
    });
});
<commit_msg>BAP-564 Create emails collection flexible attribute type, Fix js remove item functional<commit_after>$(function () {
    $(document).on('click', '.add-list-item', function (event) {
        event.preventDefault();
        var cList  = $(this).siblings('.collection-fields-list'),
            cCount = cList.children().length;
            widget = cList.attr('data-prototype').replace(/__name__/g, cCount++);

        $('

').html(widget).appendTo(cList);
    });

    $(document).on('click', '.removeRow', function (event) {
        event.preventDefault();
        $(this).parents('*[data-content]').remove();
    });
});
<|endoftext|>


<commit_before>$(function() {
    $(window).on('resize', function () {
        var height = $(window).height()

        $('#map').height((height / 3) + 200)
        $('#content').css('margin-top', height / 3 + 'px')

        if ($('#image').length) {
            $('#image').height(height)
            $('#content').css('min-height', (height / 3) * 2 + 'px')
            $('#content').css('margin-bottom', height + 'px')
        } else {
            $('#content').css('border-bottom', 'none')
        }

    }).resize()

    $(window).scroll(function () {
        $('#map-container').css('top', ($(window).scrollTop() * -0.6) - 100 + 'px')
    })

    var multiplePointers = $('.list-item').length > 1
    var bounds = new google.maps.LatLngBounds()
    var infowindow = new google.maps.InfoWindow()
    var map = new google.maps.Map(document.getElementById('map'), {
        center: {
            lat: parseFloat($('.list-item').data('geo').split(',')[0]),
            lng: parseFloat($('.list-item').data('geo').split(',')[1])
        },
        zoom: 11,
        scrollwheel: false,
        mapTypeControl: false,
        streetViewControl: false,
        rotateControl: false,
        styles: [
            {
                'featureType': 'poi.business',
                'stylers': [
                    {
                        'visibility': 'off'
                    }
                ]
            },
            {
                'featureType': 'road',
                'elementType': 'labels.icon',
                'stylers': [
                    {
                        'visibility': 'off'
                    }
                ]
            },
            {
                'featureType': 'transit',
                'stylers': [
                    {
                        'visibility': 'off'
                    }
                ]
            }
        ]
    })

    $('.list-item').each(function () {
        var position = $(this).data('geo')
        if (position) {
            var info = '
' + $(this).text() + '

' + $(this).data('info') + '
'
            var marker = new google.maps.Marker({
                position: {
                    lat: parseFloat(position.split(',')[0]),
                    lng: parseFloat(position.split(',')[1]),
                },
                title: $(this).text(),
                map: map
            })

            if (multiplePointers) {
                marker.addListener('click', function() {
                    infowindow.setContent(info)
                    infowindow.open(map, this)
                })
                bounds.extend(marker.getPosition())
                map.fitBounds(bounds)
            }
        }
    })
})
<commit_msg>Bugfix<commit_after>$(function() {
    $(window).on('resize', function () {
        var height = $(window).height()

        $('#map-container').height((height / 3) + 200)
        $('#content').css('margin-top', height / 3 + 'px')

        if ($('#image').length) {
            $('#image').height(height)
            $('#content').css('min-height', (height / 3) * 2 + 'px')
            $('#content').css('margin-bottom', height + 'px')
        } else {
            $('#content').css('border-bottom', 'none')
        }

    }).resize()

    $(window).scroll(function () {
        $('#map-container').css('top', ($(window).scrollTop() * -0.6) - 100 + 'px')
    })

    var multiplePointers = $('.list-item').length > 1
    var bounds = new google.maps.LatLngBounds()
    var infowindow = new google.maps.InfoWindow()
    var map = new google.maps.Map(document.getElementById('map'), {
        center: {
            lat: parseFloat($('.list-item').data('geo').split(',')[0]),
            lng: parseFloat($('.list-item').data('geo').split(',')[1])
        },
        zoom: 11,
        scrollwheel: false,
        mapTypeControl: false,
        streetViewControl: false,
        rotateControl: false,
        styles: [
            {
                'featureType': 'poi.business',
                'stylers': [
                    {
                        'visibility': 'off'
                    }
                ]
            },
            {
                'featureType': 'road',
                'elementType': 'labels.icon',
                'stylers': [
                    {
                        'visibility': 'off'
                    }
                ]
            },
            {
                'featureType': 'transit',
                'stylers': [
                    {
                        'visibility': 'off'
                    }
                ]
            }
        ]
    })

    $('.list-item').each(function () {
        var position = $(this).data('geo')
        if (position) {
            var info = '
' + $(this).text() + '

' + $(this).data('info') + '
'
            var marker = new google.maps.Marker({
                position: {
                    lat: parseFloat(position.split(',')[0]),
                    lng: parseFloat(position.split(',')[1]),
                },
                title: $(this).text(),
                map: map
            })

            if (multiplePointers) {
                marker.addListener('click', function() {
                    infowindow.setContent(info)
                    infowindow.open(map, this)
                })
                bounds.extend(marker.getPosition())
                map.fitBounds(bounds)
            }
        }
    })
})
<|endoftext|>


<commit_before>// @flow

import React, { Component } from 'react';
import { StyleSheet, Dimensions, TouchableOpacity, Animated } from 'react-native';

const { width: WIDTH, height: HEIGHT } = Dimensions.get('window');

type Props = {
  onPress: Function;
  backgroundColor: string;
  opacity: number;
  animationDuration: number;
  showOverlay: bool;
  pointerEvents: string;
}

const DefaultProps = {
  backgroundColor: '#000',
  opacity: 0.5,
  animationDuration: 200,
  showOverlay: false,
};

class Overlay extends Component {
  props: Props;
  static defaultProps = DefaultProps;

  constructor(props) {
    super(props);
    this.state = {
      opacity: new Animated.Value(0),
    };
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.showOverlay !== nextProps.showOverlay) {
      const toValue = nextProps.showOverlay ? nextProps.opacity : 0;
      Animated.timing(this.state.opacity, {
        toValue,
        duration: this.props.animationDuration,
      }).start();
    }
  }

  render() {
    const { onPress, pointerEvents } = this.props;
    const backgroundColor = { backgroundColor: this.props.backgroundColor };
    const opacity = { opacity: this.state.opacity };

    return (
      <Animated.View
        pointerEvents={pointerEvents}
        style={[styles.overlay, backgroundColor, opacity]}
      >
        <TouchableOpacity onPress={onPress} style={[styles.overlay]} />
      </Animated.View>
    );
  }
}

const styles = StyleSheet.create({
  overlay: {
    flex: 1,
    top: 0,
    left: 0,
    width: WIDTH,
    height: HEIGHT,
    position: 'absolute',
  },
});

export default Overlay;
<commit_msg>Partial Resolves issue #12<commit_after>// @flow

import React, { Component } from 'react';
import { StyleSheet, Dimensions, TouchableOpacity, Animated } from 'react-native';

const { width: WIDTH, height: HEIGHT } = Dimensions.get('window');

type Props = {
  onPress: Function;
  backgroundColor: string;
  opacity: number;
  animationDuration: number;
  showOverlay: bool;
  pointerEvents: string;
}

const DefaultProps = {
  backgroundColor: '#000',
  opacity: 0.5,
  animationDuration: 200,
  showOverlay: false,
};

class Overlay extends Component {
  props: Props;
  static defaultProps = DefaultProps;

  constructor(props) {
    super(props);
    this.state = {
      opacity: new Animated.Value(0),
    };
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.showOverlay !== nextProps.showOverlay) {
      const toValue = nextProps.showOverlay ? nextProps.opacity : 0;
      Animated.timing(this.state.opacity, {
        toValue,
        duration: this.props.animationDuration,
      }).start();
    }
  }

  render() {
    const { onPress, pointerEvents } = this.props;
    const backgroundColor = { backgroundColor: this.props.backgroundColor };
    const opacity = { opacity: this.state.opacity };
    const dimensions = {width: Dimensions.get('window').width, height: Dimensions.get('window').height }

    return (
      <Animated.View
        pointerEvents={pointerEvents}
        style={[styles.overlay, backgroundColor, opacity, dimensions]}
      >
        <TouchableOpacity onPress={onPress} style={[styles.overlay, dimensions]} />
      </Animated.View>
    );
  }
}

const styles = StyleSheet.create({
  overlay: {
    flex: 1,
    top: 0,
    left: 0,
    position: 'absolute',
  },
});

export default Overlay;
<|endoftext|>


<commit_before>// =============================================================================
// Imports
// =============================================================================

// React
// import React    from 'react';
// import { Link } from 'react-router-dom';

// Components

// =============================================================================
// Styles
// =============================================================================

import styled               from 'styled-components';
import { colour, zIndex }   from '../utils/styles';

const Navbar = styled.nav`
  position: fixed;
  right: 0;
  left: 0;
  top: 0;

  background-color: ${colour.brand.complement};
`;

// =============================================================================
// Export
// =============================================================================

export default Navbar;<commit_msg>add navbar mobile styles<commit_after>// =============================================================================
// Styles
// =============================================================================

import styled from 'styled-components';
import { colour, zIndex, media } from '../utils/styles';

export const Navbar = styled.nav`
  display: flex;
  justify-content: space-between;
  right: 0;
  left: 0;
  top: 0;
  z-index: ${zIndex.navbar.fixed};
  background-color: ${colour.grey.lightest};
  ${props => props.fixed ? 'position: fixed' : 'position: relative'};
  padding-bottom: 0.25rem;
  ${media.lg`padding-bottom: initial`}
  &:after {
    content: '';
	  position: absolute;
	  top: 0;
	  bottom: 0;
	  left: 0;
	  right: 0;
	  z-index: -1;
    border-bottom: 1px solid ${colour.grey.light};
  }
`;

export const NavbarBlock = styled.div`
  flex-direction: column;
  justify-content: center;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: ${props => props.collapsed ? 'none' : 'flex'};
  opacity: ${props => props.collapsed ? 'initial' : '0.95'};
  position: ${props => props.collapsed ? 'static' : 'fixed'};
  ${props => props.collapsed && media.lg`
    display: flex;
    flex-direction: row;
  `}
`;

export const NavbarToggle = styled.div`
  position: relative;
  align-self: center;
	width: 1rem;
	height: 2px;
	transition: 1s ease transform;
	transform: ${props => props.collapsed ? 'initial' : 'rotate(-45deg)'};
	background-color: ${props => props.collapsed ? colour.grey.basic : colour.brand.primary};
  ${media.lg`display: none;`}
  &:after, &:before {
    content: '';
    position: absolute;
    height: inherit;
    width: inherit;
    background-color: inherit;
    transition: inherit;
  }
  &:after {
    top: 5px;
    transform: ${props => props.collapsed ? 'initial' : 'translate(0px, -5px) rotate(90deg)'};
  }
  &:before {
    top: -5px;
    transform: ${props => props.collapsed ? 'initial' : 'translate(0px, 5px) rotate(90deg)'};
  }
`; // FIXME add transition constants

// =============================================================================
// Export
// =============================================================================

// export default Navbar;<|endoftext|>


<commit_before>'use strict';

var SilentError    = require('silent-error');
var SilentErrorLib = require('../../../lib/errors/silent');
var expect         = require('chai').expect;

describe('SilentError', function() {
  it('return silent-error and print a deprecation', function() {
    expect(SilentErrorLib, 'returns silent-error').to.equal(SilentError);
  });
});
<commit_msg>tests/errors/silent: Move deprecated require() call into test<commit_after>'use strict';

var SilentError    = require('silent-error');
var expect         = require('chai').expect;

describe('SilentError', function() {
  it('return silent-error and print a deprecation', function() {
    var SilentErrorLib = require('../../../lib/errors/silent');
    expect(SilentErrorLib, 'returns silent-error').to.equal(SilentError);
  });
});
<|endoftext|>