text:
/*
 / _____)             _              | |
( (____  _____ ____ _| |_ _____  ____| |__
 \____ \| ___ |    (_   _) ___ |/ ___)  _ \
 _____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
    (C)2013 Semtech

Description: Target board general functions implementation

License: Revised BSD License, see LICENSE.TXT file include in the project

Maintainer: Andreas Pella (IMST GmbH), Miguel Luis and Gregory Cristian
*/
#include "board.h"

/*!
 * Potentiometer max and min levels definition
 */
#define POTI_MAX_LEVEL 900
#define POTI_MIN_LEVEL 10

/*!
 * Vref values definition
 */
#define PDDADC_VREF_BANDGAP                             1224 // mV
#define PDDADC_MAX_VALUE                                4096

/*!
 * Battery level ratio (battery dependent)
 */
#define BATTERY_STEP_LEVEL                          0.23

/*!
 * Unique Devices IDs register set ( STM32L1xxx )
 */
#define         ID1                                 ( 0x1FF80050 )
#define         ID2                                 ( 0x1FF80054 )
#define         ID3                                 ( 0x1FF80064 )

#if ( USE_POTENTIOMETER == 0 )
Gpio_t Led1;
#endif
Gpio_t Led2;
Gpio_t Led3;
Gpio_t Led4;

/*
 * MCU objects
 */
Adc_t Adc;
I2c_t I2c;
Uart_t Uart1;

/*!
 * Initializes the unused GPIO to a know status
 */
static void BoardUnusedIoInit( void );

/*!
 * System Clock Configuration
 */
static void SystemClockConfig( void );

/*!
 * Used to measure and calibrate the system wake-up time from STOP mode
 */
static void CalibrateSystemWakeupTime( void );

/*!
 * System Clock Re-Configuration when waking up from STOP mode
 */
static void SystemClockReConfig( void );

/*!
 * Timer used at first boot to calibrate the SystemWakeupTime
 */
static TimerEvent_t CalibrateSystemWakeupTimeTimer;

/*!
 * Flag to indicate if the MCU is Initialized
 */
static bool McuInitialized = false;

/*!
 * Flag to indicate if the SystemWakeupTime is Calibrated
 */
static bool SystemWakeupTimeCalibrated = false;

/*!
 * Callback indicating the end of the system wake-up time calibration
 */
static void OnCalibrateSystemWakeupTimeTimerEvent( void )
{
    SystemWakeupTimeCalibrated = true;
}

void BoardInitPeriph( void )
{
    /* Init the GPIO extender pins */
#if ( USE_POTENTIOMETER == 0 )
    GpioInit( &Led1, LED_1, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
#endif
    GpioInit( &Led2, LED_2, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
    GpioInit( &Led3, LED_3, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
    GpioInit( &Led4, LED_4, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );

    // Switch LED 1, 2, 3, 4 OFF
#if ( USE_POTENTIOMETER == 0 )
    GpioWrite( &Led1, 0 );
#endif
    GpioWrite( &Led2, 0 );
    GpioWrite( &Led3, 0 );
    GpioWrite( &Led4, 0 );
}

void BoardInitMcu( void )
{
    if( McuInitialized == false )
    {
#if defined( USE_BOOTLOADER )
        // Set the Vector Table base location at 0x3000
        SCB->VTOR = FLASH_BASE | 0x3000;
#endif
        HAL_Init( );

        SystemClockConfig( );

        RtcInit( );

        BoardUnusedIoInit( );
    }
    else
    {
        SystemClockReConfig( );
    }

    AdcInit( &Adc, POTI );

    SpiInit( &SX1272.Spi, RADIO_MOSI, RADIO_MISO, RADIO_SCLK, NC );
    SX1272IoInit( );

    if( McuInitialized == false )
    {
        McuInitialized = true;
        if( GetBoardPowerSource( ) == BATTERY_POWER )
        {
            CalibrateSystemWakeupTime( );
        }
    }
}

void BoardDeInitMcu( void )
{
    Gpio_t ioPin;

    SpiDeInit( &SX1272.Spi );
    SX1272IoDeInit( );

    GpioInit( &ioPin, OSC_HSE_IN, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
    GpioInit( &ioPin, OSC_HSE_OUT, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 1 );

    GpioInit( &ioPin, OSC_LSE_IN, PIN_INPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 1 );
    GpioInit( &ioPin, OSC_LSE_OUT, PIN_INPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 1 );
}

uint32_t BoardGetRandomSeed( void )
{
    return ( ( *( uint32_t* )ID1 ) ^ ( *( uint32_t* )ID2 ) ^ ( *( uint32_t* )ID3 ) );
}

void BoardGetUniqueId( uint8_t *id )
{
    id[7] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ) >> 24;
    id[6] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ) >> 16;
    id[5] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ) >> 8;
    id[4] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) );
    id[3] = ( ( *( uint32_t* )ID2 ) ) >> 24;
    id[2] = ( ( *( uint32_t* )ID2 ) ) >> 16;
    id[1] = ( ( *( uint32_t* )ID2 ) ) >> 8;
    id[0] = ( ( *( uint32_t* )ID2 ) );
}

uint8_t BoardMeasurePotiLevel( void )
{
    uint8_t potiLevel = 0;
    uint16_t MeasuredLevel = 0;

    // read the current potentiometer setting
    MeasuredLevel = AdcMcuRead( &Adc , ADC_CHANNEL_3 );

    // check the limits
    if( MeasuredLevel >= POTI_MAX_LEVEL )
    {
        potiLevel = 100;
    }
    else if( MeasuredLevel <= POTI_MIN_LEVEL )
    {
        potiLevel = 0;
    }
    else
    {
        // if the value is in the area, calculate the percentage value
        potiLevel = ( ( MeasuredLevel - POTI_MIN_LEVEL ) * 100 ) / POTI_MAX_LEVEL;
    }
    return potiLevel;
}

uint16_t BoardMeasureVdd( void )
{
    uint16_t MeasuredLevel = 0;
    uint32_t milliVolt = 0;

    // Read the current Voltage
    MeasuredLevel = AdcMcuRead( &Adc , ADC_CHANNEL_17 );

    // We don't use the VREF from calibValues here.
    // calculate the Voltage in miliVolt
    milliVolt = ( uint32_t )PDDADC_VREF_BANDGAP * ( uint32_t )PDDADC_MAX_VALUE;
    milliVolt = milliVolt / ( uint32_t ) MeasuredLevel;

    return ( uint16_t ) milliVolt;
}

uint8_t BoardGetBatteryLevel( void )
{
    uint8_t batteryLevel = 0;
    uint16_t measuredLevel = 0;

    measuredLevel = BoardMeasureVdd( );

    if( measuredLevel >= 3000 )
    {
        batteryLevel = 254;
    }
    else if( measuredLevel <= 2400 )
    {
        batteryLevel = 1;
    }
    else
    {
        batteryLevel = ( measuredLevel - 2400 ) * BATTERY_STEP_LEVEL;
    }
    return batteryLevel;
}

