text:
@interface CPTimerViewController () {
    NSInteger _remainingTimeA;
    NSInteger _remainingTimeB;
    NSTimer *_timer;
    BOOL enabledA;
    BOOL enabledB;
}
@end

@implementation CPTimerViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.timerBtnA.transform = CGAffineTransformMakeRotation( M_PI );
    _timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(substractTime) userInfo:nil repeats:YES];
    [self reset:nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)touchedTimerA:(id)sender {
    if (enabledA) {
        [self.timerBtnA setEnabled:NO];
        [self.timerBtnB setEnabled:YES];
        enabledA = NO;
        enabledB = YES;
        [self.timerBtnA setAlpha:0.33];
        [self.timerBtnB setAlpha:1.0];
    } else {
        [self.timerBtnA setEnabled:YES];
        [self.timerBtnB setEnabled:NO];
        enabledA = YES;
        enabledB = NO;
        [self.timerBtnB setAlpha:0.33];
        [self.timerBtnA setAlpha:1.0];
    }
}

- (IBAction)touchedTimerB:(id)sender {
    if (enabledB) {
        [self.timerBtnB setEnabled:NO];
        [self.timerBtnA setEnabled:YES];
        enabledB = NO;
        enabledA = YES;
        [self.timerBtnB setAlpha:0.33];
        [self.timerBtnA setAlpha:1.0];

    } else {
        [self.timerBtnB setEnabled:YES];
        [self.timerBtnA setEnabled:NO];
        enabledB = YES;
        enabledA = NO;
        [self.timerBtnA setAlpha:0.33];
        [self.timerBtnB setAlpha:1.0];
    }
}

- (void)substractTime {
    if (enabledA) {
        _remainingTimeA--;
        if (_remainingTimeA == 0)
        {
            [self pause:nil];
            [self.timerBtnA setEnabled:NO];
        }
        [self updateTime:A];
    }

    if (enabledB) {
        _remainingTimeB--;
        if (_remainingTimeB == 0)
        {
            [self pause:nil];
            [self.timerBtnB setEnabled:NO];
        }
        [self updateTime:B];
    }
}

- (IBAction)pause:(id)sender {
    enabledA = enabledB = NO;

}

- (IBAction)reset:(id)sender {
    enabledA = enabledB = NO;
    [self.timerBtnA setEnabled:YES];
    [self.timerBtnB setEnabled:YES];
    _remainingTimeA = _remainingTimeB = 6000;
    [self updateTime:A];
    [self updateTime:B];
    [self.timerBtnA setAlpha:1.0];
    [self.timerBtnB setAlpha:1.0];
}

- (void)updateTime: (TimerType)type {
    NSInteger time = type == A ? _remainingTimeA : _remainingTimeB;
    NSInteger minutes = time / 600;
    NSInteger seconds = (time/10) % 60;
    NSInteger milliseconds = time % 10;
    if (type == A)
    {
        [self.timerBtnA setTitle:[NSString stringWithFormat:@"%02d:%02d:%01d",minutes, seconds, milliseconds] forState:UIControlStateNormal];
    }
    else
    {
        [self.timerBtnB setTitle:[NSString stringWithFormat:@"%02d:%02d:%01d",minutes, seconds, milliseconds] forState:UIControlStateNormal];

    }
}

@end


