text:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.yems.painter;

public final class R {
    public static final class array {
        /**  backup options
 backup options
         */
        public static final int backup_opened_options=0x7f070003;
        public static final int backup_opened_options_codes=0x7f070004;
        /**  exit options
 exit options
         */
        public static final int before_exit_options=0x7f070005;
        public static final int before_exit_options_codes=0x7f070006;
        public static final int blur_types=0x7f070000;
        /**  language
         */
        public static final int languages=0x7f070001;
        public static final int locales=0x7f070002;
        /**  volume shortcuts options
 volume shortcuts options
         */
        public static final int volume_buttons_options=0x7f070007;
        public static final int volume_buttons_options_codes=0x7f070008;
    }
    public static final class attr {
    }
    public static final class drawable {
        public static final int brush=0x7f020000;
        public static final int fork_me=0x7f020001;
        public static final int ic_launcher=0x7f020002;
        public static final int ic_menu_brush=0x7f020003;
        public static final int ic_menu_colors=0x7f020004;
        public static final int ic_menu_file=0x7f020005;
        public static final int ic_menu_more=0x7f020006;
        public static final int ic_menu_redo=0x7f020007;
        public static final int ic_menu_save=0x7f020008;
        public static final int ic_menu_trash=0x7f020009;
        public static final int ic_menu_undo=0x7f02000a;
        public static final int icon=0x7f02000b;
        public static final int marker=0x7f02000c;
        public static final int pen=0x7f02000d;
        public static final int pencil=0x7f02000e;
    }
    public static final class id {
        public static final int about=0x7f060008;
        public static final int brush_size=0x7f06000e;
        public static final int bt_change_brush_color=0x7f06000d;
        public static final int canvas=0x7f06000a;
        public static final int developers=0x7f060009;
        public static final int dialog_about=0x7f060003;
        public static final int dialog_clear=0x7f060000;
        public static final int dialog_exit=0x7f060001;
        public static final int dialog_open=0x7f060004;
        public static final int dialog_share=0x7f060002;
        public static final int et_ip=0x7f06000f;
        public static final int et_port=0x7f060010;
        public static final int icon=0x7f060005;
        public static final int menu_brush=0x7f060011;
        public static final int menu_clear=0x7f060013;
        public static final int menu_file=0x7f060015;
        public static final int menu_more=0x7f060019;
        public static final int menu_open=0x7f060016;
        public static final int menu_preferences=0x7f06001a;
        public static final int menu_save=0x7f060012;
        public static final int menu_set_wallpaper=0x7f060018;
        public static final int menu_share=0x7f060017;
        public static final int menu_undo=0x7f060014;
        public static final int properties_bar=0x7f06000c;
        public static final int settings_layout=0x7f06000b;
        public static final int title=0x7f060006;
        public static final int version=0x7f060007;
    }
    public static final class layout {
        public static final int dialog_about=0x7f030000;
        public static final int painter_main=0x7f030001;
        public static final int splash_main=0x7f030002;
    }
    public static final class menu {
        public static final int setting_main=0x7f090000;
    }
    public static final class string {
        public static final int about_text=0x7f050003;
        public static final int aply_wallpaper=0x7f05000e;
        public static final int app_developers=0x7f050004;
        /**  app
         */
        public static final int app_name=0x7f050001;
        /**   app
         */
        public static final int app_version=0x7f050002;
        public static final int blur_radius=0x7f050025;
        public static final int blur_style=0x7f050026;
        public static final int blur_type_select=0x7f050027;
        public static final int brush_color=0x7f050028;
        /**  brush setup
  brush setup
         */
        public static final int brush_size=0x7f050024;
        public static final int clear_bitmap_prompt=0x7f05000a;
        public static final int clear_bitmap_prompt_title=0x7f050009;
        public static final int color_pick=0x7f050029;
        public static final int copy_file_title=0x7f050017;
        public static final int exit_app_prompt=0x7f050010;
        public static final int exit_app_prompt_title=0x7f05000f;
        public static final int file_not_found=0x7f05002b;
        /**  toasts
 toasts
         */
        public static final int invalid_file=0x7f05002a;
        public static final int menu_about=0x7f05001d;
        /**  menu
 menu
         */
        public static final int menu_brush=0x7f050018;
        public static final int menu_clear=0x7f05001a;
        public static final int menu_file=0x7f050023;
        public static final int menu_open=0x7f050020;
        public static final int menu_preferences=0x7f050021;
        public static final int menu_redo=0x7f05001f;
        public static final int menu_rotate=0x7f050019;
        public static final int menu_save=0x7f05001b;
        public static final int menu_set_wallpaper=0x7f050022;
        public static final int menu_share=0x7f05001c;
        public static final int menu_undo=0x7f05001e;
        public static final int more=0x7f050007;
        public static final int no=0x7f050006;
        public static final int open_prompt=0x7f050014;
        public static final int open_prompt_title=0x7f050013;
        public static final int preferences_about=0x7f05004d;
        public static final int preferences_about_category=0x7f05003d;
        public static final int preferences_about_summary=0x7f05004f;
        public static final int preferences_about_title=0x7f05004e;
        public static final int preferences_backup_category=0x7f05003c;
        public static final int preferences_backup_openeded_file=0x7f050044;
        public static final int preferences_backup_openeded_file_summary=0x7f050046;
        public static final int preferences_backup_openeded_file_title=0x7f050045;
        public static final int preferences_before_exit=0x7f050050;
        public static final int preferences_before_exit_summary=0x7f050052;
        public static final int preferences_before_exit_title=0x7f050051;
        public static final int preferences_behavior_category=0x7f05003a;
        /**  preferences
 preferences
         */
        public static final int preferences_interface_category=0x7f050039;
        public static final int preferences_language=0x7f05003e;
        public static final int preferences_language_summary=0x7f050040;
        public static final int preferences_language_title=0x7f05003f;
        public static final int preferences_last_file=0x7f050041;
        public static final int preferences_last_file_summary=0x7f050043;
        public static final int preferences_last_file_title=0x7f050042;
        public static final int preferences_shake=0x7f05004a;
        public static final int preferences_shake_summary=0x7f05004c;
        public static final int preferences_shake_title=0x7f05004b;
        public static final int preferences_shortcuts_category=0x7f05003b;
        public static final int preferences_tooltips=0x7f050047;
        public static final int preferences_tooltips_summary=0x7f050049;
        public static final int preferences_tooltips_title=0x7f050048;
        public static final int preferences_volume_shortcuts=0x7f050053;
        public static final int preferences_volume_shortcuts_summary=0x7f050055;
        public static final int preferences_volume_shortcuts_title=0x7f050054;
        public static final int repo_url=0x7f050000;
        public static final int saving_title=0x7f05000b;
        public static final int saving_to_sd=0x7f05000c;
        public static final int sd_card_not_available=0x7f05002d;
        public static final int sd_card_not_writeable=0x7f05002c;
        public static final int select_language_title=0x7f050016;
        public static final int settings_brush_blur_radius=0x7f050036;
        public static final int settings_brush_blur_style=0x7f050035;
        public static final int settings_brush_color=0x7f050034;
        public static final int settings_brush_size=0x7f050033;
        public static final int settings_brush_type=0x7f050037;
        public static final int settings_force_open_file=0x7f050038;
        public static final int settings_last_picture=0x7f050032;
        public static final int settings_orientation=0x7f050031;
        /**  settings
         */
        public static final int settings_version=0x7f050030;
        public static final int share_image_title=0x7f050015;
        public static final int share_prompt=0x7f050012;
        public static final int share_prompt_title=0x7f050011;
        public static final int wallpaper_error=0x7f05002f;
        public static final int wallpaper_setted=0x7f05002e;
        public static final int wallpaper_title=0x7f05000d;
        public static final int which_app=0x7f050008;
        /**  dialog
  dialog
         */
        public static final int yes=0x7f050005;
    }
    public static final class style {
        public static final int BrushProperties=0x7f080000;
        public static final int BrushProperties_Control=0x7f080003;
        public static final int BrushProperties_Control_Image=0x7f080004;
        public static final int BrushProperties_Controls=0x7f080005;
        public static final int BrushProperties_Controls_Last=0x7f080006;
        public static final int BrushProperties_Label=0x7f080002;
        public static final int BrushProperties_Wrapper=0x7f080001;
        public static final int BrushsPresets=0x7f080007;
        public static final int BrushsPresets_Preset=0x7f080008;
        public static final int Settings=0x7f080009;
    }
    public static final class xml {
        public static final int preferences=0x7f040000;
    }
}


text:
'use strict';

jest
  .dontMock('worker-farm')
  .dontMock('os')
  .dontMock('../index');

var OPTIONS = {
  transformModulePath: '/foo/bar'
};