static void BoardUnusedIoInit( void )
{
    Gpio_t ioPin;

    if( GetBoardPowerSource( ) == BATTERY_POWER )
    {
        GpioInit( &ioPin, USB_DM, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
        GpioInit( &ioPin, USB_DP, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    }

#if defined( USE_DEBUGGER )
    HAL_DBGMCU_EnableDBGStopMode( );
    HAL_DBGMCU_EnableDBGSleepMode( );
    HAL_DBGMCU_EnableDBGStandbyMode( );
#else
    HAL_DBGMCU_DisableDBGSleepMode( );
    HAL_DBGMCU_DisableDBGStopMode( );
    HAL_DBGMCU_DisableDBGStandbyMode( );

    GpioInit( &ioPin, JTAG_TMS, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &ioPin, JTAG_TCK, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &ioPin, JTAG_TDI, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &ioPin, JTAG_TDO, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &ioPin, JTAG_NRST, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
#endif
}

void SystemClockConfig( void )
{
    RCC_OscInitTypeDef RCC_OscInitStruct;
    RCC_ClkInitTypeDef RCC_ClkInitStruct;
    RCC_PeriphCLKInitTypeDef PeriphClkInit;

    __HAL_RCC_PWR_CLK_ENABLE( );

    __HAL_PWR_VOLTAGESCALING_CONFIG( PWR_REGULATOR_VOLTAGE_SCALE1 );

    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
    RCC_OscInitStruct.LSEState = RCC_LSE_ON;
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
    RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
    RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV3;
    HAL_RCC_OscConfig( &RCC_OscInitStruct );

    RCC_ClkInitStruct.ClockType = ( RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 );
    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
    HAL_RCC_ClockConfig( &RCC_ClkInitStruct, FLASH_LATENCY_1 );

    PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC;
    PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
    HAL_RCCEx_PeriphCLKConfig( &PeriphClkInit );

    HAL_SYSTICK_Config( HAL_RCC_GetHCLKFreq( ) / 1000 );

    HAL_SYSTICK_CLKSourceConfig( SYSTICK_CLKSOURCE_HCLK );

    /*    HAL_NVIC_GetPriorityGrouping*/
    HAL_NVIC_SetPriorityGrouping( NVIC_PRIORITYGROUP_4 );

    /* SysTick_IRQn interrupt configuration */
    HAL_NVIC_SetPriority( SysTick_IRQn, 0, 0 );
}

void CalibrateSystemWakeupTime( void )
{
    if( SystemWakeupTimeCalibrated == false )
    {
        TimerInit( &CalibrateSystemWakeupTimeTimer, OnCalibrateSystemWakeupTimeTimerEvent );
        TimerSetValue( &CalibrateSystemWakeupTimeTimer, 1000 );
        TimerStart( &CalibrateSystemWakeupTimeTimer );
        while( SystemWakeupTimeCalibrated == false )
        {
            TimerLowPowerHandler( );
        }
    }
}

void SystemClockReConfig( void )
{
    __HAL_RCC_PWR_CLK_ENABLE( );
    __HAL_PWR_VOLTAGESCALING_CONFIG( PWR_REGULATOR_VOLTAGE_SCALE1 );

    /* Enable HSE */
    __HAL_RCC_HSE_CONFIG( RCC_HSE_ON );

    /* Wait till HSE is ready */
    while( __HAL_RCC_GET_FLAG( RCC_FLAG_HSERDY ) == RESET )
    {
    }

    /* Enable PLL */
    __HAL_RCC_PLL_ENABLE( );

    /* Wait till PLL is ready */
    while( __HAL_RCC_GET_FLAG( RCC_FLAG_PLLRDY ) == RESET )
    {
    }

    /* Select PLL as system clock source */
    __HAL_RCC_SYSCLK_CONFIG ( RCC_SYSCLKSOURCE_PLLCLK );

    /* Wait till PLL is used as system clock source */
    while( __HAL_RCC_GET_SYSCLK_SOURCE( ) != RCC_SYSCLKSOURCE_STATUS_PLLCLK )
    {
    }
}

void SysTick_Handler( void )
{
    HAL_IncTick( );
    HAL_SYSTICK_IRQHandler( );
}

uint8_t GetBoardPowerSource( void )
{
    return BATTERY_POWER;
}

#ifdef USE_FULL_ASSERT
/*
 * Function Name  : assert_failed
 * Description    : Reports the name of the source file and the source line number
 *                  where the assert_param error has occurred.
 * Input          : - file: pointer to the source file name
 *                  - line: assert_param error line source number
 * Output         : None
 * Return         : None
 */
void assert_failed( uint8_t* file, uint32_t line )
{
    /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

    /* Infinite loop */
    while( 1 )
    {
    }
}
#endif

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

  <meta charset="utf-8">
  <title>Image Galleries with amp-carousel</title>

  <link rel="canonical" href="https://ampbyexample.com/advanced/image_galleries_with_amp-carousel/">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

  <amp-carousel class="carousel1" layout="responsive" height="450" width="500" type="slides">

      <amp-img src="/examples/visual-tests/amp-by-example/img/Border_Collie.jpg" layout="responsive" width="500" height="300" alt="Border Collie"></amp-img>
      <amp-fit-text layout="responsive" width="500" height="150"> The Border Collie is a working and herding dog breed developed in the Anglo-Scottish border region for herding livestock, especially sheep. It was specifically bred for intelligence and obedience.  Considered highly intelligent, and typically extremely energetic, acrobatic, smart and athletic, they frequently compete with great success in dog sports, in addition to their success in sheepdog trials. They are often cited as the most intelligent of all domestic dogs. Border Collies also remain employed throughout the world in their traditional work of herding livestock.  </amp-fit-text>

      <amp-img src="/examples/visual-tests/amp-by-example/img/Shetland_Sheepdog.jpg" layout="responsive" width="500" height="340" alt="Shetland Sheepdog"></amp-img>
      <amp-fit-text layout="responsive" width="500" height="110"> The Shetland Sheepdog, often known as the Sheltie, is a breed of herding dog. Less favored nicknames are the Toy Collie and the Miniature Collie. They are small dogs, and come in a variety of colors, such as sable, tri-color, and blue merle. They are very intelligent, vocal, excitable, energetic dogs who are always willing to please and work hard.
      </amp-fit-text>

      <amp-img src="/examples/visual-tests/amp-by-example/img/Hovawart.jpg" layout="responsive" width="500" height="350" alt="Hovawart"></amp-img>
      <amp-fit-text layout="responsive" width="500" height="100">
        The Hovawart is a medium to large size German dog breed. The name of the breed means "an estate
        guard dog", which is the original use for the breed. The breed originated in the Black Forest
        region and was first described in text and paintings in medieval times.
      </amp-fit-text>

  </amp-carousel>

  <amp-carousel class="carousel2" layout="responsive" height="400" width="500" type="slides">

      <amp-img src="/examples/visual-tests/amp-by-example/img/Border_Collie.jpg" layout="fill" alt="Border Collie"></amp-img>

        The Border Collie is a working and herding dog breed developed in the Anglo-Scottish border region
        for herding livestock, especially sheep. It was specifically bred for intelligence and obedience.

      <amp-img src="/examples/visual-tests/amp-by-example/img/Shetland_Sheepdog.jpg" layout="fill" alt="Shetland Sheepdog"></amp-img>

        The Shetland Sheepdog, often known as the Sheltie, is a breed of herding dog. Less favored nicknames
        are the Toy Collie and the Miniature Collie. They are small dogs, and come in a variety of colors,
        such as sable, tri-color, and blue merle. They are very intelligent, vocal, excitable, energetic dogs
        who are always willing to please and work hard.

      <amp-img src="/examples/visual-tests/amp-by-example/img/Hovawart.jpg" layout="fill" alt="Hovawart"></amp-img>

        The Hovawart is a medium to large size German dog breed. The name of the breed means "an estate guard
        dog", which is the original use for the breed. The breed originated in the Black Forest region and was
        first described in text and paintings in medieval times.

  </amp-carousel>

 Selected slide: 1/3

    <amp-carousel controls type="slides" width="400" height="300"
                                                     layout="responsive"
                                                     [slide]="selectedSlide" on="slideChange:AMP.setState({selectedSlide: event.index})">
      <amp-img src="/examples/visual-tests/amp-by-example/img/image1.jpg" width="400" height="300"></amp-img>
      <amp-img src="/examples/visual-tests/amp-by-example/img/image2.jpg" width="400" height="300"></amp-img>
      <amp-img src="/examples/visual-tests/amp-by-example/img/image3.jpg" width="400" height="300"></amp-img>
    </amp-carousel>

  <amp-carousel controls width="400" height="100">
    <amp-img src="/examples/visual-tests/amp-by-example/img/image1.jpg" width="100" height="75" role="button" tabindex="0"
                                                                         [class]="selectedSlide == 0 ? 'selected' : ''" on="tap:AMP.setState({selectedSlide: 0})"></amp-img>
                                                                       <amp-img src="/examples/visual-tests/amp-by-example/img/image2.jpg" width="100" height="75" role="button" tabindex="1"
                                                                                [class]="selectedSlide == 1 ? 'selected' : ''" on="tap:AMP.setState({selectedSlide: 1})"></amp-img>
                                                                                <amp-img src="/examples/visual-tests/amp-by-example/img/image3.jpg" width="100" height="75" role="button" tabindex="2"
                                                                                [class]="selectedSlide == 2 ? 'selected' : ''" on="tap:AMP.setState({selectedSlide: 2})"></amp-img>
  </amp-carousel>

  <amp-selector layout="container" name="carousel-selector" [selected]="selectedSlide" on="select:AMP.setState({selectedSlide: event.targetOption})">
    <amp-carousel controls width="400" height="100">
      <amp-img src="/examples/visual-tests/amp-by-example/img/image1.jpg" width="100" height="75" option="0"></amp-img>
      <amp-img src="/examples/visual-tests/amp-by-example/img/image2.jpg" width="100" height="75" option="1"></amp-img>
      <amp-img src="/examples/visual-tests/amp-by-example/img/image3.jpg" width="100" height="75" option="2"></amp-img>
    </amp-carousel>
  </amp-selector>

  <amp-carousel class="collapsible-captions" height="332" layout="fixed-height" type="slides">

        <amp-img layout="fill" src="https://unsplash.it/500/400"></amp-img>

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
        ▲

        <amp-img layout="fill" src="https://unsplash.it/500/500"></amp-img>

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
        ▲

        <amp-img layout="fill" src="https://unsplash.it/200/500"></amp-img>

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
        ▲

  </amp-carousel>

    <amp-carousel id="carousel-with-preview" width="400" height="300" layout="responsive" type="slides">
      <amp-img src="https://unsplash.it/400/300?image=10" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=11" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=12" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=13" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
    </amp-carousel>

      <button on="tap:carousel-with-preview.goToSlide(index=0)"><amp-img src="https://unsplash.it/60/40?image=10" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-preview.goToSlide(index=1)"><amp-img src="https://unsplash.it/60/40?image=11" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-preview.goToSlide(index=2)"><amp-img src="https://unsplash.it/60/40?image=12" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-preview.goToSlide(index=3)"><amp-img src="https://unsplash.it/60/40?image=13" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>

    <amp-carousel id="carousel-with-carousel-preview" width="400" height="300" layout="responsive" type="slides">
      <amp-img src="https://unsplash.it/400/300?image=10" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=11" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=12" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=13" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=14" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=15" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=16" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=17" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=18" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=19" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=110" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=111" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=112" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=113" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=114" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=115" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=116" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
      <amp-img src="https://unsplash.it/400/300?image=117" width="400" height="300" layout="responsive" alt="a sample image"></amp-img>
    </amp-carousel>
    <amp-carousel class="carousel-preview" width="auto" height="48" layout="fixed-height" type="carousel">
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=0)"><amp-img src="https://unsplash.it/60/40?image=10" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=1)"><amp-img src="https://unsplash.it/60/40?image=11" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=2)"><amp-img src="https://unsplash.it/60/40?image=12" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=3)"><amp-img src="https://unsplash.it/60/40?image=13" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=4)"><amp-img src="https://unsplash.it/60/40?image=14" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=5)"><amp-img src="https://unsplash.it/60/40?image=15" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=6)"><amp-img src="https://unsplash.it/60/40?image=16" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=7)"><amp-img src="https://unsplash.it/60/40?image=17" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=8)"><amp-img src="https://unsplash.it/60/40?image=18" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=9)"><amp-img src="https://unsplash.it/60/40?image=19" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=10)"><amp-img src="https://unsplash.it/60/40?image=110" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=11)"><amp-img src="https://unsplash.it/60/40?image=111" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=12)"><amp-img src="https://unsplash.it/60/40?image=112" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=13)"><amp-img src="https://unsplash.it/60/40?image=113" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=14)"><amp-img src="https://unsplash.it/60/40?image=114" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=15)"><amp-img src="https://unsplash.it/60/40?image=115" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=16)"><amp-img src="https://unsplash.it/60/40?image=116" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
      <button on="tap:carousel-with-carousel-preview.goToSlide(index=17)"><amp-img src="https://unsplash.it/60/40?image=117" width="60" height="40" layout="responsive" alt="a sample image"></amp-img></button>
    </amp-carousel>


text:
<?php
require_once ("Form.php");
class HierarchicalPositionForm extends Form
{

	function addHierarchicalPosition($name, $label, $mandatory = "off",$entity=null)
	{
		$factory=new HierarchicalPositionFieldFactory();
		$newField=$factory->create($this);

		$newField->name= $name;
		$newField->type = "hierarchicalPosition";
		$newField->label = $label;
		$newField->mandatory = $mandatory;
		$newField->entity=$entity;
		$this->elements[] = $newField;
	}

	function edit($entity=null)
	{
		$this->updatePositions($entity);
	}

	function add($entity=null)
	{
		$this->updatePositions($entity);
	}

	private function updatePositions($entity)
	{

		/**
		 * if the main entity was correctly updated it's time to update her relations included in the requested
		 * triggered forms (subforms).
		 */

		/**
		 * Searching for request hashtags in the scheme
		 * attributename_hash
		*/
		$hashesValues = array();
		foreach($this->entity->fields as $k=>$v)
		{
			foreach($_REQUEST as $requestKey=>$requestValue)
			{
				if (ereg("{$v->name}_",$requestKey) && ereg("{$this->formHash}",$requestKey)) {
					$hash=preg_replace("/{$v->name}_/","",$requestKey);
					if(!in_array($hash,$hashesValues))
					{
						$hashesValues[]=$hash;
					}
				}
			}
		}

		/**
		 * for every found hashtag we have a relation to update
		 */
		foreach($hashesValues as $k=>$hash)
		{
			/**
			 * preparing update value conditions, first of all the primary key of the base entity
			 */
			$values_conditions=array();
			$where_conditions=array();

			/**
			 * for every field of the entity to update
			 */
			foreach($this->entity->fields as $k=>$v)
			{	/**
				* for every element of the request
				*/
				foreach($_REQUEST as $requestKey=>$requestValue)
				{
					/**
					 * if there's an element of the request compatible with the hash and the entity field
					 */
					if (preg_match("/{$v->name}_{$hash}/",$requestKey)&&!empty($v->name)) {
						/**
						 * add it to values conditions
						 */
						if($v->name==$this->entity->fields[0]->name)
							$where_conditions[$v->name]=$requestValue;
						else
							$values_conditions[$v->name]=$requestValue;

					}
				}
			}

			/**
			 * if check is passed update the entity
			 */
			if(sizeof($where_conditions)>0 && sizeof($values_conditions)>0)
			{
				$this->entity->update($where_conditions,$values_conditions);
			}
		}
	}
}
?>


text:
@implementation AppDelegate

+ (AppDelegate *)appDelegate
{
    return (AppDelegate *)[[UIApplication sharedApplication] delegate];
}

#pragma mark - Application Life Cycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Saves changes in the application's managed object context before the application terminates.
    [[CoreDataManager sharedManager] saveContext];
}

#pragma mark - Application's Documents directory

// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}

@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
ketai.net.nfc.record
</TITLE>

<META NAME="date" CONTENT="2013-03-03">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Package ketai.net.nfc.record

Interface Summary

ParsedNdefRecord
The Interface ParsedNdefRecord.

Class Summary

SmartPoster
A representation of an NFC Forum "Smart Poster".

TextRecord
An NFC Text Record.

UriRecord
A parsed record containing a Uri.

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Curr. Sci. 41(21): 756 (1972)

#### Original name
Edyuillia Subram.

### Remarks
null


text:
extern crate pnet_macros;
extern crate pnet_macros_support;
use pnet_macros::packet;

#[packet]
pub struct InvalidType {
    pub field: String, //~ ERROR: non-primitive field types must specify #[construct_with]
    #[payload]
    pub payload: Vec<u8>,
}

fn main() {}


text:
using System;
using System.Globalization;
using FluentAssertions;
using Xunit;

namespace LiteDB.Tests.Document
{
    public class Json_Tests
    {
        private BsonDocument CreateDoc()
        {
            // create same object, but using BsonDocument
            var doc = new BsonDocument();
            doc["_id"] = 123;
            doc["Special"] = "Màçã ámö-î";
            doc["FirstString"] = "BEGIN this string \" has \" \t and this \f \n\r END";
            doc["CustomerId"] = Guid.NewGuid();
            doc["Date"] = new DateTime(2015, 1, 1);
            doc["MyNull"] = null;
            doc["Items"] = new BsonArray();
            doc["MyObj"] = new BsonDocument();
            doc["EmptyString"] = "";
            var obj = new BsonDocument();
            obj["Qtd"] = 3;
            obj["Description"] = "Big beer package";
            obj["Unit"] = 1299.995;
            doc["Items"].AsArray.Add(obj);
            doc["Items"].AsArray.Add("string-one");
            doc["Items"].AsArray.Add(null);
            doc["Items"].AsArray.Add(true);
            doc["Items"].AsArray.Add(DateTime.Now);

            return doc;
        }

        [Fact]
        public void Json_To_Document()
        {
            var o = CreateDoc();

            var json = JsonSerializer.Serialize(o);

            var doc = JsonSerializer.Deserialize(json).AsDocument;

            doc["Special"].AsString.Should().Be(o["Special"].AsString);
            doc["Date"].AsDateTime.Should().Be(o["Date"].AsDateTime);
            doc["CustomerId"].AsGuid.Should().Be(o["CustomerId"].AsGuid);
            doc["Items"].AsArray.Count.Should().Be(o["Items"].AsArray.Count);
            doc["_id"].AsInt32.Should().Be(123);
            doc["_id"].AsInt64.Should().Be(o["_id"].AsInt64);
        }

        [Fact]
        public void JsonWriterTest()
        {
            var specialChars = "ÁÀÃÂÄÉÈÊËÉÍÌÎÏÓÒÕÔÖÚÙÛÜÇáàãâäéèêëéíìîïóòõôöúùûüç";
            JsonSerializer.Serialize(specialChars).Should().Be('\"' + specialChars + '\"');
        }

        [Fact]
        public void Json_Number_Deserialize_Test()
        {
            int positiveInt32 = 5000000;
            int negativeInt32 = -5000000;
            long positiveInt64 = 210000000000L;
            long negativeInt64 = -210000000000L;
            double positiveDouble = 210000000000D;
            double negativeDouble = -210000000000D;

            JsonSerializer.Deserialize(positiveInt32.ToString()).Should().Be(positiveInt32);
            JsonSerializer.Deserialize(negativeInt32.ToString()).Should().Be(negativeInt32);
            JsonSerializer.Deserialize(positiveInt64.ToString()).Should().Be(positiveInt64);
            JsonSerializer.Deserialize(negativeInt64.ToString()).Should().Be(negativeInt64);
            JsonSerializer.Deserialize(positiveDouble.ToString("F1", CultureInfo.InvariantCulture)).Should().Be(positiveDouble);
            JsonSerializer.Deserialize(negativeDouble.ToString("F1", CultureInfo.InvariantCulture)).Should().Be(negativeDouble);
        }

        [Fact]
        public void Json_DoubleNaN_Tests()
        {
            BsonDocument doc = new BsonDocument();
            doc["doubleNaN"] = double.NaN;
            doc["doubleNegativeInfinity"] = double.NegativeInfinity;
            doc["doublePositiveInfinity"] = double.PositiveInfinity;

            // Convert to JSON
            string json = JsonSerializer.Serialize(doc);

            var bson = JsonSerializer.Deserialize(json);

            // JSON standard converts NaN and Infinities to null, so deserialized values should not be double.NaN nor double.*Infinity
            Assert.False(double.IsNaN(bson["doubleNaN"].AsDouble));
            Assert.False(double.IsNegativeInfinity(bson["doubleNegativeInfinity"].AsDouble));
            Assert.False(double.IsPositiveInfinity(bson["doublePositiveInfinity"].AsDouble));
        }
    }
}


text:
package com.yueny.blog.service.disruptor.event;

import com.yueny.blog.service.IArticleBlogService;
import com.yueny.blog.service.IOwenerTagService;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* 标签完整性检查事件<br>
*
* @author yueny09 <deep_blue_yang@163.com>
*
* @DATE 2018年1月21日 上午12:03:49
*
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FigureTagCheckerEvent implements IEvent {
	/**
	 *
	 */
	@Setter
	@Getter
	private IArticleBlogService articleBlogService;
	/**
	 *
	 */
	@Setter
	@Getter
	private IOwenerTagService owenerTagService;
	/**
	 * 待检查标签拥有者 uid
	 */
	@Setter
	@Getter
	private String uid;

}


text:
 Improve this Doc

Security

This document explains some of AngularJS's security features and best practices that you should
keep in mind as you build your application.

Reporting a security issue

Email us at security@angularjs.org to report any potential
security issues in AngularJS.

Please keep in mind the points below about Angular's expression language.

Use the latest AngularJS possible

Like any software library, it is critical to keep AngularJS up to date. Please track the
CHANGELOG and make sure you are aware
of upcoming security patches and other updates.

Be ready to update rapidly when new security-centric patches are available.

Those that stray from Angular standards (such as modifying Angular's core) may have difficulty updating,
so keeping to AngularJS standards is not just a functionality issue, it's also critical in order to
facilitate rapid security updates.

Expression Sandboxing

AngularJS's expressions are sandboxed not for security reasons, but instead to maintain a proper
separation of application responsibilities. For example, access to window is disallowed
because it makes it easy to introduce brittle global state into your application.

However, this sandbox is not intended to stop attackers who can edit the template before it's
processed by Angular. It may be possible to run arbitrary JavaScript inside double-curly bindings
if an attacker can modify them.

But if an attacker can change arbitrary HTML templates, there's nothing stopping them from doing:

<script>somethingEvil();</script>

It's better to design your application in such a way that users cannot change client-side templates.

For instance:

Do not mix client and server templates

Do not use user input to generate templates dynamically

Do not run user input through $scope.$eval

Consider using CSP (but don't rely only on CSP)

Mixing client-side and server-side templates

In general, we recommend against this because it can create unintended XSS vectors.

However, it's ok to mix server-side templating in the bootstrap template (index.html) as long
as user input cannot be used on the server to output html that would then be processed by Angular
in a way that would allow for arbitrary code execution.

For instance, you can use server-side templating to dynamically generate CSS, URLs, etc, but not
for generating templates that are bootstrapped/compiled by Angular.

HTTP Requests

Whenever your application makes requests to a server there are potential security issues that need
to be blocked. Both server and the client must cooperate in order to eliminate these threats.
Angular comes pre-configured with strategies that address these issues, but for this to work backend
server cooperation is required.

Cross Site Request Forgery (XSRF/CSRF)

Protection from XSRF is provided by using the double-submit cookie defense pattern.
For more information please visit XSRF protection.

JSON Hijacking Protection

Protection from JSON Hijacking is provided if the server prefixes all JSON requests with following string ")]}',\n".
Angular will automatically strip the prefix before processing it as JSON.
For more information please visit JSON Hijacking Protection.

Bear in mind that calling $http.jsonp, like in our Yahoo! finance example,
gives the remote server (and, if the request is not secured, any Man-in-the-Middle attackers)
instant remote code execution in your application: the result of these requests is handed off
to the browser as regular <script> tag.

Strict Contextual Escaping

Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain contexts to require
a value that is marked as safe to use for that context.

This mode is implemented by the $sce service and various core directives.

One example of such a context is rendering arbitrary content via the ngBindHtml directive. If the content is
provided by a user there is a chance of Cross Site Scripting (XSS) attacks. The ngBindHtml directive will not
render content that is not marked as safe by $sce. The ngSanitize module can be used to clean such
user provided content and mark the content as safe.

Be aware that marking untrusted data as safe via calls to $sce.trustAsHtml, etc is
dangerous and will lead to Cross Site Scripting exploits.

For more information please visit $sce and $sanitize.

Using Local Caches

There are various places that the browser can store (or cache) data. Within Angular there are objects created by
the $cacheFactory. These objects, such as $templateCache are used to store and retrieve data,
primarily used by $http and the script directive to cache templates and other data.

Similarly the browser itself offers localStorage and sessionStorage objects for caching data.

Attackers with local access can retrieve sensitive data from this cache even when users are not authenticated.

For instance in a long running Single Page Application (SPA), one user may "log out", but then another user
may access the application without refreshing, in which case all the cached data is still available.

For more information please visit Web Storage Security.

See also

Content Security Policy


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
  <title>Flora & Sauna</title>

  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
  <link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
  <link rel="shortcut icon" type="image/x-icon" href="img/transparent.png">

    menu

About

Membership

Community

Menu

Contact

About

Membership

Community

Menu

Contact

Community

            Any medical marijuana collective, in the state of California, must operate for "public good." While many dispensaries narrow the definition of "public good" to only include the facilitation of transactions, we at Flora & Sauna believe that further community-enhancement efforts are critical. Aside from operating as an eco-friendly delivery service, we also arrange a variety of events where collective members can volunteer, including environmental and low-income community improvement projects.

            Along with external community building, we also host private events for collective members, ranging anywhere from exclusive product unveilings and musical performances to art showcases and gourmet meals.

Events

Company Bio

Flora & Sauna is a not-for-profit in compliance with Prop 215, SB420, Health & Safety Code Section 11362.5(B)(1)(A) & 1362.7(H), and attorney general guidelines.

Connect

Facebook

Twitter

Instagram


text:
- player_id: int
- session_token: int

## Message types
- type: str('update')
- ticks: dict
    - tick: int
    - events: array
      - event:
        type: str('movement_start')
        direction: int
      - event:
        type: str('movement_stop')
      - event:
        type: str('shot')
        direction: int

<!-- Hier einmalig ohne session_token! -->
- type: str('request_spawn')
- name: str

# Server -> Client

- type: str('spawn')
- player_id: int
- session_token: int
- position: dict
    - x: float
    - y: float

- type: str('update')
- ticks: array(dict)
    - tick: int
    - positions: array
        - position: dict
            * entity_id: int
            * x: float
            * y: float


text:
<?php

namespace Indigo\Backup\Source;

use Indigo\Dumper\Dumper;

/**
 * Database Source Test
 *
 * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
 */
class DatabaseSourceTest extends SourceTest
{
    public function setUp()
    {
        $dumper = \Mockery::mock('Indigo\\Dumper\\Dumper', function ($mock) {
            $mock->shouldReceive('getStore')
                ->andReturn(\Mockery::mock('Indigo\\Dumper\\Store\\FileStore', function ($mock) {
                    $mock->shouldReceive('getFile')
                        ->andReturn(tempnam(sys_get_temp_dir(), ''));
                }));

            $mock->shouldReceive('getDatabase')->andReturn('test');
            $mock->shouldReceive('dump')->andReturn(true);
        });

        $this->source = new DatabaseSource($dumper);
    }

    public function tearDown()
    {
        \Mockery::close();
    }

    public function testDumper()
    {
        $dumper = $this->source->getDumper();

        $this->assertInstanceOf(
            'Indigo\\Dumper\\Dumper',
            $dumper
        );

        $this->assertInstanceOf(
            get_class($this->source),
            $this->source->setDumper($dumper)
        );
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testStore()
    {
        $dumper = \Mockery::mock('Indigo\\Dumper\\Dumper', function ($mock) {
            $mock->shouldReceive('getStore')
                ->andReturn(\Mockery::mock('Indigo\\Dumper\\Store\\StoreInterface'));

            $mock->shouldReceive('getDatabase')->andReturn('test');
            $mock->shouldReceive('dump')->andReturn(true);
        });

        $this->source->setDumper($dumper);
    }
}


text:
<?php

use yii\helpers\Html;
// use yii\widgets\ActiveForm;
use yii\bootstrap\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Planillas */
/* @var $form yii\widgets\ActiveForm */
?>

(*) campos requeridos.

    <?php $form = ActiveForm::begin(['layout' => 'horizontal']); ?>

    <?= $form->field($model, 'numero')->textInput(['value' => $model->isNewRecord ? $numero : $model->numero, 'readonly'=>''])->label('Número de planilla') ?>

            Fecha *

                <?= yii\jui\DatePicker::widget(["id" => "planillas-fecha", "name" => "Planillas[fecha]", "dateFormat" => "yyyy-MM-dd", 'options' => ['required' => '', 'class' => 'fecha form-control', "placeholder" => "aaaa-mm-dd"], 'clientOptions'=>['changeMonth'=>'true', 'changeYear'=>'true'], 'language'=>'es'])?>

    <?= $form->field($model, 'lugar')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'unidad')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'comision_afiliado')->textInput(['maxlength' => 45])->label('Conmisión por afiliado *') ?>

    <?= $form->field($model, 'por_ant_com')->textInput(['maxlength' => 45])->label('% anticipo por comisión *') ?>

        <?= Html::submitButton($model->isNewRecord ? 'Crear' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
package compose

import (
	"testing"

	"github.com/Gamebuildr/Hal/pkg/testutils"
	"github.com/docker/docker/api/types"
	"github.com/docker/docker/api/types/container"
	"github.com/docker/docker/client"
)

func TestDockerCanRunSpecifiedContainer(t *testing.T) {
	mockImage := "mock/image:latest"
	mockID := "123456789"
	mockContainers := []container.ContainerCreateCreatedBody{
		container.ContainerCreateCreatedBody{ID: mockID},
		container.ContainerCreateCreatedBody{ID: "987654321"},
	}

	testServer := testutils.CreateContainerServer(mockContainers)
	defer testServer.Close()

	cli, err := client.NewClient(testServer.URL, "1.13", nil, map[string]string{})
	if err != nil {
		t.Fatalf(err.Error())
	}

	engine := Docker{Client: cli}
	container := Container{Engine: engine}

	if err := container.Engine.RunContainer(mockImage, "image"); err != nil {
		t.Fatalf(err.Error())
	}
}

func TestDockerRunContainerReturnsErrorWhenContainerNotFound(t *testing.T) {
	mockContainers := []container.ContainerCreateCreatedBody{}

	testServer := testutils.CreateContainerServer(mockContainers)
	defer testServer.Close()

	cli, err := client.NewClient(testServer.URL, "1.13", nil, map[string]string{})
	if err != nil {
		t.Fatalf(err.Error())
	}

	engine := Docker{Client: cli}
	container := Container{Engine: engine}

	runErr := container.Engine.RunContainer("no_container", "image")
	if runErr == nil {
		t.Errorf("Expected error for container not found not thrown")
	}
}

func TestDockerReturnsRunningContainerCount(t *testing.T) {
	mockContainers := []types.Container{
		types.Container{ID: "test_one"},
		types.Container{ID: "test_two"},
	}

	testServer := testutils.OkResponseContainerServer(mockContainers)
	defer testServer.Close()

	cli, err := client.NewClient(testServer.URL, "1.13", nil, map[string]string{})
	if err != nil {
		t.Fatalf(err.Error())
	}

	engine := Docker{Client: cli}
	container := Container{Engine: engine}

	count, err := container.Engine.ActiveContainers()
	if err != nil {
		t.Fatalf(err.Error())
	}
	if count == 0 {
		t.Errorf("Expected 2 continers, got %v", count)
	}
	if count != 2 {
		t.Errorf("Expected 2 containers, got %v", count)
	}
}

func TestDockerCanGetContainerIDByImageName(t *testing.T) {
	mockImage := "mock/image:latest"
	mockID := "123456789"
	mockContainers := []types.Container{
		types.Container{ID: mockID, Image: mockImage},
		types.Container{ID: "987654321", Image: "test/mock/images:latest"},
	}
	testServer := testutils.OkResponseContainerServer(mockContainers)
	defer testServer.Close()

	cli, err := client.NewClient(testServer.URL, "1.13", nil, map[string]string{})
	if err != nil {
		t.Fatalf(err.Error())
	}
	engine := Docker{Client: cli}
	container := Container{Engine: engine}

	id, err := container.Engine.getContainerID(mockImage)
	if err != nil {
		t.Fatalf(err.Error())
	}
	if id == "" {
		t.Errorf("Expected container id to not be empty")
	}
	if id != mockID {
		t.Errorf("Expected container id %v, got %v", mockID, id)
	}
}


text:
({
    doInit: function(component, event, helper) {
        var store = component.find("store");
        store.createStore("counter", helper.counterReducer);

        var mapStateToAttributes = {
            "v.counter": "counter"
        }
        store.connect(mapStateToAttributes);
    },

    clickIncrement: function(component) {
        function increment() {
            return {
                type: 'INCREMENT'
            };
        }

        component.dispatch(increment());
    },

    clickDecrement: function(component) {
        function decrement() {
            return {
                type: 'DECREMENT'
            };
        }

        component.dispatch(decrement());
    }
})


text:
(function () {
    var session = null;

    QUnit.module("Activity Statics");

    test(
        "Activity.fromJSON",
        function () {
            var raw = {
                    id: "http://tincanapi.com/TinCanJS/Test/Activity_fromJSON"
                },
                string,
                result
            ;

            result = TinCan.Activity.fromJSON(JSON.stringify(raw));
            ok(result instanceof TinCan.Activity, "returns TinCan.Activity");
        }
    );
}());


text:
var mongodb = require('mongodb');
var uri = 'mongodb://localhost:27017/movies';

module.exports = function(callback) {
  mongodb.MongoClient.connect(uri, callback);
};


text:
from __future__ import unicode_literals

from faker.providers.date_time import Provider as DateTimeProvider
from .. import BaseProvider

class CreditCard(object):

    def __init__(self, name, prefixes, length=16, security_code='CVC', security_code_length=3):
        self.name = name
        self.prefixes = prefixes
        self.length = length
        self.security_code = security_code
        self.security_code_length = security_code_length

class Provider(BaseProvider):

    prefix_maestro = ['5018', '5020', '5038', '5612', '5893', '6304', '6759', '6761', '6762', '6763', '0604', '6390']
    prefix_mastercard = ['51', '52', '53', '54', '55']
    prefix_visa = ['4']
    prefix_amex = ['34', '37']
    prefix_discover = ['6011']
    prefix_diners = ['300', '301', '302', '303', '304', '305']
    prefix_jcb16 = ['3088', '3096', '3112', '3158', '3337', '3528']
    prefix_jcb15 = ['2100', '1800']
    prefix_voyager = ['8699']

    credit_card_types = {
        'maestro':      CreditCard('Maestro',           prefix_maestro, 12, security_code='CVV'),
        'mastercard':   CreditCard('Mastercard',        prefix_mastercard, 16, security_code='CVV'),
        'visa16':       CreditCard('VISA 16 digit',     prefix_visa),
        'visa13':       CreditCard('VISA 13 digit',     prefix_visa, 13),
        'amex':         CreditCard('American Express',  prefix_amex, 15, security_code='CID', security_code_length=4),
        'discover':     CreditCard('Discover',          prefix_discover),
        'diners':       CreditCard('Diners Club / Carte Blanche', prefix_diners, 14),
        'jcb15':        CreditCard('JCB 15 digit',      prefix_jcb15, 15),
        'jcb16':        CreditCard('JCB 16 digit',      prefix_jcb16),
        'voyager':      CreditCard('Voyager',           prefix_voyager, 15),
    }
    credit_card_types['visa'] = credit_card_types['visa16']
    credit_card_types['jcb'] = credit_card_types['jcb16']

    luhn_lookup = {'0': 0, '1': 2, '2': 4, '3': 6, '4': 8,
                   '5': 1, '6': 3, '7': 5, '8': 7, '9': 9}

    @classmethod
    def credit_card_provider(cls, card_type=None):
        """ Returns the provider's name of the credit card. """
        if card_type is None:
            card_type = cls.random_element(cls.credit_card_types.keys())
        return cls._credit_card_type(card_type).name

    @classmethod
    def credit_card_number(cls, card_type=None):
        """ Returns a valid credit card number. """
        card = cls._credit_card_type(card_type)
        prefix = cls.random_element(card.prefixes)
        number = cls._generate_number(prefix, card.length)
        return number

    @classmethod
    def credit_card_expire(cls, start='now', end='+10y', date_format='%m/%y'):
        expire_date = DateTimeProvider.date_time_between(start, end)
        return expire_date.strftime(date_format)

    def credit_card_full(self, card_type=None):
        card = self._credit_card_type(card_type)

        tpl = ('{provider}\n'
               '{owner}\n'
               '{number} {expire_date}\n'
               '{security}: {security_nb}\n')

        tpl = tpl.format(provider = card.name,
                         owner = self.generator.parse("{{first_name}} {{last_name}}"),
                         number = self.credit_card_number(card),
                         expire_date = self.credit_card_expire(),
                         security = card.security_code,
                         security_nb = self.credit_card_security_code(card))

        return self.generator.parse(tpl)

    @classmethod
    def credit_card_security_code(cls, card_type=None):
        """ Returns a security code string. """
        sec_len = cls._credit_card_type(card_type).security_code_length
        return cls.numerify('#' * sec_len)

    @classmethod
    def _credit_card_type(cls, card_type=None):
        """ Returns a random credit card type instance. """
        if card_type is None:
            card_type = cls.random_element(cls.credit_card_types.keys())
        elif isinstance(card_type, CreditCard):
            return card_type
        return cls.credit_card_types[card_type]

    @classmethod
    def _generate_number(cls, prefix, length):
        """
        'prefix' is the start of the CC number as a string, any number of digits.
        'length' is the length of the CC number to generate. Typically 13 or 16
        """
        number = prefix
        # Generate random char digits
        number += '#' * (length - len(prefix) - 1)
        number = cls.numerify(number)
        reverse = number[::-1]
        # Calculate sum
        tot = 0
        pos = 0
        while pos < length - 1:
            tot += Provider.luhn_lookup[reverse[pos]]
            if pos != (length - 2):
                tot += int(reverse[pos+1])
            pos += 2
        # Calculate check digit
        check_digit = (10 - (tot % 10)) % 10
        number += str(check_digit)
        return number


text:
// helper objects related to Realm's hijacking of the CUDA runtime API

#ifndef REALM_CUDART_HIJACK_H
#define REALM_CUDART_HIJACK_H

// so that we get types and stuff right
#include <cuda_runtime.h>

#include "activemsg.h"

#include <set>
#include <vector>

namespace Realm {
  namespace Cuda {

    // this flag will be set on the first call into any of this hijack code - if
    //  an application is linked with -lcudart, we will NOT be hijacking the
    //  application's calls, and the cuda module needs to know that)
    extern bool cudart_hijack_active;

    // files compiled with nvcc will use global registrations of modules, variables, etc.
    //  that get broadcast to all contexts

    struct FatBin {
      int magic; // magic number
      int version;
      const unsigned long long *data;
      void *filename_or_fatbins;
    };

    struct RegisteredFunction {
      const FatBin *fat_bin;
      const void *host_fun;
      const char *device_fun;

      RegisteredFunction(const FatBin *_fat_bin, const void *_host_fun,
			 const char *_device_fun);
    };

    struct RegisteredVariable {
      const FatBin *fat_bin;
      const void *host_var;
      const char *device_name;
      bool external;
      int size;
      bool constant;
      bool global;

      RegisteredVariable(const FatBin  *_fat_bin, const void *_host_var,
			 const char *_device_name, bool _external,
			 int _size, bool _constant, bool _global);
    };

    class GPU;

    class GlobalRegistrations {
    protected:
      GlobalRegistrations(void);
      ~GlobalRegistrations(void);

      static GlobalRegistrations& get_global_registrations(void);

    public:
      // called by a GPU when it has created its context - will result in calls back
      //  into the GPU for any modules/variables/whatever already registered
      static void add_gpu_context(GPU *gpu);
      static void remove_gpu_context(GPU *gpu);

      // called by __cuda(un)RegisterFatBinary
      static void register_fat_binary(FatBin *fatbin);
      static void unregister_fat_binary(FatBin *fatbin);

      // called by __cudaRegisterVar
      static void register_variable(RegisteredVariable *var);

      // called by __cudaRegisterFunction
      static void register_function(RegisteredFunction *func);

    protected:
      GASNetHSL mutex;
      std::set<GPU *> active_gpus;
      std::vector<FatBin *> fat_binaries;
      std::vector<RegisteredVariable *> variables;
      std::vector<RegisteredFunction *> functions;
    };
  };
};

#endif


text:
var _ = require('lodash');

var getRequirejsConfig = function () {
  var requirejsConfig;
  global.define = function (config) {
    requirejsConfig = config({ isBuild: true });
  };
  require('./app/config');

  return _.extend(requirejsConfig, {
    baseUrl: 'app',
    name: 'client',
    waitSeconds: 60,
    include: ['vendor/almond'],
    deps: [
      'client',
      'client/client_bootstrap',
      'client/logger'
    ],
    wrap: true,
    optimize: 'uglify'
  });
};

var addArgs = function (cmd) {
  return function () {
    return [cmd].concat([].slice.apply(arguments)).join(' ');
  };
};

var requirejsConfig = getRequirejsConfig();

module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    // Removes the contents of the public directory
    clean: ['public/'],
    // Builds Sass in development and production
    sass: {
      development: {
        files: {
          'public/stylesheets/spotlight.css': 'styles/index.scss'
        },
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/stylesheets'
          ],
          style: 'nested',
          sourceComments: 'map'
        }
      },
      production: {
        files: [
          { 'public/stylesheets/spotlight.css': 'styles/index.scss' },
          {
            expand: true,
            cwd: 'node_modules/govuk_template_mustache/assets/stylesheets',
            src: ['*.css'],
            dest: 'public/stylesheets',
            ext: '.css'
          }
        ],
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'compressed'
        }
      }
    },
    // Sets up Jasmine tests
    jasmine: {
      spotlight: {
        src: ['app/**/*.js'],
        options: {
          helpers: ['spec/helpers/*.js'],
          specs: [
            'spec/shared/**/spec.*.js',
            'spec/client/**/spec.*.js'
          ],
          template: 'spec/index.html',
          keepRunner: true
        }
      }
    },
    // Sets up server-side Jasmine node tests
    jasmine_node: {
      legacy: {
        verbose: false,
        src: './spec/helpers',
        options: {
          specFolders: [
            './spec/shared',
            './spec/server'
          ],
          useHelpers: true,
          specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
          match: '.*',
          useRequireJs: 'spec/requirejs-setup.js',
          verbose: false,
          jUnit: {
            report: false,
            savePath : './build/reports/jasmine/',
            useDotNotation: true,
            consolidate: true
          }
        }
      },
      server: {
        verbose: false,
        src: './spec/server-pure',
        options: {
          specFolders: [
            './spec/server-pure'
          ],
          useHelpers: true,
          specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
          match: '.*',
          verbose: false,
          jUnit: {
            report: false,
            savePath : './build/reports/jasmine/',
            useDotNotation: true,
            consolidate: true
          }
        }
      }
    },
    // Sets up server-side Jasmine node tests
    // Lints our JavaScript
    jshint: {
      browser: {
        src: ['app/client/**/*.js', 'spec/client/**/*.js'],
        options: {
          reporter: require('jshint-stylish'),
          jshintrc: true,
          config: './node_modules/performanceplatform-js-style-configs/.jshintrc-browser.json'
        }
      },
      node: {
        src: ['app/**/*.js', 'app/**/*.json', 'spec/**/*.js',
          '!app/client/**/*.js', '!spec/client/**/*.js'],
        options: {
          reporter: require('jshint-stylish'),
          jshintrc: true,
          config: './node_modules/performanceplatform-js-style-configs/.jshintrc-node.json'
        }
      }
    },
    // Creates a single big JS file
    requirejs: {
      production: {
        options: _.extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight.js',
          d3: true
        })
      },
      'production-no-d3': {
        options: _.extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight-no-d3.js',
          d3: false
        })
      }
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: [
          'node_modules/govuk_frontend_toolkit/javascripts/govuk/analytics/google-analytics-universal-tracker.js',
          'node_modules/govuk_frontend_toolkit/javascripts/govuk/analytics/analytics.js',
          'app/client/analytics.js'
        ],
        dest: 'public/javascripts/analytics.js'
      }
    },
    // Copies templates and assets from external modules and dirs
    copy: {
      govuk_template: {
        src: 'node_modules/govuk_template_mustache/views/layouts/govuk_template.html',
        dest: 'app/server/templates/page-components/',
        expand: true,
        flatten: true,
        filter: 'isFile'
      },
      govuk_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'node_modules/govuk_template_mustache/assets',
            dest: 'public/'
          }
        ]
      },
      spotlight_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'assets',
            dest: 'public/'
          }
        ]
      },
      vendor: {
        files: [
          {
            src: 'node_modules/backbone/backbone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/d3/d3.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/moment-timezone/moment-timezone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/lodash/dist/lodash.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          }
        ]
      }
    },
    // Watches styles and specs for changes
    watch: {
      css: {
        files: ['styles/**/*.scss'],
        tasks: ['sass:development'],
        options: { nospawn: true }
      },
      spec: {
        files: ['spec/**/spec.*.js'],
        tasks: ['jasmine:spotlight:build']
      }
    },
    shell: {
      // Runs subset of cheapseats tests
      cheapseats: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: addArgs('node ./node_modules/cheapseats/index.js --reporter dot-retry --standalone --path --quickrun ./')
      },
      // Runs all cheapseats tests
      cheapseats_full_run: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: addArgs('node ./node_modules/cheapseats/index.js --reporter dot-retry --standalone --path ./')
      },
      nightwatch: {
        command: addArgs('./node_modules/nightwatch/bin/nightwatch')
      },
      // Supervises the node process in development
      supervisor: {
        options: {
          stdout: true,
          stderr: true,
          execOptions: {
            maxBuffer: Infinity
          }
        },
        command: './node_modules/supervisor/lib/cli-wrapper.js -w app -i app/vendor -e "js|html" -n error app/server'
      },
      functional_spotlight: {
        command: 'node ./tests/tools/server_and_test.js'
      }
    },
    // Runs development tasks concurrently
    concurrent: {
      dev: {
        tasks: ['shell:supervisor', 'watch'],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    // Creates an asset digest for cachebusting URLs
    digest: {
      options: {
        out: 'public/asset-digest.json',
        separator: '-',
        algorithm: 'md5'
      },
      files: {
        src: ['public/**/*.*']
      }
    }
  });

  // Load external module tasks
  [
    'grunt-contrib-jasmine',
    'grunt-jasmine-node-new',
    'grunt-contrib-jshint',
    'grunt-contrib-clean',
    'grunt-contrib-requirejs',
    'grunt-contrib-concat',
    'grunt-digest',
    'grunt-sass',
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-shell',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask('copy:assets', [
    'copy:govuk_assets',
    'copy:spotlight_assets'
  ]);

  grunt.registerTask('build:common', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets'
  ]);

  grunt.registerTask('build:development', [
    'build:common',
    'concat',
    'sass:development',
    'digest'
  ]);

  grunt.registerTask('build:production', [
    'build:common',
    'sass:production',
    'requirejs:production',
    'requirejs:production-no-d3',
    'concat',
    'digest'
  ]);

  grunt.registerTask('test:unit', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'sass:development',
    'digest',
    'jasmine',
    'jasmine_node',
    'jshint'
  ]);

  grunt.registerTask('test:all', [
    'test:unit',
    'shell:cheapseats',
    'test:functional'
  ]);

  grunt.registerTask('cheapseats', [
    'shell:cheapseats'
  ]);

  grunt.registerTask('nightwatch', [
    'shell:nightwatch'
  ]);

  grunt.registerTask('test:functional:ci', [
    'shell:functional_spotlight'
  ]);

  grunt.registerTask('test:functional', [
    'shell:nightwatch:-e phantomjs'
  ]);

  grunt.registerTask('test:functional:ff', [
    'shell:nightwatch'
  ]);

  grunt.registerTask('test:functional:chrome', [
    'shell:nightwatch:-e chrome'
  ]);

  grunt.registerTask('test:functional:all', [
    'shell:nightwatch:-e default,chrome,phantomjs'
  ]);

  grunt.registerTask('cheapseats:unpublished', [
    'shell:cheapseats:--unpublished'
  ]);

  // Default task
  grunt.registerTask('default', [
    'build:development',
    'jasmine:spotlight:build',
    'concurrent'
  ]);

  grunt.registerTask('heroku:development', [
    'build:development'
  ]);

};


