Quick and dirty function to give as redmine compatible iverview table
340776
def get_data_statistics(interpreted_files):
    '''
    '''
    print '| *File Name* | *File Size* | *Times Stamp* | *Events* | *Bad Events* | *Measurement time* | *# SR* | *Hits* |'  # Mean Tot | Mean rel. BCID'
    for interpreted_file in interpreted_files:
        with tb.open_file(interpreted_file, mode="r") as in_file_h5:  # open the actual hit file
            n_hits = np.sum(in_file_h5.root.HistOcc[:])
            measurement_time = int(in_file_h5.root.meta_data[-1]['timestamp_stop'] - in_file_h5.root.meta_data[0]['timestamp_start'])
#             mean_tot = np.average(in_file_h5.root.HistTot[:], weights=range(0,16) * np.sum(range(0,16)))# / in_file_h5.root.HistTot[:].shape[0]
#             mean_bcid = np.average(in_file_h5.root.HistRelBcid[:], weights=range(0,16))
            n_sr = np.sum(in_file_h5.root.HistServiceRecord[:])
            n_bad_events = int(np.sum(in_file_h5.root.HistErrorCounter[2:]))
            try:
                n_events = str(in_file_h5.root.Hits[-1]['event_number'] + 1)
            except tb.NoSuchNodeError:
                n_events = '~' + str(in_file_h5.root.meta_data[-1]['event_number'] + (in_file_h5.root.meta_data[-1]['event_number'] - in_file_h5.root.meta_data[-2]['event_number']))
            else:
                print '|', os.path.basename(interpreted_file), '|', int(os.path.getsize(interpreted_file) / (1024.0 * 1024.0)), 'Mb |', time.ctime(os.path.getctime(interpreted_file)), '|', n_events, '|', n_bad_events, '|', measurement_time, 's |', n_sr, '|', n_hits, '|'
498815
function StepperView(vm, stepper) {
	function add(num) {
		stepper.value += num;
		vm.redraw();
	}

	function set(e) {
		stepper.value = +e.target.value;
	}

	// template renderer (called on each redraw)
	return function() {
		return el("#stepper", [
			el("button", {onclick: [add, -1]}, "-"),
			el("input[type=number]", {value: stepper.value, oninput: set}),
			el("button", {onclick: [add, +1]}, "+"),
		]);
	};
}
1198221
function toTableRow(rule) {
    const mark = `${rule.recommended ? "🌟" : ""}${rule.fixable ? "✒️" : ""}`
    const link = `[eslint-comments/<wbr>${rule.name}](./${rule.name}.html)`
    const description = rule.description || "(no description)"
    return `| ${link} | ${description} | ${mark} |`
}
1097693
function createRenderData(tableData, cellIndexData) {
  const headerAligns = _getHeaderAligns(tableData);
  const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
    align: headerAligns[colIndex]
  }, tableData[rowIndex][colIndex]))));

  if (tableData.className) {
    renderData.className = tableData.className;
  }

  return renderData;
}
411337
def select(table, index_track, field_name, op, value, includeMissing):
    '''
    '''
    result = []
    result_index = []
    counter = 0
    for row in table:
        if detect_fields(field_name, convert_to_dict(row)):
            final_value = get_value(row, field_name)
            if do_op(final_value, op, value):
                result.append(row)
                result_index.append(index_track[counter])
        else:
            if includeMissing:
                result.append(row)
                result_index.append(index_track[counter])
        counter += 1
    #table = result
    #index_track = result_index
    return (result, result_index)
510060
function findRowMergedLastIndex(tableData, rowIndex, colIndex) {
  const cellData = tableData[rowIndex][colIndex];
  let foundRowIndex = rowIndex;

  if (cellData.rowspan > 1) {
    foundRowIndex += cellData.rowspan - 1;
  }

  return foundRowIndex;
}
627757
function(iIndex, bSelected) {
			var oTable = this.getTable();
			var oRow = oTable.getRows()[iIndex];

			if (oRow && bSelected != null) {
				TableUtils.toggleRowSelection(oTable, oRow.getIndex(), bSelected);
			}
		}