describe('Transformer', function() {
  var Transformer;
  var workers;

  beforeEach(function() {
    workers = jest.genMockFn();
    jest.setMock('worker-farm', jest.genMockFn().mockImpl(function() {
      return workers;
    }));
    require('../Cache').prototype.get.mockImpl(function(filePath, callback) {
      return callback();
    });
    require('fs').readFile.mockImpl(function(file, callback) {
      callback(null, 'content');
    });
    Transformer = require('../');
  });

  pit('should loadFileAndTransform', function() {
    workers.mockImpl(function(data, callback) {
      callback(null, { code: 'transformed' });
    });
    require('fs').readFile.mockImpl(function(file, callback) {
      callback(null, 'content');
    });

    return new Transformer(OPTIONS).loadFileAndTransform('file')
      .then(function(data) {
        expect(data).toEqual({
          code: 'transformed',
          sourcePath: 'file',
          sourceCode: 'content'
        });
      });
  });

  pit('should add file info to parse errors', function() {
    require('fs').readFile.mockImpl(function(file, callback) {
      callback(null, 'var x;\nvar answer = 1 = x;');
    });

    workers.mockImpl(function(data, callback) {
      var esprimaError = new Error('Error: Line 2: Invalid left-hand side in assignment');
      esprimaError.description = 'Invalid left-hand side in assignment';
      esprimaError.lineNumber = 2;
      esprimaError.column = 15;
      callback(null, {error: esprimaError});
    });

    return new Transformer(OPTIONS).loadFileAndTransform('foo-file.js')
      .catch(function(error) {
        expect(error.type).toEqual('TransformError');
        expect(error.snippet).toEqual([
          'var answer = 1 = x;',
          '             ^',
        ].join('\n'));
      });
  });
});

redpajama_set_name: RedPajamaGithub


text:
/**
 * Module dependencies.
 */
var express = require('express');
var async = require('async');
var partials = require('express-partials');
var flash = require('connect-flash');
var moment = require('moment');
var errorHandler = require('express-error-handler')

var Check = require('../../models/check');
var Tag = require('../../models/tag');
var TagDailyStat = require('../../models/tagDailyStat');
var TagMonthlyStat = require('../../models/tagMonthlyStat');
var CheckMonthlyStat = require('../../models/checkMonthlyStat');
var moduleInfo = require('../../package.json');

var app = module.exports = express();

// middleware

// app.configure(function(){
//
// });

app.use(partials());
app.use(flash());
app.use(function locals(req, res, next) {
  res.locals.route = app.route;
  res.locals.addedCss = [];
  res.locals.renderCssTags = function (all) {
    if (all != undefined) {
      return all.map(function(css) {
        return '<link rel="stylesheet" href="' + app.route + '/stylesheets/' + css + '">';
      }).join('\n ');
    } else {
      return '';
    }
  };
  res.locals.moment = moment;
  next();
});
// app.use(app.router);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/public'));

if (app.get('env') === 'development' || app.get('env') === 'test') {
  app.use(errorHandler({ dumpExceptions: true, showStack: true }));
}

if (app.get('env') === 'production') {
  app.use(errorHandler());
}

app.locals.version = moduleInfo.version

// Routes

app.get('/events', function(req, res) {
  res.render('events');
});

app.get('/checks', function(req, res, next) {
  Check.find().sort({ isUp: 1, lastChanged: -1 }).exec(function(err, checks) {
    if (err) return next(err);
    res.render('checks', { info: req.flash('info'), checks: checks });
  });
});

app.get('/checks/new', function(req, res) {
  res.render('check_new', { check: new Check(), pollerCollection: app.get('pollerCollection'), info: req.flash('info') });
});

app.post('/checks', function(req, res, next) {
  var check = new Check();
  try {
    var dirtyCheck = req.body.check;
    check.populateFromDirtyCheck(dirtyCheck, app.get('pollerCollection'))
    app.emit('populateFromDirtyCheck', check, dirtyCheck, check.type);
  } catch (err) {
    return next(err);
  }
  check.save(function(err) {
    if (err) return next(err);
    req.flash('info', 'New check has been created');
    res.redirect(app.route + (req.body.saveandadd ? '/checks/new' : ('/checks/' + check._id + '?type=hour&date=' + Date.now())));
  });
});

app.get('/checks/:id', function(req, res, next) {
  Check.findOne({ _id: req.params.id }, function(err, check) {
    if (err) return next(err);
    if (!check) return res.send(404, 'failed to load check ' + req.params.id);
    res.render('check', { check: check, info: req.flash('info'), req: req });
  });
});

app.get('/checks/:id/edit', function(req, res, next) {
  Check.findOne({ _id: req.params.id }, function(err, check) {
    if (err) return next(err);
    if (!check) return res.send(404, 'failed to load check ' + req.params.id);
    var pollerDetails = [];
    app.emit('checkEdit', check.type, check, pollerDetails);
    res.render('check_edit', { check: check, pollerCollection: app.get('pollerCollection'), pollerDetails: pollerDetails.join(''), info: req.flash('info'), req: req });
  });
});

app.get('/pollerPartial/:type', function(req, res, next) {
  var poller;
  try {
    poller = app.get('pollerCollection').getForType(req.params.type);
  } catch (err) {
    return next(err);
  }
  var pollerDetails = [];
  app.emit('checkEdit', req.params.type, new Check(), pollerDetails);
  res.send(pollerDetails.join(''));
});

app.put('/checks/:id', function(req, res, next) {
  Check.findById(req.params.id, function(err, check) {
    if (err) return next(err);
    try {
      var dirtyCheck = req.body.check;
      check.populateFromDirtyCheck(dirtyCheck, app.get('pollerCollection'))
      app.emit('populateFromDirtyCheck', check, dirtyCheck, check.type);
    } catch (populationError) {
      return next(populationError);
    }
    check.save(function(err2) {
      if (err2) return next(err2);
      req.flash('info', 'Changes have been saved');
      res.redirect(app.route + '/checks/' + req.params.id);
    });
  });
});

app.delete('/checks/:id', function(req, res, next) {
  Check.findOne({ _id: req.params.id }, function(err, check) {
    if (err) return next(err);
    if (!check) return next(new Error('failed to load check ' + req.params.id));
    check.remove(function(err2) {
      if (err2) return next(err2);
      req.flash('info', 'Check has been deleted');
      res.redirect(app.route + '/checks');
    });
  });
});

app.get('/tags', function(req, res, next) {
  Tag.find().sort({ name: 1 }).exec(function(err, tags) {
    if (err) return next(err);
    res.render('tags', { tags: tags });
  });
});

app.get('/tags/:name', function(req, res, next) {
  Tag.findOne({ name: req.params.name }, function(err, tag) {
    if (err) {
      return next(err);
    }
    if (!tag) return next(new Error('failed to load tag ' + req.params.name));
    res.render('tag', { tag: tag, req: req });
  });
});

if (!module.parent) {
  app.listen(3000);
  console.log('Express started on port 3000');
}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _mdlUpgrade = require('./utils/mdlUpgrade');

var _mdlUpgrade2 = _interopRequireDefault(_mdlUpgrade);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var propTypes = {
    accent: _react.PropTypes.bool,
    className: _react.PropTypes.string,
    colored: _react.PropTypes.bool,
    component: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.element, _react.PropTypes.func]),
    href: _react.PropTypes.string,
    primary: _react.PropTypes.bool,
    raised: _react.PropTypes.bool,
    ripple: _react.PropTypes.bool
};

// eslint-disable-next-line react/prefer-stateless-function

var Button = function (_React$Component) {
    _inherits(Button, _React$Component);

    function Button() {
        _classCallCheck(this, Button);

        return _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).apply(this, arguments));
    }

    _createClass(Button, [{
        key: 'render',
        value: function render() {
            var _props = this.props,
                accent = _props.accent,
                className = _props.className,
                colored = _props.colored,
                primary = _props.primary,
                raised = _props.raised,
                ripple = _props.ripple,
                component = _props.component,
                href = _props.href,
                children = _props.children,
                otherProps = _objectWithoutProperties(_props, ['accent', 'className', 'colored', 'primary', 'raised', 'ripple', 'component', 'href', 'children']);

            var buttonClasses = (0, _classnames2.default)('mdl-button mdl-js-button', {
                'mdl-js-ripple-effect': ripple,
                'mdl-button--raised': raised,
                'mdl-button--colored': colored,
                'mdl-button--primary': primary,
                'mdl-button--accent': accent
            }, className);

            return _react2.default.createElement(component || (href ? 'a' : 'button'), _extends({
                className: buttonClasses,
                href: href
            }, otherProps), children);
        }
    }]);

    return Button;
}(_react2.default.Component);

Button.propTypes = propTypes;

exports.default = (0, _mdlUpgrade2.default)(Button);


text:
ActiveAdmin.register Source do

  permit_params :name, :key

  # See permitted parameters documentation:
  # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
  #
  # permit_params :list, :of, :attributes, :on, :model
  #
  # or
  #
  # permit_params do
  #   permitted = [:permitted, :attributes]
  #   permitted << :other if resource.something?
  #   permitted
  # end

end


