text:
% NOTE(Cam): Because Matlab uses 1-index arrays, I'm fixing up
% the register indices by adding 1 as they're unpacked. This means
% the numbers will be off by one when compared raw with the instruction
% set documentation. The regidx2name() function will properly handle
% these modified indices.

function cpustate = execInstr(cpustate, instr)
if cpustate.loops >= cpustate.dmpdelay
    dumpRegs(cpustate.regs);
    fprintf('0x%08x - ', cpustate.pc);
    dumpOpcode(instr);
end

% Branching instructions depend on PC being incremented
% before executing the instruction
cpustate.pc = cpustate.pc + 4;

% TODO(Cam): Fix signedness and overflow/underflow behavior of arithmetic
% instructions. Fix arithmetic shift behavior.
opcode = opCode(instr);
if ~opcode
    % R-type instruction. Have to switch on funct
    [rs, rt, rd, shamt, funct] = unpackR(instr);
    switch (funct)
        case 32
            % add
            cpustate.regs(rd) = cpustate.regs(rs) + cpustate.regs(rt);
        case 33
            % addu
            cpustate.regs(rd) = cpustate.regs(rs) + cpustate.regs(rt);
        case 34
            % sub
            cpustate.regs(rd) = cpustate.regs(rs) - cpustate.regs(rt);
        case 35
            % subu
            cpustate.regs(rd) = cpustate.regs(rs) - cpustate.regs(rt);
        case 24
            % mult
            product = cpustate.regs(rs) * cpustate.regs(rt);
            cpustate.reg_lo = int32(product);
            cpustate.reg_hi = int32(bitshift(product, -32));
        case 25
            % multu
            product = cpustate.regs(rs) * cpustate.regs(rt);
            cpustate.reg_lo = val2int32(product);
            cpustate.reg_hi = val2int32(bitshift(product, -32));
        case 26
            % div
            cpustate.reg_lo = cpustate.regs(rs) / cpustate.regs(rt);
            cpustate.reg_hi = mod(cpustate.regs(rs), cpustate.regs(rt));
        case 27
            % divu
            cpustate.reg_lo = cpustate.regs(rs) / cpustate.regs(rt);
            cpustate.reg_hi = mod(cpustate.regs(rs), cpustate.regs(rt));
        case 16
            % mfhi
            cpustate.regs(rd) = cpustate.reg_hi;
        case 18
            % mflo
            cpustate.regs(rd) = cpustate.reg_lo;
        case 36
            % and
            cpustate.regs(rd) = bitand(cpustate.regs(rs), cpustate.regs(rt), 'uint32');
        case 37
            % or
            cpustate.regs(rd) = bitor(cpustate.regs(rs), cpustate.regs(rt), 'uint32');
        case 38
            % xor
            cpustate.regs(rd) = bitxor(cpustate.regs(rs), cpustate.regs(rt), 'uint32');
        case 39
            % nor
            cpustate.regs(rd) = bitcmp(bitor(cpustate.regs(rs), cpustate.regs(rt), 'uint32'), 'uint32');
        case 42
            % slt
            cpustate.regs(rd) = (cpustate.regs(rs) < cpustate.regs(rt));
        case 43
            % sltu
            cpustate.regs(rd) = (cpustate.regs(rs) < cpustate.regs(rt));
        case 0
            % sll
            cpustate.regs(rd) = bitshift(cpustate.regs(rt), shamt);
        case 2
            % srl
            cpustate.regs(rd) = bitshift(cpustate.regs(rt), -shamt);
        case 3
            % sra
            cpustate.regs(rd) = bitshift(cpustate.regs(rt), -shamt);
        case 4
            % sllv
            cpustate.regs(rd) = bitshift(cpustate.regs(rt), cpustate.regs(rs));
        case 6
            % srlv
            cpustate.regs(rd) = bitshift(cpustate.regs(rt), -cpustate.regs(rs));
        case 7
            % srav
            cpustate.regs(rd) = bitshift(cpustate.regs(rt), -cpustate.regs(rs));
        case 8
            % jr
            if rs == Register.ra
               cpustate.callframes(length(cpustate.callframes)) = [];
            end
            cpustate.pc = cpustate.regs(rs);
        case 11
            % movn
            if cpustate.regs(rt)
                cpustate.regs(rd) = cpustate.regs(rs);
            end
        case 12
            % syscall
            cpustate = dispatchSyscall(cpustate);
        otherwise
            % Illegal instruction - halt core
            fprintf('Bad opcode at: 0x%08x\n', cpustate.pc-4);
            cpustate.halted = 1;
    end
else
[rs, rt, immediate] = unpackI(instr);
switch (opcode)
    case 8
        % addi
        cpustate.regs(rt) = cpustate.regs(rs) + immediate;
    case 9
        % addiu
        cpustate.regs(rt) = cpustate.regs(rs) + immediate;
    case 35
        % lw
        cpustate.regs(rt) = val2int32(readMemory(cpustate, cpustate.regs(rs) + immediate, 4));
    case 33
        % lh
        cpustate.regs(rt) = val2int16(readMemory(cpustate, cpustate.regs(rs) + immediate, 2));
    case 37
        % lhu
        cpustate.regs(rt) = readMemory(cpustate, cpustate.regs(rs) + immediate, 2);
    case 32
        % lb
        cpustate.regs(rt) = val2int8(readMemory(cpustate, cpustate.regs(rs) + immediate, 1));
    case 36
        % lbu
        cpustate.regs(rt) = readMemory(cpustate, cpustate.regs(rs) + immediate, 1);
    case 43
        % sw
        cpustate = writeMemory(cpustate, cpustate.regs(rs) + immediate, 4, cpustate.regs(rt));
    case 41
        % sh
        cpustate = writeMemory(cpustate, cpustate.regs(rs) + immediate, 2, cpustate.regs(rt));
    case 40
        % sb
        cpustate = writeMemory(cpustate, cpustate.regs(rs) + immediate, 1, cpustate.regs(rt));
    case 15
        % lui
        cpustate.regs(rt) = bitshift(immediate, 16);
    case 12
        % andi
        cpustate.regs(rt) = bitand(cpustate.regs(rs), immediate);
    case 13
        % ori
        cpustate.regs(rt) = bitor(cpustate.regs(rs), immediate);
    case 10
        % slti
        cpustate.regs(rt) = (cpustate.regs(rs) < immediate);
    case 4
        % beq
        taken = cpustate.regs(rs) == cpustate.regs(rt);
        if (taken)
            cpustate.pc = computeBranchTarget(cpustate.pc, immediate);
        end
    case 5
        % bne
        taken = cpustate.regs(rs) ~= cpustate.regs(rt);
        if (taken)
            cpustate.pc = computeBranchTarget(cpustate.pc, immediate);
        end
    case 1
        switch (rt-1)
            case 0
                % bltz
                taken = cpustate.regs(rs) < 0;
                if (taken)
                    cpustate.pc = computeBranchTarget(cpustate.pc, immediate);
                end

            case 17
                % bgezal
                taken = cpustate.regs(rs) >= 0;
                if (taken)
                    cpustate.regs(Register.ra) = cpustate.pc;
                    cpustate.callframes = [cpustate.callframes cpustate.pc];
                    cpustate.pc = computeBranchTarget(cpustate.pc, immediate);
                end

            otherwise
                % Illegal instruction - halt core
                fprintf('Bad opcode at: 0x%08x\n', cpustate.pc-4);
                cpustate.halted = 1;
        end
    case 7
        % bgtz
        if cpustate.regs(rs) > 0
            cpustate.pc = computeBranchTarget(cpustate.pc, immediate);
        end

    case 2
        % j
        address = unpackJ(instr);
        cpustate.pc = computeJumpTarget(cpustate.pc, address);
    case 3
        % jal
        address = unpackJ(instr);
        cpustate.regs(Register.ra) = cpustate.pc;
        cpustate.callframes = [cpustate.callframes cpustate.pc];
        cpustate.pc = computeJumpTarget(cpustate.pc, address);
    otherwise
        % Illegal instruction - halt core
        fprintf('Bad opcode at: 0x%08x\n', cpustate.pc-4);
        cpustate.halted = 1;
end
end
end

function type = instrType(instr)
%INSTRTYPE Returns the type of instruction, as defined by the enum in
%          InstructionType.

% I-TYPE opcodes are 4, 5, 8-A, C, D, F, 20, 21, 23-25, 28, 2B in hex
i_type_opcodes = [4:5, 8:10, 12:13, 15, 32:33, 35:37, 40, 43];
j_type_opcodes = [2 3];

op = opCode(instr);
if op == 0
    type = InstructionType.R;
elseif ~isempty(find(i_type_opcodes == op, 1))
    type = InstructionType.I;
elseif ~isempty(find(j_type_opcodes == op, 1))
    type = InstructionType.J;
else
    type = InstructionType.UNKNOWN;
end
end

function op = opCode(instr)
%OPCODE Return the op code of an instruction.
%       The op code is the first six bits.
op = bin2int(bitget(instr, 32:-1:27));
end

function [rs, rt, rd, shamt, funct] = unpackR(instr)
% Extracts parameters from an R-type instruction
% These instructions contain 3 registers, a constant offset, and a function
% code
rs = bin2int(bitget(instr, 26:-1:22)) + 1;
rt = bin2int(bitget(instr, 21:-1:17)) + 1;
rd = bin2int(bitget(instr, 16:-1:12)) + 1;
shamt = bin2int(bitget(instr, 11:-1:7));
funct = bin2int(bitget(instr, 6:-1:1));
end

function [rs, rt, immediate] = unpackI(instr)
% Extracts parameters from an I-type instruction
% These instructions contain 2 registers and an immediate value
rs = bin2int(bitget(instr, 26:-1:22)) + 1;
rt = bin2int(bitget(instr, 21:-1:17)) + 1;
immediate = val2int16(bin2int(bitget(instr, 16:-1:1)));
end

function address = unpackJ(instr)
% Extracts parameters from an J-type instruction
% These instructions contain a jump target only.
address = bin2int(bitget(instr, 26:-1:1));
end

% TODO(Cam): We should move this into another file if we can
function dumpOpcode(instr)

% Unpack I and J forms now since they don't conflict with each other.
% We'll use the correct unpacked form when executing.
[rs, rt, immediate] = unpackI(instr);
address = unpackJ(instr);
switch (opCode(instr))
    case hex2dec('0')
        % R-type instruction. Have to switch on funct
        [rs, rt, rd, shamt, funct] = unpackR(instr);
        switch (funct)
            case hex2dec('20')
                fprintf('add');
            case hex2dec('21')
                fprintf('addu');
            case hex2dec('22')
                fprintf('sub');
            case hex2dec('23')
                fprintf('subu');
            case hex2dec('18')
                fprintf('mult');
            case hex2dec('19')
                fprintf('multu');
            case hex2dec('1A')
                fprintf('div');
            case hex2dec('1B')
                fprintf('divu');
            case hex2dec('10')
                fprintf('mfhi');
            case hex2dec('12')
                fprintf('mflo');
            case hex2dec('24')
                fprintf('and');
            case hex2dec('25')
                fprintf('or');
            case hex2dec('26')
                fprintf('xor');
            case hex2dec('27')
                fprintf('nor');
            case hex2dec('2A')
                fprintf('slt');
            case hex2dec('2B')
                fprintf('sltu');
            case hex2dec('0')
                fprintf('sll');
            case hex2dec('2')
                fprintf('srl');
            case hex2dec('3')
                fprintf('sra');
            case hex2dec('4')
                fprintf('sllv');
            case hex2dec('6')
                fprintf('srlv');
            case hex2dec('7')
                fprintf('srav');
            case hex2dec('8')
                fprintf('jr $%s\n', regidx2name(rs));
                return;
            case hex2dec('C')
                disp('syscall');
                return;
            otherwise
                return;
        end
        fprintf(' $%s $%s $%s %d\n', regidx2name(rd), regidx2name(rs), ...
            regidx2name(rt), shamt);
        return;
    case hex2dec('8')
        fprintf('addi');
    case hex2dec('9')
        fprintf('addiu');
    case hex2dec('23')
        fprintf('lw');
    case hex2dec('21')
        fprintf('lh');
    case hex2dec('25')
        fprintf('lhu');
    case hex2dec('20')
        fprintf('lb');
    case hex2dec('24')
        fprintf('lbu');
    case hex2dec('2B')
        fprintf('sw');
    case hex2dec('29')
        fprintf('sh');
    case hex2dec('28')
        fprintf('sb');
    case hex2dec('F')
        fprintf('lui');
    case hex2dec('C')
        fprintf('andi');
    case hex2dec('D')
        fprintf('ori');
    case hex2dec('A')
        fprintf('slti');
    case hex2dec('4')
        fprintf('beq $%s $%s 0x%04x\n', regidx2name(rs), regidx2name(rt), immediate);
        return;
    case hex2dec('5')
        fprintf('bne $%s $%s 0x%04x\n', regidx2name(rs), regidx2name(rt), immediate);
        return;
    otherwise
        switch (opCode(instr))
            case hex2dec('2')
                fprintf('j');
            case hex2dec('3')
                fprintf('jal');
            otherwise
                return;
        end
        fprintf(' 0x%08x\n', address);
        return;