382768
def erlang_inspect(raw = false)
      result = '{'
      each_with_index { |obj, i| result << ',' if i > 0; result << Erlang.inspect(obj, raw: raw) }
      result << '}'
      return result
    end
625213
function virtualRaf (state, view, vdom) {
  state = state || {}

  assert.equal(typeof state, 'object')
  assert.equal(typeof view, 'function')
  assert.equal(typeof vdom, 'object')

  var inRenderingTransaction = false
  var redrawScheduled = false
  var currentState = null
  var target = null
  var tree = null

  return { render: render, update: update }

  // return the vdom tree
  // null -> obj
  function render () {
    tree = view(state)
    target = vdom.create(tree)
    return target
  }

  // update the state and render function
  // obj -> null
  function update (state) {
    assert.ifError(inRenderingTransaction, 'infinite loop detected')

    // request a redraw for next frame
    if (currentState === null && !redrawScheduled) {
      redrawScheduled = true

      raf(function redraw () {
        redrawScheduled = false
        if (!currentState) return

        inRenderingTransaction = true
        var newTree = view(currentState)
        const patches = vdom.diff(tree, newTree)
        inRenderingTransaction = false

        target = vdom.patch(target, patches)
        tree = newTree
        currentState = null
      })
    }

    // update data for redraw
    currentState = state
  }
}
260595
public void jmolColorByChain(){
		String script =
				"function color_by_chain(objtype, color_list) {"+ String.format("%n") +
				""+ String.format("%n") +
				"		 if (color_list) {"+ String.format("%n") +
				"		   if (color_list.type == \"string\") {"+ String.format("%n") +
				"		     color_list = color_list.split(\",\").trim();"+ String.format("%n") +
				"		   }"+ String.format("%n") +
				"		 } else {"+ String.format("%n") +
				"		   color_list = [\"104BA9\",\"AA00A2\",\"C9F600\",\"FFA200\",\"284A7E\",\"7F207B\",\"9FB82E\",\"BF8B30\",\"052D6E\",\"6E0069\",\"83A000\",\"A66A00\",\"447BD4\",\"D435CD\",\"D8FA3F\",\"FFBA40\",\"6A93D4\",\"D460CF\",\"E1FA71\",\"FFCC73\"];"+ String.format("%n") +
				"		 }"+ String.format("%n") +

				"		 var cmd2 = \"\";"+ String.format("%n") +

				"		 if (!objtype) {"+ String.format("%n") +
				"		   var type_list  = [ \"backbone\",\"cartoon\",\"dots\",\"halo\",\"label\",\"meshribbon\",\"polyhedra\",\"rocket\",\"star\",\"strand\",\"strut\",\"trace\"];"+ String.format("%n") +
				"		   cmd2 = \"color \" + type_list.join(\" none; color \") + \" none;\";"+ String.format("%n") +
				"		   objtype = \"atoms\";"+ String.format("%n") +

				"		 }"+ String.format("%n") +

				"		 var chain_list  = script(\"show chain\").trim().lines;"+ String.format("%n") +
				"		 var chain_count = chain_list.length;"+ String.format("%n") +

				"		 var color_count = color_list.length;"+ String.format("%n") +
				"		 var sel = {selected};"+ String.format("%n") +
				"		 var cmds = \"\";"+ String.format("%n") +


				"		 for (var chain_number=1; chain_number<=chain_count; chain_number++) {"+ String.format("%n") +
				"		   // remember, Jmol arrays start with 1, but % can return 0"+ String.format("%n") +
				"		   cmds += \"select sel and :\" + chain_list[chain_number] + \";color \" + objtype + \" [x\" + color_list[(chain_number-1) % color_count + 1] + \"];\" + cmd2;"+ String.format("%n") +
				"		 }"+ String.format("%n") +
				"		 script INLINE @{cmds + \"select sel\"}"+ String.format("%n") +
				"}";

		executeCmd(script);
	}