text:
var _store = (function () {

//  P U B L I C   I N T E R F A C E
    var that = {};

    // meta_data setter/getter
    that.meta_data = function ( value ) {
        // set it just once
//        _assert.is_equal( meta_data.length, 0,
//                          "meta_data already assigned" );

        meta_data = value;
    };

    // get metadata about available datasets
    that.meta_datasets = function () {
        return meta_data;
    };

    // get metadata about views available in a cerain dataset (name perspectives comes from db!)
    that.meta_views = function ( dataset_id ) {
        return meta_data[ dataset_id ]['perspectives'];
    };

    // check if group exists
    that.group_exists = function ( data ) {
        if( find_group( data ) === -1) {
            return false;
        }
        return true;
    };

    that.non_filtered_exists = function ( data ) {
        var i;
        var sheets;
        var grp_number = find_group( data );

        // no such group exists yet
        if( grp_number === -1 ) {
            return false;
        }

        sheets = that.get_group( grp_number )['sheets'];
        for( i = 0; i < sheets.length; ++i ) {
            if( sheets[i]['filtered'] === false ) {
                // the group exists and there is a non-filtered sheet present
                return true;
            }
        }

        // though group exists, there are only filtered sheets
        return false;
    };

    // creates a new group and sets an activ group index
    that.create_group = function (data) {
        // create a group for new data collection
        groups.push( group( data ));
        that.active_group( groups.length - 1 );
    };

    // creates a new group or sets an active group index to apropriate group
    that.create_new_group = function ( data ) {
        var found = find_group( data );

        if( found !== -1 ) {
            that.active_group( found );
            return false;
        }

        // create a group for new data collection
        groups.push( group( data ));
        that.active_group( groups.length - 1 );

        return true;
    };

    that.dataset = function () {
        return that.active_group()['dataset'];
    };

    that.view = function () {
        return that.active_group()['view'];
    };

    that.issue = function () {
        return that.active_group()['issue'];
    };

    that.init_basic_sheet = function ( data ) {
        var active_grp = that.active_group();

        // store original version of collection
        active_grp['name'] = data['name'];
        active_grp['basic_rows'] = sheet( data, true );
        // add data to mutable list of sheets
        active_grp['sheets'].push( sheet( data ) );
    };

    that.set_active_columnes = function ( columns ) {
        that.active_sheet()['columns'] = columns;
    };

    that.get_column_from_group = function( id ) {
        var columns = that.active_group()['columns'];
        return columns.filter( function ( col ) {
            return col['key'] === id;
        })[0];
    };

    that.active_columns = function () {
        return that.active_sheet()['columns'];
    };

    that.group_columns = function () {
        return that.active_group()['columns'];
    };

    //TODO not needed
    that.basic_schema = function () {
        var full_schema = that.active_columns();

        return full_schema.filter( function ( element ) {
            return element['basic'] === true;
        });
    };

    that.set_selected = function ( id, state ) {
        var node, rows = that.active_rows();
        var i, len = rows.length;

        for( i = 0; i < len; i += 1 ) {
            node = rows[i];
            if( node['data']['idef'] === id ) {
                node['state']['selected'] = state;
                return;
            }
        }
//        that.active_rows().forEach( function ( node ) {
//            if( node['data']['idef'] === id ) {
//                node['state']['selected'] = true;
//            }
//            else {
//                node['state']['selected'] = false;
//            }
//        });
    };

    that.set_open = function ( id, state ) {
        var node, rows = that.active_rows();
        var i, len = rows.length;

        for( i = 0; i < len; i += 1 ) {
            node = rows[i];
            if( node['data']['idef'] === id ) {
                node['state']['open'] = state;
                return;
            }
        }
    };

    that.set_visible = function ( id, state ) {
        var node, rows = that.active_rows();
        var i, len = rows.length;
        for ( i = 0; i < len; i += 1 ) {
            node = rows[i];
            if ( node['data']['idef'] === id ) {
                node['state']['visible'] = state;
                return;
            }

        }

    };

    that.active_sheet_index = function ( new_active_sheet_num ) {
        if( arguments.length === 0 ) {
            return that.active_group()['active_sheet_number'];
        }
        that.active_group()['active_sheet_number'] = new_active_sheet_num;
    };

    that.active_group_index = function () {
        return active_group_number;
    };

    that.next_sheet_number = function () {
        return that.active_group()['sheets'].length;
    };

    that.max_group_number = function () {
        return groups.length;
    };

    that.active_rows = function () {
        return that.active_sheet()['rows'];
    };

    that.get_node_from_active_sheet = function ( id ) {
        var rows = that.active_rows();
        var node;
        var i;

        for ( i=0; i < rows.length ; i += 1 ) {
            node = rows[i];
            if ( node['data']['idef'] === id ){
                return node;
            }
        }
        return null;
    };

    that.get_node_name = function ( id ) {
        var node = that.get_node_from_active_sheet( id );
        var name = node['data']['name'];
        if (typeof name === 'string'){
            return name;
        }
        return null;
    };

//    that.active_pending_nodes = function () {
//        return that.active_sheet()['pending_nodes'];
//    };

    that.active_basic_changed = function ( value ) {
        that.active_group()['basic_changed'] = value;
    };

    that.active_filtered = function () {
        return that.active_sheet()['filtered'];
    };

    that.active_sorted = function () {
        return that.active_sheet()['sorted'];
    };

    that.set_sorted = function ( is_sorted ) {
        that.active_sheet()['sorted'] = is_sorted;
    }

    // active sheet getter / setter
    that.active_sheet = function ( value ) {
        var active_grp = that.active_group();

        if( arguments.length === 0 ) {
            return active_grp['sheets'][active_grp['active_sheet_number']];
        }

        active_grp['active_sheet_number'] = value;
    };

    // active group getter / setter
    that.active_group = function ( value ) {
        var num;
        if( arguments.length === 0 ) {
            return groups[ active_group_number ];

        }else if ( typeof value === 'number' ){

            active_group_number = value;

        }else if ( typeof value === 'object' &&
            typeof value.dataset === 'string' &&
            typeof value.view === 'string' ){

                num = find_group( value );
                if ( num === -1 ) {
                    return -1
                }
                else {
                    active_group_number = num;
                }
        }
    };

    that.active_group_name = function () {
        return that.active_group()['name'];
    };

    that.add_data = function ( new_data ) {
        var rows = that.active_rows();

        new_data
            .map( function ( row ) {
                return {
                    data: row,
                    state: { open: false, selected: false, visible: true }
                };
            })
            .forEach( function ( e ) {
                rows.push( e );
            });
    };

    that.add_new_sheet = function ( sheet ) {
        var active_grp = that.active_group();
        var next_sheet_number = that.next_sheet_number() ;

        active_grp['sheets'].push( sheet );
        that.active_sheet_index( next_sheet_number );
    };

    that.get_all_groups = function () {
        return groups;
    };

    // check if column exists in active_sheet
    that.is_column_in_active_sheet = function( key ){
        var i;
        var cols = that.active_columns();

        for( i = 0; i < cols.length; i += 1 ) {
            if( cols[i]['key'] === key ){
                    return true;
            }
        }
        return false;
    };

    that.get_group = function ( group ) {
        return groups[group];
    };

    that.get_sheet = function ( group, sheet ) {
        return groups[group]['sheets'][sheet];
    };

    that.remove_active_group = function() {
        if (groups.length === 1){
            return false;
        }
        groups.splice ( that.active_group_index(), 1 );
        if (that.active_group_index() !== 0){
            active_group_number = that.active_group_index()-1;
        }
        return true;
    }

    that.remove_active_sheet = function () {
        var active_grp = that.active_group();
        var active_group_sheets = active_grp['sheets'];
        var active_sheet_num = that.active_sheet_index();
        if (groups.length === 1 && active_group_sheets.length === 1 ){
            return false;
        }
        active_group_sheets.splice(active_sheet_num, 1 );
        if (active_group_sheets.length === 0 ){
            that.remove_active_group();
        }else if (active_sheet_num !== 0 ) {
                active_grp['active_sheet_number'] = active_sheet_num - 1  ;
            }
        return true;
    };

    that.active_sheet_name = function (sheet_name) {
        if( arguments.length === 0 ) {
            return that.active_sheet()['name'];
        }
        that.active_sheet()['name'] = sheet_name;
    };

    that.reset_sheet = function () {
        var active_sheet = that.active_sheet();
        var basic_rows = $.extend( true, [], that.active_group()['basic_rows'] );
        var total = active_sheet['rows']['total'];

        active_sheet['rows'] = basic_rows;
        active_sheet['rows']['total'] = total;
    };

    that.next_sheet_name = function () {
        var next_num=1;
        var sheet_name;
        that.active_group()['sheets'].forEach( function (sheet, sheet_num){
            if ( sheet['name'].indexOf('Arkusz') !== -1 ) {
                sheet_name = sheet['name'].split(' ');
                if ( sheet_name[1] >= next_num ){
                    next_num = sheet_name[1];
                    next_num++;
                   };
            }
        });

        return 'Arkusz ' + next_num;
    };

    that.get_info = function ( id ) {
        var node = that.active_rows().filter( function ( e ) {
                return e['data']['idef'] === id;
                })
                .pop();

        return node['data']['info'];
    };

    that.get_all_sheets_num = function () {
        var groups = that.get_all_groups();
        var num = 0;
        groups.forEach( function ( group ){
            num += group['sheets'].length;
        });
        return num;
    };

    that.restore_state = function ( state ) {
        // traverse the state list and prepare data to proper format
        state.forEach( function( group ) {
            group['sheets'].forEach( function ( sheet ) {
                // assign a proper node state
                sheet['rows'] = add_state( sheet['rows'] );
                // if 'Total' available, move it to separate field
                if( sheet['rows'][ sheet['rows'].length - 1 ]['data']['idef'].indexOf( '9999' ) !== -1 ) {
                    sheet['rows']['total'] = sheet['rows'].pop();
                }
            });

            // create a basic_rows on the basis of the first row in the group
            group['basic_rows'] = [];
            $.extend( true,
                      group['basic_rows'],
                      group['sheets'][0]['rows'].filter( function ( e ) {
                                                    return e['data']['level'] === 'a';
                                                })
                                                .map( function ( e ) {
                                                    return {
                                                            'data': e['data'],
                                                            'state': {
                                                                'open': false,
                                                                'selected': false,
                                                                'visible': true
                                                            }
                                                    }
                                                })
                      );

            // create easy-to-access name field in the group
            group['name'] = group['sheets'][0]['name'];
            // reset active sheet
            group['active_sheet_number'] = 0;
        });
        // assign state to groups obejct
        groups = state;
        active_group_number = 0;
        that.active_sheet_index( 0 );
    };

// P R I V A T E   I N T E R F A C E

    function add_state( rows ) {
        var open_nodes = {};
        rows.forEach( function ( e ) {
            if ( !!e['parent'] ) {
                open_nodes[ e['parent'] ] = true;
            }
        });

        return rows.map( function ( e ) {
            return {
                'data': e,
                'state': {
                    'open': !!open_nodes[ e['idef'] ],
                    'selected': false,
                    'visible': true
                }
            };
        });
    }

    // data about available datasets and their views
    var meta_data = [];

    // a store for a sheets tab in the GUI
    var groups = [];
    var active_group_number = null;

    // returns group id if it exists or -1 if there is no such a group
    function find_group( data ) {
        var i;

        for( i = 0; i < groups.length; i += 1 ) {
            if( data['dataset'] === groups[i]['dataset'] &&
                data['view'] === groups[i]['view'] &&
                data['issue'] === groups[i]['issue'] ) {

                return i;
            }
        }

        return -1;
    }

// O B J E C T   F A C T O R I E S
    // a single sheet
    function sheet( data, basic ) {
        var cols = that.active_group()['columns'].filter( function ( e ) {
                    return e['basic'] === true;
                });
        var rows = data['rows'].map( function ( row ) {
                                    return {
                                        data: row,
                                        state: {
                                            open: false,
                                            selected: false,
                                            visible: true
                                        }
                                    };
                                });

        // if total present in collection move it to special position
        if( rows[ rows.length - 1 ]['data']['idef'].indexOf( '9999' ) !== -1 ) {
            rows['total'] = rows.pop();
        }

        if( !!basic ) {
            return rows;
        }

        return {
            'columns': cols,
            'rows': rows,
            'name': data['name'],
            'filtered': false,
            'sorted': false
        };
    }

    // list of all sheets of the same dataset/view/issue
    function group( data ) {
        return {
            'name': null,
            'dataset': data['dataset'].toString(),
            'view': ( data['view'] || data['perspective'] ).toString(),
            'issue': data['issue'].toString(),
            'columns': data['columns'],
            'active_sheet_number': 0,
            'sheets': [],
            'basic_rows': null,
            'basic_changed': false
        };
    }

    return that;

}) ();