end
fprintf(' $%s %d($%s)\n', regidx2name(rt), immediate, regidx2name(rs));
end

% Converts a register index (as present in an opcode) into a human-readable
% register name
function name = regidx2name(regidx)
names = {'zero', 'at', 'v0', 'v1', 'a0', 'a1', 'a2', 'a3', 't0', 't1', 't2', 't3', ...
    't4', 't5', 't6', 't7', 's0', 's1', 's2', 's3', 's4', 's5', 's6', 's7', ...
    't8', 't9', 'k0', 'k1', 'gp', 'sp', 's8', 'ra'};
name = names{regidx};
end

% Dumps register values
function dumpRegs(regs)
for i = 1:length(regs)
    % Only print registers that have a value
    if regs(i)
        fprintf('$%s = 0x%08x = %d\n', regidx2name(i), regs(i), regs(i));
    end
end
end

% Compute branch target
function target = computeJumpTarget(pc, offset)
target = double(bitand(double(pc), hex2dec('F0000000'))) + (offset*4);
end

% Compute jump target
function target = computeBranchTarget(pc, offset)
target = pc + (offset*4);
end


text:
var mongoose = require('mongoose');

// Define our refuel schema
var StatisticSchema   = new mongoose.Schema({
		price_amount_average: Number,
		fuel_amount_average: Number,
		fuel_consumption_average: Number,
		cost_per_kilometer: Number,
		previous_distance_average: Number,
  		gas_price_average: Number,
});

// Export the Mongoose model
module.exports = mongoose.model('Statistic', StatisticSchema);

redpajama_set_name: RedPajamaGithub


text:
# Copyright (c) 2017 Chocolatey Software, Inc.
# Copyright (c) 2013 - 2017 Lawrence Gripper & original authors/contributors from https://github.com/chocolatey/cChoco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#---------------------------------#
# Header                          #
#---------------------------------#
Write-Host 'Running AppVeyor build script' -ForegroundColor Yellow
Write-Host "ModuleName    : $env:ModuleName"
Write-Host "Build version : $env:APPVEYOR_BUILD_VERSION"
Write-Host "Author        : $env:APPVEYOR_REPO_COMMIT_AUTHOR"
Write-Host "Branch        : $env:APPVEYOR_REPO_BRANCH"
Write-Host "Repo          : $env:APPVEYOR_REPO_NAME"
Write-Host "PSModulePath  :"

$env:PSModulePath -split ';'

#---------------------------------#
# BuildScript                     #
#---------------------------------#
Write-Host 'Nothing to build, skipping.....'


text:
// @flow
import React, { Component } from 'react';
import {
  Animated,
  Dimensions,
  LayoutAnimation,
  ListView,
  Platform,
  StatusBar,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
} from 'react-native';
import moment from 'moment';

import type { ScheduleTalk } from '../../types';

import { TIME_FORMAT } from '../../constants';
import talks, {
  getIndexFromId,
  getNextTalkFromId,
  getPrevTalkFromId,
} from '../../data/talks';
import Navbar from '../../components/Navbar';
import ListTitle from '../../components/ListTitle';
import Scene from '../../components/Scene';

import theme from '../../theme';

import Break from './components/Break';
import NowButton from './components/NowButton';
import Talk, { TalkSeparator } from './components/Talk';
import SplashScreen from './components/SplashScreen';

type Props = {
  navigator: Object,
  talks: Array<ScheduleTalk>,
};

type State = {
  hasScrolled: boolean,
  dataSource: Object,
  scrollY: Animated.Value,
  showNowButton?: boolean,
  activeTalkLayout?: {
    height: number,
    position: number,
  },
};

type VisibleRows = {
  [sectionID: string]: {
    [rowID: string]: true,
  },
};

type ChangedRows = {
  [sectionID: string]: {
    [rowID: string]: true | false,
  },
};

const AnimatedListView = Animated.createAnimatedComponent(ListView);

export default class Schedule extends Component {
  props: Props;
  state: State;
  scrollYListener: string;
  _listview: any;
  _navigatorWillFocusSubscription: Object;

  static defaultProps = {
    talks: talks,
  };

  constructor(props: Props) {
    super(props);

    const dataBlob = {};
    const sectionIDs = [];
    const rowIDs = [];
    let sectionIndex = 0;

    props.talks.forEach(talk => {
      const sID = moment(talk.time.start).format('dddd');

      // create new section and initialize empty array for section index
      if (!dataBlob[sID]) {
        sectionIDs.push(sID);
        rowIDs[sectionIndex] = [];
        sectionIndex++;
        dataBlob[sID] = sID;
      }

      rowIDs[rowIDs.length - 1].push(talk.id);
      dataBlob[sID + ':' + talk.id] = talk;
    });

    let ds = new ListView.DataSource({
      getSectionData: (dataBlob, sectionID) => dataBlob[sectionID],
      getRowData: (dataBlob, sectionID, rowID) =>
        dataBlob[sectionID + ':' + rowID],
      rowHasChanged: (r1, r2) => r1 !== r2,
      sectionHeaderHasChanged: (s1, s2) => s1 !== s2,
    });

    if (Platform.OS === 'ios') {
      setTimeout(
        () => {
          this.setState({
            dataSource: ds.cloneWithRowsAndSections(
              dataBlob,
              sectionIDs,
              rowIDs
            ),
          });
        },
        150
      );
    } else {
      ds = ds.cloneWithRowsAndSections(dataBlob, sectionIDs, rowIDs);
    }

    this.state = {
      dataSource: ds,
      scrollY: new Animated.Value(0),
      hasScrolled: Platform.OS === 'android',
    };

    if (Platform.OS === 'ios') {
      // This isn't relevant on Android.
      this.scrollYListener = this.state.scrollY.addListener(({ value }) => {
        if (!this.state.hasScrolled) {
          this.setState({ hasScrolled: true });
        }

        if (value > 120) {
          StatusBar.setBarStyle('default', true);
          StatusBar.setHidden(false, true);
        } else if (value < 80) {
          StatusBar.setBarStyle('light-content', true);
          StatusBar.setHidden(false, true);
        } else {
          StatusBar.setHidden(true, true);
        }
      });
    }
  }

  componentWillUnmount() {
    this.state.scrollY.removeListener(this.scrollYListener);
  }

  componentDidMount() {
    this._navigatorWillFocusSubscription = this.props.navigator.navigationContext.addListener(
      'willfocus',
      this.handleNavigatorWillFocus
    );
  }

  componentWillUnmount() {
    if (this.scrollYListener)
      this.state.scrollY.removeListener(this.scrollYListener);
    this._navigatorWillFocusSubscription.remove();
  }

  handleNavigatorWillFocus = (event: any) => {
    const { scene } = event.data.route;

    if (scene === 'Schedule' && this.state.scrollY._value < 120) {
      StatusBar.setBarStyle('light-content', true);
    }
  };
  gotoEventInfo = () => {
    StatusBar.setBarStyle('default', true);
    this.props.navigator.push({
      enableSwipeToPop: true,
      scene: 'Info',
    });
  };
  onChangeVisibleRows = (
    visibleRows: VisibleRows,
    changedRows: ChangedRows
  ) => {
    // Now button
    const now = moment();
    const currentTalk = this.props.talks.find(talk => {
      const start = moment(talk.time.start);
      const end = moment(talk.time.end);
      return now.isBetween(start, end);
    });

    // TODO all talks are over. Discuss how to handle
    if (!currentTalk) return;

    const day = moment(currentTalk.time.start).format('dddd');
    const talksForToday = visibleRows[day];

    // Set the now button to visible based on whether the talk is visible or not.
    this.toggleNowButton(!(talksForToday && talksForToday[currentTalk.id]));
  };
  scrolltoActiveTalk = () => {
    const { activeTalkLayout } = this.state;
    if (!activeTalkLayout) return;
    const { contentLength } = this._listview.scrollProperties;
    const sceneHeight = Dimensions.get('window').height;
    const maxScroll = contentLength - (sceneHeight + theme.navbar.height);
    const scrollToY = maxScroll < activeTalkLayout.position
      ? maxScroll
      : activeTalkLayout.position;

    this._listview.scrollTo({ y: scrollToY, animated: true });
  };
  toggleNowButton(showNowButton: boolean) {
    LayoutAnimation.easeInEaseOut();
    this.setState({ showNowButton });
  }
  render() {
    const { navigator, talks } = this.props;
    const { dataSource, scrollY, showNowButton } = this.state;

    const navbarTop = scrollY.interpolate({
      inputRange: [80, 120],
      outputRange: [-theme.navbar.height, 0],
      extrapolate: 'clamp',
    });

    const splashTop = scrollY.interpolate({
      inputRange: [-200, 400],
      outputRange: [200, -400],
      extrapolate: 'clamp',
    });

    const renderFooter = () => (
      <TouchableOpacity
        key="footer"
        onPress={this.gotoEventInfo}
        activeOpacity={0.75}
      >
        <Text style={styles.link}>
          Event Info
        </Text>
      </TouchableOpacity>
    );

    // we need the "active talk" to be rendered to get its scroll position
    // also, there's so few items it's not a perf concern
    const initialListSize = talks.length;

    return (
      <Scene>
        <SplashScreen
          onLogoPress={this.gotoEventInfo}
          style={{ transform: [{ translateY: splashTop }] }}
        />

        <Animated.View
          style={[
            styles.navbar,
            {
              // Small bug with native animations in iOS doesn't set the
              // transform properly on initial render, should be fixed in 0.42
              opacity: this.state.hasScrolled ? 1 : 0,
              transform: [{ translateY: navbarTop }],
            },
          ]}
        >
          <Navbar
            title="Schedule"
            rightButtonText="About"
            rightButtonOnPress={this.gotoEventInfo}
          />
        </Animated.View>

        {/* Spacer for the headings to stick correctly */}
        <View style={styles.spacer} />

        <AnimatedListView
          dataSource={dataSource}
          ref={view => {
            this._listview = view;
          }}
          initialListSize={initialListSize}
          onScroll={Animated.event(
            [{ nativeEvent: { contentOffset: { y: this.state.scrollY } } }],
            { useNativeDriver: true }
          )}
          scrollEventThrottle={1}
          onChangeVisibleRows={this.onChangeVisibleRows}
          enableEmptySections
          removeClippedSubviews={false}
          renderHeader={() => <View key="spacer" style={{ height: 190 }} />}
          renderSeparator={(sectionID, rowID) => {
            const key = sectionID + ':' + rowID;
            const talk = dataSource._dataBlob[key];
            const status = getTalkStatus(talk.time.start, talk.time.end);

            return <TalkSeparator key={key} status={status} />;
          }}
          renderRow={talk => {
            const status = getTalkStatus(talk.time.start, talk.time.end);
            const onLayout = status === 'present'
              ? ({ nativeEvent: { layout } }) => {
                  this.setState({
                    activeTalkLayout: {
                      height: layout.height,
                      position: layout.y - theme.navbar.height / 2,
                    },
                  });
                }
              : null;

            if (talk.break) {
              return (
                <Break
                  endTime={moment(talk.time.end).format(TIME_FORMAT)}
                  lightning={talk.lightning}
                  onLayout={onLayout}
                  startTime={moment(talk.time.start).format(TIME_FORMAT)}
                  status={status}
                  title={talk.title}
                />
              );
            }

            // methods on Talk
            const onPress = () => {
              let talkIdx = getIndexFromId(talk.id);
              StatusBar.setBarStyle('default', true);
              navigator.push({
                enableSwipeToPop: true,
                scene: 'Talk',
                props: {
                  introduceUI: talkIdx && talkIdx < talks.length - 1,
                  nextTalk: getNextTalkFromId(talk.id),
                  prevTalk: getPrevTalkFromId(talk.id),
                  talk,
                },
              });
            };

            return (
              <Talk
                keynote={talk.keynote}
                lightning={talk.lightning}
                onLayout={onLayout}
                onPress={onPress}
                speaker={talk.speaker}
                startTime={moment(talk.time.start).format(TIME_FORMAT)}
                status={status}
                title={talk.title}
              />
            );
          }}
          renderSectionHeader={(sectionData, sectionID) => (
            <ListTitle
              bordered={!!dataSource.sectionIdentities.indexOf(sectionID)}
              text={sectionData}
            />
          )}
          renderFooter={renderFooter}
        />

        {showNowButton && <NowButton onPress={this.scrolltoActiveTalk} />}
      </Scene>
    );
  }
}