text:
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`
popd > /dev/null

outsvg="$1"
echo "building banner with parameters:"
echo "     BUILD_LABEL: $BUILD_LABEL"
echo "      BUILD_DATE: $BUILD_DATE"
echo "   BUILT_VERSION: $BUILT_VERSION"
echo "     OUTPUT FILE: $outsvg"
envsubst < $SCRIPTPATH/banner-template.svg > $outsvg

redpajama_set_name: RedPajamaGithub


text:
import React from 'react'
import { Map, TileLayer, Marker, Popup } from 'react-leaflet'

export default class MapContainerLublin extends React.Component {
    /// STATE PRESENT LOCATION OF THE CITY (LUBLIN IN THIS EXAMPLE)
    constructor() {
        super();
        this.state = {
            lat: 51.246,
            lng: 22.568,
            zoom: 13,
        };
    }

    render() {
        const position = [this.state.lat, this.state.lng];
        return (
            <Map center={position} zoom={this.state.zoom}>
                <TileLayer
                    attribution='© OpenStreetMap contributors'
                    url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
                />
                <Marker position={position}>
                    <Popup>
                        Lublin
                    </Popup>
                </Marker>
            </Map>
        );
    }
}

///RENDER MAP OF LUBLIN USING <MapContainerLublin /> AND IMPORT COMPONENT


text:
macro_rules! declare_machine {

    // Initialize state by values
    (@inner next $new_state:ident{$($new_el:ident:$new_el_val:expr),*}) => (
        $new_state{$($new_el:$new_el_val),*}
    );

    // if state have no fields to initialize. Just for remove redundant curl braces.
    (@inner next $new_state:ident) => (
        $new_state{}
    );

    // If Event have user-defined code and move machine to new state. Execute code and return new state.
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident;$callback:block;$new_state:ident$({$($new_el:ident:$new_el_val:expr),*})*) => (
        {
            declare_machine!(@inner context $sel $cur);
            $callback;
            $cur.leave($glob_context).unwrap();
            Some(States::$new_state{context: declare_machine!(@inner next $new_state$({$($new_el:$new_el_val),*})*)})
        }
    );

    // If Event have user-defined code and don't move machine to new state. Execute code and return __SameState__ .
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident;$callback:block;) => (
        {
            declare_machine!(@inner context $sel $cur);
            $callback;
            Some(States::__SameState__)
        }
    );

    // If Event have no user-defined code and move machine to new state. Just return new state.
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident; ;$new_state:ident$({$($new_el:ident:$new_el_val:expr),*})*) => (
        {
            declare_machine!(@inner context $sel $cur);
            $cur.leave($glob_context).unwrap();
            Some(States::$new_state{context: declare_machine!(@inner next $new_state$({$($new_el:$new_el_val),*})*)})
        }
    );

    // If Event have nothing to do on event. Just return __SameState__.
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident ; ;) => (
        Some(States::__SameState__)
    );

    // If Event have user-defined code and move machine to new state. Execute code and return new state.
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident;$callback:block;$new_state:ident$({$($new_el:ident:$new_el_val:expr),*})*) => (
        {
            declare_machine!(@inner context $sel $cur);
            $callback;
            $cur.leave($glob_context).unwrap();
            Some(States::$new_state{context: declare_machine!(@inner next $new_state$({$($new_el:$new_el_val),*})*)})
        }
    );

    // If Event have user-defined code and don't move machine to new state. Execute code and return __SameState__ .
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident;$callback:block;) => (
        {
            declare_machine!(@inner context $sel $cur);
            $callback;
            Some(States::__SameState__)
        }
    );

    // If Event have no user-defined code and move machine to new state. Just return new state.
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident; ;$new_state:ident$({$($new_el:ident:$new_el_val:expr),*})*) => (
        {
            declare_machine!(@inner context $sel $cur);
            $cur.leave($glob_context).unwrap();
            Some(States::$new_state{context: declare_machine!(@inner next $new_state$({$($new_el:$new_el_val),*})*)})
        }
    );

    // If Event have nothing to do on event. Just return __SameState__.
    (@inner command @$glob_context:ident@ $sel:ident:$cur:ident ; ;) => (
        Some(States::__SameState__)
    );

    (@inner context $ss:ident $sel:ident)=>(let $sel = $ss;);
    (@inner context $ss:ident )=>();

    // Enter/Leave processors with and without user-defined code.
    (@inner >> $($sel:ident)* @$glob_context:ident@ $income:block) => (
            fn enter(&mut self, $glob_context: &mut MachineContext) -> Result<(), ()> {
                declare_machine!(@inner context self $($sel)*);
                $income
                Ok(())
            }
    );
    (@inner << $($sel:ident)* @$glob_context:ident@ $outcome:block) => (
            fn leave(&mut self, $glob_context: &mut MachineContext) -> Result<(), ()> {
                declare_machine!(@inner context self $($sel)*);
                $outcome
                Ok(())
            }
    );
    (@inner >> $($sel:ident)* @$glob_context:ident@ ) => (
            fn enter(&mut self, $glob_context: &mut MachineContext) -> Result<(), ()> {
                Ok(())
            }
    );
    (@inner << $($sel:ident)* @$glob_context:ident@ ) => (
            fn leave(&mut self, $glob_context: &mut MachineContext) -> Result<(), ()> {
                Ok(())
            }
    );

    // This structs keep user-defined contexts for states.
    (@inner params $state:ident {$($el:ident:$typ:ty);*}) => (
        #[derive(Debug)]
        #[derive(PartialEq)]
        #[derive(Copy)]
        #[derive(Clone)]
        pub struct $state {pub $($el:$typ),*}
    );
    (@inner params $state:ident) => (
        #[derive(Debug)]
        #[derive(PartialEq)]
        #[derive(Copy)]
        #[derive(Clone)]
        pub struct $state {}
    );
    (@inner initial $initial:ident{$($init_field:ident:$init_val:expr),*}) => ($initial{$($init_field: $init_val),*});
    (@inner initial $initial:ident) => ($initial{});

    (@cmd_processor $sel:ident @$glob_context:ident@ ($($cmd:ident $($callback:block)* => $($new_state:ident$({$($new_el:ident:$new_el_val:expr),*})*)*;)*))=>(
        fn do_job(&mut self, cmd: & Commands, $glob_context: &mut MachineContext) -> Option<States> {
            match *cmd {
                $(Commands::$cmd => {declare_machine!(@inner command @$glob_context@ self:$sel;$($callback)*;$($new_state$({$($new_el:$new_el_val),*})*)*)})*
                _ => None
            }
        }
    );

    (@state $gc_name:ident; $($state:ident @ $sel:ident ; $($income:block)*; ($job:tt); $($outcome:block)*@),*) => (
        $(
        impl CanDoJob for $state {
            declare_machine!(@cmd_processor $sel @$gc_name@ $job);
            declare_machine!(@inner >> $sel @$gc_name@ $($income)*);
            declare_machine!(@inner << $sel @$gc_name@ $($outcome)*);
        }
        )*
    );
    (@state ; $($state:ident @ $sel:ident ; $($income:block)*; ($job:tt); $($outcome:block)* @),*) => (
        $(
        impl CanDoJob for $state {
            declare_machine!(@cmd_processor $sel @__@ $job);
            declare_machine!(@inner >> $sel @__@ $($income)*);
            declare_machine!(@inner << $sel @__@ $($outcome)*);
        }
        )*
    );

    (@state $gc_name:ident; $($state:ident@; $($income:block)*; ($job:tt); $($outcome:block)*@),*) => (
        $(
        impl CanDoJob for $state {
            declare_machine!(@cmd_processor ___ @$gc_name@ $job);
            declare_machine!(@inner >> ___ @$gc_name@ $($income)*);
            declare_machine!(@inner << ___ @$gc_name@ $($outcome)*);
        }
        )*
    );
    (@state ; $($state:ident@; $($income:block)*; ($job:tt); $($outcome:block)*@),*) => (
        $(
        impl CanDoJob for $state {
            declare_machine!(@cmd_processor ___ @__@ $job);
            declare_machine!(@inner >> ___ @__@ $($income)*);
            declare_machine!(@inner << ___ @__@ $($outcome)*);
        }
        )*
    );

// Main pattern

(
    $machine:ident $($gc_name:ident{$($context_field:ident:$context_type:ty),*})* ($initial:ident$({$($init_field:ident:$init_val:expr),*})*)
    states[$($states:ident),*]
    commands[$($commands:ident),*]

    $(($state:ident $($sel:ident)*$({$($el:ident:$typ:ty);*})*:
        $(>> $income:block)*
        $(<< $outcome:block)*
        $($cmd:ident $($callback:block)* => $($new_state:ident$({$($new_el:ident:$new_el_val:expr),*})*)*;)*
    ))*
) => (
    #[allow(non_snake_case)]
    #[allow(unused_imports)]
    #[allow(dead_code)]
    #[allow(unused_variables)]
    mod $machine {
        use super::*;
        trait CanDoJob {
            fn do_job(&mut self, cmd: &Commands, global_context: &mut MachineContext) -> Option<States>;
            fn leave(&mut self, &mut MachineContext) -> Result<(), ()>;
            fn enter(&mut self, &mut MachineContext) -> Result<(), ()>;
        }

        $(
        declare_machine!(@inner params $state $({$($el:$typ);*})*);
        )*

        declare_machine!(@state $($gc_name)*;$($state @ $($sel)* ; $($income)*; (($($cmd $($callback)* => $($new_state $({$($new_el:$new_el_val),*})*)*;)*)); $($outcome)*@),*);

        #[derive(Debug)]
        #[derive(PartialEq)]
        #[derive(Copy)]
        #[derive(Clone)]
        pub enum States {
            __SameState__,
            $($states {context: $states}),*
        }

        #[derive(Debug)]
        #[derive(PartialEq)]
        pub enum Commands {
            $($commands),*
        }

        #[derive(Clone)]
        pub struct MachineContext {$($(pub $context_field: $context_type),*)*}

        pub struct Machine {
            state: States,
            context: MachineContext
        }
        pub fn new($($($context_field: $context_type),*)*) -> Machine {
            let mut context = declare_machine!(@inner initial $initial $({$($init_field: $init_val),*})*);
            let mut machine_context = MachineContext{$($($context_field: $context_field),*)*};
            context.enter(&mut machine_context).unwrap();
            Machine{state: States::$initial{context: context}, context: machine_context}
        }

        impl Machine {
            pub fn execute(&mut self, cmd: & Commands) -> Result<(),()>{
                match {
                    match self.state {
                        States::__SameState__ => None,
                        $(States::$state{ ref mut context } => context.do_job(cmd, &mut self.context)),*
                    }
                } {
                    Some(x) => {
                        match x {
                            States::__SameState__ => {},
                            _ => {
                                self.change_state(x)
                            }
                        };Ok(())
                    },
                    None => {println!("Wrong operation {:?} for {:?} state!", cmd, self.state); Err(())}
                }
            }
            fn change_state(&mut self, new_state: States) {
                self.state = new_state;
                match self.state {
                    States::__SameState__ => Ok(()),
                    $(States::$state{ ref mut context } => context.enter(&mut self.context)),*
                }.unwrap();
            }
            pub fn get_current_state(&self) -> States {
                self.state.clone()
            }
            pub fn get_inner_context(&self) -> MachineContext {
                self.context.clone()
            }
        }
    }
)
}

#[cfg(test)]
mod tests {
    fn tes(x:i16) {
        println!("x:{}",x);
    }

    declare_machine!(
    Mach1 (New{x:0})

    states[New,InConfig,Operational]
    commands[Configure, ConfigureDone, Drop]

    ( New context{x: i16}:
        >> {println!("Enter {:?}", context)}
        << {println!("Leave {:?}", context)}
        Configure     {println!("In New with context val: {}", context.x);} =>     InConfig{x:context.x+1, y:0};
        ConfigureDone => New{x:0};
    )
    ( InConfig context{x:i16; y:i16}:
        >> {println!("Enter {:?}", context)}
        << {println!("Leave {:?}", context)}
        ConfigureDone {tes(context.x)}=> Operational;
    )
    ( Operational context:
        >> {println!("Enter {:?}", context)}
        << {println!("Leave {:?}", context)}
        ConfigureDone =>;
        Drop => New{x:0};
    )
    );

    declare_machine!(
    Mach2 (State1)

    states[State1,State2,State3]
    commands[ToState1, ToState2, ToState3]

    ( State1 :
        ToState2 => State2;
    )
    ( State2 :
        ToState3 => State3;
    )
    ( State3 :
        ToState1 => State1;
    )
    );

    #[test]
    fn test1() {
        let mut m = Mach1::new();
        m.execute(&Mach1::Commands::Configure).unwrap();
        m.execute(&Mach1::Commands::ConfigureDone).unwrap();
        m.execute(&Mach1::Commands::Drop).unwrap();
        m.execute(&Mach1::Commands::Configure).unwrap();
        m.execute(&Mach1::Commands::ConfigureDone).unwrap();
        m.execute(&Mach1::Commands::ConfigureDone).unwrap();
        m.execute(&Mach1::Commands::ConfigureDone).unwrap();
    }

    #[test]
    #[should_panic]
    fn test2() {
        let mut m = Mach2::new();
        m.execute(&Mach2::Commands::ToState2).unwrap();
        m.execute(&Mach2::Commands::ToState3).unwrap();
        m.execute(&Mach2::Commands::ToState1).unwrap();
        m.execute(&Mach2::Commands::ToState3).unwrap();
    }

    declare_machine!(
    Mach3 glob_cont{id:i16}(State1{counter:0})

    states[State1,State2,State3]
    commands[ToState1, ToState2, ToState3]

    ( State1 cont{counter:i16}:
        >>{println!("Mach {} enter {:?}", glob_cont.id, cont);}
        <<{cont.counter+=1; println!("Mach {} leave {:?}", glob_cont.id, cont);}
        ToState2 => State2{counter: cont.counter};
    )
    ( State2 cont{counter:i16}:
        >>{println!("Mach {} enter {:?}", glob_cont.id, cont);}
        <<{cont.counter+=1; println!("Mach {} leave {:?}", glob_cont.id, cont);}
        ToState3 => State3{counter: cont.counter};
    )
    ( State3 cont{counter:i16}:
        >>{println!("Mach {} enter {:?}", glob_cont.id, cont);}
        <<{cont.counter+=1; println!("Mach {} leave {:?}", glob_cont.id, cont);}
        ToState1 => State1{counter: cont.counter};
    )
    );

    #[test]
    fn test3() {
        let mut m = Mach3::new(0);
        let mut m1 = Mach3::new(1);
        m1.execute(&Mach3::Commands::ToState2).unwrap();
        m.execute(&Mach3::Commands::ToState2).unwrap();
        m.execute(&Mach3::Commands::ToState3).unwrap();
        m1.execute(&Mach3::Commands::ToState3).unwrap();
    }

    #[derive(Clone)]
    pub struct InnerMachineContext {
        id: i16,
        name: String,
        counter: i16
    }

    declare_machine!(
        Mach4 inner{st: InnerMachineContext} (State1)
        states[State1,State2,State3]
        commands[ToState1, ToState2, ToState3]

        ( State1 :
            << {println!("id={} name={} counter={}", inner.st.id, inner.st.name, inner.st.counter);}
            ToState2 {inner.st.counter+=1;}=> State2;
        )
        ( State2 :
            << {println!("id={} name={} counter={}", inner.st.id, inner.st.name, inner.st.counter);}
            ToState3 {inner.st.counter+=1;}=> State3;
        )
        ( State3 :
            << {println!("id={} name={} counter={}", inner.st.id, inner.st.name, inner.st.counter);}
            ToState1 {inner.st.counter+=1;}=> State1;
        )
    );
    #[test]
    fn test4() {
        let mut m = Mach4::new(InnerMachineContext{id:0, name: String::from("Mach 0"), counter: 0});
        let mut m1 = Mach4::new(InnerMachineContext{id:1, name: String::from("Mach 1"), counter: 0});
        let mut m2 = Mach4::new(InnerMachineContext{id:2, name: String::from("Mach 2"), counter: 0});
        m.execute(&Mach4::Commands::ToState2).unwrap();
        m.execute(&Mach4::Commands::ToState3).unwrap();
        m1.execute(&Mach4::Commands::ToState2).unwrap();
        m.execute(&Mach4::Commands::ToState1).unwrap();
        m1.execute(&Mach4::Commands::ToState3).unwrap();
        m2.execute(&Mach4::Commands::ToState2).unwrap();
        m.execute(&Mach4::Commands::ToState2).unwrap();
        m2.execute(&Mach4::Commands::ToState3).unwrap();
        m1.execute(&Mach4::Commands::ToState1).unwrap();
    }
}


text:
<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@ to vcf" id="bcftools_@EXECUTABLE@_to_vcf" version="@VERSION@">
    <description>Converts other formats to VCF/BCFk</description>
    <macros>
        <token name="@EXECUTABLE@">convert</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements">
        <expand macro="samtools_requirement"/>
    </expand>
    <expand macro="version_command" />
    <command detect_errors="aggressive"><![CDATA[
@PREPARE_ENV@
#set $input_vcf = None
#if $convert.convert_from == 'gvcf':
  #set $input_vcf = 'input.vcf.gz'
  #if $convert.input_file.is_of_type('vcf')
    bgzip -c '$convert.input_file' > $input_vcf &&
    bcftools index $input_vcf &&
  #elif $convert.input_file.is_of_type('vcf_bgzip')
    ln -s '$convert.input_file' $input_vcf
  #elif $convert.input_file.is_of_type('bcf')
    #set $input_vcf = 'input.bcf'
    ln -s '$convert.input_file' $input_vcf &&
    bcftools index $input_vcf &&
  #elif $convert.input_file.is_of_type('bcf_bgzip')
    ln -s '$convert.input_file' $input_vcf &&
  #end if
#end if
#set $section = $convert
@PREPARE_FASTA_REF@

bcftools @EXECUTABLE@

@OUTPUT_TYPE@

#set $section = $convert
#if $convert.convert_from == 'gen_sample':
  --gensample2vcf '$convert.input_file,$convert.input_sample'
#elif $convert.convert_from == 'hap_sample':
  --hapsample2vcf '$convert.input_file,$convert.input_sample'
#elif $convert.convert_from == 'hap_legend_sample':
  --haplegendsample2vcf '$convert.input_file,$convert.input_legend,$convert.input_sample'
#elif $convert.convert_from == 'gvcf':
   @FASTA_REF@
   --gvcf2vcf $input_vcf
#elif $convert.convert_from == 'tsv':
   @FASTA_REF@
   @SAMPLES@
   @COLUMNS@
   --tsv2vcf '$convert.input_file'
#end if
> '$output_file'
]]>
    </command>
    <inputs>
        <conditional name="convert">
            <param name="convert_from" type="select" label="convert from">
                <option value="tsv">tsv - TAB-Separated-Value (e.g. 23andMe)</option>
                <option value="gvcf">gVCF - GATK Variant Call Format</option>
                <option value="gen_sample">gen sample - IMPUTE2 or SHAPEIT</option>
                <option value="hap_sample">haps sample - IMPUTE2 or SHAPEIT</option>
                <option value="hap_legend_sample">haps legend sample - IMPUTE2 or SHAPEIT</option>
            </param>
            <when value="tsv">
                <param name="input_file" type="data" format="tabular" label="Tabular Variant Data"
                       help="Reference sequence and samples are required"/>
                <expand macro="macro_fasta_ref" />
                <expand macro="macro_samples"/>
                <expand macro="macro_columns"/>
            </when>
            <when value="gvcf">
                <param name="input_file" type="data" format="gvcf" label="Genomic VCF (GATK HaplotypeCaller)" />
                <expand macro="macro_fasta_ref" />
            </when>
            <when value="gen_sample">
                <param name="input_file" type="data" format="tabular" label="The .gen file" />
                <param name="input_sample" type="data" format="tabular" label="The .samples file" />
            </when>
            <when value="hap_sample">
                <param name="input_file" type="data" format="tabular" label="The .hap file" />
                <param name="input_sample" type="data" format="tabular" label="The .samples file" />
            </when>
            <when value="hap_legend_sample">
                <param name="input_file" type="data" format="tabular" label="The .hap file" />
                <param name="input_legend" type="data" format="tabular" label="The .legend file" />
                <param name="input_sample" type="data" format="tabular" label="The .samples file" />
            </when>

        </conditional>
        <expand macro="macro_select_output_type" />
    </inputs>
    <outputs>
        <expand macro="macro_vcf_output"/>
    </outputs>
    <tests>
        <test>
            <param name="convert_from"  value="gen_sample" />
            <param name="input_file" ftype="tabular" value="convert.gs.gt.gen" />
            <param name="input_sample" ftype="tabular" value="convert.gs.gt.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tNA00001\tNA00002\tNA00003\tNA00004\tNA00005\tNA00006\tNA00007\tNA00008\tNA00009\tNA00010" />
                    <has_text_matching expression="X\t2698560\t.\tG\tA\t.\t.\t.\tGT:GP" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="hap_sample" />
            <param name="input_file" ftype="tabular" value="convert.hs.gt.hap" />
            <param name="input_sample" ftype="tabular" value="convert.hs.gt.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tNA00001\tNA00002\tNA00003\tNA00004\tNA00005\tNA00006\tNA00007\tNA00008\tNA00009\tNA00010" />
                    <has_text_matching expression="X\t2698769\t.\tAAG\tA\t.\t.\t.\tGT\t1|0\t1|1\t0|1\t1|0\t1|0\t0|0\t0|0\t0|0\t0|0\t0|0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="hap_legend_sample" />
            <param name="input_file" ftype="tabular" value="convert.hls.gt.hap" />
            <param name="input_legend" ftype="tabular" value="convert.hls.gt.legend" />
            <param name="input_sample" ftype="tabular" value="convert.hls.gt.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tNA00001\tNA00002\tNA00003\tNA00004\tNA00005\tNA00006\tNA00007\tNA00008\tNA00009\tNA00010" />
                    <has_text_matching expression="X\t2698769\t.\tAAG\tA\t.\t.\t.\tGT\t1|0\t1|1\t0|1\t1|0\t1|0\t0|0\t0|0\t0|0\t0|0\t0|0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="gvcf" />
            <param name="input_file" ftype="vcf" value="convert.gvcf.vcf" />
            <param name="fasta_ref" ftype="fasta" value="gvcf.fa" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSAMPLE99" />
                    <has_text_matching expression="22\t10\t.\tC\t.\t0\tLowGQX\tEND=20;BLOCKAVG_min30p3a\tGT:GQX:DP:DPF\t0/0:5:2:0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="tsv" />
            <param name="input_file" ftype="tabular" value="convert.23andme" />
            <param name="fasta_ref" ftype="fasta" value="23andme.fa" />
            <param name="samples"  value="SAMPLE1" />
            <param name="columns"  value="ID,CHROM,POS,AA" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSAMPLE1" />
                    <has_text_matching expression="1\t10\trs002\tG\tA\t.\t.\t.\tGT\t1/0" />
                </assert_contents>
            </output>
        </test>
    </tests>

    <help><![CDATA[
=====================================
 bcftools @EXECUTABLE@ plugin
=====================================

Converts other variant formats to vcf.  See man page for file formats details.

@BCFTOOLS_MANPAGE@#@EXECUTABLE@

@BCFTOOLS_WIKI@
]]>
    </help>
    <expand macro="citations" />
</tool>


text:
import sys, argparse, os

from network_flow_throughput import get_peer_data

def find_slow_receivers(log_directory, percentile):
    log_files = [
        x for x in os.listdir(log_directory) if x.find("stats.log") != -1]
    flow_times = []
    for log_file in log_files:
        (peer_flow_data, peer_max_times, peer_total_bytes) = \
            get_peer_data(os.path.join(log_directory, log_file))

        for sender in peer_flow_data:
            for peer in peer_flow_data[sender]:
                for flow in peer_flow_data[sender][peer]:
                    flow_time = peer_flow_data[sender][peer][flow]["sec"]
                    flow_times.append((flow_time, log_file, sender, peer, flow))

    flow_times.sort(key=lambda t: t[0], reverse=True)

    # Display data.
    num_flows = len(flow_times)
    num_flows_to_show = int(num_flows * (percentile / 100.0))
    for (flow_time, log_file, sender, peer, flow) in \
            flow_times[:num_flows_to_show]:
        print "%.2fs - Peer %d - Sender %d Flow %d from %s" % (
            flow_time, peer, sender, flow, log_file)
    return 0

def main():
    parser = argparse.ArgumentParser(
        description="Find slow receivers in an experiment.")
    parser.add_argument("log_directory", help="a directory containing stat "
                        "files to analyze")
    parser.add_argument("-p", "--percentile", type=int, default=100,
                        help="Show only the slowest percentile flow times")

    args = parser.parse_args()

    return find_slow_receivers(**vars(args))

if __name__ == "__main__":
    sys.exit(main())


text:
angular.module("exambazaar").controller("allquestionpapersController",
[ '$scope', '$rootScope', '$cookies', 'ExamService', '$http', '$state', '$mdDialog', '$timeout', 'testService', 'Notification', 'viewService', '$location', 'screenSize', function($scope, $rootScope, $cookies, ExamService, $http, $state, $mdDialog, $timeout, testService, Notification, viewService, $location, screenSize){
    var qpURL = "https://www.exambazaar.com/previous-year-question-papers-for-competitive-exams";
    $scope.canonicalFlip = true;
    $rootScope.canonicalUrl = qpURL;
    $scope.mainOptions = {
        sectionsColor: ['#FFFFFF', '#FFFFFF', ,'#FFFFFF', '#FFFFFF'],
        navigation: false,
        navigationPosition: 'left',
        scrollingSpeed: 700,
    };
    $scope.sideBarButtonClass = function(thisexam){
        var classname = '';
        if($scope.exam._id == thisexam._id){
            classname = 'sideactive';
        }
        return classname;
    };
    $scope.defaultCoverPhoto = 'https://www.exambazaar.com/images/pl1/question_papers.jpg';
    $rootScope.pageImage = $scope.defaultCoverPhoto;
    $rootScope.pageTitle = "Free Official Previous Year Question Papers of 50+ Exams in India";
    $rootScope.pageDescription = 'Attempt, download and analyse last 10 Years Question Papers of IIT JEE , NEET, SSC, BANK, GATE, CAT, IAS, CA, NDA, CLAT and other competitive exams for FREE';
    var keywordString = '';
    //var suffix = [' Question Papers ', ' Question Papers PDF ', ' Question Papers & Answers PDF ' , ' Previous Papers '];

    $scope.$watch('streamExams', function (newValue, oldValue, rootScope) {
        if(newValue){
            var examNames = [];
            $rootScope.streamExams.forEach(function(thisStream, sindex){
                if(thisStream._opSimulated){
                    //examNames.push(thisStream.stream);
                    thisStream.exams.forEach(function(thisExam, eindex){
                        if(thisExam._opSimulated){
                            examNames.push(thisExam.exam_page_name);
                        }
                    });
                }
            });

            var suffix = ['Question Papers'];
            var prefix = "";
            //, 'Previous Papers', "All"

            examNames.forEach(function(thisExam, eindex){
                suffix.forEach(function(thisSuffix, index){
                    var newKeyWord = prefix + " " + thisExam + ' ' +thisSuffix;
                    keywordString = keywordString + newKeyWord + ', ';
                });
            });
            keywordString = keywordString + ",Question Papers with Answer Keys, 10 year question papers, Previous Year Question Papers, Previous Papers, Question Papers with Solutions";
            $rootScope.pageKeywords = keywordString;
            //console.log($rootScope.pageKeywords);

        }

    }, true);

    if($cookies.getObject('sessionuser')){
        $scope.user = $cookies.getObject('sessionuser');
    }else{
        //$scope.signupNeeded = true;
    }
    var viewForm = {
        state: $state.current.name,
        claim: false,
        url: $location.url()
    };
    if($scope.user && $scope.user.userId){
        viewForm.user = $scope.user.userId;
    }
    if($cookies.getObject('ip')){
        var ip = $cookies.getObject('ip');
        viewForm.ip = ip;
    }
    viewService.saveview(viewForm).success(function (data, status, headers) {
        //console.log('View Marked');
    })
    .error(function (data, status, header, config) {
        console.log('View not saved!');
    });

    $scope.userLogin = function(){
        $rootScope.$emit("CallBlogLogin", {});
    };

}]);


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

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.github.ppodgorsek</groupId>
		<artifactId>juncacher</artifactId>
		<version>1.2.1-SNAPSHOT</version>
	</parent>

	<groupId>com.github.ppodgorsek</groupId>
	<artifactId>juncacher-springcachemanager</artifactId>
	<packaging>jar</packaging>

	<name>Spring CacheManager module for JUncacher</name>
	<description>Spring CacheManager module for JUncacher, usually using ehcache.</description>
	<url>https://github.com/ppodgorsek/juncacher</url>

	<licenses>
		<license>
			<name>MIT License</name>
			<url>http://www.opensource.org/licenses/mit-license.php</url>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Paul Podgorsek</name>
			<email>ppodgorsek@users.noreply.github.com</email>
			<organization>GitHub</organization>
			<organizationUrl>https://github.com/ppodgorsek</organizationUrl>
		</developer>
	</developers>

	<scm>
		<connection>scm:git:git@github.com:ppodgorsek/juncacher.git</connection>
		<developerConnection>scm:git:git@github.com:ppodgorsek/juncacher.git</developerConnection>
		<url>git@github.com:ppodgorsek/juncacher.git</url>
	</scm>

	<properties>
		<config.path.prefix>..</config.path.prefix>
	</properties>

	<dependencies>
		<dependency>
			<groupId>com.github.ppodgorsek</groupId>
			<artifactId>juncacher-core</artifactId>
		</dependency>

		<!-- Various Application Context utilities, including EhCache, JavaMail,
			Quartz, and Freemarker integration Define this if you need any of these integrations -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
		</dependency>

		<dependency>
			<groupId>org.easymock</groupId>
			<artifactId>easymock</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
	</dependencies>

</project>


text:
// ***********************************************************************
// <copyright file="ReflectionOptimizer.cs" company="ServiceStack, Inc.">
//     Copyright (c) ServiceStack, Inc. All Rights Reserved.
// </copyright>
// <summary>Fork for YetAnotherForum.NET, Licensed under the Apache License, Version 2.0</summary>
// ***********************************************************************
using System;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.Serialization;

namespace ServiceStack.Text;

/// <summary>
/// Class ReflectionOptimizer.
/// </summary>
public abstract class ReflectionOptimizer
{
    /// <summary>
    /// The instance
    /// </summary>
    public static ReflectionOptimizer Instance =
#if NETFX || NETCORE
            EmitReflectionOptimizer.Provider
#else
            ExpressionReflectionOptimizer.Provider
#endif
        ;

    /// <summary>
    /// Uses the type.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>Type.</returns>
    public abstract Type UseType(Type type);

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>GetMemberDelegate.</returns>
    public abstract GetMemberDelegate CreateGetter(PropertyInfo propertyInfo);
    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>GetMemberDelegate<T>.</returns>
    public abstract GetMemberDelegate<T> CreateGetter<T>(PropertyInfo propertyInfo);
    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>SetMemberDelegate.</returns>
    public abstract SetMemberDelegate CreateSetter(PropertyInfo propertyInfo);
    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>SetMemberDelegate<T>.</returns>
    public abstract SetMemberDelegate<T> CreateSetter<T>(PropertyInfo propertyInfo);

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>GetMemberDelegate.</returns>
    public abstract GetMemberDelegate CreateGetter(FieldInfo fieldInfo);
    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>GetMemberDelegate<T>.</returns>
    public abstract GetMemberDelegate<T> CreateGetter<T>(FieldInfo fieldInfo);
    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberDelegate.</returns>
    public abstract SetMemberDelegate CreateSetter(FieldInfo fieldInfo);
    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberDelegate<T>.</returns>
    public abstract SetMemberDelegate<T> CreateSetter<T>(FieldInfo fieldInfo);

    /// <summary>
    /// Creates the setter reference.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberRefDelegate<T>.</returns>
    public abstract SetMemberRefDelegate<T> CreateSetterRef<T>(FieldInfo fieldInfo);

    /// <summary>
    /// Determines whether the specified assembly is dynamic.
    /// </summary>
    /// <param name="assembly">The assembly.</param>
    /// <returns><c>true</c> if the specified assembly is dynamic; otherwise, <c>false</c>.</returns>
    public abstract bool IsDynamic(Assembly assembly);
    /// <summary>
    /// Creates the constructor.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>EmptyCtorDelegate.</returns>
    public abstract EmptyCtorDelegate CreateConstructor(Type type);
}

/// <summary>
/// Class RuntimeReflectionOptimizer. This class cannot be inherited.
/// Implements the <see cref="ServiceStack.Text.ReflectionOptimizer" />
/// </summary>
/// <seealso cref="ServiceStack.Text.ReflectionOptimizer" />
public sealed class RuntimeReflectionOptimizer : ReflectionOptimizer
{
    /// <summary>
    /// The provider
    /// </summary>
    private static RuntimeReflectionOptimizer provider;
    /// <summary>
    /// Gets the provider.
    /// </summary>
    /// <value>The provider.</value>
    public static RuntimeReflectionOptimizer Provider => provider ??= new RuntimeReflectionOptimizer();
    /// <summary>
    /// Prevents a default instance of the <see cref="RuntimeReflectionOptimizer"/> class from being created.
    /// </summary>
    private RuntimeReflectionOptimizer() { }

    /// <summary>
    /// Uses the type.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>Type.</returns>
    public override Type UseType(Type type) => type;

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>GetMemberDelegate.</returns>
    public override GetMemberDelegate CreateGetter(PropertyInfo propertyInfo)
    {
        var getMethodInfo = propertyInfo.GetGetMethod(true);
        if (getMethodInfo == null) return null;

        return o => propertyInfo.GetGetMethod(true).Invoke(o, TypeConstants.EmptyObjectArray);
    }

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>GetMemberDelegate<T>.</returns>
    public override GetMemberDelegate<T> CreateGetter<T>(PropertyInfo propertyInfo)
    {
        var getMethodInfo = propertyInfo.GetGetMethod(true);
        if (getMethodInfo == null) return null;

        return o => propertyInfo.GetGetMethod(true).Invoke(o, TypeConstants.EmptyObjectArray);
    }

    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>SetMemberDelegate.</returns>
    public override SetMemberDelegate CreateSetter(PropertyInfo propertyInfo)
    {
        var propertySetMethod = propertyInfo.GetSetMethod(true);
        if (propertySetMethod == null) return null;

        return (o, convertedValue) =>
            propertySetMethod.Invoke(o, new[] { convertedValue });
    }

    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>SetMemberDelegate<T>.</returns>
    public override SetMemberDelegate<T> CreateSetter<T>(PropertyInfo propertyInfo)
    {
        var propertySetMethod = propertyInfo.GetSetMethod(true);
        if (propertySetMethod == null) return null;

        return (o, convertedValue) =>
            propertySetMethod.Invoke(o, new[] { convertedValue });
    }

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>GetMemberDelegate.</returns>
    public override GetMemberDelegate CreateGetter(FieldInfo fieldInfo) => fieldInfo.GetValue;
    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>GetMemberDelegate<T>.</returns>
    public override GetMemberDelegate<T> CreateGetter<T>(FieldInfo fieldInfo) => x => fieldInfo.GetValue(x);
    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberDelegate.</returns>
    public override SetMemberDelegate CreateSetter(FieldInfo fieldInfo) => fieldInfo.SetValue;
    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberDelegate<T>.</returns>
    public override SetMemberDelegate<T> CreateSetter<T>(FieldInfo fieldInfo) => (o, x) => fieldInfo.SetValue(o, x);

    /// <summary>
    /// Creates the setter reference.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberRefDelegate<T>.</returns>
    public override SetMemberRefDelegate<T> CreateSetterRef<T>(FieldInfo fieldInfo) =>
        ExpressionReflectionOptimizer.Provider.CreateSetterRef<T>(fieldInfo);

    /// <summary>
    /// Determines whether the specified assembly is dynamic.
    /// </summary>
    /// <param name="assembly">The assembly.</param>
    /// <returns><c>true</c> if the specified assembly is dynamic; otherwise, <c>false</c>.</returns>
    public override bool IsDynamic(Assembly assembly)
    {
        try
        {
            var isDyanmic = string.IsNullOrEmpty(assembly.Location);
            return isDyanmic;
        }
        catch (NotSupportedException)
        {
            //Ignore assembly.Location not supported in a dynamic assembly.
            return true;
        }
    }

    /// <summary>
    /// Creates the constructor.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>EmptyCtorDelegate.</returns>
    public override EmptyCtorDelegate CreateConstructor(Type type)
    {
        var emptyCtor = type.GetConstructor(Type.EmptyTypes);
        if (emptyCtor != null)
            return () => Activator.CreateInstance(type);

        //Anonymous types don't have empty constructors
        return () => FormatterServices.GetUninitializedObject(type);
    }
}

/// <summary>
/// Class ExpressionReflectionOptimizer. This class cannot be inherited.
/// Implements the <see cref="ServiceStack.Text.ReflectionOptimizer" />
/// </summary>
/// <seealso cref="ServiceStack.Text.ReflectionOptimizer" />
public sealed class ExpressionReflectionOptimizer : ReflectionOptimizer
{
    /// <summary>
    /// The provider
    /// </summary>
    private static ExpressionReflectionOptimizer provider;
    /// <summary>
    /// Gets the provider.
    /// </summary>
    /// <value>The provider.</value>
    public static ExpressionReflectionOptimizer Provider => provider ??= new ExpressionReflectionOptimizer();
    /// <summary>
    /// Prevents a default instance of the <see cref="ExpressionReflectionOptimizer"/> class from being created.
    /// </summary>
    private ExpressionReflectionOptimizer() { }

    /// <summary>
    /// Uses the type.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>Type.</returns>
    public override Type UseType(Type type) => type;

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>GetMemberDelegate.</returns>
    public override GetMemberDelegate CreateGetter(PropertyInfo propertyInfo)
    {
        var lambda = GetExpressionLambda(propertyInfo);
        var propertyGetFn = lambda.Compile();
        return propertyGetFn;
    }

    /// <summary>
    /// Gets the expression lambda.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>Expression<GetMemberDelegate>.</returns>
    public static Expression<GetMemberDelegate> GetExpressionLambda(PropertyInfo propertyInfo)
    {
        var getMethodInfo = propertyInfo.GetGetMethod(true);
        if (getMethodInfo == null) return null;

        var oInstanceParam = Expression.Parameter(typeof(object), "oInstanceParam");
        var instanceParam = Expression.Convert(oInstanceParam, propertyInfo.ReflectedType); //propertyInfo.DeclaringType doesn't work on Proxy types

        var exprCallPropertyGetFn = Expression.Call(instanceParam, getMethodInfo);
        var oExprCallPropertyGetFn = Expression.Convert(exprCallPropertyGetFn, typeof(object));

        return Expression.Lambda<GetMemberDelegate>
        (
            oExprCallPropertyGetFn,
            oInstanceParam
        );
    }

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>GetMemberDelegate<T>.</returns>
    public override GetMemberDelegate<T> CreateGetter<T>(PropertyInfo propertyInfo)
    {
        var expr = GetExpressionLambda<T>(propertyInfo);
        return expr.Compile();
    }

    /// <summary>
    /// Gets the expression lambda.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>Expression<GetMemberDelegate<T>>.</returns>
    public static Expression<GetMemberDelegate<T>> GetExpressionLambda<T>(PropertyInfo propertyInfo)
    {
        var instance = Expression.Parameter(typeof(T), "i");
        var property = typeof(T) != propertyInfo.DeclaringType
                           ? Expression.Property(Expression.TypeAs(instance, propertyInfo.DeclaringType), propertyInfo)
                           : Expression.Property(instance, propertyInfo);
        var convertProperty = Expression.TypeAs(property, typeof(object));
        return Expression.Lambda<GetMemberDelegate<T>>(convertProperty, instance);
    }

    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>SetMemberDelegate.</returns>
    public override SetMemberDelegate CreateSetter(PropertyInfo propertyInfo)
    {
        var propertySetMethod = propertyInfo.GetSetMethod(true);
        if (propertySetMethod == null) return null;

        try
        {
            var declaringType = propertyInfo.ReflectedType;

            var instance = Expression.Parameter(typeof(object), "i");
            var argument = Expression.Parameter(typeof(object), "a");

            var instanceParam = declaringType.IsValueType && !declaringType.IsNullableType()
                                    ? Expression.Unbox(instance, declaringType)
                                    : Expression.Convert(instance, declaringType);

            var valueParam = Expression.Convert(argument, propertyInfo.PropertyType);

            var setterCall = Expression.Call(instanceParam, propertySetMethod, valueParam);

            return Expression.Lambda<SetMemberDelegate>(setterCall, instance, argument).Compile();
        }
        catch //fallback for Android
        {
            return (o, convertedValue) =>
                propertySetMethod.Invoke(o, new[] { convertedValue });
        }
    }

    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>SetMemberDelegate<T>.</returns>
    public override SetMemberDelegate<T> CreateSetter<T>(PropertyInfo propertyInfo)
    {
        try
        {
            var lambda = SetExpressionLambda<T>(propertyInfo);
            return lambda?.Compile();
        }
        catch //fallback for Android
        {
            var mi = propertyInfo.GetSetMethod(true);
            return (o, convertedValue) =>
                mi.Invoke(o, new[] { convertedValue });
        }
    }

    /// <summary>
    /// Sets the expression lambda.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="propertyInfo">The property information.</param>
    /// <returns>Expression<SetMemberDelegate<T>>.</returns>
    public static Expression<SetMemberDelegate<T>> SetExpressionLambda<T>(PropertyInfo propertyInfo)
    {
        var mi = propertyInfo.GetSetMethod(true);
        if (mi == null) return null;

        var instance = Expression.Parameter(typeof(T), "i");
        var argument = Expression.Parameter(typeof(object), "a");

        var instanceType = typeof(T) != propertyInfo.DeclaringType
                               ? (Expression)Expression.TypeAs(instance, propertyInfo.DeclaringType)
                               : instance;

        var setterCall = Expression.Call(
            instanceType,
            mi,
            Expression.Convert(argument, propertyInfo.PropertyType));

        return Expression.Lambda<SetMemberDelegate<T>>
        (
            setterCall, instance, argument
        );
    }

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>GetMemberDelegate.</returns>
    public override GetMemberDelegate CreateGetter(FieldInfo fieldInfo)
    {
        var fieldDeclaringType = fieldInfo.DeclaringType;

        var oInstanceParam = Expression.Parameter(typeof(object), "source");
        var instanceParam = GetCastOrConvertExpression(oInstanceParam, fieldDeclaringType);

        var exprCallFieldGetFn = Expression.Field(instanceParam, fieldInfo);
        var oExprCallFieldGetFn = Expression.Convert(exprCallFieldGetFn, typeof(object));

        var fieldGetterFn = Expression.Lambda<GetMemberDelegate>
            (
                oExprCallFieldGetFn,
                oInstanceParam
            )
            .Compile();

        return fieldGetterFn;
    }

    /// <summary>
    /// Gets the cast or convert expression.
    /// </summary>
    /// <param name="expression">The expression.</param>
    /// <param name="targetType">Type of the target.</param>
    /// <returns>Expression.</returns>
    private static Expression GetCastOrConvertExpression(Expression expression, Type targetType)
    {
        Expression result;
        var expressionType = expression.Type;

        if (targetType.IsAssignableFrom(expressionType))
        {
            result = expression;
        }
        else
        {
            // Check if we can use the as operator for casting or if we must use the convert method
            if (targetType.IsValueType && !targetType.IsNullableType())
            {
                result = Expression.Convert(expression, targetType);
            }
            else
            {
                result = Expression.TypeAs(expression, targetType);
            }
        }

        return result;
    }

    /// <summary>
    /// Creates the getter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>GetMemberDelegate<T>.</returns>
    public override GetMemberDelegate<T> CreateGetter<T>(FieldInfo fieldInfo)
    {
        var instance = Expression.Parameter(typeof(T), "i");
        var field = typeof(T) != fieldInfo.DeclaringType
                        ? Expression.Field(Expression.TypeAs(instance, fieldInfo.DeclaringType), fieldInfo)
                        : Expression.Field(instance, fieldInfo);
        var convertField = Expression.TypeAs(field, typeof(object));
        return Expression.Lambda<GetMemberDelegate<T>>(convertField, instance).Compile();
    }

    /// <summary>
    /// The set field method
    /// </summary>
    private static readonly MethodInfo setFieldMethod = typeof(ExpressionReflectionOptimizer).GetStaticMethod(nameof(SetField));
    /// <summary>
    /// Sets the field.
    /// </summary>
    /// <typeparam name="TValue">The type of the t value.</typeparam>
    /// <param name="field">The field.</param>
    /// <param name="newValue">The new value.</param>
    internal static void SetField<TValue>(ref TValue field, TValue newValue) => field = newValue;

    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberDelegate.</returns>
    public override SetMemberDelegate CreateSetter(FieldInfo fieldInfo)
    {
        var declaringType = fieldInfo.DeclaringType;

        var sourceParameter = Expression.Parameter(typeof(object), "source");
        var valueParameter = Expression.Parameter(typeof(object), "value");

        var sourceExpression = declaringType.IsValueType && !declaringType.IsNullableType()
                                   ? Expression.Unbox(sourceParameter, declaringType)
                                   : GetCastOrConvertExpression(sourceParameter, declaringType);

        var fieldExpression = Expression.Field(sourceExpression, fieldInfo);

        var valueExpression = GetCastOrConvertExpression(valueParameter, fieldExpression.Type);

        var genericSetFieldMethodInfo = setFieldMethod.MakeGenericMethod(fieldExpression.Type);

        var setFieldMethodCallExpression = Expression.Call(
            null, genericSetFieldMethodInfo, fieldExpression, valueExpression);

        var setterFn = Expression.Lambda<SetMemberDelegate>(
            setFieldMethodCallExpression, sourceParameter, valueParameter).Compile();

        return setterFn;
    }

    /// <summary>
    /// Creates the setter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberDelegate<T>.</returns>
    public override SetMemberDelegate<T> CreateSetter<T>(FieldInfo fieldInfo)
    {
        var instance = Expression.Parameter(typeof(T), "i");
        var argument = Expression.Parameter(typeof(object), "a");

        var field = typeof(T) != fieldInfo.DeclaringType
                        ? Expression.Field(Expression.TypeAs(instance, fieldInfo.DeclaringType), fieldInfo)
                        : Expression.Field(instance, fieldInfo);

        var setterCall = Expression.Assign(
            field,
            Expression.Convert(argument, fieldInfo.FieldType));

        return Expression.Lambda<SetMemberDelegate<T>>
        (
            setterCall, instance, argument
        ).Compile();
    }

    /// <summary>
    /// Creates the setter reference.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="fieldInfo">The field information.</param>
    /// <returns>SetMemberRefDelegate<T>.</returns>
    public override SetMemberRefDelegate<T> CreateSetterRef<T>(FieldInfo fieldInfo)
    {
        var instance = Expression.Parameter(typeof(T).MakeByRefType(), "i");
        var argument = Expression.Parameter(typeof(object), "a");

        var field = typeof(T) != fieldInfo.DeclaringType
                        ? Expression.Field(Expression.TypeAs(instance, fieldInfo.DeclaringType), fieldInfo)
                        : Expression.Field(instance, fieldInfo);

        var setterCall = Expression.Assign(
            field,
            Expression.Convert(argument, fieldInfo.FieldType));

        return Expression.Lambda<SetMemberRefDelegate<T>>
        (
            setterCall, instance, argument
        ).Compile();
    }

    /// <summary>
    /// Determines whether the specified assembly is dynamic.
    /// </summary>
    /// <param name="assembly">The assembly.</param>
    /// <returns><c>true</c> if the specified assembly is dynamic; otherwise, <c>false</c>.</returns>
    public override bool IsDynamic(Assembly assembly) => RuntimeReflectionOptimizer.Provider.IsDynamic(assembly);

    /// <summary>
    /// Creates the constructor.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>EmptyCtorDelegate.</returns>
    public override EmptyCtorDelegate CreateConstructor(Type type) => RuntimeReflectionOptimizer.Provider.CreateConstructor(type);
}


text:
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: sign() and verify() Using HMAC</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#SubtleCrypto-method-sign">
<link rel="help" href="https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#SubtleCrypto-method-verify">

sign and verify Tests for HMAC


text:
/*
 * Grafeas API
 * An API to insert and retrieve annotations on cloud artifacts.
 *
 * OpenAPI spec version: v1alpha1
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package io.grafeas.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.grafeas.model.HashHashType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

/**
 * Container message for hash values.
 */
@ApiModel(description = "Container message for hash values.")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-06-04T13:20:14.121-07:00")
public class ApiHash {
  @SerializedName("type")
  private HashHashType type = null;

  @SerializedName("value")
  private byte[] value = null;

  public ApiHash type(HashHashType type) {
    this.type = type;
    return this;
  }

   /**
   * The type of hash that was performed.
   * @return type
  **/
  @ApiModelProperty(value = "The type of hash that was performed.")
  public HashHashType getType() {
    return type;
  }

  public void setType(HashHashType type) {
    this.type = type;
  }

  public ApiHash value(byte[] value) {
    this.value = value;
    return this;
  }

   /**
   * The hash value.
   * @return value
  **/
  @ApiModelProperty(value = "The hash value.")
  public byte[] getValue() {
    return value;
  }

  public void setValue(byte[] value) {
    this.value = value;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ApiHash apiHash = (ApiHash) o;
    return Objects.equals(this.type, apiHash.type) &&
        Arrays.equals(this.value, apiHash.value);
  }

  @Override
  public int hashCode() {
    return Objects.hash(type, Arrays.hashCode(value));
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ApiHash {\n");

    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    value: ").append(toIndentedString(value)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}


text:
package com.extjs;

import com.algocrafts.locators.Locators;
import com.algocrafts.pages.Page;
import com.algocrafts.selectors.Id;
import com.algocrafts.selenium.Element;
import com.algocrafts.selenium.Locator;

import static com.algocrafts.converters.ElementFunctions.CLICK;
import static com.algocrafts.locators.Locators.element;

public enum CalendarClicker implements Locator<Page, Void> {
    NEXT_MONTH(
            Locators.<Page>element(Id.EXTJS_CALENDAR)
                    .andThen(element(Id.EXTJS_CALENDAR_NEXT_MONTH))
    ),
    PREVIOUS_MONTH(
            Locators.<Page>element(Id.EXTJS_CALENDAR)
                    .andThen(element(Id.EXTJS_CALENDAR_PREV_MONTH))
    );

    private final Locator<Page, Element> locator;

    CalendarClicker(Locator<Page, Element> locator) {
        this.locator = locator;
    }

    @Override
    public Void locate(Page page) {
        return locator.andThen(CLICK).locate(page);
    }
}


text:
var fs = require('fs')
  , Path = require('path')

function readTemplates(dir, ready, output) {
  output = output || []

  fs.readdir(dir, function(err, data) {
    if(err) return ready(err)

    var readyCount = data.length

    data.forEach(function(datum, idx) {
      var path = Path.join(dir, datum)

      fs.stat(path, function(err, stat) {
        if(stat.isDirectory()) return readTemplates(path, collect, output)

        fs.readFile(path, 'utf8', function(err, data) {
          output.push([path.split('/').slice(2).join('/'), data])
          collect()
        })
      })
    })

    function collect() {
      !--readyCount && ready(null, output)
    }
  })
}

readTemplates('pecan.js/templates', function(e, items) {
  items = items.reduce(function(l, r) { l[r[0]] = r[1]; return l }, {})
  process.stdout.write(JSON.stringify(items))
})


text:
package com.ibeaconstart.ibsrestclient.helper;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by rgiurea on 20/07/15.
 */
public class DateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
    private final static String DATE_FORMAT = "yyyy-MMM-dd HH:mm:ss";
    DateFormat df = new SimpleDateFormat(DATE_FORMAT);

    @Override
    public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
        String dateAsString = df.format(src);
        return new JsonPrimitive(dateAsString);
    }

    @Override
    public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        if (!(json instanceof JsonPrimitive)) {
            throw new JsonParseException("The date should be a string value");
        }

        try {
            return df.parse(json.getAsString());
        } catch (ParseException e) {
            throw new JsonParseException(e);
        }
    }

}


text:
package org.kaaproject.kaa.sandbox.web.client.mvp.event.project;

import org.kaaproject.kaa.examples.common.projects.Project;

import com.google.gwt.event.shared.GwtEvent;

public class ProjectActionEvent extends GwtEvent<ProjectActionEventHandler>{

  private static Type<ProjectActionEventHandler> TYPE;

  private final Project project;
  private final ProjectAction action;

  public ProjectActionEvent(Project project, ProjectAction action) {
    this.project = project;
    this.action = action;
  }

  public Project getProject() {
      return project;
  }

  public ProjectAction getAction() {
      return action;
  }

  public static Type<ProjectActionEventHandler> getType() {
      if (TYPE == null) {
          TYPE = new Type<ProjectActionEventHandler>();
      }
    return TYPE;
  }

  @Override
  public Type<ProjectActionEventHandler> getAssociatedType() {
      return TYPE;
  }

  @Override
  protected void dispatch(ProjectActionEventHandler handler) {
    handler.onProjectAction(this);
  }
}


text:
\haddockmoduleheading{Simple}
\label{module:Simple}
\haddockbeginheader
{\haddockverb\begin{verbatim}
module Simple (
    foo
  ) where\end{verbatim}}
\haddockendheader

\begin{haddockdesc}
\item[\begin{tabular}{@{}l}
foo :: t
\end{tabular}]
{\haddockbegindoc
This is foo.\par}
\end{haddockdesc}


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

namespace GildedRose.Contracts.Entities
{
    public class Item
    {
        public string Name { get; set; }
        public int SellIn { get; set; }
        public int Quality { get; set; }
    }
}


text:
 - [cmake](https://cmake.org/)
 - [WebAssembly](http://webassembly.org/)
 - [Emscripten SDK](https://kripken.github.io/emscripten-site/docs/tools_reference/emsdk.html)
 - [SDL2](https://www.libsdl.org/)
## Install dependencies
The project skeleton was generated based on [this](http://www.willusher.io/sdl2%20tutorials/2014/03/06/lesson-0-cmake) tutorial
 - install cmake
 - install [emsdk](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html), in Archlinux `yaourt -S aur/emsdk`
 - compile sdk-incoming-64bit `emsdk install --build=Release sdk-incoming-64bit binaryen-master-64bit`
 - activate sdk-incoming-64bit `emsdk activate --build=Release sdk-incoming-64bit binaryen-master-64bit`
 - Install [sdl2](https://www.libsdl.org/download-2.0.php), in Archlinux `pacman -S sdl2`
## Build and run
 - `mkdir build && cd build`
 - `cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../`
 - `emconfigure cmake .`
 - `emmake make`


text:
require 'spec_helper'

describe Gitlab::Diff::ParallelDiff, lib: true do
  include RepoHelpers

  let(:project) { create(:project) }
  let(:repository) { project.repository }
  let(:commit) { project.commit(sample_commit.id) }
  let(:diffs) { commit.raw_diffs }
  let(:diff) { diffs.first }
  let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs: commit.diff_refs, repository: repository) }
  subject { described_class.new(diff_file) }

  describe '#parallelize' do
    it 'should return an array of arrays containing the parsed diff' do
      diff_lines = diff_file.highlighted_diff_lines
      expected = [
        # Unchanged lines
        { left: diff_lines[0], right: diff_lines[0] },
        { left: diff_lines[1], right: diff_lines[1] },
        { left: diff_lines[2], right: diff_lines[2] },
        { left: diff_lines[3], right: diff_lines[3] },
        { left: diff_lines[4], right: diff_lines[5] },
        { left: diff_lines[6], right: diff_lines[6] },
        { left: diff_lines[7], right: diff_lines[7] },
        { left: diff_lines[8], right: diff_lines[8] },

        # Changed lines
        { left: diff_lines[9], right: diff_lines[11] },
        { left: diff_lines[10], right: diff_lines[12] },

        # Added lines
        { left: nil, right: diff_lines[13] },
        { left: nil, right: diff_lines[14] },
        { left: nil, right: diff_lines[15] },
        { left: nil, right: diff_lines[16] },
        { left: nil, right: diff_lines[17] },
        { left: nil, right: diff_lines[18] },

        # Unchanged lines
        { left: diff_lines[19], right: diff_lines[19] },
        { left: diff_lines[20], right: diff_lines[20] },
        { left: diff_lines[21], right: diff_lines[21] },
        { left: diff_lines[22], right: diff_lines[22] },
        { left: diff_lines[23], right: diff_lines[23] },
        { left: diff_lines[24], right: diff_lines[24] },
        { left: diff_lines[25], right: diff_lines[25] },

        # Added line
        { left: nil, right: diff_lines[26] },

        # Unchanged lines
        { left: diff_lines[27], right: diff_lines[27] },
        { left: diff_lines[28], right: diff_lines[28] },
        { left: diff_lines[29], right: diff_lines[29] }
      ]

      expect(subject.parallelize).to eq(expected)
    end
  end
end


text:
package coffee4dev.finalyz.dao;

import java.util.List;

import coffee4dev.finalyz.model.Expense;

public interface ExpenseDAO {

	void saveExpense(Expense expense);

	List<Expense> findAllExpenses();

	void updateExpense(Expense expense);

}


text:
<?php

namespace Tests\Services;
use Silex\Application;
use Silex\Provider\DoctrineServiceProvider;
use App\Services\ItemsService;

class ItemsServiceTest extends \PHPUnit_Framework_TestCase
{

    private $itemService;

    public function setUp()
    {
        $app = new Application();
        $app->register(new DoctrineServiceProvider(), array(
            "db.options" => array(
                "driver" => "pdo_sqlite",
                "memory" => true
            ),
        ));
        $this->itemService = new ItemsService($app["db"]);

        $statement = $app["db"]->prepare("CREATE TABLE items (
                                     id INTEGER PRIMARY KEY AUTOINCREMENT,
                                     name VARCHAR NOT NULL,
                                     description VARCHAR NOT NULL,
                                     price INTEGER NOT NULL
                                    )"
        );

        $statement->execute();
    }

    public function testGetAll()
    {
        $data = $this->itemService->getAll();
        $this->assertNotNull($data);
    }

    public function testSave()
    {
        $item = array(
            "name"          => "adidas",
            "description"   => "sports shoes",
            "price"         => 20
        );
        $data = $this->itemService->save($item);
        $data = $this->itemService->getAll();
        $this->assertEquals(1, count($data));
    }

    public function testUpdateName()
    {
        $this->mockDataSave();

        $item = array(
            "name"          => "boo",
            "description"   => "shoes",
            "price"         => 20
        );

        $this->itemService->update(1, $item);

        $data = $this->itemService->getAll();
        $this->assertEquals("boo", $data[0]["name"]);

    }

    public function testUpdateDescription()
    {
        $this->mockDataSave();

        $item = array(
            "name"          => "adidas",
            "description"   => "shoes",
            "price"         => 20
        );

        $this->itemService->update(1, $item);

        $data = $this->itemService->getAll();
        $this->assertEquals("shoes", $data[0]["description"]);

    }

    public function testUpdatePrice()
    {
        $this->mockDataSave();

        $item = array(
            "name"          => "adidas",
            "description"   => "shoes",
            "price"         => 30
        );

        $this->itemService->update(1, $item);

        $data = $this->itemService->getAll();
        $this->assertEquals(30, $data[0]["price"]);

    }

    public function testDelete()
    {
        $this->mockDataSave();

        $this->itemService->delete(1);
        $data = $this->itemService->getAll();

        $this->assertEquals(0, count($data));
    }

    private function mockDataSave()
    {
        $item = array("name" => "adidas", "description" => "sports shoes", "price" => 20);

        return $this->itemService->save($item);
    }

}


text:
. "test/testlib.sh"
reponame="submodule-test-repo"
submodname="submodule-test-submodule"

begin_test "submodule local git dir"
(
  set -e

  setup_remote_repo "$reponame"
  setup_remote_repo "$submodname"

  clone_repo "$submodname" submod
  mkdir dir
  echo "sub module" > dir/README
  git add dir/README
  git commit -a -m "submodule readme"
  git push origin master

  clone_repo "$reponame" repo
  git submodule add "$GITSERVER/$submodname" sub
  git submodule update
  git add .gitmodules sub
  git commit -m "add submodule"
  git push origin master

  grep "sub module" sub/dir/README || {
    cat sub/dir/README
    exit 1
  }
)
end_test

begin_test "submodule env"
(
  set -e

  # using the local clone from the above test
  cd repo

  git lfs env | tee env.log
  grep "Endpoint=$GITSERVER/$reponame.git/info/lfs (auth=none)$" env.log
  grep "LocalWorkingDir=$TRASHDIR/repo$" env.log
  grep "LocalGitDir=$TRASHDIR/repo/.git$" env.log
  grep "LocalGitStorageDir=$TRASHDIR/repo/.git$" env.log
  grep "LocalMediaDir=$TRASHDIR/repo/.git/lfs/objects$" env.log
  grep "TempDir=$TRASHDIR/repo/.git/lfs/tmp$" env.log

  cd .git

  echo "./.git"
  git lfs env | tee env.log
  grep "Endpoint=$GITSERVER/$reponame.git/info/lfs (auth=none)$" env.log
  grep "LocalWorkingDir=$" env.log
  grep "LocalGitDir=$TRASHDIR/repo/.git$" env.log
  grep "LocalGitStorageDir=$TRASHDIR/repo/.git$" env.log
  grep "LocalMediaDir=$TRASHDIR/repo/.git/lfs/objects$" env.log
  grep "TempDir=$TRASHDIR/repo/.git/lfs/tmp$" env.log

  cd ../sub

  echo "./sub"
  git lfs env | tee env.log
  grep "Endpoint=$GITSERVER/$submodname.git/info/lfs (auth=none)$" env.log
  grep "LocalWorkingDir=$TRASHDIR/repo/sub$" env.log
  grep "LocalGitDir=$TRASHDIR/repo/.git/modules/sub$" env.log
  grep "LocalGitStorageDir=$TRASHDIR/repo/.git/modules/sub$" env.log
  grep "LocalMediaDir=$TRASHDIR/repo/.git/modules/sub/lfs/objects$" env.log
  grep "TempDir=$TRASHDIR/repo/.git/modules/sub/lfs/tmp$" env.log

  cd dir

  echo "./sub/dir"
  git lfs env | tee env.log
  grep "Endpoint=$GITSERVER/$submodname.git/info/lfs (auth=none)$" env.log
  grep "LocalWorkingDir=$TRASHDIR/repo/sub$" env.log
  grep "LocalGitDir=$TRASHDIR/repo/.git/modules/sub$" env.log
  grep "LocalGitStorageDir=$TRASHDIR/repo/.git/modules/sub$" env.log
  grep "LocalMediaDir=$TRASHDIR/repo/.git/modules/sub/lfs/objects$" env.log
  grep "TempDir=$TRASHDIR/repo/.git/modules/sub/lfs/tmp$" env.log
)
end_test


text:
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

// Original author: Steven A. O'Hara, Aug 16, 2012

public class GenIndexHtml {
	private int checkedFiles = 0;
	private int updatedFiles = 0;

	private static final String JPGS = "/utilities";
	private final SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");

	public static void main(String[] args) {
		if (args.length < 1) {
			System.err.println("Usage: Dir");
			System.exit(1);
		}

		try {
			GenIndexHtml gen = new GenIndexHtml();
			String top = args[0];
			String justName = top;
			int pos = top.lastIndexOf("\\");
			if (pos >= 0) justName = top.substring(pos + 1);
			int pdfPages = gen.doDir(" ", top, justName);
			System.out.println("Files checked: " + commas(gen.checkedFiles));
			System.out.println("      updated: " + commas(gen.updatedFiles));
			System.out.println("    PDF pages: " + commas(pdfPages));
			System.exit(0);
		} catch (Exception ex) {
			System.err.println("GetIndexHtml failed: " + ex.getMessage());
			ex.printStackTrace();
			System.exit(1);
		}
	}

	// Return # PDF pages in a directory (including sub-directories)
	private int doDir(String indent, String dirName, String shortDirName) throws IOException
	{
		int pages = 0;
		String outName = dirName + "\\index.html";

		checkedFiles++;

		// If the file exists, read it all into one String
		StringBuffer oldFileContents = new StringBuffer("");
		File oldf = new File(outName);
		if (oldf.exists())
		{
			// See if all files and directories are *older* than index.html
			// If yes, skip this folder
			// long oldDate = oldf.lastModified();

			BufferedReader br = new BufferedReader(new FileReader(outName));
			String rec;
			while ((rec = br.readLine()) != null)
			{
				oldFileContents.append(rec).append("\r\n");
			}
			br.close();
		}

		// Create the new file, in memory only for now
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		PrintWriter pw = new PrintWriter(stream);
		pw.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
        pw.println("");
		pw.println("");
		pw.println("  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>");
		pw.println("  <link rel=\"stylesheet\" type=\"text/css\" href=\"/Dox/dox.css\"/>");
		pw.println("  <title>Directory " + shortDirName + "</title>");
		pw.println("");
		pw.println("");
		pw.println("");
		pw.println("
Directory " + shortDirName + "
");
		pw.println();

		File dir = new File(dirName);
		int seq = 0;
		boolean showedHeader = false;
		for (File f : dir.listFiles())
		{
			if (f.isDirectory())
			{
				if (f.getName().equals(".git")) continue;

				if (!showedHeader)
				{
					showedHeader = true;
					if (indent.length() < 2)
					{
						Date now = new Date();
						System.out.println(df.format(now) + indent + shortDirName);
					}
				}
				pages += dirSub(indent, pw, f.getCanonicalPath(), f.getName());
			}
		}
		// Did directories, now do files
		for (File f : dir.listFiles())
		{
			if (f.isFile())
			{
				pages += fileSub(pw, f.getCanonicalPath(), f.getName(), ++seq);
			}
		}

		pw.println("");
		if (pages > 0) pw.println("
Total PDF page count = " + commas(pages) + "
");
		// pw.println("
Last Updated: " + (new Date()).toString() + "
"); 	// This messes up the 'diff' below
		pw.println("");
		pw.println("");
		pw.close();

		if (indent.length() < 5)
		{
			Date now = new Date();
			System.out.print(df.format(now) + indent + shortDirName);
			if (pages > 0) System.out.print(" (pdf pages = " + commas(pages) + ")");
			System.out.println();
		}

		String newFileContents = new String(stream.toByteArray());
		if (! oldFileContents.toString().equals(newFileContents))
		{
			updatedFiles++;

			// Have to write to the actual file
			FileWriter fw = new FileWriter(outName);
			fw.write(newFileContents);
			fw.close();

			if (oldFileContents.length() == 0)
			{
				System.out.println("             Created " + outName);
			}
			else
			{
				System.out.println("             Updated " + outName);
			}
		}

		return pages;
	}

	private int dirSub(String indent, PrintWriter pw, String fullName, String shortName) throws IOException
	{
		// Skip thumbnail folders
		if (shortName.equals("thumbs")) return 0;

		// Skip .git folders
		if (shortName.equals(".git")) return 0;

		// Recurse
		int pages = doDir(indent + ". ", fullName, shortName);

		pw.println("

");
		pw.print("
" + shortName);
		if (pages > 0) pw.print("
(pdf pages=" + commas(pages) + ")");
		pw.println();
		pw.println("

");
		pw.println();

		return pages;
	}

	private int fileSub(PrintWriter pw, String fullName, String name, int seq) throws IOException
	{
		if (name.equals("index.html")) return 0;
		if (name.equals(".htaccess")) return 0;
		if (name.endsWith("~")) return 0;

		int pages = 0;

		pw.println("

");
		if (name.endsWith(".jpg") || name.endsWith(".JPG")
				 || name.endsWith(".png") || name.endsWith(".PNG")
				 || name.endsWith(".gif") || name.endsWith(".GIF"))
		{
			int nc = name.length();
			String noSuffix = name.substring(0, nc - 4);
			String suffix = name.substring(nc - 4);
			pw.println("    ");
			pw.print("    ");
		}
		else if (name.endsWith(".jpeg") || name.endsWith(".JPEG") || name.endsWith(".tiff"))
		{
			int nc = name.length();
			String noSuffix = name.substring(0, nc - 5);
			String suffix = name.substring(nc - 5);
			pw.println("    ");
			pw.print("    ");
		}
		else if (name.endsWith(".pdf"))
		{
			int nc = name.length();
			String noSuffix = name.substring(0, nc - 4);
			pw.println("    ");
			pw.print("    ");
			pages = count_pdf_pages(fullName);
		}
		else if (name.endsWith(".xls") || name.endsWith(".xlsx"))
		{
			pw.print("    ");
		}
		else if (name.endsWith(".doc") || name.endsWith(".docx"))
		{
			pw.print("    ");
		}
		else
		{
			pw.print("    ");
		}

		pw.print("
" + name);
		if (pages > 0) pw.print("
pages=" + commas(pages) + "");
		pw.println();
		pw.println("

");
		pw.println();
		return pages;
	}

	private int count_pdf_pages(String fileName) throws IOException
	{
		int pages = 0;
		BufferedReader br = new BufferedReader(new FileReader(fileName));
		String rec;
		while ((rec = br.readLine()) != null)
		{
			int type = rec.indexOf("Type");
			if (type >= 0)
			{
				int page = rec.indexOf("Page", type);
				if (page > 0)
				{
					if (page + 4 >= rec.length() || rec.charAt(page + 4) != 's')
					{
						pages++;
					}
				}
			}
		}
		br.close();
		return pages;
	}

	private static String commas (int num)
	{
		return String.format("%,d", num);
	}
}


text:
var exec = require('child_process').exec;
var AWS = require ('aws-sdk');
var async = require ('async');
var EC2;
var config = require('./config');

/* IMPLEMENTS THE AWS VERSIONS OF:
 getInstanceId ()
 getInstanceData ()
 isCloud ()

 WARNING CALL INIT FIRST OR THE OTHER FUNCTIONS WILL ALL RETURN NULL
 */

function createCloudInterface() {

    var instance_id;
    var instance_user_data = {};
    var configData = config.data;

    return {
        // this must be called first to init everything
        init: function (cb){
            instance_id = "None";
            instance_user_data = {};
            if (configData && configData.accessKeyId && configData.secretAccessKey && configData.region) {
                var error;
                try {
                    AWS && AWS.config.loadFromPath(config.path + '/.app-config.json');
                }
                catch (err) {
                    error = err;
                    console.log(err);
                }
                finally {
                    if (!error) {
                        EC2 = AWS && new AWS.EC2();
                    }
                }
            }
            if (configData.remote == 'n'){
                cb && cb();
            }
            else {
                var child = exec('wget -q -O - http://169.254.169.254/latest/meta-data/instance-id', function (err, std, ster) {
                    // get our instance id
                    if (!err) {
                        instance_id = std;
                    }
                    // if this is an AWS instance go get the instance user data
                    if (instance_id !== "None") {
                        var child2 = exec('wget -q -O - http://169.254.169.254/latest/user-data', function (err, std, ster) {
                            // get our instance user data
                            if (!err && std) {
                                try {
                                    instance_user_data = JSON.parse(std);
                                }
                                catch (err) {
                                    instance_user_data = std;
                                }
                            }
                            cb && cb();
                        });
                    }
                    else {
                        cb && cb();
                    }
                });
            }
        },
        // get the instance id for this instance
        getInstanceId: function() {
            return instance_id;
        },
        // get the instance data for this instance
        setInstanceData: function(data) {
            instance_user_data = data;
        },
        // get the instance data for this instance
        getInstanceData: function() {
            return instance_user_data;
        },
        // is this instance on the cloud
        isCloud: function (){
            return (instance_id && instance_id !== "None");
        },
        // get all the instances associated with this AWS account and with the same data type set in user data
        getInstances: function (cb){
            var instances = [];
            var instance_map = {};
            if (EC2){
                EC2.describeInstances(function(error, data) {
                    if (error) { cb && cb (error);}
                    else {
                        async.eachSeries (data.Reservations, function (reservation, done){
                            async.eachSeries (reservation.Instances, function (instance, _done){
                                if (instance.PublicDnsName){
                                    EC2.describeInstanceAttribute ({Attribute: "userData", InstanceId:instance.InstanceId}, function (err, data){
                                        if (!err && data.UserData && data.UserData.Value){
                                            var user_data = new Buffer(data.UserData.Value, 'base64').toString ();
                                            if (user_data) {
                                                try{user_data = JSON.parse (user_data);}
                                                catch (err){}
                                            }
                                            if (user_data.type && instance_user_data.type && user_data.type === instance_user_data.type){
                                                var id = instance.InstanceId;
                                                if (!instance_map[id]){
                                                    instances.push ({id:id, dns:instance.PublicDnsName,
                                                        user_data:user_data});
                                                    instance_map[id] = true;
                                                }
                                            }
                                            else if (instance_user_data.type && !user_data.type && instance_user_data.type === user_data){
                                                var id = instance.InstanceId;
                                                if (!instance_map[id]){
                                                    instances.push ({id:id, dns:instance.PublicDnsName,
                                                        user_data:user_data});
                                                    instance_map[id] = true;
                                                }
                                            }
                                        }
                                        _done ();
                                    });
                                } else {
                                    _done ();
                                }
                            }, function (){
                                done ();
                            });
                        }, function (err){
                            cb && cb (err, instances);
                        });
                    }
                });
            }
            else { cb && cb ("AWS is not configured correctly"); }
        }
    };
};

var cloud = createCloudInterface ();
for (var func in cloud){
    exports[func] = cloud[func];
}


text:
___

WDI Woodstock: Javascript

jQuery

---

- **jQuery**'s motto is *write less, do more*
- jQuery was originally written by John Rezig
- It is now maintained by a strong community
- There is even a yearly jQuery conference in Toronto
- http://jquery.com

#3.1 - jQuery Recap

1. Define what a library vs framework is
  - **Library** is set of methods to be utilized
  - **framework** is a combination of multiple libraries and tools.
  - Various libraries include:
    - jQuery: http://jquery.com
    - Zepto: http://zeptojs.com/
    - Prototype: http://prototypejs.org/
    - Modernizr: http://modernizr.com/
2. List primary components of jQuery
  - DOM traversal
  - Event Handling
  - Ajax interactions
  - Event Handling
3. How to include jQuery into an app
  - Include using CDN or local file
  - See the **Installing jQuery with NPM** section below
  - CDNS:
    - http://cdnjs.com
    - http://googleapis.com
4. Select existing DOM nodes
  - See **Selector Examples** section below.
5. Build and append custom DOM nodes
  * `.append()`
  * `.appendTo()`
  * `.text()`
  * `.prepend()`
  * `.prependTo()`
6. Trigger and listen to events
```javascript
$(selector).click(function() {
  // your code
});
```
  - https://api.jquery.com/category/events/

##Using jQuery in your html head element

- In your index.html file, add: `<script type='text/javascript' src='scripts/jquery.js'></script>`

##jQuery Selector Examples!

    Example
    ... in jQuery

    Elements
    `$("element")`, `$("#id")` or `$(".class")`

    Descendants
    `$("#id descendant")`

    Children
    `$(".class > child")`

    Multiple
    `$("#id1, #id2, #id3")`

    Pseudo-selectors
    `$("li :first")`

## Resources & Further Reading

- [jQuery Selector Reference](https://api.jquery.com/category/selectors/)
- [jQuery Cheat Sheet Reference](http://overapi.com/jquery/)
- [jQuery Succinctly](http://weeklymirror.com.np/files/download/jQuery_Succinctly.pdf)
- [jQuery Basics](http://jqfundamentals.com/chapter/jquery-basics)
- [Try jQuery (Interactive)](http://try.jquery.com/)


text:
'use strict';

const models = require('./index');

/**
 * The details of the snoozed or dismissed rule; for example, the duration,
 * name, and GUID associated with the rule.
 *
 * @extends models['Resource']
 */
class SuppressionContract extends models['Resource'] {
  /**
   * Create a SuppressionContract.
   * @member {string} [suppressionId] The GUID of the suppression.
   * @member {string} [ttl] The duration for which the suppression is valid.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of SuppressionContract
   *
   * @returns {object} metadata of SuppressionContract
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'SuppressionContract',
      type: {
        name: 'Composite',
        className: 'SuppressionContract',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          suppressionId: {
            required: false,
            serializedName: 'properties.suppressionId',
            type: {
              name: 'String'
            }
          },
          ttl: {
            required: false,
            serializedName: 'properties.ttl',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = SuppressionContract;


text:
package de.is24.aws.mavenplugin.springbootrpm.testapp;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@EnableAutoConfiguration
public class Application {

	@RequestMapping("/")
	@ResponseBody
	String home() {
		return "Hello!";
	}

	public static void main(String[] args) throws Exception {
		SpringApplication.run(Application.class, args);
	}
}


text:
/*
 *
 *	ChartSurfaceSerie.h
 *
 *	Written by Cédric Moonen (cedric_moonen@hotmail.com)
 *
 *
 *
 *	This code may be used for any non-commercial and commercial purposes in a compiled form.
 *	The code may be redistributed as long as it remains unmodified and providing that the
 *	author name and this disclaimer remain intact. The sources can be modified WITH the author
 *	consent only.
 *
 *	This code is provided without any garanties. I cannot be held responsible for the damage or
 *	the loss of time it causes. Use it at your own risks
 *
 *	An e-mail to notify me that you are using this code is appreciated also.
 *
 *
 */

#if !defined(AFX_CHARTSURFACESERIE_H__28A77823_43BD_4502_9AA7_A2B227454035__INCLUDED_)
#define AFX_CHARTSURFACESERIE_H__28A77823_43BD_4502_9AA7_A2B227454035__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ChartSerie.h"

//! Specialization of a CChartSerie to display a surface series.
/**
	A surface can be horizontal (default) or vertical: this defines how
	the filling of the surface is done. For a horizontal surface, the
	filling is done between the points and the associated horizontal axis
	and for a vertical surface, the filling is done between the points
	and the associated vertical axis.
	The series can be associated with a secondary axis. For example, if
	the surface series is horizontal and is associated with the top axis
	(secondary axis), the filling is done between the top axis and the points.
**/
class CChartSurfaceSerie : public CChartSerie
{
public:
	//! Constructor
	CChartSurfaceSerie(CChartCtrl* pParent);
	//! Destructor
	virtual ~CChartSurfaceSerie();

	//! The different fill styles
	enum FillStyle
	{
		fsSolid = 0,
		fsHatchDownDiag,
		fsHatchUpDiag,
		fsHatchCross,
		fsHatchDiagCross,
		fsHatchHorizontal,
		fsHatchVertical
	};

	//! Sets the fill style
	void SetFillStyle(FillStyle NewStyle);
	//! Returns the fill style
	FillStyle GetFillStyle() const		   { return m_FillStyle; }

	//! Sets the series in horizontal or vertical mode
	/**
		If the series is in horizontal mode, the filling will be done between
		the data points and the horizontal axis.
	**/
	void SetHorizontal(bool bHoriz);
	//! Returns true if the series is in horizontal mode
	bool GetHorizontal() const		{ return m_bHorizontal;   }

	//! Check whether a screen point is on the series.
	/**
		This function returns true if the screen point is on the surface.
		If the screen point is also close to a specific point of the series, the
		index of the point is stored in the uIndex parameter. Otherwise, this
		parameter contains INVALID_POINT.
		@param screenPoint
			The screen point to test
		@param uIndex
			If the point is close to a specific point of the series, its index is stored here.
		@return true if the point is on the series
	**/
	bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;

private:
	//! Override in order to avoid changing series ordering.
	void SetSeriesOrdering(CChartPointsArray::PointsOrdering);

	//! Draws the legend icon for the series.
	/**
		This pure virtual function should be overriden by child classes.
		@param pDC
			The device context used to draw
		@param rectBitmap
			The rectangle in which to draw the legend icon
	**/
    void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;

	//! Draws the most recent points of the series.
	/**
		This pure virtual function should be overriden by child classes.
		This function should only draw the points that were not previously
		drawn.
		@param pDC
			The device context used to draw
	**/
	void Draw(CDC* pDC);
	//! Redraws the full series.
	/**
		This pure virtual function should be overriden by child classes.
		@param pDC
			The device context used to draw
	**/
	void DrawAll(CDC *pDC);

	//! The brush style used to fill the surface
	FillStyle m_FillStyle;
	//! The horizontal/vertical mode
	bool m_bHorizontal;
};

#endif // !defined(AFX_CHARTSURFACESERIE_H__28A77823_43BD_4502_9AA7_A2B227454035__INCLUDED_)


text:
TimePassed
==========

This is a simple class that check how much time passed since the given date


text:
import React from "react";
import {render} from "react-dom";
import {Provider} from "react-redux";
import {createStore, applyMiddleware}from "redux";
import reduxLogger from "redux-logger";
import ProgressBar from "./components/progressBar";

const STORE = createStore(()=>{}, applyMiddleware(reduxLogger()));

render (
  <Provider store={STORE}>
    <ProgressBar steps={[
      {name: "regForm", label: "Sign Up", required: true},
      {name: "addressForm", label: "Add Address", required: false},
      {name: "confirm", label:"Confirmation", required: true}
    ]} />
  </Provider>,
  document.getElementById("container")
);