text:
typedef int (*TestFunction)(char *const argv[]);

int ReportEE(ExecErrorT ee) {
    switch (ee) {
        case EE_OK:         printf("ok");
        case EE_FORK:       printf("fork problem");
        case EE_FILE:       printf("file problem");
        case EE_PIPE:       printf("pipe problem");
        case EE_REDIRECT:   printf("redirect problem");
        case EE_EXEC:       printf("exit code non-zero");
    }
    return 0;
}

int ReportExitCode(ProcessInfoT* info) {
    printf("exit code was %d", info->exit_code);
    return 0;
}

int TestOutRedirect(char *const argv[]) {
    ProcessInfoT info;
    ExecErrorT ee;
    ee = simple_exec(&info, "ls", argv, NULL, "out.txt", NULL);
    if (ee != EE_OK) return ReportEE(ee);
    simple_exec_wait(&info);
    if (info.exit_code != 0) return ReportExitCode(&info);
    return 1;
}

int RunTests(int count, const TestFunction tests[], char *const argv[]) {
    int c;
    int total = 0;
    for (c = 0; c < count; c++) {
        printf("Test %d: ", c);
        if (tests[c](argv)) {
            printf("ok");
            total++;
        }
        printf("\n");
    }
    return total;
}

const int NumTests = 1;
const TestFunction Tests[] = {
    TestOutRedirect
};

int main(int argc, char *const argv[]) {
    int total = RunTests(NumTests, Tests, argv);
    printf("%d of %d tests passed\n", total, NumTests);
}


text:
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/platform_device.h>

#include <asm/io.h>

#include <asm/arch/init.h>
#include <asm/arch/sm.h>

struct at32_sm system_manager;

static int __init at32_sm_init(void)
{
	struct resource *regs;
	struct at32_sm *sm = &system_manager;
	int ret = -ENXIO;

	regs = platform_get_resource(&at32_sm_device, IORESOURCE_MEM, 0);
	if (!regs)
		goto fail;

	spin_lock_init(&sm->lock);
	sm->pdev = &at32_sm_device;

	ret = -ENOMEM;
	sm->regs = ioremap(regs->start, regs->end - regs->start + 1);
	if (!sm->regs)
		goto fail;

	return 0;

fail:
	printk(KERN_ERR "Failed to initialize System Manager: %d\n", ret);
	return ret;
}

void __init setup_platform(void)
{
	at32_sm_init();
	at32_clock_init();
	at32_portmux_init();
}

static int __init pdc_probe(struct platform_device *pdev)
{
	struct clk *pclk, *hclk;

	pclk = clk_get(&pdev->dev, "pclk");
	if (IS_ERR(pclk)) {
		dev_err(&pdev->dev, "no pclk defined\n");
		return PTR_ERR(pclk);
	}
	hclk = clk_get(&pdev->dev, "hclk");
	if (IS_ERR(hclk)) {
		dev_err(&pdev->dev, "no hclk defined\n");
		clk_put(pclk);
		return PTR_ERR(hclk);
	}

	clk_enable(pclk);
	clk_enable(hclk);

	dev_info(&pdev->dev, "Atmel Peripheral DMA Controller enabled\n");
	return 0;
}

static struct platform_driver pdc_driver = {
	.probe		= pdc_probe,
	.driver		= {
		.name	= "pdc",
	},
};

static int __init pdc_init(void)
{
	return platform_driver_register(&pdc_driver);
}
arch_initcall(pdc_init);


text:
package com.thinkgem.jeesite.modules.jxc.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.jxc.entity.JxcIncomekind;
import com.thinkgem.jeesite.modules.jxc.service.JxcIncomekindService;

/**
 * 收入类别Controller
 * @author 吴文豪
 * @version 2016-07-23
 */
@Controller
@RequestMapping(value = "${adminPath}/jxc/jxcIncomekind")
public class JxcIncomekindController extends BaseController {

	@Autowired
	private JxcIncomekindService jxcIncomekindService;

	@ModelAttribute
	public JxcIncomekind get(@RequestParam(required=false) String id) {
		JxcIncomekind entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = jxcIncomekindService.get(id);
		}
		if (entity == null){
			entity = new JxcIncomekind();
		}
		return entity;
	}

	@RequiresPermissions("jxc:jxcIncomekind:view")
	@RequestMapping(value = {"list", ""})
	public String list(JxcIncomekind jxcIncomekind, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<JxcIncomekind> page = jxcIncomekindService.findPage(new Page<JxcIncomekind>(request, response), jxcIncomekind);
		model.addAttribute("page", page);
		return "modules/jxc/jxcIncomekindList";
	}

	@RequiresPermissions("jxc:jxcIncomekind:view")
	@RequestMapping(value = "form")
	public String form(JxcIncomekind jxcIncomekind, Model model) {
		model.addAttribute("jxcIncomekind", jxcIncomekind);
		return "modules/jxc/jxcIncomekindForm";
	}

	@RequiresPermissions("jxc:jxcIncomekind:edit")
	@RequestMapping(value = "save")
	public String save(JxcIncomekind jxcIncomekind, Model model, RedirectAttributes redirectAttributes) {
		if (!beanValidator(model, jxcIncomekind)){
			return form(jxcIncomekind, model);
		}
		jxcIncomekindService.save(jxcIncomekind);
		addMessage(redirectAttributes, "保存收入类别成功");
		return "redirect:"+Global.getAdminPath()+"/jxc/jxcIncomekind/?repage";
	}

	@RequiresPermissions("jxc:jxcIncomekind:edit")
	@RequestMapping(value = "delete")
	public String delete(JxcIncomekind jxcIncomekind, RedirectAttributes redirectAttributes) {
		jxcIncomekindService.delete(jxcIncomekind);
		addMessage(redirectAttributes, "删除收入类别成功");
		return "redirect:"+Global.getAdminPath()+"/jxc/jxcIncomekind/?repage";
	}

}


text:
require File.expand_path("../lib/brand_captcha", File.dirname(__FILE__))

prepare do
  BrandCaptcha.configure do |c|
    c.public_key = '11111111'
    c.private_key = '22222222'
  end
end

test "generates a widget" do
  expected = "<script type='text/javascript' src='//api.pontamedia.net/challenge.php?k=11111111'></script>"
  assert_equal expected, BrandCaptcha.widget