const styles = StyleSheet.create({
  navbar: {
    position: 'absolute',
    top: 0,
    right: 0,
    left: 0,
    zIndex: 2,
  },
  spacer: {
    backgroundColor: 'transparent',
    height: theme.navbar.height,
    zIndex: 1,
  },
  link: {
    color: theme.color.blue,
    fontSize: theme.fontSize.default,
    fontWeight: '500',
    paddingVertical: theme.fontSize.large,
    marginBottom: 34 * 2,
    textAlign: 'center',
  },
});

function getTalkStatus(startTime, endTime) {
  const now = moment();

  if (now.isBetween(startTime, endTime)) {
    return 'present';
  } else if (now.isBefore(startTime)) {
    return 'future';
  }

  return 'past';
}


text:
package org.openrdf.repository.object.advisers.helpers;

import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.Collections;
import java.util.Map;
import java.util.Set;

import org.openrdf.annotations.Bind;
import org.openrdf.annotations.Iri;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.LiteralImpl;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.model.vocabulary.OWL;
import org.openrdf.repository.object.ObjectConnection;
import org.openrdf.repository.object.ObjectFactory;
import org.openrdf.repository.object.advisers.helpers.SparqlEvaluator.SparqlBuilder;

/**
 * Stores the binding names, type and default values for a method with @Sparql
 * annotation as read from the parameter annotations.
 */
public class SparqlParameters {
	private final Type[] ptypes;
	private final String[][] bindingNames;
	private final String[] defaults;

	public SparqlParameters(Method m) {
		this.ptypes = m.getGenericParameterTypes();
		this.bindingNames = getBindingNames(m.getParameterAnnotations());
		this.defaults = getDefaultValues(m.getParameterAnnotations());
	}

	public Class<?> getComponentClass(Class<?> cls, Type type) {
		return asClass(getComponentType(cls, type));
	}

	public SparqlBuilder populate(Object[] args, SparqlBuilder with, ObjectConnection con) {
		for (int i = 0; i < args.length && i < bindingNames.length; i++) {
			Object value = args[i];
			Type vtype = ptypes[i];
			Class<?> cvtype = asClass(vtype);
			String defaultValue = defaults[i];
			if (value == null && defaultValue != null && con != null) {
				value = getDefaultValue(defaultValue, vtype, con);
			}
			if (value == null)
				continue;
			if (Set.class.equals(cvtype)) {
				for (String name : bindingNames[i]) {
					with = with.with(name, (Set<?>) value);
				}
			} else {
				for (String name : bindingNames[i]) {
					with = with.with(name, value);
				}
			}
		}
		return with;
	}

	private Object getDefaultValue(String value, Type type, ObjectConnection con) {
		Class<?> ctype = asClass(type);
		if (Set.class.equals(ctype)) {
			Object v = getDefaultValue(value, getComponentType(ctype, type), con);
			if (v == null)
				return null;
			return Collections.singleton(v);
		}
		ValueFactory vf = con.getValueFactory();
		ObjectFactory of = con.getObjectFactory();
		if (of.isDatatype(ctype)) {
			URIImpl datatype = new URIImpl("java:" + ctype.getName());
			return of.createValue(of.createObject(new LiteralImpl(value, datatype)));
		}
		return vf.createURI(value);
	}

	private Type getComponentType(Class<?> cls, Type type) {
		if (cls.isArray())
			return cls.getComponentType();
		if (type instanceof ParameterizedType) {
			ParameterizedType ptype = (ParameterizedType) type;
			Type[] args = ptype.getActualTypeArguments();
			return args[args.length - 1];
		}
		if (Set.class.equals(cls) || Map.class.equals(cls))
			return Object.class;
		return null;
	}

	private Class<?> asClass(Type type) {
		if (type == null)
			return null;
		if (type instanceof Class<?>)
			return (Class<?>) type;
		if (type instanceof GenericArrayType) {
			GenericArrayType atype = (GenericArrayType) type;
			Class<?> componentType = asClass(atype.getGenericComponentType());
			return Array.newInstance(asClass(componentType), 0).getClass();
		}
		if (type instanceof ParameterizedType) {
			return asClass(((ParameterizedType) type).getRawType());
		}
		return Object.class; // wildcard
	}

	private String[][] getBindingNames(Annotation[][] anns) {
		String[][] bindingNames = new String[anns.length][];
		loop: for (int i=0; i<anns.length; i++) {
			bindingNames[i] = new String[0];
			for (Annotation ann : anns[i]) {
				if (Bind.class.equals(ann.annotationType())) {
					bindingNames[i] = ((Bind) ann).value();
					continue loop;
				} else if (Iri.class.equals(ann.annotationType())) {
					bindingNames[i] = new String[] { local(((Iri) ann).value()) };
				}
			}
		}
		return bindingNames;
	}

	private String local(String iri) {
		String string = iri;
		if (string.lastIndexOf('#') >= 0) {
			string = string.substring(string.lastIndexOf('#') + 1);
		}
		if (string.lastIndexOf('?') >= 0) {
			string = string.substring(string.lastIndexOf('?') + 1);
		}
		if (string.lastIndexOf('/') >= 0) {
			string = string.substring(string.lastIndexOf('/') + 1);
		}
		if (string.lastIndexOf(':') >= 0) {
			string = string.substring(string.lastIndexOf(':') + 1);
		}
		return string;
	}

	private String[] getDefaultValues(Annotation[][] anns) {
		String[] defaults = new String[anns.length];
		for (int i=0; i<anns.length; i++) {
			Object value = getDefaultValue(anns[i]);
			if (value != null) {
				defaults[i] = value.toString();
			}
		}
		return defaults;
	}

	private Object getDefaultValue(Annotation[] anns) {
		for (Annotation ann : anns) {
			for (Method m : ann.annotationType().getDeclaredMethods()) {
				Iri iri = m.getAnnotation(Iri.class);
				if (iri != null && OWL.HASVALUE.equals(iri.value()) && m.getParameterTypes().length == 0) {
					return invoke(m, ann);
				}
			}
		}
		return null;
	}

	private Object invoke(Method m, Object obj) {
		try {
			return m.invoke(obj);
		} catch (IllegalArgumentException e) {
			throw new AssertionError(e);
		} catch (IllegalAccessException e) {
			IllegalAccessError error = new IllegalAccessError(e.getMessage());
			error.initCause(e);
			throw error;
		} catch (InvocationTargetException e) {
			try {
				throw e.getCause();
			} catch (RuntimeException cause) {
				throw cause;
			} catch (Error cause) {
				throw cause;
			} catch (Throwable cause) {
				throw new UndeclaredThrowableException(cause);
			}
		}
	}
}


text:
'use strict';

import type { Foo } from 'Foo';

const React = require('React');

const {PropTypes} = React;

class Component extends React.PureComponent {
  render() {
    return <div />;
  }
}

module.exports = Component;


text:
# ifndef __MATCHER_HPP__
# define __MATCHER_HPP__

/*
author: Ivan Yakimov
date: 2015
e-mail: ivan.yakimov.research@yandex.ru
*/

// useful links:
/*
http://en.cppreference.com/w/cpp/language/parameter_pack
http://www.cplusplus.com/reference/type_traits/remove_pointer/
 */

# include "llvm/IR/InstVisitor.h"
# include "llvm/IR/Instruction.h"
#include "llvm/IR/Module.h"
# include "llvm/Support/raw_ostream.h"
# include "llvm/Support/Debug.h"

#include "printer.hpp"

# include <type_traits>
# include <map>
# include <string>
# include <memory>
# include <exception>
# include <ostream>
#include <iostream>

namespace interpreter {
	//TODO: refactoring
	//TODO: handling of unsupporter instructions!

	class Matcher : public llvm::InstVisitor <Matcher>
	{
	public:
		Matcher () {}
		virtual ~Matcher () {}

		// Specific Instruction type classes
		void visitReturnInst(const llvm::ReturnInst &return_inst);
		void visitBranchInst(const llvm::BranchInst &branch_inst);
		void visitSwitchInst(const llvm::SwitchInst &switch_inst);
		// missed instructions
		void visitBinaryOperator(const llvm::BinaryOperator &binary_operator);
		void visitICmpInst (const llvm::ICmpInst &icmp_inst);
		// missed instructions
		void visitAllocaInst (const llvm::AllocaInst &alloca_inst);
		void visitLoadInst (const llvm::LoadInst &load_inst);
		void visitStoreInst (const llvm::StoreInst &store_inst);
		// missed
		void visitGetElementPtrInst (const llvm::GetElementPtrInst &getelementptr_inst);
		void visitPHINode(const llvm::PHINode &phi_node);
		void visitTruncInst (const llvm::TruncInst &trunc_inst);
		void visitZExtInst (const llvm::ZExtInst &zext_inst);
		void visitSExtInst (const llvm::SExtInst &sext_inst);
		// missed
		void visitPtrToIntInst (const llvm::PtrToIntInst &ptrtoint_inst);
		void visitIntToPtrInst (const llvm::IntToPtrInst &inttoptr_inst);
		void visitBitCastInst (const llvm::BitCastInst &bitcast_inst);
		// missed
		void visitSelectInst(const llvm::SelectInst& select_inst);
		// missed
		void visitCallInst(const llvm::CallInst &call_inst);

	protected:
		// Return
		virtual void HandleReturnInst (const llvm::ReturnInst &inst, const llvm::Value *ret_inst) = 0;
		virtual void HandleReturnInst (const llvm::ReturnInst &inst) = 0;