text:
* Can view slides online at https://talks.godoc.org/github.com/CodyOss/presentations/ready-set-go/ready-set-go-2018.slide#1

### 1.2 On my local machine
1. Install Go. Directions here: [HERE](https://golang.org/doc/install)
2. Run `go get golang.org/x/tools/cmd/present`
4. Run `go install golang.org/x/tools/cmd/present`
5. Pull this repo if you have not already
6. Assuming you followed the instructions in step one and added `$GOPATH/bin` to your `$PATH` you should be able to run `present` from the location of this README.
7. Navigate to the location the command spits out (`http://127.0.0.1:3999` for me)
8. Launch the slides


text:
from django.conf.urls import url

from . import views

app_name = 'RecruitManage'

urlpatterns = [
    url(r'^$', views.position, name='position'),
    url(r'^(?P<recruitment_id>[0-9]+)/$', views.detail, name='detail'),
]


text:
module PartialGameSpec
  ( spec
  , completePartialGame
  , incompletePartialGame
  ) where

import Test.Hspec
import Test.QuickCheck

import Board (cluesFor)
import Game (Game(..))
import PartialGame

import CluesSpec ()
import GameSpec (completeGame, incompleteGame)
import PartialBoardSpec ()

completePartialGame :: Gen PartialGame
completePartialGame = partialGameFor <$> completeGame

incompletePartialGame :: Gen PartialGame
incompletePartialGame = partialGameFor <$> incompleteGame

instance Arbitrary PartialGame where
  arbitrary = partialGameFor <$> arbitrary

spec :: Spec
spec = do
  describe "partialGame" $ do
    it "is inverted by unPartialGame" $ property $
      \pb cs -> unPartialGame (partialGame pb cs) `shouldBe` (pb, cs)

  describe "getPartialGameBoard" $ do
    it "gets the PartialBoard contained in a PartialGame" $ property $
      \pb cs -> getPartialGameBoard (partialGame pb cs) `shouldBe` pb

  describe "getPartialGameClues" $ do
    it "gets the Clues contained in a PartialGame" $ property $
      \pb cs -> getPartialGameClues (partialGame pb cs) `shouldBe` cs

  describe "partialGameFor" $ do
    it "returns a PartialGame containing the PartialBoard from the given Game" $ property $
      \g -> getPartialGameBoard (partialGameFor g) `shouldBe` getGamePartialBoard g
    it "returns a PartialGame containing the Clues from the given Game" $ property $
      \g -> getPartialGameClues (partialGameFor g) `shouldBe` cluesFor (getGameBoard g)


text:
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Wexflow.NetCore.Tests
{
    [TestClass]
    public class FilesRenamer
    {
        private static readonly string Src = @"C:\WexflowTesting\file1.txt";
        private static readonly string SrcRenamed = @"C:\WexflowTesting\file1_renamed.txt";
        private static readonly string Tmp = @"C:\WexflowTesting\FilesRenamer\file1.txt";

        [TestInitialize]
        public void TestInitialize()
        {
            if(!File.Exists(Tmp)) File.Copy(Src, Tmp);
            if (File.Exists(SrcRenamed)) File.Delete(SrcRenamed);
        }

        [TestCleanup]
        public void TestCleanup()
        {
            File.Copy(Tmp, Src);
            File.Delete(Tmp);
            File.Delete(SrcRenamed);
        }

        [TestMethod]
        public void FilesRenamerTest()
        {
            Assert.AreEqual(false, File.Exists(SrcRenamed));
            Helper.StartWorkflow(36);
            Assert.AreEqual(true, File.Exists(SrcRenamed));
        }
    }
}


text:
brew tap d12frosted/emacs-plus
brew install emacs-plus
brew linkapps emacs-plus

if [ -e ~/.emacs.d ]; then
    rm -rf ~/.emacs.d
fi
if [ -e ~/.emacs ]; then
    rm -rf ~/.emacs
fi

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

${PWD%/scripts}/scripts/link_spacemacs.sh


text:
redirect_to: ../0.10.x/configuration/
---


text:
// Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
Timer interface.

TimerConf is a MCU-specific struct.

Timers provide a simple way to delay program execution for some time.
*/

#[path="../util/wait_for.rs"]
#[macro_use] mod wait_for;

/// Timer implementation.
pub trait Timer {
  /// Implementation-specific method to wait a given number of microseconds.
  fn get_counter(&self) -> u32;

  #[inline(always)]
  /// Waits for specified number of microseconds.
  fn wait_us(&self, us: u32) {
    let start = self.get_counter();
    wait_for!((self.get_counter() - start) >= us);
  }

  #[inline(always)]
  /// Waits for specified number of milliseconds.
  fn wait_ms(&self, ms: u32) {
    self.wait_us(ms * 1000);
  }

  #[inline(always)]
  /// Waits for specified number of seconds.
  fn wait(&self, s: u32) {
    self.wait_us(s * 1000000);
  }
}


text:
'use strict';

angular.module('cloudoptingApp')
    .config(function ($stateProvider) {
        $stateProvider
            .state('service', {
                abstract: true,
                parent: 'site'
            });
    });


text:
<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>net.onedaybeard.artemis</groupId>
        <artifactId>artemis-parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>artemis-odb-gwt</artifactId>

    <properties>
        <junit.version>3.8</junit.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>artemis-odb</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>2.6.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>2.6.0</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
				<version>2.4</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>


text:
package org.apache.samza.storage;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.apache.samza.SamzaException;
import org.apache.samza.config.Config;
import org.apache.samza.config.StorageConfig;
import org.apache.samza.config.SystemConfig;
import org.apache.samza.container.TaskName;
import org.apache.samza.coordinator.stream.CoordinatorStreamValueSerde;
import org.apache.samza.coordinator.stream.messages.SetChangelogMapping;
import org.apache.samza.metadatastore.MetadataStore;
import org.apache.samza.system.StreamSpec;
import org.apache.samza.system.SystemAdmin;
import org.apache.samza.system.SystemStream;
import org.apache.samza.util.StreamUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Responsible for creating the changelog stream. Used for reading, writing
 * and updating the task to changelog stream partition association in metadata store.
 */
public class ChangelogStreamManager {

  private static final Logger LOG = LoggerFactory.getLogger(ChangelogStreamManager.class);

  private final MetadataStore metadataStore;
  private final CoordinatorStreamValueSerde valueSerde;

  /**
   * Builds the ChangelogStreamManager based upon the provided {@link MetadataStore} that is instantiated.
   * Setting up a metadata store instance is expensive which requires opening multiple connections
   * and reading tons of information. Fully instantiated metadata store is taken as a constructor argument
   * to reuse it across different utility classes. Uses the {@link CoordinatorStreamValueSerde} to serialize
   * messages before reading/writing into metadata store.
   *
   * @param metadataStore an instance of {@link MetadataStore} to read/write the container locality.
   */
  public ChangelogStreamManager(MetadataStore metadataStore) {
    this.metadataStore = metadataStore;
    this.valueSerde = new CoordinatorStreamValueSerde(SetChangelogMapping.TYPE);
  }

  /**
   * Reads the taskName to changelog partition assignments from the {@link MetadataStore}.
   *
   * @return TaskName to change LOG partition mapping, or an empty map if there were no messages.
   */
  public Map<TaskName, Integer> readPartitionMapping() {
    LOG.debug("Reading changelog partition information");
    final Map<TaskName, Integer> changelogMapping = new HashMap<>();
    metadataStore.all().forEach((taskName, partitionIdAsBytes) -> {
      String partitionId = valueSerde.fromBytes(partitionIdAsBytes);
      LOG.debug("TaskName: {} is mapped to {}", taskName, partitionId);
      if (StringUtils.isNotBlank(partitionId)) {
        changelogMapping.put(new TaskName(taskName), Integer.valueOf(partitionId));
      }
    });
    return changelogMapping;
  }

  /**
   * Writes the taskName to changelog partition assignments to the {@link MetadataStore}.
   * @param changelogEntries a map of the taskName to the changelog partition to be written to
   *                         metadata store.
   */
  public void writePartitionMapping(Map<TaskName, Integer> changelogEntries) {
    LOG.debug("Updating changelog information with: ");
    for (Map.Entry<TaskName, Integer> entry : changelogEntries.entrySet()) {
      Preconditions.checkNotNull(entry.getKey());
      String taskName = entry.getKey().getTaskName();
      if (entry.getValue() != null) {
        String changeLogPartitionId = String.valueOf(entry.getValue());
        LOG.debug("TaskName: {} to Partition: {}", taskName, entry.getValue());
        metadataStore.put(taskName, valueSerde.toBytes(changeLogPartitionId));
      } else {
        LOG.debug("Deleting the TaskName: {}", taskName);
        metadataStore.delete(taskName);
      }
    }
    metadataStore.flush();
  }

  /**
   * Merges the previous and the new taskName to changelog partition mapping.
   * Writes the merged taskName to partition mapping to {@link MetadataStore}.
   * @param prevChangelogEntries The previous map of taskName to changelog partition.
   * @param newChangelogEntries The new map of taskName to changelog partition.
   */
  public void updatePartitionMapping(Map<TaskName, Integer> prevChangelogEntries,
      Map<TaskName, Integer> newChangelogEntries) {
    Map<TaskName, Integer> combinedEntries = new HashMap<>(newChangelogEntries);
    combinedEntries.putAll(prevChangelogEntries);
    writePartitionMapping(combinedEntries);
  }

  /**
   * Creates and validates the changelog streams of a samza job.
   *
   * @param config the configuration with changelog info.
   * @param maxChangeLogStreamPartitions the maximum number of changelog stream partitions to create.
   */
  public static void createChangelogStreams(Config config, int maxChangeLogStreamPartitions) {
    // Get changelog store config
    StorageConfig storageConfig = new StorageConfig(config);
    ImmutableMap.Builder<String, SystemStream> storeNameSystemStreamMapBuilder = new ImmutableMap.Builder<>();
    storageConfig.getStoreNames().forEach(storeName -> {
      Optional<String> changelogStream = storageConfig.getChangelogStream(storeName);
      if (changelogStream.isPresent() && StringUtils.isNotBlank(changelogStream.get())) {
        storeNameSystemStreamMapBuilder.put(storeName, StreamUtil.getSystemStreamFromNames(changelogStream.get()));
      }
    });
    Map<String, SystemStream> storeNameSystemStreamMapping = storeNameSystemStreamMapBuilder.build();

    // Get SystemAdmin for changelog store's system and attempt to create the stream
    SystemConfig systemConfig = new SystemConfig(config);
    storeNameSystemStreamMapping.forEach((storeName, systemStream) -> {
      // Load system admin for this system.
      SystemAdmin systemAdmin = systemConfig
          .getSystemFactories()
          .get(systemStream.getSystem())
          .getAdmin(systemStream.getSystem(), config, ChangelogStreamManager.class.getSimpleName());

      if (systemAdmin == null) {
        throw new SamzaException(String.format(
            "Error creating changelog. Changelog on store %s uses system %s, which is missing from the configuration.",
            storeName, systemStream.getSystem()));
      }

      StreamSpec changelogSpec =
          StreamSpec.createChangeLogStreamSpec(systemStream.getStream(), systemStream.getSystem(),
              maxChangeLogStreamPartitions);

      systemAdmin.start();

      if (systemAdmin.createStream(changelogSpec)) {
        LOG.info(String.format("created changelog stream %s.", systemStream.getStream()));
      } else {
        LOG.info(String.format("changelog stream %s already exists.", systemStream.getStream()));
      }
      systemAdmin.validateStream(changelogSpec);

      if (storageConfig.getAccessLogEnabled(storeName)) {
        String accesslogStream = storageConfig.getAccessLogStream(systemStream.getStream());
        StreamSpec accesslogSpec =
            new StreamSpec(accesslogStream, accesslogStream, systemStream.getSystem(), maxChangeLogStreamPartitions);
        systemAdmin.createStream(accesslogSpec);
        systemAdmin.validateStream(accesslogSpec);
      }

      systemAdmin.stop();
    });
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
        <function
            eval="('default',False,'warehouse_id', [('purchase.requisition', False)], ref('stock.warehouse0'), True, False, False, False, True)"
            id="purchase_default_set"
            model="ir.values"
            name="set"/>
    </data>
</openerp>


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--

 Copyright 2003 - 2014 The eFaps Team

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

 Author:          The eFaps Team
 Revision:        $Rev$
 Last Changed:    $Date$
 Last Changed By: $Author$

--><ui-menu xmlns="http://www.efaps.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.efaps.org/xsd http://www.efaps.org/xsd/eFaps_1.0.xsd">
    <uuid>381cdcd3-9c13-4042-bcc2-f8a773d09c60</uuid>
    <file-application>eFapsApp-Accounting</file-application>
    <file-revision>$Rev$</file-revision>
    <definition>
        <version-expression>(version==latest)</version-expression>
        <name>Accounting_ExternalVoucherTree_Doc_Menu</name>
        <childs>
            <child>Accounting_ExternalVoucherTree_Doc_Menu_Action</child>
        </childs>
    </definition>
</ui-menu>


text:
package com.twitter.cassie

import types._

/**
 * Implicit conversions for all of Cassie's special types.
 */
package object types {
  implicit def String2LexicalUUID(s: String): LexicalUUID = LexicalUUID(s)
  implicit def LexicalUUID2String(uuid: LexicalUUID): String = uuid.toString
}


text:
//
// (C) Copyright 2015 Martin E. Nordberg III
// Apache 2.0 License
//

package org.steamflake.core.domain.javamodel.api.elements;

/**
 * Mixin interface for elements that have a Java type.
 */
@SuppressWarnings( "InterfaceMayBeAnnotatedFunctional" )
public interface IJavaTyped {

    /** @return the type of this element. */
    IJavaType getType();

}


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>angular-date-format documentation</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	    <link rel="stylesheet" href="../styles/style.css">

            angular-date-format documentation
            <button type="button" class="btn btn-default btn-menu fa fa-bars" id="btn-menu"></button>

                <input type="text" placeholder="Type to search">

                        angular-date-format documentation

                        Getting started

                                        Overview

                                  README

                                        LICENSE

                                        TODO

                                Modules

                                    AppModule

                                    DateFormatModule

                                    DateFormatModule

                                    MdDateFormatModule

                                    MdDateFormatModule

                            Components

                                    AppComponent

                                    DateFormatComponent

                                    DateFormatComponent

                                    MdDateFormatComponent

                                    MdDateFormatComponent

                            Classes

                                    BaseDateFormatComponent

                                    BaseDateFormatComponent

                                    DateFormatModel

                                    DateFormatModel

                                    DateFormatValidator

                                    DateFormatValidator

                            Miscellaneous

                                  Enums

                                  Variables

                        Documentation coverage

                            Documentation generated using

                               angular-date-format documentation

                                   <input type="text" placeholder="Type to search">

                               Getting started

                                               Overview

                                         README

                                               LICENSE

                                               TODO

                                       Modules

                                           AppModule

                                           DateFormatModule

                                           DateFormatModule

                                           MdDateFormatModule

                                           MdDateFormatModule

                                   Components

                                           AppComponent

                                           DateFormatComponent

                                           DateFormatComponent

                                           MdDateFormatComponent

                                           MdDateFormatComponent

                                   Classes

                                           BaseDateFormatComponent

                                           BaseDateFormatComponent

                                           DateFormatModel

                                           DateFormatModel

                                           DateFormatValidator

                                           DateFormatValidator

                                   Miscellaneous

                                         Enums

                                         Variables

                               Documentation coverage

                                   Documentation generated using

Modules

AppModule

              <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="504pt" height="284pt"
 viewBox="0.00 0.00 504.00 284.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 280)">
<title>dependencies</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-280 500,-280 500,4 -4,4"/>
<text text-anchor="start" x="227.0091" y="-42.4" font-family="sans-serif" font-weight="bold" font-size="14.00" fill="#000000">Legend</text>
<polygon fill="#ffffb3" stroke="transparent" points="14,-10 14,-30 34,-30 34,-10 14,-10"/>
<text text-anchor="start" x="37.629" y="-15.4" font-family="sans-serif" font-size="14.00" fill="#000000">  Declarations</text>
<polygon fill="#8dd3c7" stroke="transparent" points="127,-10 127,-30 147,-30 147,-10 127,-10"/>
<text text-anchor="start" x="150.7251" y="-15.4" font-family="sans-serif" font-size="14.00" fill="#000000">  Module</text>
<polygon fill="#80b1d3" stroke="transparent" points="213,-10 213,-30 233,-30 233,-10 213,-10"/>
<text text-anchor="start" x="236.7812" y="-15.4" font-family="sans-serif" font-size="14.00" fill="#000000">  Bootstrap</text>
<polygon fill="#fdb462" stroke="transparent" points="310,-10 310,-30 330,-30 330,-10 310,-10"/>
<text text-anchor="start" x="333.6732" y="-15.4" font-family="sans-serif" font-size="14.00" fill="#000000">  Providers</text>
<polygon fill="#fb8072" stroke="transparent" points="406,-10 406,-30 426,-30 426,-10 406,-10"/>
<text text-anchor="start" x="429.7258" y="-15.4" font-family="sans-serif" font-size="14.00" fill="#000000">  Exports</text>
<g id="clust1" class="cluster">
<title>cluster_AppModule</title>
<polygon fill="none" stroke="#000000" stroke-dasharray="1,5" points="104,-70 104,-268 392,-268 392,-70 104,-70"/>
</g>
<g id="clust2" class="cluster">
<title>cluster_AppModule_declarations</title>
<polygon fill="none" stroke="#000000" points="262,-78 262,-130 384,-130 384,-78 262,-78"/>
</g>
<g id="clust4" class="cluster">
<title>cluster_AppModule_imports</title>
<polygon fill="none" stroke="#000000" points="112,-78 112,-130 254,-130 254,-78 112,-78"/>
</g>
<g id="clust6" class="cluster">
<title>cluster_AppModule_bootstrap</title>
<polygon fill="none" stroke="#000000" points="190,-208 190,-260 314,-260 314,-208 190,-208"/>
</g>

<g id="node1" class="node">
<title>AppComponent</title>
<polygon fill="#ffffb3" stroke="#000000" points="375.9399,-122 270.0601,-122 270.0601,-86 375.9399,-86 375.9399,-122"/>
<text text-anchor="middle" x="323" y="-99.8" font-family="Times,serif" font-size="14.00" fill="#000000">AppComponent</text>
</g>

<g id="node2" class="node">
<title>AppModule</title>
<polygon fill="#8dd3c7" stroke="#000000" points="293.6571,-187 290.6571,-191 269.6571,-191 266.6571,-187 210.3429,-187 210.3429,-151 293.6571,-151 293.6571,-187"/>
<text text-anchor="middle" x="252" y="-164.8" font-family="Times,serif" font-size="14.00" fill="#000000">AppModule</text>
</g>

<g id="edge1" class="edge">
<title>AppComponent->AppModule</title>
<path fill="none" stroke="#000000" d="M282.0544,-122.1061C282.0544,-122.1061 282.0544,-140.991 282.0544,-140.991"/>
<polygon fill="#000000" stroke="#000000" points="278.5544,-140.9909 282.0544,-150.991 285.5544,-140.991 278.5544,-140.9909"/>
</g>

<g id="node4" class="node">
<title>AppComponent </title>
<polygon fill="#80b1d3" stroke="#000000" points="306.439,-252 197.561,-252 197.561,-216 306.439,-216 306.439,-252"/>
<text text-anchor="middle" x="252" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">AppComponent </text>
</g>

<g id="edge3" class="edge">
<title>AppModule->AppComponent </title>
<path fill="none" stroke="#000000" stroke-dasharray="1,5" d="M252,-187.1061C252,-187.1061 252,-205.991 252,-205.991"/>
<polygon fill="#000000" stroke="#000000" points="248.5001,-205.9909 252,-215.991 255.5001,-205.991 248.5001,-205.9909"/>
</g>

<g id="node3" class="node">
<title>DateFormatModule</title>
<polygon fill="#8dd3c7" stroke="#000000" points="246.4159,-122 243.4159,-126 222.4159,-126 219.4159,-122 119.5841,-122 119.5841,-86 246.4159,-86 246.4159,-122"/>
<text text-anchor="middle" x="183" y="-99.8" font-family="Times,serif" font-size="14.00" fill="#000000">DateFormatModule</text>
</g>

<g id="edge2" class="edge">
<title>DateFormatModule->AppModule</title>
<path fill="none" stroke="#000000" d="M228.1897,-122.1061C228.1897,-122.1061 228.1897,-140.991 228.1897,-140.991"/>
<polygon fill="#000000" stroke="#000000" points="224.6898,-140.9909 228.1897,-150.991 231.6898,-140.991 224.6898,-140.9909"/>
</g>
</g>
</svg>

              <button id="zoom-in" class="btn btn-default btn-sm">Zoom in</button>
              <button id="reset" class="btn btn-default btn-sm">Reset</button>
              <button id="zoom-out" class="btn btn-default btn-sm">Zoom out</button>

        Info

        Source

File

            src/demo/app/app.module.ts

Declarations

                                AppComponent

Imports

                                    DateFormatModule

Bootstrap

                                AppComponent

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DateFormatModule } from 'angular-date-format';

import { AppComponent }  from './app.component';

@NgModule({
  imports:      [ BrowserModule, DateFormatModule],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

 results matching ""

No results matching ""


text:
<!DOCTYPE html>
<title>Design</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>

Classic

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Start on sign up

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Start on forgot password

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Don't allow sign up

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Don't allow forgot password

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Only allow log in

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Small buttons

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Two rows of small buttons

      Use an @auth.com email to enable SSO.

      Use an @rolodato.com email to enable HRD.

Classic

Sign up with request terms agreement

Enterprise

Single connection (google)

Enterprise

Single connection (office365)

Enterprise

Single connection (saml)

Enterprise

Multiple connections

      Use an @auth.com or @auth10.com email to enable SSO.

Corporate

Single connection

Corporate

Multiple, with and without domain

      Try an @rolodato.com email.

Corporate + Database

Mising domain for corporate

Kerberos

Database

Last Login

Database

Social

Classic

Custom Signup Field

      Use checkbox custom input