end

test "generates a widget with error" do
  expected = "<script type='text/javascript' src='//api.pontamedia.net/challenge.php?k=11111111&error=error_message'></script>"
  assert_equal expected, BrandCaptcha.widget('error_message')
end

test "check_answer requires an private_key" do
  assert_raise BrandCaptcha::Error do
    BrandCaptcha.check_answer(nil, nil, nil, nil)
  end
end

test "discard empty challenges" do
  assert_equal false, BrandCaptcha.check_answer('1.1.1.1', nil, nil)
end


text:
package org.fest.assertions.internal;

import static org.fest.assertions.error.ShouldNotBeNull.shouldNotBeNull;
import static org.fest.assertions.test.TestFailures.expectedAssertionErrorNotThrown;
import static org.fest.test.ExpectedException.none;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;

import org.fest.assertions.description.Description;
import org.fest.assertions.error.ShouldBeEqual;
import org.fest.test.ExpectedException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

/**
 * @author Alex
 * @author Alex
 */
public class Characters_assertEqual_Test {

  @Rule
  public ExpectedException thrown = none();

  private Characters characters;
  private Description description;
  private Failures failures;

  @Before
  public void setUp() {
    characters = new Characters();
    description = new TestDescription("testing");
    failures = spy(new Failures());
    characters.failures = failures;
  }

  @Test
  public void should_fail_if_actual_is_null() {
    String message = shouldNotBeNull().create(description);
    thrown.expect(AssertionError.class, message);
    characters.assertEqual(description, null, 'e');
  }

  @Test
  public void should_fail_if_actual_is_not_equal_to_expected() {
    try {
      characters.assertEqual(description, 'a', 'b');
    } catch (AssertionError e) {
      verify(failures).failure(description, ShouldBeEqual.shouldBeEqual('a', 'b'));
      return;
    }
    expectedAssertionErrorNotThrown();
  }

  @Test
  public void should_pass_if_actual_is_equal_to_expected() {
    characters.assertEqual(description, 'a', 'a');
  }
}


text:
class PublicBillsController < ApplicationController
  before_action :set_public_bill, only: [:show, :edit, :update, :destroy]
  before_action :authenticate_user!

  # GET /public_bills
  def index
    @public_bills = PublicBill.all
  end

  # GET /estimates/1
  def show
    @until = 3 - @public_bill.public_bill_lines.length
    respond_to do |format|
      format.html {
        redirect_to :id => params[:id],:debug => true, :format => :pdf, controller: :public_bills, action: :show
      }
      format.pdf {
        render pdf: @public_bill.name  + " - 見積書",
               encoding: 'UTF-8',
               layout: 'pdf.html',
               show_as_html: params[:debug].present?
      }
    end
  end

  # GET /public_bills/new
  def new
    if params[:dup_id].present?
      parent = PublicBill.find(params[:dup_id])
      clone = parent.deep_clone :include => :public_bill_lines
      @public_bill = clone
    else
      @public_bill = PublicBill.new
    end
  end

  # GET /public_bills/1/edit
  def edit
  end

  # POST /public_bills
  def create
    @public_bill = PublicBill.new(public_bill_params)

    if @public_bill.save
      redirect_to public_bills_url, notice: 'Public bill was successfully created.'
    else
      render action: 'new'
    end
  end

  # PATCH/PUT /public_bills/1
  def update
    if @public_bill.update(public_bill_params)
      redirect_to public_bills_url, notice: 'Public bill was successfully updated.'
    else
      render action: 'edit'
    end
  end

  # DELETE /public_bills/1
  def destroy
    @public_bill.destroy
    redirect_to public_bills_url, notice: 'Public bill was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_public_bill
      @public_bill = PublicBill.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def public_bill_params
      params.require(:public_bill).permit(:name,:bill_number, :publish_date, :send_flg,
      :company_name, :invoice_date, :payment_date, :memo, :public_bill_lines_attributes => [:id, :name, :detail, :unit_price, :quantity, :tax_rate, :_destroy])
    end
end