		// Branch
		virtual void HandleBranchInst (const llvm::BranchInst &inst, const llvm::Value *cond, const llvm::BasicBlock *iftrue, const llvm::BasicBlock *iffalse) = 0;
		virtual void HandleBranchInst (const llvm::BranchInst &inst, const llvm::BasicBlock *jump) = 0;

		// Switch
		virtual void HandleSwitchInst (const llvm::SwitchInst& switch_inst) = 0;

		// BinOp
		virtual void HandleBinOp (const llvm::BinaryOperator &inst, const llvm::Value *lhs, const llvm::Value *rhs) = 0;
		// Cmp
		virtual void HandleICmpInst (const llvm::ICmpInst &inst, const llvm::Value *lhs, const llvm::Value *rhs) = 0;

		// Alloca
		virtual void HandleAllocaInst (const llvm::AllocaInst &inst, const llvm::ConstantInt *allocated, const llvm::Type *allocated_type) = 0;

		// Load
		virtual void HandleLoadInst (const llvm::LoadInst &inst, const llvm::Value *ptr) = 0;
		// Store
		virtual void HandleStoreInst (const llvm::StoreInst &inst, const llvm::Value *target, const llvm::Value *ptr) = 0;
		// GetElementPtr
		virtual void HandleGetElementPtr (const llvm::GetElementPtrInst& inst, const llvm::Value *target, const llvm::Value *start_from, const llvm::Value *index) = 0;
		virtual void HandleGetElementPtr (const llvm::GetElementPtrInst& inst, const llvm::Value *target, const llvm::Value *index) = 0;

		// Trunc
		virtual void HandleTruncInst (const llvm::TruncInst &inst, const llvm::Value* target, const llvm::IntegerType* dest_ty) = 0;
		// ZExt
		virtual void HandleZExtInst (const llvm::ZExtInst &inst, const llvm::Value* target, const llvm::IntegerType* dest_ty) = 0;
		// SExt
		virtual void HandleSExtInst (const llvm::SExtInst &inst, const llvm::Value* target, const llvm::IntegerType* dest_ty) = 0;
		// IntToPtr
		virtual void HandlePtrToInt (const llvm::PtrToIntInst &inst, const llvm::Value* target, const llvm::IntegerType* dest_ty) = 0;
		// PtrToInt
		virtual void HandleIntToPtr (const llvm::IntToPtrInst &inst, const llvm::Value* target, const llvm::PointerType* dest_ty) = 0;

		// Phi
		virtual void HandlePHINode(const llvm::PHINode &phi_node) = 0;

		// Select
		virtual void HandleSelectInst(const llvm::SelectInst &select_inst) = 0;

		// Call
		virtual void HandleCallInst(const llvm::CallInst &inst) = 0;
	protected:
		template <class D, class I>
		D* ExtractDestType(const I &inst);

		// "pattern matching"
		template <typename... Targs>
		bool Case (const llvm::Instruction &inst, Targs... Fargs); // inductive casen

		class CaseHelper {
		public:
		// "pattern matching"
		protected:
			static bool Do (const llvm::Instruction &inst, unsigned i); // base case
			template <typename T, typename... Targs>
			static bool Do (const llvm::Instruction &inst, unsigned i, T value, Targs... Fargs); // inductive case
			template <typename... Targs> friend bool Matcher::Case (const llvm::Instruction &inst, Targs... Fargs); // inductive casen
		};

		static inline void DebugInstInfo(const llvm::Instruction &inst);
		static inline void DebugOpList(const llvm::Instruction &inst);
	};
}

# endif /* __INST_PRINTER_HPP__ */


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Falcor.Router.Parser
{
    public class ParsingException: Exception
    {
        public ParsingException(string message) : base(message)
        {
        }
    }
}


text:
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

package org.cef.callback;

import org.cef.misc.CefPrintSettings;

/**
 * Callback interface for asynchronous continuation of print dialog requests.
 */
public interface CefPrintDialogCallback {

    /**
     * Continue printing with the specified |settings|.
     */
    void Continue(CefPrintSettings settings);

    /**
     * Cancel the printing.
     */
    void cancel();
}