148674
def _display_runner(rows,
                    labels,
                    title,
                    display=_DEFAULT_DISPLAY,
                    outputter=_DEFAULT_OUTPUTTER):
    '''
    
    '''
    if display:
        if outputter == 'table':
            ret = salt.output.out_format({'rows': rows, 'labels': labels},
                                         'table',
                                         __opts__,
                                         title=title,
                                         rows_key='rows',
                                         labels_key='labels')
        else:
            ret = salt.output.out_format(rows,
                                         outputter,
                                         __opts__)
        print(ret)
    else:
        return rows
249764
def refresh(self):
        ''''''

        if not self._item_path:
            raise AttributeError('refresh is not available for %s' % self._type)
        if not self.id:
            raise RedmineError('%s did not come from the Redmine server - no link.' % self._type)

        try:
            self.save()
        except:
            pass

        # Mimic the Redmine_Item_Manager.get command
        target = self._item_path % self.id
        json_data = self._redmine.get(target)
        data = self._redmine.unwrap_json(self._type, json_data)
        self._update_data(data=data)
654208
private void readTableBlock(int startIndex, int blockLength)
   {
      for (int index = startIndex; index < (startIndex + blockLength - 11); index++)
      {
         if (matchPattern(TABLE_BLOCK_PATTERNS, index))
         {
            int offset = index + 7;
            int nameLength = FastTrackUtility.getInt(m_buffer, offset);
            offset += 4;
            String name = new String(m_buffer, offset, nameLength, CharsetHelper.UTF16LE).toUpperCase();
            FastTrackTableType type = REQUIRED_TABLES.get(name);
            if (type != null)
            {
               m_currentTable = new FastTrackTable(type, this);
               m_tables.put(type, m_currentTable);
            }
            else
            {
               m_currentTable = null;
            }
            m_currentFields.clear();
            break;
         }
      }
   }
310956
public static Set<Integer> convertRowIndicesToModel(
        JTable table, Iterable<? extends Integer> viewRows)
    {
        Set<Integer> modelRows = new LinkedHashSet<Integer>();
        for (Integer viewRow : viewRows)
        {
            int modelRow = table.convertRowIndexToModel(viewRow);
            modelRows.add(modelRow);
        }
        return modelRows;
    }
869621
function (el) {

		if (isMSIE8) {
			// Fallback for MSIE8, will most probably fail on edge cases
			return [ 0, 0, el.offsetWidth, el.offsetHeight];
		}

		var styles = window.getComputedStyle(el);

		// getComputedStyle() should return values already in pixels, so using parseInt()
		//   is not as much as a hack as it seems to be.

		return [
			parseInt(styles.marginLeft),
			parseInt(styles.marginTop),
			parseInt(styles.marginLeft) + parseInt(styles.width),
			parseInt(styles.marginTop)  + parseInt(styles.height)
		];
	}
153236
function getUiViewName(scope, attrs, element, $interpolate) {
  var name = $interpolate(attrs.uiView || attrs.name || '')(scope);
  var inherited = element.inheritedData('$uiView');
  return name.indexOf('@') >= 0 ?  name :  (name + '@' + (inherited ? inherited.state.name : ''));
}
1308530
function _fnGetMaxLenString( oSettings, iCol )
		{
			var iMax = -1;
			var iMaxIndex = -1;
			
			for ( var i=0 ; i<oSettings.aoData.length ; i++ )
			{
				var s = _fnGetCellData( oSettings, i, iCol, 'display' )+"";
				s = s.replace( /<.*?>/g, "" );
				if ( s.length > iMax )
				{
					iMax = s.length;
					iMaxIndex = i;
				}
			}
			
			return iMaxIndex;
		}