text:
title: Traitement d'une arborescence de fichiers en bash
excerpt: "Avec compression d'images au passage"
tags: [bash, traitement d'images, optimisation]
modified: 2015-04-24
comments: true
---

Pour un projet perso, j'ai quelques milliers d'images à traiter par lots. Les problèmes sont multiples, j'ai des fichiers avec des noms qui comportent des accents et décrivent assez finement le contenu de mes images. J'ai besoin de garder ces noms quelque part, mais étant donné que j'embarque ces images dans une application web, j'ai besoin de les compresser assez fortement.

### Liste des fichiers avec find

Premier petit problème, mes fichiers contiennent des espaces. Et par défaut, en bash, une boucle for sur un find itère entre les espaces. C'est lié au fait que l'IFS (Internal Field Separator) est par défaut défini à n'importe quel caractère d'espacement, c'est à dire les espaces, les tabulations ainsi que les retours à la ligne.

Petite feinte donc, il nous faut temporairement modifier sa valeur, effectuer notre boucle for et enfin, remettre sa valeur initiale.

{% highlight bash %}
OLDIFS=$IFS
IFS=`echo -en '\n\b'`

...

IFS=$OLDIFS
{% endhighlight %}

Premier souci réglé !

### Remplacement des caractères accentués

Ensuite, comme je le disais, on veut conserver à la fois l'ancien nom de nos fichiers avec les accents, mais aussi le nouveau.
Pour supprimer les accents, on va utiliser la commande __unaccent__, en y passant l'encoding. On en profite pour faire un petit coup de __sed__ en remplaçant les espaces par des underscores. Du coup, avec tout ça mis en commun et un petit __mv__ pour renommer les fichiers on obtient le script suivant :

{% highlight bash %}
#!/bin/bash

DIR="."

# save and change IFS
OLDIFS=$IFS
IFS=`echo -en '\n\b'`

# use for loop read all filenames
for i in `find $DIR -type f`;do
  echo "$i"
  newName=`echo $i | unaccent utf8 | sed 's/ /_/g'`
  echo $newName
  mv `echo $i | sed 's/ /\\ /g'` $newName
done

# restore it
IFS=$OLDIFS
{% endhighlight %}

On met le tout dans un script bash qu'on lance dans le répertoire qui nous intéresse en redirigeant la sortie standard vers un fichier.

### Compression des images

On prend les mêmes et on recommence. La base du script est la même, on applique juste à chacun des fichiers __jpegoptim__.

{% highlight bash %}
#!/bin/bash

DIR="."

# save and change IFS
OLDIFS=$IFS
IFS=`echo -en '\n\b'`

# use for loop read all filenames
for i in `find $DIR -type f`;do
  echo "$i"
	# On réoriente et on compresse un peu pour jpegoptim
	mogrify -auto-orient -quality 80 $i

	# On redimensionne les images en 1024×800 par exemple
	mogrify -resize 1024x800 $i

	# Compression des jpeg à 80 Ko environ
	jpegoptim -S80 $i
done

# restore it
IFS=$OLDIFS
{% endhighlight %}

Et voila ! Je suis passé de 6Go d'images à 100Mo !


text:
<?php

/*
 * This file is part of the PHP CS utility.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Symfony\CS\Tests\Fixer\Contrib;

use Symfony\CS\Tests\Fixer\AbstractFixerTestBase;

/**
 * @author Vincent Klaiber <hello@vinkla.com>
 *
 * @internal
 */
final class ShortEchoTagFixerTest extends AbstractFixerTestBase
{
    /**
     * @dataProvider provideClosingTagExamples
     * @requires PHP 5.4
     */
    public function testOneLineFix($expected, $input = null)
    {
        /*
         * short_echo_tag setting is ignored by HHVM
         * @see https://github.com/facebook/hhvm/issues/4809
         */
        if (!defined('HHVM_VERSION')) {
            $this->makeTest($expected, $input);
        }
    }

    public function provideClosingTagExamples()
    {
        return array(
            array('<?php echo \'Foo\';', '<?= \'Foo\';'),
            array('<?php echo \'Foo\'; ?> PLAIN TEXT', '<?= \'Foo\'; ?> PLAIN TEXT'),
            array('PLAIN TEXT<?php echo \'Foo\'; ?>', 'PLAIN TEXT<?= \'Foo\'; ?>'),
            array('<?php echo \'Foo\'; ?> <?php echo \'Bar\'; ?>', '<?= \'Foo\'; ?> <?= \'Bar\'; ?>'),
            array('<?php echo foo();', '<?=foo();'),
        );
    }
}


text:
int main()
{
  BOOST_STATIC_ASSERT_MSG((boost::is_same<boost::shared_lock_guard<boost::shared_mutex>::mutex_type,
      boost::shared_mutex>::value), "");

  return boost::report_errors();
}


text:
label: FormRepeater
id: FormRepeater
categorySlug: widget
categoryLabel: Widgets
categoryRank: 1
documentRank: 1

# FormRepeater element

```jade

+FormRepeater()

```


text:
var optionator;
optionator = require('optionator');
module.exports = optionator({
  prepend: 'Usage: lsc [option]... [file]...\n\nUse \'lsc\' with no options to start REPL.',
  append: 'Version {{version}}\n<http://livescript.net/>',
  helpStyle: {
    maxPadFactor: 1.9
  },
  positionalAnywhere: false,
  options: [
    {
      heading: 'Misc'
    }, {
      option: 'version',
      alias: 'v',
      type: 'Boolean',
      description: 'display version'
    }, {
      option: 'help',
      alias: 'h',
      type: 'Boolean',
      description: 'display this help message'
    }, {
      option: 'compile',
      alias: 'c',
      type: 'Boolean',
      description: 'compile to JavaScript and save as .js files'
    }, {
      option: 'eval',
      alias: 'e',
      type: 'code::String',
      description: 'pass as string from the command line as input'
    }, {
      option: 'prelude',
      alias: 'd',
      type: 'Boolean',
      description: 'automatically import prelude.ls in REPL'
    }, {
      option: 'require',
      alias: 'r',
      type: 'paths::[String]',
      description: 'require libraries before executing'
    }, {
      option: 'stdin',
      alias: 's',
      type: 'Boolean',
      description: 'read stdin'
    }, {
      option: 'json',
      alias: 'j',
      type: 'Boolean',
      description: 'print/compile as JSON'
    }, {
      option: 'nodejs',
      alias: 'n',
      type: 'Boolean',
      description: 'pass options after this through to the \'node\' binary',
      restPositional: true
    }, {
      option: 'watch',
      alias: 'w',
      type: 'Boolean',
      description: 'watch scripts for changes, and repeat'
    }, {
      option: 'const',
      alias: 'k',
      type: 'Boolean',
      description: 'compile all variables as constants'
    }, {
      heading: 'Output control'
    }, {
      option: 'output',
      alias: 'o',
      type: 'path::String',
      description: 'compile into the specified directory'
    }, {
      option: 'print',
      alias: 'p',
      type: 'Boolean',
      description: 'print the result to stdout'
    }, {
      option: 'bare',
      alias: 'b',
      type: 'Boolean',
      description: 'compile without the top-level function wrapper'
    }, {
      option: 'header',
      type: 'Boolean',
      description: 'do not add "Generated by" header',
      'default': 'true'
    }, {
      option: 'lex',
      alias: 'l',
      type: 'Boolean',
      description: 'print the tokens the lexer produces'
    }, {
      option: 'tokens',
      alias: 't',
      type: 'Boolean',
      description: 'print the tokens the rewriter produces'
    }, {
      option: 'ast',
      alias: 'a',
      type: 'Boolean',
      description: 'print the syntax tree the parser produces'
    }, {
      option: 'debug',
      type: 'Boolean',
      description: 'print debug output when compiling'
    }, {
      option: 'map',
      alias: 'm',
      type: 'String',
      description: "generate source maps - either: 'none', 'linked', 'linked-src', 'embedded', or 'debug'"
    }
  ]
});


text:
require 'rails_helper'

describe UserPolicy do
  let(:resource) { create :user }
  subject { described_class }

  context 'when guest user' do
    let(:user) { create :user, :guest }

    permissions :index? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :show? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :update? do
      it { expect(subject).not_to permit(user, resource) }
    end

    permissions :destroy? do
      it { expect(subject).not_to permit(user, resource) }
    end
  end

  context 'when admin user' do
    let(:user) { create :user, :admin }

    permissions :index? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :show? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :update? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :destroy? do
      it { expect(subject).to permit(user, resource) }
    end
  end

  context 'when regular user' do
    let(:user) { create :user }

    permissions :index? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :show? do
      it { expect(subject).to permit(user, resource) }
    end

    permissions :update? do
      context 'when updating themselves' do
        it { expect(subject).to permit(user, user) }
      end

      context 'when updating another user' do
        it { expect(subject).not_to permit(user, resource) }
      end
    end

    permissions :destroy? do
      context 'when destroying themselves' do
        it { expect(subject).to permit(user, user) }
      end

      context 'when destroying another user' do
        it { expect(subject).not_to permit(user, resource) }
      end
    end
  end
end


text:
package com.github.phudekar.downloader.exceptions;

public class UnexpectedResponseException extends Throwable {
    private final String location;
    private final int responseCode;

    public UnexpectedResponseException(int responseCode, String location) {
        super("Could not connect. status code : " + responseCode);
        this.responseCode = responseCode;
        this.location = location;
    }

    public int getResponseCode(){
      return this.responseCode;
    }

    public String getLocation() {
        return location;
    }
}


text:
package com.albedinsky.android.database.examples;

import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.albedinsky.android.database.examples.fragment.FragmentsFactory;
import com.albedinsky.android.database.examples.task.BenchmarkTask;
import com.albedinsky.android.examples.ExNavigationActivity;
import com.albedinsky.android.fragment.manage.FragmentController;
import com.albedinsky.android.ui.navigation.NavigationItem;

import java.util.List;

/**
 * @author Martin Albedinsky
 */
public final class HomeActivity extends ExNavigationActivity {

	@SuppressWarnings("unused")
	private static final String TAG = "HomeActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			new BenchmarkTask().executeOnExecutor(BenchmarkTask.THREAD_POOL_EXECUTOR);
		}
	}

	@NonNull
	@Override
	protected List<NavigationItem> onCreateNavigationItems(@NonNull List<NavigationItem> list, @NonNull Resources resources) {
		final NavigationItem.Builder builder = new NavigationItem.Builder(resources, getTheme());
		/**
		 * Recipes content -------------------------------------------------------------------------
		 */
		//list.add(builder.text(R.string.navigation_heading_recipes_content).asHeader().build());
		list.add(createNavigationItem(
				FragmentsFactory.HOME,
				R.string.navigation_label_home,
				builder
		));
		/**
		 * Lorem Ipsum content ---------------------------------------------------------------------
		 */
		//list.add(builder.reset().text(R.string.navigation_heading_lorem_ipsum_content).asHeader().build());
		list.add(createNavigationItem(
				FragmentsFactory.LOREM_IPSUM_LIST,
				R.string.navigation_label_lorem_ipsum_list,
				builder
		));
		list.add(createNavigationItem(
				FragmentsFactory.LOREM_IPSUM_RECYCLER,
				R.string.navigation_label_lorem_ipsum_recycler,
				builder
		));
		return list;
	}

	@Override
	protected void onAttachFragmentFactory(@NonNull FragmentController controller) {
		controller.setFragmentFactory(new FragmentsFactory());
	}

	@Override
	protected int getDefaultSelectedNavigationItemPosition() {
		return 0;
	}
}


text:
const posthtml = require('posthtml');
const css = require('..');
const {expect} = require('chai');
const autoprefixer = require('autoprefixer')({overrideBrowserslist: ['ie >= 10']});

function test(html, expected, postcssOptions, typeFilter, plugins, done) {
  plugins = plugins || [autoprefixer];
  expect(posthtml([css(plugins, postcssOptions, typeFilter)])
    .process(html, {from: 'test/test.js'})
    .then(result => {
      expect(expected).to.eql(result.html);
      done();
    }).catch(error => {
      done(error);
    }));
}

describe('use postcss', () => {
  it('object options', () => {
    expect(() => {
      posthtml([css({})]);
    }).to.throw(Error);
  });

  it('options', () => {
    expect(() => {
      posthtml([css([])]);
    }).to.not.throw(Error);
  });

  it('style tag', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, null, null, done);
  });

  it('style tag empty', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, null, null, done);
  });

  it('style attrs', done => {
    const html = '

';
    const expected = '

';
    test(html, expected, {}, null, null, done);
  });

  it('style attrs empty', done => {
    const html = '

';
    const expected = '

';
    test(html, expected, {}, null, null, done);
  });

  it('no style', done => {
    const html = 'text

';
    const expected = 'text

';
    test(html, expected, {}, null, null, done);
  });

  it('filtered style tag with standard type', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, /^text\/css$/, null, done);
  });

  it('filtered style tag with standard type (with spaces)', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, /^text\/css$/, null, done);
  });

  it('filtered style tag with standard type (empty string)', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, /^text\/css$/, null, done);
  });

  it('filtered style tag with standard type (one empty space)', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, /^text\/css$/, null, done);
  });

  it('filtered style tag with standard type (two empty spaces)', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, /^text\/css$/, null, done);
  });

  it('filtered style tag with non-standard type', done => {
    const html = '';
    const expected = '';
    test(html, expected, {}, /^text\/other$/, null, done);
  });

  it('filtered out style tag with non-standard type', done => {
    const html = '';
    const expected = html;
    test(html, expected, {}, /^text\/another$/, null, done);
  });

  it('style tag with newline and not indent', done => {
    const html = 'text ';
    const expected = 'text ';
    test(html, expected, {}, null, null, done);
  });

  it('style tag with newline and multyply indent', done => {
    const html = 'text ';
    const expected = 'text ';
    test(html, expected, {}, null, null, done);
  });

  it('style tag with newline and indent', done => {
    const html = 'text ';
    const expected = 'text ';
    test(html, expected, {}, null, null, done);
  });

  it('style tag with newline and indent + plugin remove "\\n" character', done => {
    const html = 'text ';
    const expected = 'text ';

    function plugin(root) {
      root.walk(node => {
        node.raws.before = node.raws.before.replace('\n', '');
      });
    }

    test(html, expected, {}, null, [plugin], done);
  });

  it('includes the file name in the syntax error', done => {
    const html = '';

    posthtml([css([autoprefixer])])
      .process(html, {from: 'test/test.js'})
      .catch(error => {
        expect(error.message).to.include('test/test.js');
        done();
      });
  });

  it('throws if PostCSS configuration is not found', () => {
    expect(() => {
      posthtml([css()]);
    }).to.throw(Error);
  });
});