text:
"""Square bijector."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import numpy as np

from tensorflow.python.ops import check_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import bijector

__all__ = [
    "Square",
]

class Square(bijector.Bijector):
  """Compute `g(X) = X^2`; X is a positive real number.

  g is a bijection between the non-negative real numbers (R_+) and the
  non-negative real numbers.

  #### Examples

  ```python
  bijector.Square().forward(x=[[1., 0], [2, 1]])
  # Result: [[1., 0], [4, 1]], i.e., x^2

  bijector.Square().inverse(y=[[1., 4], [9, 1]])
  # Result: [[1., 2], [3, 1]], i.e., sqrt(y).
  ```

  """

  def __init__(self, validate_args=False, name="square"):
    """Instantiates the `Square` bijector.

    Args:
      validate_args: Python `bool` indicating whether arguments should be
        checked for correctness.
      name: Python `str` name given to ops managed by this object.
    """
    self._name = name
    super(Square, self).__init__(
        forward_min_event_ndims=0,
        validate_args=validate_args,
        name=name)

  def _forward(self, x):
    x = self._maybe_assert_valid(x)
    return math_ops.square(x)

  def _inverse(self, y):
    y = self._maybe_assert_valid(y)
    return math_ops.sqrt(y)

  def _forward_log_det_jacobian(self, x):
    x = self._maybe_assert_valid(x)
    return np.log(2.) + math_ops.log(x)

  def _maybe_assert_valid(self, t):
    if not self.validate_args:
      return t
    is_valid = check_ops.assert_non_negative(
        t, message="All elements must be non-negative.")
    return control_flow_ops.with_dependencies([is_valid], t)


text:
<?php

/**
 * Description of EmployeeProfileInformationSafeFormProcessor
 *
 * @author ben.dokter
 */

require_once('modules/model/service/employee/profile/EmployeeProfileController.class.php');

class EmployeeProfileInformationSafeFormProcessor
{
    static function processEdit($objResponse, $safeFormHandler)
    {
        $hasError = true;
        $messages = array();

        if (PermissionsService::isEditAllowed(PERMISSION_EMPLOYEE_PROFILE_INFORMATION)) {

            $employeeId                 = $safeFormHandler->retrieveSafeValue('employeeId');
            $isEditAllowedManagerInfo   = $safeFormHandler->retrieveSafeValue('isEditAllowedManagerInfo');

            $educationLevel     = $safeFormHandler->retrieveInputValue('education_level');
            $additionalInfo     = $safeFormHandler->retrieveInputValue('additional_info');
            $managerInfo        = $safeFormHandler->retrieveInputValue('manager_info');

            $valueObject = EmployeeProfileInformationValueObject::createWithValues( $employeeId,
                                                                                $educationLevel,
                                                                                $additionalInfo,
                                                                                $managerInfo);

            list($hasError, $messages) = EmployeeProfileController::processEditInformation($employeeId, $valueObject, $isEditAllowedManagerInfo);
            if (!$hasError) {
                // klaar met edit
                $safeFormHandler->finalizeSafeFormProcess();
                EmployeeProfileInterfaceProcessor::finishEditInformation($objResponse, $employeeId);
            }
        }
        return array($hasError, $messages);
    }
}

?>


text:
TEST(GmockSetup, HookUpTest)
{
	ASSERT_TRUE(true);
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE36_Absolute_Path_Traversal__wchar_t_console_ifstream_53d.cpp
Label Definition File: CWE36_Absolute_Path_Traversal.label.xml
Template File: sources-sink-53d.tmpl.cpp
*/
/*
 * @description
 * CWE: 36 Absolute Path Traversal
 * BadSource: console Read input from the console
 * GoodSource: Full path and file name
 * Sink: ifstream
 *    BadSink : Open the file named in data using ifstream::open()
 * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
 *
 * */

#include "std_testcase.h"

#ifndef _WIN32
#include <wchar.h>
#endif

#include <fstream>
using namespace std;

namespace CWE36_Absolute_Path_Traversal__wchar_t_console_ifstream_53
{

/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */

#ifndef OMITBAD

void badSink_d(wchar_t * data)
{
    {
        ifstream inputFile;
        /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
        inputFile.open((char *)data);
        inputFile.close();
    }
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink_d(wchar_t * data)
{
    {
        ifstream inputFile;
        /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
        inputFile.open((char *)data);
        inputFile.close();
    }
}

#endif /* OMITGOOD */

} /* close namespace */


text:
#include <stdint.h>
#include <string.h>

#include <benchmark/benchmark.h>

#define KB 1024
#define MB 1024 * KB
#define AT_COMMON_SIZES \
    Arg(8)->Arg(64)->Arg(512)->Arg(1 * KB)->Arg(8 * KB)->Arg(16 * KB)->Arg(32 * KB)->Arg(64 * KB)

// TODO: test unaligned operation too? (currently everything will be 8-byte aligned by malloc.)
void BM_string_memcmp(benchmark::State& state)
{
    const auto nbytes = state.range();
    char* src = new char[nbytes];
    char* dst = new char[nbytes];
    memset(src, 'x', nbytes);
    memset(dst, 'x', nbytes);

    for (auto _ : state)
    {
        auto val = memcmp(dst, src, nbytes);
        benchmark::DoNotOptimize(val);
        benchmark::ClobberMemory();
    }

    state.SetBytesProcessed(state.iterations() * nbytes);
    delete[] src;
    delete[] dst;
}

BENCHMARK(BM_string_memcmp)->AT_COMMON_SIZES;

void BM_string_memcpy(benchmark::State& state)
{
    const auto nbytes = state.range();
    char* src = new char[nbytes];
    char* dst = new char[nbytes];
    memset(src, 'x', nbytes);
    memset(dst, 'x', nbytes);

    for (auto _ : state)
    {
        auto val = memcpy(dst, src, nbytes);
        benchmark::DoNotOptimize(val);
        benchmark::ClobberMemory();
    }

    state.SetBytesProcessed(state.iterations() * nbytes);
    delete[] src;
    delete[] dst;
}

BENCHMARK(BM_string_memcpy)->AT_COMMON_SIZES;

void BM_string_memmove(benchmark::State& state)
{
    const auto nbytes = state.range();
    char* buf = new char[nbytes + 64];
    memset(buf, 'x', nbytes + 64);

    for (auto _ : state)
    {
        auto val = memmove(buf, buf + 1, nbytes); // Worst-case overlap.
        benchmark::DoNotOptimize(val);
        benchmark::ClobberMemory();
    }

    state.SetBytesProcessed(state.iterations() * nbytes);
    delete[] buf;
}

BENCHMARK(BM_string_memmove)->AT_COMMON_SIZES;

void BM_string_memset(benchmark::State& state)
{
    const auto nbytes = state.range();
    char* dst = new char[nbytes];

    for (auto _ : state)
    {
        auto ret = memset(dst, 0, nbytes);
        benchmark::DoNotOptimize(ret);
        benchmark::ClobberMemory();
    }

    state.SetBytesProcessed(state.iterations() * nbytes);
    delete[] dst;
}
BENCHMARK(BM_string_memset)->AT_COMMON_SIZES;

void BM_string_strlen(benchmark::State& state)
{
    const auto nbytes = state.range();
    char* s = new char[nbytes];
    memset(s, 'x', nbytes);
    s[nbytes - 1] = 0;

    for (auto _ : state)
    {
        auto len = strlen(s);
        benchmark::DoNotOptimize(len);
    }

    state.SetBytesProcessed(state.iterations() * nbytes);
    delete[] s;
}
BENCHMARK(BM_string_strlen)->AT_COMMON_SIZES;


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>PluginAttribute Constructor (Type)</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            log4net SDK Reference

PluginAttribute Constructor (Type)

 Initializes a new instance of the PluginAttribute class with the specified type.

        [Visual Basic]

Overloads Public Sub New( _
   ByVal type As Type _
)

        [C#]

public PluginAttribute(
   Type type
);

Parameters

          type

The type of plugin to create.

Remarks

 Create the attribute with the plugin type specified.

See Also

PluginAttribute Class | log4net.Config Namespace | PluginAttribute Constructor Overload List

Copyright 2001-2006 The Apache Software Foundation.

Generated from assembly log4net [1.2.10.0]


text:
import { Template } from 'meteor/templating';

Template.proxyItem.events({
  'click #edit-proxy': function (event, instance) {
    // Get proxy document
    const proxy = this.proxy;

    // Show proxy form modal
    Modal.show('proxyForm', { proxy });
  },
  'click #remove-proxy': function (event, instance) {
    // Get proxy document
    const proxy = this.proxy;

    // Show remove proxy modal
    Modal.show('removeProxy', { proxy });
  },
});

Template.proxyItem.helpers({
  equals (a, b) {
    return a === b;
  },
});


text:
'use strict';

var should = require('should'),
	request = require('supertest'),
	app = require('../../server'),
	mongoose = require('mongoose'),
	User = mongoose.model('User'),
	Mycrud = mongoose.model('Mycrud'),
	agent = request.agent(app);

/**
 * Globals
 */
var credentials, user, mycrud;

/**
 * Mycrud routes tests
 */
describe('Mycrud CRUD tests', function() {
	beforeEach(function(done) {
		// Create user credentials
		credentials = {
			username: 'username',
			password: 'password'
		};

		// Create a new user
		user = new User({
			firstName: 'Full',
			lastName: 'Name',
			displayName: 'Full Name',
			email: 'test@test.com',
			username: credentials.username,
			password: credentials.password,
			provider: 'local'
		});

		// Save a user to the test db and create new Mycrud
		user.save(function() {
			mycrud = {
				name: 'Mycrud Name'
			};

			done();
		});
	});

	it('should be able to save Mycrud instance if logged in', function(done) {
		agent.post('/auth/signin')
			.send(credentials)
			.expect(200)
			.end(function(signinErr, signinRes) {
				// Handle signin error
				if (signinErr) done(signinErr);

				// Get the userId
				var userId = user.id;

				// Save a new Mycrud
				agent.post('/mycruds')
					.send(mycrud)
					.expect(200)
					.end(function(mycrudSaveErr, mycrudSaveRes) {
						// Handle Mycrud save error
						if (mycrudSaveErr) done(mycrudSaveErr);

						// Get a list of Mycruds
						agent.get('/mycruds')
							.end(function(mycrudsGetErr, mycrudsGetRes) {
								// Handle Mycrud save error
								if (mycrudsGetErr) done(mycrudsGetErr);

								// Get Mycruds list
								var mycruds = mycrudsGetRes.body;

								// Set assertions
								(mycruds[0].user._id).should.equal(userId);
								(mycruds[0].name).should.match('Mycrud Name');

								// Call the assertion callback
								done();
							});
					});
			});
	});

	it('should not be able to save Mycrud instance if not logged in', function(done) {
		agent.post('/mycruds')
			.send(mycrud)
			.expect(401)
			.end(function(mycrudSaveErr, mycrudSaveRes) {
				// Call the assertion callback
				done(mycrudSaveErr);
			});
	});

	it('should not be able to save Mycrud instance if no name is provided', function(done) {
		// Invalidate name field
		mycrud.name = '';

		agent.post('/auth/signin')
			.send(credentials)
			.expect(200)
			.end(function(signinErr, signinRes) {
				// Handle signin error
				if (signinErr) done(signinErr);

				// Get the userId
				var userId = user.id;

				// Save a new Mycrud
				agent.post('/mycruds')
					.send(mycrud)
					.expect(400)
					.end(function(mycrudSaveErr, mycrudSaveRes) {
						// Set message assertion
						(mycrudSaveRes.body.message).should.match('Please fill Mycrud name');

						// Handle Mycrud save error
						done(mycrudSaveErr);
					});
			});
	});

	it('should be able to update Mycrud instance if signed in', function(done) {
		agent.post('/auth/signin')
			.send(credentials)
			.expect(200)
			.end(function(signinErr, signinRes) {
				// Handle signin error
				if (signinErr) done(signinErr);

				// Get the userId
				var userId = user.id;

				// Save a new Mycrud
				agent.post('/mycruds')
					.send(mycrud)
					.expect(200)
					.end(function(mycrudSaveErr, mycrudSaveRes) {
						// Handle Mycrud save error
						if (mycrudSaveErr) done(mycrudSaveErr);

						// Update Mycrud name
						mycrud.name = 'WHY YOU GOTTA BE SO MEAN?';

						// Update existing Mycrud
						agent.put('/mycruds/' + mycrudSaveRes.body._id)
							.send(mycrud)
							.expect(200)
							.end(function(mycrudUpdateErr, mycrudUpdateRes) {
								// Handle Mycrud update error
								if (mycrudUpdateErr) done(mycrudUpdateErr);

								// Set assertions
								(mycrudUpdateRes.body._id).should.equal(mycrudSaveRes.body._id);
								(mycrudUpdateRes.body.name).should.match('WHY YOU GOTTA BE SO MEAN?');

								// Call the assertion callback
								done();
							});
					});
			});
	});

	it('should be able to get a list of Mycruds if not signed in', function(done) {
		// Create new Mycrud model instance
		var mycrudObj = new Mycrud(mycrud);

		// Save the Mycrud
		mycrudObj.save(function() {
			// Request Mycruds
			request(app).get('/mycruds')
				.end(function(req, res) {
					// Set assertion
					res.body.should.be.an.Array.with.lengthOf(1);

					// Call the assertion callback
					done();
				});

		});
	});

	it('should be able to get a single Mycrud if not signed in', function(done) {
		// Create new Mycrud model instance
		var mycrudObj = new Mycrud(mycrud);

		// Save the Mycrud
		mycrudObj.save(function() {
			request(app).get('/mycruds/' + mycrudObj._id)
				.end(function(req, res) {
					// Set assertion
					res.body.should.be.an.Object.with.property('name', mycrud.name);

					// Call the assertion callback
					done();
				});
		});
	});

	it('should be able to delete Mycrud instance if signed in', function(done) {
		agent.post('/auth/signin')
			.send(credentials)
			.expect(200)
			.end(function(signinErr, signinRes) {
				// Handle signin error
				if (signinErr) done(signinErr);

				// Get the userId
				var userId = user.id;

				// Save a new Mycrud
				agent.post('/mycruds')
					.send(mycrud)
					.expect(200)
					.end(function(mycrudSaveErr, mycrudSaveRes) {
						// Handle Mycrud save error
						if (mycrudSaveErr) done(mycrudSaveErr);

						// Delete existing Mycrud
						agent.delete('/mycruds/' + mycrudSaveRes.body._id)
							.send(mycrud)
							.expect(200)
							.end(function(mycrudDeleteErr, mycrudDeleteRes) {
								// Handle Mycrud error error
								if (mycrudDeleteErr) done(mycrudDeleteErr);

								// Set assertions
								(mycrudDeleteRes.body._id).should.equal(mycrudSaveRes.body._id);

								// Call the assertion callback
								done();
							});
					});
			});
	});

	it('should not be able to delete Mycrud instance if not signed in', function(done) {
		// Set Mycrud user
		mycrud.user = user;

		// Create new Mycrud model instance
		var mycrudObj = new Mycrud(mycrud);

		// Save the Mycrud
		mycrudObj.save(function() {
			// Try deleting Mycrud
			request(app).delete('/mycruds/' + mycrudObj._id)
			.expect(401)
			.end(function(mycrudDeleteErr, mycrudDeleteRes) {
				// Set message assertion
				(mycrudDeleteRes.body.message).should.match('User is not logged in');

				// Handle Mycrud error error
				done(mycrudDeleteErr);
			});

		});
	});

	afterEach(function(done) {
		User.remove().exec();
		Mycrud.remove().exec();
		done();
	});
});


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package src.java.Sistema;

/**
 *
 * @author Gabriel Souza
 */
public abstract class Investimentos {

    protected Double valor;
    protected int tempo;
    protected String tipo;
    protected String mensal = "false";

    public Investimentos() {

    }

    public abstract Resultado previsaoRetorno();

    public abstract void setMensal(String Mensal);

    public abstract void setTipo(String tipo);

    public abstract void setTaxa(Double taxa);

    public abstract void setValor(Double valor);

    public abstract void setTempo(int tempo);

    public abstract Double getValor();

}


text:
##===- docs/Makefile ---------------------------------------*- Makefile -*-===##
#
#                     The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

LEVEL      := ..
DIRS       :=

ifdef BUILD_FOR_WEBSITE
PROJ_OBJ_DIR = .
DOXYGEN = doxygen

$(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
	cat $< | sed \
	  -e 's/@DOT@/dot/g' \
	  -e 's/@PACKAGE_VERSION@/mainline/' \
	  -e 's/@abs_top_builddir@/../g' \
	  -e 's/@abs_top_srcdir@/../g' \
	  -e 's/@enable_external_search@/NO/g' \
	  -e 's/@enable_searchengine@/NO/g' \
	  -e 's/@enable_server_based_search@/NO/g' \
	  -e 's/@extra_search_mappings@//g' \
	  -e 's/@llvm_doxygen_generate_qhp@//g' \
	  -e 's/@llvm_doxygen_qch_filename@//g' \
	  -e 's/@llvm_doxygen_qhelpgenerator_path@//g' \
	  -e 's/@llvm_doxygen_qhp_cust_filter_attrs@//g' \
	  -e 's/@llvm_doxygen_qhp_cust_filter_name@//g' \
	  -e 's/@llvm_doxygen_qhp_namespace@//g' \
	  -e 's/@searchengine_url@//g' \
	  -e 's/@DOT_IMAGE_FORMAT@/png/g' \
	  > $@
endif

include $(LEVEL)/Makefile.common

HTML       := $(wildcard $(PROJ_SRC_DIR)/*.html) \
              $(wildcard $(PROJ_SRC_DIR)/*.css)
DOXYFILES  := doxygen.cfg.in doxygen.intro

.PHONY: install-html install-doxygen doxygen install-ocamldoc ocamldoc generated

install_targets := install-html
ifeq ($(ENABLE_DOXYGEN),1)
install_targets += install-doxygen
endif
ifdef OCAMLFIND
ifneq (,$(filter ocaml,$(BINDINGS_TO_BUILD)))
install_targets += install-ocamldoc
endif
endif
install-local:: $(install_targets)

generated_targets := doxygen
ifdef OCAMLFIND
generated_targets += ocamldoc
endif

# Live documentation is generated for the web site using this target:
# 'make generated BUILD_FOR_WEBSITE=1'
generated:: $(generated_targets)

install-html: $(PROJ_OBJ_DIR)/html.tar.gz
	$(Echo) Installing HTML documentation
	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)

$(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
	$(Echo) Packaging HTML documentation
	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/html.tar
	$(Verb) cd $(PROJ_SRC_DIR) && \
	  $(TAR) cf $(PROJ_OBJ_DIR)/html.tar *.html
	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/html.tar

install-doxygen: doxygen
	$(Echo) Installing doxygen documentation
	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen/html && \
	  for DIR in $$($(FIND) . -type d); do \
	    DESTSUB="$(DESTDIR)$(PROJ_docsdir)/html/doxygen/$$(echo $$DIR | cut -c 3-)"; \
	    $(MKDIR) $$DESTSUB && \
	    $(FIND) $$DIR -maxdepth 1 -type f -exec $(DataInstall) {} $$DESTSUB \; ; \
	    if [ $$? != 0 ]; then exit 1; fi \
	  done

doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz

regendoc:
	$(Echo) Building doxygen documentation
	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/doxygen
	$(Verb) $(DOXYGEN) $(PROJ_OBJ_DIR)/doxygen.cfg

$(PROJ_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(PROJ_OBJ_DIR)/doxygen.cfg
	$(Echo) Packaging doxygen documentation
	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/doxygen.tar
	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/doxygen.tar doxygen
	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/doxygen.tar
	$(Verb) $(CP) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_OBJ_DIR)/doxygen/html/

userloc: $(LLVM_SRC_ROOT)/docs/userloc.html

$(LLVM_SRC_ROOT)/docs/userloc.html:
	$(Echo) Making User LOC Table
	$(Verb) cd $(LLVM_SRC_ROOT) ; ./utils/userloc.pl -details -recurse \
	  -html lib include tools runtime utils examples autoconf test > docs/userloc.html

install-ocamldoc: ocamldoc
	$(Echo) Installing ocamldoc documentation
	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
	  $(FIND) . -type f -exec \
	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;

ocamldoc: regen-ocamldoc
	$(Echo) Packaging ocamldoc documentation
	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/

regen-ocamldoc:
	$(Echo) Building ocamldoc documentation
	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc
	$(Verb) $(MAKE) -C $(LEVEL)/bindings/ocaml ocamldoc
	$(Verb) $(MKDIR) $(PROJ_OBJ_DIR)/ocamldoc/html
	$(Verb) \
		$(OCAMLFIND) ocamldoc -d $(PROJ_OBJ_DIR)/ocamldoc/html -sort -colorize-code -html \
		`$(FIND) $(LEVEL)/bindings/ocaml -name "*.odoc" \
		         -path "*/$(BuildMode)/*.odoc" -exec echo -load '{}' ';'`

uninstall-local::
	$(Echo) Uninstalling Documentation
	$(Verb) $(RM) -rf $(DESTDIR)$(PROJ_docsdir)


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>FileHelpers Library - Marcos Meli</title>
<link href="/favicon.ico" rel="SHORTCUT ICON"/>
<link href="global.css" type="text/css" rel="stylesheet"/>
<link type="text/css" rel="stylesheet" href="SyntaxHighlighter.css"/>
<meta name="Description" content="FileHelpers is an easy to use .NET library to read/write data from fixed length or delimited files or streams. It has support to import/export data from different data sources." />
<meta name="Author" content="Marcos Meli" />
<meta name="keywords" content="filehelpers,CSV,Marcos Meli,C#,free,opensource,Devoo.net,Delimited Files,Import/Export"/>
<meta name="Copyright" content="Copyright 2005-10 to Marcos Meli - www.Devoo.net. All Rights Reserved."/>

{$HEADER$}

Multi Record Engine Example

The idea of this engine is to parse files with different record types
(this engine doesn't use any hierarical structure like the master-details,
all the records are in linear relation for it).

With the MultiRecordEngine you can parse also mixed delimited and fixed
length records. For example, you can parse this strange file:

<textarea name="code" rows="14" cols="109" class="data">10248|VINET|5|04071996|01081996|16071996|3|32.38
10249|TOMSP|6|05071996|16081996|10071996|1|11.61
ALFKI;Alfreds Futterkiste;Maria Anders;Sales Representative;Obere Str. 57;Berlin;Germany
ANATR;Ana Trujillo Emparedados y helados;Ana Trujillo;Owner;Avda. de la Constitución 2222;México D.F.;Mexico
10250|HANAR|4|08071996|05081996|12071996|2|65.83
10111314012345
11101314123456
10251|VICTE|3|08071996|05081996|15071996|1|41.34
11121314901234
10101314234567
ANTON;Antonio Moreno Taquería;Antonio Moreno;Owner;Mataderos  2312;México D.F.;Mexico
BERGS;Berglunds snabbköp;Christina Berglund;Order Administrator;Berguvsvägen  8;Luleå;Sweden

</textarea>

This file contains three record types; Customers (begins with letters, | delimited),
Orders (begin with numbers, ';' delimited) and the sample type of the first example.

To work with this engine you must create one instance of it in this way:

<textarea name="code" rows="23" cols="80" class="c#">/// <summary>
/// The idea of this engine is to parse files with different record types
/// (this engine doesn't use any hierarical structure like the
/// master-details, all the records are in linear relation for it).
/// With the MultiRecordEngine you can parse also mixed delimited and
/// fixed length records.
/// </summary>
public override void Run()
{
    MultiRecordEngine engine;

    engine = new MultiRecordEngine(typeof(Orders),
                                    typeof(Customer),
                                    typeof(SampleType));
    engine.RecordSelector = new RecordTypeSelector(CustomSelector);

    object[] res = engine.ReadFile("Input.txt");

    foreach (object rec in res)
        Console.WriteLine(res.ToString());

}
</textarea>

In the res array you have all the records in the file, each one with the corresponding type.

And the Selector Method looks like this:

<textarea name="code" rows="20" cols="80" class="c#">/// <summary>
/// This is the selector that determines the record type based on
/// whatever criteria you write
/// </summary>
/// <param name="engine">Engine that is processing file</param>
/// <param name="record">Record read from input</param>
/// <returns>Record to accept this record</returns>
Type CustomSelector(MultiRecordEngine engine, string record)
{
    if (record.Length == 0)
        return null;

    if (Char.IsLetter(record[0]))
        return typeof(Customer);
    else if (record.Length == 14)
        return typeof(SampleType);
    else
        return typeof(Orders);
}
</textarea>

 here are the three classes that read the different records

<textarea name="code" rows="24" cols="80" class="c#">/// <summary>
/// Sample class that is delimited by | default
/// </summary>
/// <remarks>
/// Order of fields in the class is the same as the order in the file
/// </remarks>
[DelimitedRecord(";")]
public class Customer
{
    public string CustomerID;
    public string CompanyName;
    public string ContactName;
    public string ContactTitle;
    public string Address;
    public string City;
    public string Country;

    //-> To display in the PropertyGrid.
    public override string ToString()
    {
        return CustomerID + " - " + CompanyName + ", " + ContactName;
    }
}
</textarea>

<textarea name="code" rows="21" cols="80" class="c#">/// <summary>
/// Sample class that is Fixed length and has vrious data
/// </summary>
[FixedLengthRecord]
public class SampleType
{
    [FieldFixedLength(8)]
    [FieldConverter(ConverterKind.Date, "ddMMyyyy")]
    public DateTime Field1;

    [FieldFixedLength(3)]
    [FieldAlign(AlignMode.Left, ' ')]
    [FieldTrim(TrimMode.Both)]
    public string Field2;

    [FieldFixedLength(3)]
    [FieldAlign(AlignMode.Right, '0')]
    [FieldTrim(TrimMode.Both)]
    public int Field3;
}
</textarea>

<textarea name="code" rows="24" cols="80" class="c#">/// <summary>
/// Sample class that is breaks up a vertical bar delimitted file
/// </summary>
[DelimitedRecord("|")]
public class Orders
{
    public int OrderID;

    public string CustomerID;

    public int EmployeeID;

    public DateTime OrderDate;

    public DateTime RequiredDate;

    [FieldNullValue(typeof(DateTime), "2005-1-1")]
    public DateTime ShippedDate;

    public int ShipVia;

    public decimal Freight;
}
</textarea>

Hope you find this useful.

${FOOTER}


text:
package org.apache.apex.malhar.contrib.r;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.rosuda.REngine.REngineException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.apex.malhar.lib.util.BaseNumberValueOperator;

import com.datatorrent.api.Context;
import com.datatorrent.api.DefaultInputPort;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.Operator.Unifier;

import com.datatorrent.netlet.util.DTThrowable;

/**
 * Emits at end of window, a maximum of all values sub-classed from Number in the incoming stream.

 * A vector is created in the process method. This vector is passed to the 'max' operator in R in the 'endWindow'
 * function.

 * StateFull :Yes, max value is computed over application windows.

 * Partitions :Yes, operator is kin unifier operator.

 *

 * Ports:

 * data: expects V extends Number

 * max: emits V extends Number

 *

 *

 *
 * @displayName R Max
 * @category Scripting
 * @tags script, r
 * @since 2.1.0
 */

public class RMax<V extends Number> extends BaseNumberValueOperator<Number> implements Unifier<Number>
{
  private List<Number> numList = new ArrayList<Number>();

  private static Logger log = LoggerFactory.getLogger(RMax.class);
  REngineConnectable connectable;

  public final transient DefaultInputPort<Number> data = new DefaultInputPort<Number>()
  {
    /**
     * Adds the tuple to the numList
     */
    @Override
    public void process(Number tuple)
    {
      RMax.this.process(tuple);
    }
  };

  /**
   * Adds the received tuple to the numList
   */

  @Override
  public void process(Number tuple)
  {
    numList.add(tuple);
  }

  public final transient DefaultOutputPort<Number> max = new DefaultOutputPort<Number>()
  {
    @Override
    public Unifier<Number> getUnifier()
    {
      return RMax.this;
    }
  };

  /*
   * Initialize the R engine
   */
  @Override
  public void setup(Context.OperatorContext context)
  {

    super.setup(context);
    try {
      connectable = new REngineConnectable();
      connectable.connect();
    } catch (IOException ioe) {
      log.error("Exception: ", ioe);
      DTThrowable.rethrow(ioe);
    }

  }

  /*
   * Stop the R engine
   */
  @Override
  public void teardown()
  {

    try {
      connectable.disconnect();
    } catch (IOException ioe) {
      log.error("Exception: ", ioe);
      DTThrowable.rethrow(ioe);
    }

  }

  /**
   * Invokes the 'max' function from R to emit a maximum from the values received in the application window. Clears the
   * numList at the end of the function.
   **/

  @Override
  public void endWindow()
  {
    if (numList.size() == 0) {
      return;
    }

    double[] values = new double[numList.size()];
    for (int i = 0; i < numList.size(); i++) {
      values[i] = numList.get(i).doubleValue();
    }

    try {
      connectable.getRengine().assign("numList", values);

    } catch (REngineException e) {
      log.error("Exception: ", e);
      DTThrowable.rethrow(e);
    }

    double rMax = 0;
    try {
      rMax = connectable.getRengine().parseAndEval("max(numList)").asDouble();
      connectable.getRengine().parseAndEval("rm(list = setdiff(ls(), lsf.str()))");
    } catch (Exception e) {
      log.error("Exception: ", e);
      DTThrowable.rethrow(e);
    }

    log.debug(String.format("Max is : " + rMax));

    max.emit(rMax);
    numList.clear();

  }
}


text:
using System.Collections.Generic;
using System.Linq;
using LeanKit.API.Client.Library.Exceptions;
using Newtonsoft.Json;

namespace LeanKit.API.Client.Library.TransferObjects
{
	[JsonObject(MemberSerialization = MemberSerialization.OptOut)]
	public class Board
	{
		public virtual long Id { get; set; }
		public virtual string Title { get; set; }
		public virtual string Description { get; set; }
		public virtual long Version { get; set; }
		public virtual bool Active { get; set; }
		public virtual long OrganizationId { get; set; }
		public virtual IList<Activity> OrganizationActivities { get; set; }
		public virtual IList<Lane> Lanes { get; set; }
		public virtual IEnumerable<User> BoardUsers { get; set; }
		public virtual IList<Lane> Backlog { get; set; }
		public virtual IList<Lane> Archive { get; set; }
		public virtual IList<ClassOfService> ClassesOfService { get; set; }
		public virtual IList<CardType> CardTypes { get; set; }
		public virtual bool ClassOfServiceEnabled { get; set; }
		public virtual string CardColorField { get; set; }
		public virtual bool IsCardIdEnabled { get; set; }
		public virtual bool IsHeaderEnabled { get; set; }
		public virtual bool IsPrefixEnabled { get; set; }
		public virtual bool IsPrefixIncludedInHyperlink { get; set; }
		public virtual string Prefix { get; set; }
		public virtual bool IsHyperlinkEnabled { get; set; }
		public virtual string Format { get; set; }
		public virtual bool AllowMultiUserAssignments { get; set; }
		public virtual bool BaseWipOnCardSize { get; set; }
		public virtual bool ExcludeFromOrgAnalytics { get; set; }
		public virtual bool ExcludeCompletedAndArchiveViolations { get; set; }
		public virtual IList<long?> TopLevelLaneIds { get; set; }
		public virtual long? BacklogTopLevelLaneId { get; set; }
		public virtual long? ArchiveTopLevelLaneId { get; set; }
		public IList<CardContext> CardContexts { get; set; }
		public IList<ParentCard> ParentCards { get; set; }

		public IEnumerable<Lane> AllLanes()
		{
			return new List<Lane>().Concat(Backlog).Concat(Lanes).Concat(Archive);
		}

		public CardView GetCardViewById(long cardId)
		{
			CardView cardView = Lanes.Where(x => x.Cards != null).SelectMany(l => l.Cards).FirstOrDefault(c => c.Id == cardId);

			if (cardView == null)
			{
				cardView = Backlog.Where(x => x.Cards != null).SelectMany(lane => lane.Cards).FirstOrDefault(c => c.Id == cardId);
			}
			if (cardView == null)
			{
				cardView = Archive.Where(x => x.Cards != null).SelectMany(lane => lane.Cards).FirstOrDefault(c => c.Id == cardId);
			}

			return cardView;
		}

		public Card GetCardById(long cardId)
		{
			CardView cardView = GetCardViewById(cardId);

			return cardView == null ? null : cardView.ToCard();
		}

		public Card GetCardByExternalId(string externalId)
		{
			if (IsPrefixEnabled && externalId.StartsWith(Prefix))
			{
				externalId = externalId.TrimStart(Prefix.ToCharArray());
			}

			CardView cardView = Lanes.SelectMany(lane => lane.Cards).FirstOrDefault(c => c.ExternalCardID == externalId);

			if (cardView == null)
			{
				cardView = Backlog.SelectMany(lane => lane.Cards).FirstOrDefault(c => c.ExternalCardID == externalId);
			}
			if (cardView == null)
			{
				cardView = Archive.SelectMany(lane => lane.Cards).FirstOrDefault(c => c.ExternalCardID == externalId);
			}

			return cardView == null ? null : cardView.ToCard();
		}

		public Lane GetLaneById(long laneId)
		{
			Lane lane = Lanes.FirstOrDefault(x => x.Id == laneId);

			if (lane == null)
			{
				lane = Backlog.FirstOrDefault(x => x.Id == laneId);
			}

			if (lane == null)
			{
				lane = Archive.FirstOrDefault(x => x.Id == laneId);
			}

			return lane;
		}

		public void UpdateLane(Lane laneToUpdateWith)
		{
			//Try getting the lane from the Lanes
			Lane regularLaneToReplace = Lanes.FirstOrDefault(lane => lane.Id == laneToUpdateWith.Id);
			if (regularLaneToReplace != null)
			{
				int laneIndex = Lanes.IndexOf(regularLaneToReplace);
				Lanes.RemoveAt(laneIndex);
				Lanes.Insert(laneIndex, laneToUpdateWith);
				return;
			}

			//If none, try getting from Backlog
			Lane backLogLaneToReplace = Backlog.FirstOrDefault(lane => lane.Id == laneToUpdateWith.Id);
			if (backLogLaneToReplace != null)
			{
				int laneIndex = Backlog.IndexOf(backLogLaneToReplace);
				Backlog.RemoveAt(laneIndex);
				Backlog.Insert(laneIndex, laneToUpdateWith);
				return;
			}

			//Lastly, get it from Archive
			Lane archiveLaneToReplace = Archive.FirstOrDefault(lane => lane.Id == laneToUpdateWith.Id);
			if (archiveLaneToReplace != null)
			{
				int laneIndex = Archive.IndexOf(archiveLaneToReplace);
				Archive.RemoveAt(laneIndex);
				Archive.Insert(laneIndex, laneToUpdateWith);
				return;
			}

			throw new ItemNotFoundException("Could not find the Lane to replace with the updated Lane.");
		}

		public void ApplyCardMove(long cardId, long toLaneId, int position)
		{
			//get the card
			CardView currentCard = GetCardViewById(cardId);

			//remove from the lane it was in
			Lane lane = GetLaneById(currentCard.LaneId);
			int index = lane.Cards.IndexOf(currentCard);

			foreach (CardView cardView in lane.Cards.OrderBy(card => card.Index))
			{
				if (cardView.Index > currentCard.Index)
				{
					cardView.Index--;
				}
			}

			lane.Cards.RemoveAt(index);

			//move the card into the new lane
			bool inserted = false;
			int indexToInsert = 0;
			Lane destinationLane = GetLaneById(toLaneId);
			if (destinationLane.Cards == null) destinationLane.Cards = new List<CardView>();
			foreach (CardView cardView in destinationLane.Cards.OrderBy(card => card.Index))
			{
				if (cardView.Index >= position)
				{
					if (!inserted)
					{
						indexToInsert = destinationLane.Cards.IndexOf(cardView);
						inserted = true;
					}
					else
					{
						cardView.Index++;
					}
				}
			}

			currentCard.Index = position;
			destinationLane.Cards.Insert(indexToInsert, currentCard);
			if (destinationLane.Id != null) currentCard.LaneId = (long) destinationLane.Id;
		}

		public void ApplyCardDelete(long cardId)
		{
			CardView cardToDelete = GetCardViewById(cardId);
			IList<CardView> laneCards = GetLaneById(cardToDelete.Id).Cards;

			for (int i = 0; i < laneCards.Count(); i++)
			{
				CardView currentCard = laneCards[i];
				if (currentCard.Index > cardToDelete.Index)
				{
					currentCard.Index--;
				}
			}

			laneCards.Remove(cardToDelete);
		}

		public string GetLaneTitle(long laneId)
		{
			long parentLaneId = 0;
			Lane parentLane = Lanes.FirstOrDefault(x => x.ChildLaneIds != null && x.ChildLaneIds.Contains(laneId));

			if (parentLane != null)
			{
				parentLaneId = parentLane.Id.GetValueOrDefault(0);
			}
			if (parentLaneId != 0)
			{
				return GetLaneTitle(parentLaneId) + ":" + GetLaneById(laneId).Title;
			}
			return GetLaneById(laneId).Title;
		}
	}
}


text:
<?php
//----------------------------------------------------------------------
// Copyright (c) 2011-2016 Raytheon BBN Technologies
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and/or hardware specification (the "Work") to
// deal in the Work without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Work, and to permit persons to whom the Work
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Work.
//
// THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
// IN THE WORK.
//----------------------------------------------------------------------
require_once("settings.php");
require_once("header.php");

/* Display starts here. */
show_header('GENI Portal: Profile');
include("tool-breadcrumbs.php");
include("tool-showmessage.php");
include ("tool-rspecs.php");
include("footer.php");
?>


text:
import json
import struct
import time
import select

import string
from itertools import product
from hashlib import sha256
import socket

charset = string.digits + string.ascii_uppercase

def generator(charset, n_min, n_max):
    for n in range(n_min, n_max + 1):
        for lst_pw in product(charset, repeat=n):
            yield ''.join(lst_pw)

def serialize_passwords(passwords):
    return json.dumps(passwords)

def deserialize_passwords(js):
    return json.loads(js)

def myselect():

    listener_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    listener_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    listener_socket.bind(("192.168.48.212", 10001))
    listener_socket.listen(10)
    r_list = [listener_socket]

    npass_chunk = 10000
    gen = generator(charset, 4, 7)

    try:
        while True:
            r_ready, w_ready, e_ready = select.select(r_list, [], [])

            for s in r_ready:

                if s == listener_socket:
                    # handle the server socket
                    client_socket, client_address = listener_socket.accept()
                    r_list.append(client_socket)
                else:
                    # handle all other sockets
                    length = s.recv(4)
                    if length:
                        # i need to do [0] and cast int because the struct.unpack return a tupla like (23234234,)
                        # with the length as a string
                        length = int(struct.unpack('!i', length)[0])
                        message = s.recv(length)
                        passwords = []
                        for i in xrange(npass_chunk):
                            password = gen.next()
                            passwords.append(password)

                        chunk = serialize_passwords(passwords)
                        chunk_length = len(chunk)
                        s.send(struct.pack('!i', chunk_length))
                        s.sendall(chunk)
                    else:
                        s.close()
                        r_list.remove(s)

    except KeyboardInterrupt:
        print "stop"

def main():
    myselect()

if __name__ == '__main__':
    main()


text:
({
  initComponent() {
    this.listeners = {
      drop: {
        element: "el",
        fn: "drop"
      },

      dragstart: {
        element: "el",
        fn: "addDropZone"
      },
      dragenter: {
        element: "el",
        fn: "addDropZone"
      },

      dragover: {
        element: "el",
        fn: "addDropZone"
      },

      dragleave: {
        element: "el",
        fn: "removeDropZone"
      },

      dragexit: {
        element: "el",
        fn: "removeDropZone"
      }
    };

    this.callParent();
  },

  noop(e) {
    e.stopEvent();
  },

  addDropZone(e) {
    if (
      !e.browserEvent.dataTransfer ||
      Ext.Array.from(e.browserEvent.dataTransfer.types).indexOf("Files") === -1
    ) {
      return;
    }

    e.stopEvent();
    this.addCls("drag-over");
  },

  removeDropZone(e) {
    let el = e.getTarget();
    const thisEl = this.getEl();

    e.stopEvent();

    if (el === thisEl.dom) {
      this.removeCls("drag-over");
      return;
    }

    while (el !== thisEl.dom && el && el.parentNode) {
      el = el.parentNode;
    }

    if (el !== thisEl.dom) {
      this.removeCls("drag-over");
    }
  },

  uploadFiles(files) {
    const me = this;

    if (files.length != 1 || !files[0].name.toLowerCase().endsWith(".zip"))
      return this.netzkeNotify("Please upload a single .zip file");

    const file = files[0];
    const reader = new FileReader();

    reader.onloadend = function(e) {
      me.server.uploadZip(file.name, e.target.result);
    };
    reader.readAsDataURL(file);
  },

  drop(e) {
    e.stopEvent();
    this.performDrop(Array.from(e.browserEvent.dataTransfer.files));
  },

  performDrop(files) {
    this.uploadFiles(files);
    this.removeCls("drag-over");
  }
});


text:
<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\models\Post;
use app\models\User;
use app\models\Categoria;
use yii\web\View;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
use yii\helpers\Html;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;
use app\models\CommentModel;

AppAsset::register($this);
$this->registerJsFile('@web/js/autocompletar.js', ['depends' => [\yii\web\JqueryAsset::className()], 'position' => View::POS_END]);
if (!Yii::$app->user->isGuest) {
    $this->registerJsFile('@web/js/notificaciones.js', ['depends' => [\yii\web\JqueryAsset::className()], 'position' => View::POS_END]);
    $this->registerJsFile('@web/js/mensajes.js', ['depends' => [\yii\web\JqueryAsset::className()], 'position' => View::POS_END]);

    $user = User::findOne(['id' => Yii::$app->user->id]);

    $conversaciones = $user->getConversaciones();
}
$model = new Post(['scenario' => Post::SCENARIO_UPLOAD]);
$categoriasPost = Categoria::find()->select('nombre')->indexBy('id')->column();

$js = <<<EOT
    var tour = localStorage.getItem('tour');

    if (tour === null) {
        if (location.pathname !== '/') {
            location.pathname = '/';
        } else {
            introJs()
            .setOption('showStepNumbers', false)
            .setOption('nextLabel', 'Siguiente')
            .setOption('prevLabel', 'Anterior')
            .setOption('skipLabel', 'Terminar Tour')
            .setOption('doneLabel', 'Terminar Tour')
            .setOption('overlayOpacity', 0.2)
            .start();
            localStorage.setItem('tour', 1);
        }
    }

    var cookieBanner = localStorage.getItem('cookie-banner');

    if (cookieBanner === null) {
        $('.wrap').append('

');
        $('.banner-cookie').append('
Esta página web usa cookies para asegurarse de que obtienes la mejor experiencia en nuestra aplicación.
');
        $('.banner-cookie').append('<button type="button" class="banner-cookie-btn">Entendido</button>');
    }

    $('.navbar-left a, .categorias-sub a').each(function(index, value) {
        if ($(this).prop("href") === window.location.href) {
            $(this).parent().addClass('active');
        }
    });

    $('.banner-cookie-btn').on('click', function() {
        $('.banner-cookie').fadeOut('fast');
        localStorage.setItem('cookie-banner', 1);
    });
EOT;
$this->registerJs($js);
$categorias = Categoria::find()->all();
CommentModel::deleteAll(['status' => 2]);
$this->title = 'GKRI';
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">

    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
    <link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet">

<?php $this->beginBody() ?>

    <?php
    NavBar::begin([
        'brandLabel' => Html::img('@web/images/logo.png', [
            'alt'=>Yii::$app->name,
            'class' => 'logo',
            'data-intro'=>"¡Bienvenido! Vamos a hacer un pequeño Tour para que no te pierdas ni un detalle.",
            'data-step'=>"1"
        ]),
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-inverse navbar-fixed-top menu-grande',
        ],
    ]);

    ?>

Gracioso

Amor

Series

WTF

            Más

            <?php foreach ($categorias as $i => $categoria) {
                if ($i == 0) { ?>

<a href="/<?= $categoria->nombre_c ?>"><?= $categoria->nombre ?>

                <?php }
                elseif ($i == 5 || $i == 11) { ?>

<a href="/<?= $categoria->nombre_c ?>"><?= $categoria->nombre ?>

                <?php
                } elseif ($i == count($categorias) - 1) { ?>

<a href="/<?= $categoria->nombre_c ?>"><?= $categoria->nombre ?>

                <?php
                } else { ?>

<a href="/<?= $categoria->nombre_c ?>"><?= $categoria->nombre ?>

                <?php }
            } ?>

        <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">

        </button>

            <?php foreach ($categorias as $i => $categoria) : ?>

<a href="/<?= $categoria->nombre_c ?>"><?= $categoria->nombre ?>

            <?php endforeach; ?>

                   <?php ActiveForm::begin(['action' =>  ['/posts/search'], 'method' => 'get', 'options' => ['class' => 'navbar-form navbar-right','role' => 'search']]);?>
                   Buscar
                   <input type="text" id="search" class="form-control" maxlength="100" placeholder="Search" name="q">
                   <?php ActiveForm::end();?>

    <?php if (Yii::$app->user->isGuest) : ?>

<a class="blanco" href="<?= Url::to('/user/security/login') ?>">Login

<a class="blanco" href="<?= Url::to('/user/register') ?>">Registrarse

    <?php else :?>

                        Marcar todas como leídas

Notificaciones

                <?= Html::img(Yii::$app->user->identity->profile->getAvatar() . '?t=' . date('d-m-Y-H:i:s'), ['class' => 'img-rounded little']) ?>

<a href="<?= Url::to('/u/' . Yii::$app->user->identity->username) ?> " tabindex="-1">Mi Perfil

<a href="<?= Url::to('/settings/profile') ?>" tabindex="-1">Configuración

Mensajes

<a href="<?= Url::to('/user/security/logout') ?>" data-method="post" tabindex="-1">Cerrar sesión

<a href="<?= Url::to('/u/' . Yii::$app->user->identity->username) ?> ">

<a href="<?= Url::to('/settings/profile') ?>">

<a href="<?= Url::to('/user/security/logout') ?>" data-method="post">

Enviar

    <?php endif; ?>

 <?php

    NavBar::end();

    ?>

        <?= Breadcrumbs::widget([
            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        ]) ?>
        <?php if (isset($conversaciones)) : ?>
        <?= $this->render('messages', ['conversaciones' => $conversaciones, 'user' => $user]) ?>
        <?php endif; ?>
        <?= $this->render('../posts/create', ['model' => $model, 'categorias' => $categoriasPost]) ?>
        <?= $content ?>

© GKRI <?= date('Y') ?>

<?php $this->endBody() ?>

<?php $this->endPage() ?>


text:
class PaletteFilterFxRenderData;

static const std::string PLUGIN_PREFIX("STD");

#define FX_PLUGIN_DECLARATION(T) \
public:                          \
	const TPersistDeclaration *getDeclaration() const;

#ifdef _WIN32

#ifdef TNZSTDFX_EXPORTS

#define FX_PLUGIN_IDENTIFIER(T, I)                                       \
	template class DV_EXPORT_API TFxDeclarationT<T>;                     \
	namespace                                                            \
	{                                                                    \
	TFxDeclarationT<T> info##T(TFxInfo(PLUGIN_PREFIX + "_" + I, false)); \
	}                                                                    \
	const TPersistDeclaration *T::getDeclaration() const { return &info##T; }
#else
#define FX_PLUGIN_IDENTIFIER(T, I)                                       \
	template class DV_IMPORT_API TFxDeclarationT<T>;                     \
	namespace                                                            \
	{                                                                    \
	TFxDeclarationT<T> info##T(TFxInfo(PLUGIN_PREFIX + "_" + I, false)); \
	}                                                                    \
	const TPersistDeclaration *T::getDeclaration() const { return &info##T; }
#endif
#else
#define FX_PLUGIN_IDENTIFIER(T, I)                                       \
	namespace                                                            \
	{                                                                    \
	TFxDeclarationT<T> info##T(TFxInfo(PLUGIN_PREFIX + "_" + I, false)); \
	}                                                                    \
	const TPersistDeclaration *T::getDeclaration() const { return &info##T; }
#endif

class TStandardRasterFx : public TRasterFx
{
public:
	std::string getPluginId() const { return PLUGIN_PREFIX; }
};

//-------------------------------------------------------------------

class TStandardZeraryFx : public TZeraryFx
{
public:
	std::string getPluginId() const { return PLUGIN_PREFIX; }
};

//-------------------------------------------------------------------

bool isAlmostIsotropic(const TAffine &aff);

#endif


text:
from django.db import migrations, models
import markitup.fields

class Migration(migrations.Migration):

    dependencies = [
        ('cms', '0016_auto_20160608_1535'),
    ]

    operations = [
        migrations.CreateModel(
            name='MarkitUpPluginModel',
            fields=[
                ('cmsplugin_ptr', models.OneToOneField(on_delete=models.deletion.CASCADE, parent_link=True, related_name='cms_utils_markituppluginmodel', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
                ('body', markitup.fields.MarkupField(no_rendered_field=True)),
                ('_body_rendered', models.TextField(editable=False, blank=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('cms.cmsplugin',),
        ),
    ]


text:
Based on [https://github.com/modularcode/modular-admin-html](https://github.com/modularcode/modular-admin-html)

### Usage

- composer require cawakharkov/admin-view
- if using Laravel < 5.5, add ```\CawaKharkov\AdminView\AdminViewServiceProvider::class``` to your **app.php** providers
- publish assets ``` artisan vendor:publish --tag=public ```
- extends from view - ```admin-view::layout```


text:
package com.github.florent37.materialviewpager.worldmovies.fragment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.github.florent37.materialviewpager.worldmovies.R;
import com.github.florent37.materialviewpager.worldmovies.model.TrendsObject;
import com.github.florent37.materialviewpager.worldmovies.framework.ContentWebViewActivity;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;

/**
 * Created by aaron on 2016/6/30.
 */
public class TrendsCastTabFragment extends Fragment {

    private TrendsObject trendsObject;
    private Gson gson = new Gson();

    public static TrendsCastTabFragment newInstance(TrendsObject trendsObject) {
        TrendsCastTabFragment fragment = new TrendsCastTabFragment();
        Bundle args = new Bundle();
        args.putSerializable("trends", trendsObject);
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        trendsObject = (TrendsObject) getArguments().getSerializable("trends");
        RecyclerView rv = (RecyclerView) inflater.inflate(
                R.layout.fragment_recyclerview, container, false);
        setupRecyclerView(rv);
        return rv;
    }

    private void setupRecyclerView(RecyclerView recyclerView) {
        recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
        recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(getActivity(),
                getCastlist()));
//        recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(recyclerView.getContext()).build());
    }

    private ArrayList<TrendsObject.CastItem> getCastlist() {
        ArrayList<TrendsObject.CastItem> castItems = new ArrayList<> ();
        JsonArray castInfo = new JsonParser().parse(trendsObject.getCast()).getAsJsonArray();
        JsonElement jsonElement = null;
        TrendsObject.CastItem castItem = null;
        for(int i=0; i<castInfo.size(); i++ ) {
            jsonElement = castInfo.get(i);
            castItem = gson.fromJson(jsonElement, TrendsObject.CastItem.class);
            castItems.add(castItem);
        }
        return castItems;
    }

    public static class SimpleStringRecyclerViewAdapter
            extends RecyclerView.Adapter<SimpleStringRecyclerViewAdapter.ViewHolder> {

        private final TypedValue mTypedValue = new TypedValue();
        private ArrayList<TrendsObject.CastItem> mItems;
        private int mPlaceholderSize = 0; //default value
        private int mBackground;

        public static class ViewHolder extends RecyclerView.ViewHolder {
            public TrendsObject.CastItem castItem;

            public final View mView;
            public final ImageView mImageView;
            public final TextView mCastView, mAsView;

            public ViewHolder(View view) {
                super(view);
                mView = view;
                mImageView = (ImageView) view.findViewById(R.id.avatar);
                mCastView = (TextView) view.findViewById(R.id.cast);
                mAsView = (TextView) view.findViewById(R.id.as);
            }

            @Override
            public String toString() {
                return super.toString() + " '" + mCastView.getText();
            }
        }

        public TrendsObject.CastItem getValueAt(int position) {
            return mItems.get(position);
        }

        public SimpleStringRecyclerViewAdapter(Context context, ArrayList<TrendsObject.CastItem> items) {
            context.getTheme().resolveAttribute(R.attr.selectableItemBackground, mTypedValue, true);
            mBackground = mTypedValue.resourceId;
            mItems = items;
        }

        @Override
        public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.cast_list_item, parent, false);
            view.setBackgroundResource(mBackground);
            return new ViewHolder(view);
        }

        @Override
        public void onBindViewHolder(final ViewHolder holder, int position) {
            final TrendsObject.CastItem item = mItems.get(position - mPlaceholderSize);
            holder.mCastView.setText(item.getCast());
            holder.mAsView.setText(item.getAs());
            holder.mAsView.setTextIsSelectable(true);

            holder.mImageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Context context = v.getContext();
                    Intent intent = new Intent(context, ContentWebViewActivity.class);
                    intent.putExtra("url", item.getUrl());
                    context.startActivity(intent);
                }
            });

            Picasso.with(holder.mImageView.getContext()).load(item.getAvatar()).placeholder(R.drawable.person_image_empty)
                    .fit()
                    .centerCrop()
                    .into(holder.mImageView);
        }

        @Override
        public int getItemCount() {
            return mItems.size();
        }
    }
}