text:
g = CurrentGlyph()
g.prepareUndo('convert to smooth')

for c in g:
    for s in c:
        for p in s.points:
            if p not in s.offCurve and p.selected:
                s.smooth = True

g.performUndo()


text:
#ifndef STABLEHLO_DIALECT_BROADCAST_UTILS_H
#define STABLEHLO_DIALECT_BROADCAST_UTILS_H

// Utilities relating to implementing HLO broadcasting.
// Note: This file should not depend on any non-MLIR TensorFlow libraries.

#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Value.h"

namespace mlir {
namespace hlo {

// Checks whether the given operand types and broadcast_dims attr represent a
// legal combination for "numpy" style broadcasting (where 1-dims are prepended
// to the smaller ranked operand until it is of the same rank as the larger).
// See: https://docs.scipy.org/doc/numpy/reference/ufuncs.html
bool isLegalNumpyRankedBroadcast(Value lhs, Value rhs,
                                 DenseIntElementsAttr broadcastDims);

// Emits shape dialect ops to compute the result shape for a broadcasting
// binary/n-ary elementwise op which broadcasts according to "numpy" semantics
// (see above), returning an extent tensor of the resulting shape. The function
// should only be used in contexts that ensure both operands to be
// broadcastable.
Value computeBinaryElementwiseBroadcastingResultExtents(Location loc, Value lhs,
                                                        Value rhs,
                                                        OpBuilder& builder);
Value computeNaryElementwiseBroadcastingResultExtents(Location loc,
                                                      ValueRange operands,
                                                      OpBuilder& builder);

}  // namespace hlo
}  // namespace mlir

#endif  // STABLEHLO_DIALECT_BROADCAST_UTILS_H


text:
pybabel extract -F babel.cfg -k lazy_gettext -o chef_validator/locale/chef_validator.pot .
pybabel init -i chef_validator/locale/chef_validator.pot -d translations -l es


text:
package io.hops.erasure_coding;

import io.hops.metadata.HdfsStorageFactory;
import io.hops.metadata.hdfs.dal.EncodingJobsDataAccess;
import io.hops.metadata.hdfs.entity.EncodingJob;
import io.hops.metadata.hdfs.entity.EncodingPolicy;
import io.hops.transaction.handler.HDFSOperationType;
import io.hops.transaction.handler.LightWeightRequestHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.JobID;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * Implementation of {@link BaseEncodingManager} that uses map reduce jobs to
 * raid files.
 */
public class MapReduceEncodingManager extends BaseEncodingManager {

  public static final Log LOG =
      LogFactory.getLog(MapReduceEncodingManager.class);

  public static final String ENCODING_JOB_EXECUTION_LIMIT =
      "io.hops.erasure_coding.encoding_job_execution_limit";
  public static final long DEFAULT_ENCODING_JOB_EXECUTION_LIMIT =
      24L * 3600L * 1000L;

  private final long executionLimit;
  private Map<String, MapReduceEncoder> currentJobs =
      new HashMap<String, MapReduceEncoder>();
  private Collection<MapReduceEncoder> completedJobs =
      new ArrayList<MapReduceEncoder>();

  private boolean initialized = false;

  public MapReduceEncodingManager(Configuration conf) throws IOException {
    super(conf);
    executionLimit = conf.getLong(ENCODING_JOB_EXECUTION_LIMIT,
        DEFAULT_ENCODING_JOB_EXECUTION_LIMIT);
    LOG.info("created");
  }

  @Override
  public void encodeFile(EncodingPolicy policy, Path sourceFile,
      Path parityFile, boolean copy) {
    initialize();

    Codec codec = Codec.getCodec(policy.getCodec());
    LOG.info("Start encoding with policy: " + policy + " for source file " +
        sourceFile.toUri().getPath() + " and parity file " + parityFile +
        " copy " + copy);
    PolicyInfo policyInfo = new PolicyInfo();
    try {
      policyInfo.setSrcPath(sourceFile.toUri().getPath());
      policyInfo.setCodecId(codec.getId());
      policyInfo.setProperty(PolicyInfo.PROPERTY_PARITY_PATH,
          parityFile.toUri().getPath());
      policyInfo.setProperty(PolicyInfo.PROPERTY_REPLICATION,
          String.valueOf(policy.getTargetReplication()));
      policyInfo.setProperty(PolicyInfo.PROPERTY_PARITY_REPLICATION,
          String.valueOf(1));
      policyInfo.setProperty(PolicyInfo.PROPERTY_COPY, String.valueOf(copy));
      raidFiles(policyInfo);
    } catch (IOException e) {
      LOG.error("Exception", e);
    }
  }

  /**
   * {@inheritDocs}
   */
  public void raidFiles(PolicyInfo info) throws IOException {
    MapReduceEncoder dr = new MapReduceEncoder(conf);
    boolean started = dr.startDistRaid(info);
    if (started) {
      String path = info.getSrcPath().toUri().getPath();
      // There is a risk that it crashes before persisting the job for recovery.
      // The ErasureCodingManager should restart the job in that case as it
      // does not set the state to active before this code succeeded.
      persistActiveJob(path, dr.getJobID(),
          dr.getConf().get(MapReduceEncoder.JOB_DIR_LABEL));
      currentJobs.put(path, dr);
    }
  }

  @Override
  public List<Report> computeReports() throws IOException {
    initialize();
    cleanRecovery();

    List<Report> reports = new ArrayList<Report>(currentJobs.size());
    for (Map.Entry<String, MapReduceEncoder> entry : currentJobs.entrySet()) {
      String fileName = entry.getKey();
      MapReduceEncoder job = entry.getValue();
      try {
        if (job.checkComplete() && job.successful()) {
          reports.add(new Report(fileName, Report.Status.FINISHED));
          LOG.info("Encoding successful for job " + job.getJobID());
        } else if (job.checkComplete() && !job.successful()) {
          reports.add(new Report(fileName, Report.Status.FAILED));
          LOG.info("Encoding failed for job " + job.getJobID());
        } else if (System.currentTimeMillis() - job.getStartTime() >
            executionLimit) {
          job.killJob();
          reports.add(new Report(fileName, Report.Status.CANCELED));
          LOG.info("Encoding canceled for job " + job.getJobID());
        } else {
          reports.add(new Report(fileName, Report.Status.ACTIVE));
          LOG.info("Encoding active for job " + job.getJobID());
        }
      } catch (IOException e) {
        LOG.error("Exception during completeness check", e);
        try {
          job.killJob();
        } catch (IOException e1) {
        }
        reports.add(new Report(fileName, Report.Status.FAILED));
      }
    }

    for (Report report : reports) {
      Report.Status status = report.getStatus();
      if (status == Report.Status.FINISHED || status == Report.Status.FAILED ||
          status == Report.Status.CANCELED) {
        MapReduceEncoder job = currentJobs.remove(report.getFilePath());
        completedJobs.add(job);
      }
    }

    return reports;
  }

  private void persistActiveJob(final String path, final JobID jobId,
      final String jobDir) throws IOException {
    new LightWeightRequestHandler(HDFSOperationType.PERSIST_ENCODING_JOB) {
      @Override
      public Object performTask() throws IOException {
        EncodingJobsDataAccess da = (EncodingJobsDataAccess)
            HdfsStorageFactory.getDataAccess(EncodingJobsDataAccess.class);
          da.add(new EncodingJob(jobId.getJtIdentifier(),
              jobId.getId(), path, jobDir));
        return null;
      }
    }.handle();
  }

  private void cleanRecovery() throws IOException {
    new LightWeightRequestHandler(HDFSOperationType.DELETE_ENCODING_JOBS) {
      @Override
      public Object performTask() throws IOException {
        EncodingJobsDataAccess da = (EncodingJobsDataAccess)
            HdfsStorageFactory.getDataAccess(EncodingJobsDataAccess.class);
        Iterator<MapReduceEncoder> it = completedJobs.iterator();
        while (it.hasNext()) {
          MapReduceEncoder job = it.next();
          JobID jobId = job.getJobID();
          da.delete(new EncodingJob(jobId.getJtIdentifier(), jobId.getId()));
          it.remove();
        }
        return null;
      }
    }.handle();
  }

  @Override
  public void cancelAll() {
    initialize();
    for (MapReduceEncoder job : currentJobs.values()) {
      try {
        job.killJob();
      } catch (IOException e) {
        LOG.error("Exception", e);
      }
    }
    currentJobs.clear();
  }

  @Override
  public void cancel(String toCancel) {
    initialize();
    MapReduceEncoder job = currentJobs.get(toCancel);
    try {
      job.killJob();
    } catch (IOException e) {
      LOG.error("Exception", e);
    }
    currentJobs.remove(toCancel);
  }

  private void initialize() {
    if (initialized) {
      return;
    }

    try {
      for (EncodingJob job : recoverActiveJobs()) {
        MapReduceEncoder recovered = new MapReduceEncoder(conf, job);
        currentJobs.put(job.getPath(), recovered);
      }
    } catch (IOException e) {
      LOG.error("Encoding job recovery failed", e);
      throw new RuntimeException(e);
    }

    initialized = true;
  }

  private Collection<EncodingJob> recoverActiveJobs() throws IOException {
    LightWeightRequestHandler handler = new LightWeightRequestHandler(
        HDFSOperationType.RECOVER_ENCODING_JOBS) {
      @Override
      public Object performTask() throws IOException {
        EncodingJobsDataAccess da = (EncodingJobsDataAccess)
            HdfsStorageFactory.getDataAccess(EncodingJobsDataAccess.class);
        return da.findAll();
      }
    };

    return (Collection<EncodingJob>) handler.handle();
  }
}


text:
package com.bright_side_it.fliesenui.screendefinition.dao;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.w3c.dom.Node;

import com.bright_side_it.fliesenui.base.util.BaseUtil;
import com.bright_side_it.fliesenui.base.util.XMLUtil;
import com.bright_side_it.fliesenui.project.model.AssistValue;
import com.bright_side_it.fliesenui.screendefinition.model.EventHandler;
import com.bright_side_it.fliesenui.screendefinition.model.EventHandlerContainer;
import com.bright_side_it.fliesenui.screendefinition.model.NodePath;
import com.bright_side_it.fliesenui.screendefinition.model.ScreenDefinitionDAOResult;
import com.bright_side_it.fliesenui.screendefinition.model.EventHandler.EventType;
import com.bright_side_it.fliesenui.validation.util.ValidationUtil;

public class EventHandlerDAO {
	private static final String NODE_NAME_ON_CLICK = "onClick";
	public static final String NODE_NAME_ON_ENTER = "onEnter";

    public static final String PROPERTY_NAME_URL_TO_OPEN = "urlToOpen";
    public static final String PROPERTY_NAME_OPEN_URL_IN_NEW_WINDOW = "openURLInNewWindow";
    public static final String PROPERTY_NAME_SCREEN_TO_OPEN = "screenToOpen";
    public static final String PROPERTY_NAME_OPEN_SCREEN_PARAMETER_DTO = "openScreenParameterDTO";
    public static final String PROPERTY_NAME_BUTTON_TO_CLICK = "buttonToClick";

	public boolean isEventHandlerNode(String nodeName) {
		return getNodeNames().contains(nodeName);
	}

    public void readEventHandler(Node node, NodePath nodePath, ScreenDefinitionDAOResult result, EventHandlerContainer container) throws Exception {
        EventHandler eventHandler = new EventHandler();

        if (container.getEventHandlers() == null) {
            container.setEventHandlers(new ArrayList<>());
        }
        container.getEventHandlers().add(eventHandler);

        if (node.getNodeName().equals(NODE_NAME_ON_CLICK)){
        	eventHandler.setEventType(EventType.CLICK);
        } else if (node.getNodeName().equals(NODE_NAME_ON_ENTER)){
        		eventHandler.setEventType(EventType.ENTER);
        } else {
        	throw new Exception("Unknown event type: " + node.getNodeName());
        }

        eventHandler.setNodePath(nodePath);

        eventHandler.setURLToOpen(XMLUtil.getStringAttributeOptional(node, PROPERTY_NAME_URL_TO_OPEN, null));
        eventHandler.setOpenURLInNewWindow(XMLUtil.getBooleanAttributeOptional(node, PROPERTY_NAME_OPEN_URL_IN_NEW_WINDOW, false));
        eventHandler.setScreenToOpen(XMLUtil.getStringAttributeOptional(node, PROPERTY_NAME_SCREEN_TO_OPEN, null));
        eventHandler.setOpenScreenParameterDTO(XMLUtil.getStringAttributeOptional(node, PROPERTY_NAME_OPEN_SCREEN_PARAMETER_DTO, null));
        eventHandler.setButtonToClick(XMLUtil.getStringAttributeOptional(node, PROPERTY_NAME_BUTTON_TO_CLICK, null));

        ValidationUtil.validateAllowedAttributes(node, nodePath, BaseUtil.getTextSet(getTagAttributes(node.getNodeName())), result);
    }

    public List<AssistValue> getPossibleChildTags() {
        List<AssistValue> result = new ArrayList<AssistValue>();
        return result;
    }

    public List<AssistValue> getTagAttributes(String nodeName) {
        List<AssistValue> result = new ArrayList<AssistValue>();
        result.add(BaseUtil.createAssistValue(false, PROPERTY_NAME_BUTTON_TO_CLICK, "ID of the button to be clicked"));
        result.add(BaseUtil.createAssistValue(false, PROPERTY_NAME_URL_TO_OPEN, "URL to open"));
        result.add(BaseUtil.createAssistValue(false, PROPERTY_NAME_OPEN_URL_IN_NEW_WINDOW, "true: opens the URL in a new window"));
        result.add(BaseUtil.createAssistValue(false, PROPERTY_NAME_SCREEN_TO_OPEN, "open a screen with this ID"));
        result.add(BaseUtil.createAssistValue(false, PROPERTY_NAME_OPEN_SCREEN_PARAMETER_DTO, "if the screen to open requires a parameter object it has to be specified here"));
        return result;
    }

	public static List<String> getNodeNames() {
		return Arrays.asList(NODE_NAME_ON_CLICK, NODE_NAME_ON_ENTER);
	}

}


text:
// source:

package nl.esciencecenter.xnatclient.data;

import nl.esciencecenter.xnatclient.data.XnatTypes.ImageContentType;
import nl.esciencecenter.xnatclient.data.XnatTypes.ImageFormatType;

/**
 * Info used when uploading a file.
 */
public class ImageFileInfo
{
    public String formatType;

    public String imageContentType;

    public String destinationFileBasename;

    private long fileSize;

    public ImageFileInfo()
    {
    }

    public ImageFileInfo duplicate()
    {
        ImageFileInfo newInfo = new ImageFileInfo();
        newInfo.copyFrom(this);
        return newInfo;
    }

    protected void copyFrom(ImageFileInfo other)
    {
        this.formatType = other.formatType;
        this.imageContentType = other.imageContentType;
        this.destinationFileBasename = other.destinationFileBasename;
        this.fileSize = other.fileSize;
    }

    public ImageFileInfo(ImageFormatType format, ImageContentType contentType)
    {
        this.formatType = format.toString();
        this.imageContentType = contentType.toString();
    }

    public ImageFileInfo(String formatType, String contentType)
    {
        this.formatType = formatType;
        this.imageContentType = contentType;
    }

    public String getContentType()
    {
        return this.imageContentType;
    }

    public String getImageFormatType()
    {
        return this.formatType;
    }

    /**
     * Basename of Destination file
     *
     * @return
     */
    public String getDestinationFilename()
    {
        return destinationFileBasename;
    }

    /**
     * Basename of destination file
     *
     * @param newName
     */
    public void setDestinationFilename(String newName)
    {
        this.destinationFileBasename = newName;
    }

    public void setFileSize(long length)
    {
        this.fileSize = length;
    }

    public long getFileSize()
    {
        return this.fileSize;
    }

    // generated methods.

    @Override
    public String toString()
    {
        return "ImageFileInfo [formatType=" + formatType + ", contentType=" + imageContentType
                + ", destinationFileBasename=" + destinationFileBasename + ", fileSize=" + fileSize + "]";
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((destinationFileBasename == null) ? 0 : destinationFileBasename.hashCode());
        result = prime * result + (int) (fileSize ^ (fileSize >>> 32));
        result = prime * result + ((formatType == null) ? 0 : formatType.hashCode());
        result = prime * result + ((imageContentType == null) ? 0 : imageContentType.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ImageFileInfo other = (ImageFileInfo) obj;
        if (destinationFileBasename == null)
        {
            if (other.destinationFileBasename != null)
                return false;
        }
        else if (!destinationFileBasename.equals(other.destinationFileBasename))
            return false;
        if (fileSize != other.fileSize)
            return false;
        if (formatType != other.formatType)
            return false;
        if (imageContentType == null)
        {
            if (other.imageContentType != null)
                return false;
        }
        else if (!imageContentType.equals(other.imageContentType))
            return false;
        return true;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>me.hypernatho</groupId>
    <artifactId>Messenger</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
        </repository>
        <repository>
            <id>oss.sonatype.org</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.8-R0.1-SNAPSHOT</version>
        </dependency><!--Spigot-API-->
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.8-R0.1-SNAPSHOT</version>
        </dependency><!--Bukkit API-->

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.14.8</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>Messenger</finalName>
        <defaultGoal>clean package</defaultGoal>
        <sourceDirectory>${basedir}/src/main/java/</sourceDirectory>
        <resources>
            <resource>
                <targetPath>.</targetPath>
                <directory>${basedir}/src/main/resources/</directory>
                <filtering>true</filtering>
                <includes>
                    <include>*.yml</include>
                    <include>*.txt</include>
                    <include>*.properties</include>
                </includes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipTests>true</skipTests>
    </properties>
</project>


text:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:description="Page Header with navigation"
    jcr:primaryType="cq:Component"
    jcr:title="citraining Page Header"
    componentGroup="citraining.Structure"/>