text:
/*
 * 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.
 */
package com.facebook.presto.decoder.json;

import com.facebook.airlift.json.JsonObjectMapperProvider;
import com.facebook.presto.decoder.DecoderTestColumnHandle;
import com.facebook.presto.spi.PrestoException;
import com.google.common.collect.ImmutableSet;
import org.testng.annotations.Test;

import static com.facebook.presto.common.type.DateTimeEncoding.packDateTimeWithZone;
import static com.facebook.presto.common.type.DateType.DATE;
import static com.facebook.presto.common.type.TimeType.TIME;
import static com.facebook.presto.common.type.TimeWithTimeZoneType.TIME_WITH_TIME_ZONE;
import static com.facebook.presto.common.type.TimeZoneKey.UTC_KEY;
import static com.facebook.presto.common.type.TimestampType.TIMESTAMP;
import static com.facebook.presto.common.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;
import static java.util.Collections.emptyMap;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestCustomDateTimeJsonFieldDecoder
{
    private final JsonFieldDecoderTester timestampTester = new JsonFieldDecoderTester("custom-date-time", "MM/yyyy/dd H:m:s");
    private final JsonFieldDecoderTester timestampWithTimeZoneTester = new JsonFieldDecoderTester("custom-date-time", "MM/yyyy/dd H:m:s Z");
    private final JsonFieldDecoderTester timeTester = new JsonFieldDecoderTester("custom-date-time", "mm:HH:ss");
    private final JsonFieldDecoderTester dateTester = new JsonFieldDecoderTester("custom-date-time", "MM/yyyy/dd");
    private final JsonFieldDecoderTester timeJustHourTester = new JsonFieldDecoderTester("custom-date-time", "HH");

    @Test
    public void testDecode()
    {
        timestampTester.assertDecodedAs("\"02/2018/19 9:20:11\"", TIMESTAMP, 1519032011000L);
        timestampWithTimeZoneTester.assertDecodedAs("\"02/2018/19 11:20:11 +02:00\"", TIMESTAMP, 1519032011000L);
        timestampTester.assertDecodedAs("\"02/2018/19 9:20:11\"", TIMESTAMP_WITH_TIME_ZONE, packDateTimeWithZone(1519032011000L, UTC_KEY));
        timestampWithTimeZoneTester.assertDecodedAs("\"02/2018/19 11:20:11 +02:00\"", TIMESTAMP_WITH_TIME_ZONE, packDateTimeWithZone(1519032011000L, UTC_KEY)); // TODO: extract TZ from pattern
        timeTester.assertDecodedAs("\"15:13:18\"", TIME, 47718000);
        timeJustHourTester.assertDecodedAs("\"15\"", TIME, 54000000);
        timeJustHourTester.assertDecodedAs("15", TIME, 54000000);
        timeTester.assertDecodedAs("\"15:13:18\"", TIME_WITH_TIME_ZONE, packDateTimeWithZone(47718000, UTC_KEY));
        dateTester.assertDecodedAs("\"02/2018/11\"", DATE, 17573);
    }

    @Test
    public void testDecodeNulls()
    {
        dateTester.assertDecodedAsNull("null", DATE);
        dateTester.assertMissingDecodedAsNull(DATE);

        timeTester.assertDecodedAsNull("null", TIME);
        timeTester.assertMissingDecodedAsNull(TIME);

        timeTester.assertDecodedAsNull("null", TIME_WITH_TIME_ZONE);
        timeTester.assertMissingDecodedAsNull(TIME_WITH_TIME_ZONE);

        timestampTester.assertDecodedAsNull("null", TIMESTAMP);
        timestampTester.assertMissingDecodedAsNull(TIMESTAMP);

        timestampTester.assertDecodedAsNull("null", TIMESTAMP_WITH_TIME_ZONE);
        timestampTester.assertMissingDecodedAsNull(TIMESTAMP_WITH_TIME_ZONE);
    }

    @Test
    public void testDecodeInvalid()
    {
        timestampTester.assertInvalidInput("1", TIMESTAMP, "could not parse value '1' as 'timestamp' for column 'some_column'");
        timestampTester.assertInvalidInput("{}", TIMESTAMP, "could not parse non-value node as 'timestamp' for column 'some_column'");
        timestampTester.assertInvalidInput("\"a\"", TIMESTAMP, "could not parse value 'a' as 'timestamp' for column 'some_column'");
        timestampTester.assertInvalidInput("\"15:13:18\"", TIMESTAMP, "could not parse value '15:13:18' as 'timestamp' for column 'some_column'");
        timestampTester.assertInvalidInput("\"02/2018/11\"", TIMESTAMP, "could not parse value '02/2018/11' as 'timestamp' for column 'some_column'");
    }

    @Test
    public void testInvalidFormatHint()
    {
        DecoderTestColumnHandle columnHandle = new DecoderTestColumnHandle(
                0,
                "some_column",
                TIMESTAMP,
                "mappedField",
                "custom-date-time",
                "XXMM/yyyy/dd H:m:sXX",
                false,
                false,
                false);
        assertThatThrownBy(() -> new JsonRowDecoderFactory(new JsonObjectMapperProvider().get()).create(emptyMap(), ImmutableSet.of(columnHandle)))
                .isInstanceOf(PrestoException.class)
                .hasMessageMatching("invalid joda pattern 'XXMM/yyyy/dd H:m:sXX' passed as format hint for column 'some_column'");
    }
}


text: <?php echo $content; ?>

redpajama_set_name: RedPajamaGithub


text:
<?php

declare(strict_types=1);

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles(): array
    {
        return [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new FSi\Bundle\TerytDatabaseBundle\FSiTerytDbBundle(),
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
        ];
    }

    public function registerContainerConfiguration(LoaderInterface $loader): void
    {
        $loader->load(sprintf('%s/config/config_%s.yml', __DIR__, $this->getEnvironment()));
    }

    public function getCacheDir(): string
    {
        return sys_get_temp_dir() . '/FSiTerytDbBundle/cache';
    }

    public function getLogDir(): string
    {
        return sys_get_temp_dir() . '/FSiTerytDbBundle/logs';
    }
}


text:
define(['ok/a', './locale!locales/not/exists'], function (D) {
	return 'p';
});


text:
<!--
id: 7027564458
link: http://tumblr.atmos.org/post/7027564458/why-we-chose-the-apache-license-opscode-com
slug: why-we-chose-the-apache-license-opscode-com
date: Tue Jun 28 2011 18:03:10 GMT-0700 (PDT)
publish: 2011-06-028
tags:
title: Why we chose the Apache License | Opscode.com
-->

Why we chose the Apache License | Opscode.com
=============================================

[http://www.opscode.com/blog/2009/08/11/why-we-chose-the-apache-license/](http://www.opscode.com/blog/2009/08/11/why-we-chose-the-apache-license/)


text:
De: LUIS

Para: Dirección

Asunto: Narco-Menudeo: Economía de la Aniquilación

Seguridad

Te comparto un extracto de un artículo. Hay quienes creen que el descenso en la edad del primer consumo está vinculado al narcomenudeo.

    "El narco-menudeo parece ser, en muchos casos, la etapa final de la adicción. Es la esencia de la multiplicación de la oferta. El propio consumidor ya en estado dependiente se convierte en eslabón de un negocio que comienza en una plantación o en un laboratorio de productos ilegales y termina en una isla tropical bancaria de lavado de activos pasando por diversas manos no exentas del poder y del control de las poblaciones".

    Fuente: OPRENAR. Narco – Menudeo: Economía de la Aniquilación. [En línea]. Fecha:  13 de marzo. Disponible en: https://oprenar.wordpress.com/2017/03/13/narco-menudeo-economia-de-la-aniquilacion


text:
#ifndef _SAIL_JOYSTICK_
#define _SAIL_JOYSTICK_

#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#endif

#include "MultiStdAfx.h"
//#include "Sail\SailLogReporter.h"
//#include "Rimlia\RimWindowBase.h"

#ifndef _SAIL_MACHINTYPE_CONSOLE_
#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#else
#include "host-win32\include\libpad.h"
#define LPDIRECTINPUT8 void*
#define LPDIRECTINPUTDEVICE8 void*
#define REFGUID const GUID&

struct DIJOYSTATE { BYTE buf[256]; };
struct DIMOUSESTATE { BYTE buf[256]; };

#endif

//#define _USE_DX_MOUSE_
#define _USE_DX_JOYSTICK_
#define _USE_DX_KEYBOARD_

#define AXIS_RANGE 1024
#define JOYSTICK_RANGE_MAX 1000
#define JOYSTICK_RANGE_MIN -1000

//BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCE* pdidoi,void *pContext);

//-------------------------------インスタンス
class CDirectInput {
protected:
static	LPDIRECTINPUT8		m_pDirectInput;
public:
	CDirectInput()						{ m_pDirectInput = NULL; }
	~CDirectInput()						{ Release(); }
static	LPDIRECTINPUT8&	GetInstance()	{ return m_pDirectInput; }
static		BOOL		Initialize		( HINSTANCE hInstance = NULL );
static		BOOL		Release();
};

class IInputBase {
public:
virtual	void*	GetInputState() = 0;
virtual	void*	GetLastInputState() = 0;
virtual	void	Poll( HWND hWnd = NULL ) = 0;
};

//-------------------------------デバイス基底クラス
class CDirectInputDeviceBase : public IInputBase/*, public CDirectXBase*/ {
public:
	LPDIRECTINPUTDEVICE8	m_pDevice;
	BOOL					m_bAcquired;
	string_t					m_DeviceName;
	DWORD					m_DeviceType;

	union{
		BYTE				m_KeyBuffer[256];
		DIMOUSESTATE		m_MouseData;
		DIJOYSTATE			m_JoyStickData;
	};
	union{
		BYTE				m_LastKeyBuffer[256];
		DIMOUSESTATE		m_LastMouseData;
		DIJOYSTATE			m_LastJoyStickData;
	};

public:
		CDirectInputDeviceBase()	{ m_pDevice = NULL; m_bAcquired = FALSE; }
//		~CDirectInputDeviceBase()	{ /*Release();*/ }

		string_t&	GetDeviceName()	{ return m_DeviceName; }
		BOOL	IsAcquired()	{ return m_bAcquired; }
		BOOL	Create( HWND hWnd, REFGUID guid, LPCTSTR DeviceName );
		BOOL	SetBufferSize(DWORD BufferSize);
		void	Acquire();
		void	Unaquire();
//		void	Release();
};

#ifndef _SAIL_MACHINTYPE_CONSOLE_

class CDirectInputKeyBoard : public CDirectInputDeviceBase {
public:
inline	void*	GetInputState()			{ return m_KeyBuffer; }
inline	void*	GetLastInputState()		{ return m_LastKeyBuffer; }
inline	void	Poll(HWND hWnd = NULL)	{ memcpy( m_LastKeyBuffer, m_KeyBuffer, 256); if( m_pDevice->GetDeviceState(256,&m_KeyBuffer) == DIERR_INPUTLOST) m_pDevice->Acquire(); }
};

class CDirectInputMouse : public CDirectInputDeviceBase {
public:
inline	void*	GetInputState()			{ return &m_MouseData; }
inline	void*	GetLastInputState()		{ return &m_LastMouseData; }
inline	void	Poll(HWND hWnd = NULL)	{ memcpy( &m_LastMouseData, &m_MouseData, sizeof(DIMOUSESTATE) ); if( m_pDevice->GetDeviceState(sizeof(DIMOUSESTATE),&m_MouseData) == DIERR_INPUTLOST) m_pDevice->Acquire(); }
};

#endif

class CDirectInputJoyStick : public CDirectInputDeviceBase {
protected:
	BOOL	m_bAttached;
	DWORD	m_Axes;
	DWORD	m_Buttons;

	BYTE	m_AxisData[4];		//※上下左右の順番で格納
	BYTE	m_LastAxisData[4];
public:
inline	BOOL	IsAttached()		{ return m_bAttached; }
inline	void*	GetInputState()		{ return &m_JoyStickData; }
inline	void*	GetLastInputState()	{ return &m_LastJoyStickData; }
inline	BYTE*	GetAxisData()		{ return m_AxisData; }
inline	BYTE*	GetLasrAxisData()	{ return m_LastAxisData; }
		void	GetCapabilities();
		void	Poll(HWND hWnd = NULL);
//inline	void	GetBufferData()					{ /*m_pDevice->GetDeviceData(DWORD cbObjectData,LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut,DWORD dwFlags);*/ }
		void	Clear();

};

static vector<CDirectInputJoyStick*>g_JoySticks;

#if 0

	g_pDirectInput->GetInstance()->EnumDevices( DI8DEVCLASS_GAMECTRL, EnumDirectInputDevicesCallback, &hWnd, DIEDFL_ALLDEVICES );

#ifdef _USE_DX_KEYBOARD_
	m_KeyBoard.Create( hWnd, GUID_SysKeyboard,"SysKeyboard" );
	m_KeyBoard.Acquire();
#endif

#ifdef _USE_DX_MOUSE_
	m_Mouse.Create( hWnd, pDirectInput->GetInstance(), GUID_SysMouse,"SysMouse" );
	m_Mouse.Acquire();
#endif

#endif

//HWNDのアドレスをpThisに
#ifndef _SAIL_MACHINTYPE_CONSOLE_
	BOOL CALLBACK EnumDirectInputDevicesCallback( LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pThis );
#endif

#endif


text:
#ifndef __SYNC_H__
#define __SYNC_H__

// STL headers
// C headers
#include <stdlib.h>
#include <string.h>
// Framework headers
// Library headers
#include <RF24Network_config.h>
// Project headers

class RF24Network;

/**
 * Synchronizes a shared set of variables between multiple nodes
 */

class Sync
{
private:
  RF24Network& network;
  uint8_t* app_data; /**< Application's copy of the data */
  uint8_t* internal_data; /**< Our copy of the data */
  size_t len; /**< Length of the data in bytes */
  uint16_t to_node; /**< The other node we're syncing with */

protected:
public:
  /**
   * Constructor
   *
   * @param _network Which network to syncrhonize over
   */
  Sync(RF24Network& _network): network(_network), app_data(NULL),
    internal_data(NULL), len(0), to_node(0)
  {
  }
  /**
   * Begin the object
   *
   * @param _to_node Which node we are syncing with
   */
  void begin(uint16_t _to_node)
  {
    to_node = _to_node;
  }
  /**
   * Declare the shared data set
   *
   * @param _data Location of shared data to be syncrhonized
   */
  template <class T>
  void register_me(T& _data)
  {
    app_data = reinterpret_cast<uint8_t*>(&_data);
    len = sizeof(_data);
    internal_data = reinterpret_cast<uint8_t*>(malloc(len));
    reset();
  }

  /**
   * Reset the internal copy of the shared data set
   */
  void reset(void)
  {
    memcpy(internal_data,app_data,len);
  }

  /**
   * Update the network and the shared data set
   */
  void update(void);
};

#endif // __SYNC_H__
// vim:cin:ai:sts=2 sw=2 ft=cpp


text:
package com.vr.ticketapp.service;

import com.google.common.base.Optional;
import com.vr.ticketapp.entity.SeatHoldEntity;
import com.vr.ticketapp.entity.SeatHoldEntity;

public interface TicketService {

/**

* The number of seats in the requested level that are neither held nor reserved

*

* @param venueLevel a numeric venue level identifier to limit the search

* @return the number of tickets available on the provided level

*/

 int numSeatsAvailable(Optional<Integer> venueLevel);

/**

* Find and hold the best available seats for a customer

*

* @param numSeats the number of seats to find and hold

* @param minLevel the minimum venue level

* @param maxLevel the maximum venue level

* @param customerEmail unique identifier for the customer

* @return a SeatHold object identifying the specific seats and related

information

*/

 SeatHoldEntity findAndHoldSeats(int numSeats, Optional<Integer> minLevel,

Optional<Integer> maxLevel, String customerEmail);

/**

* Commit seats held for a specific customer

*

* @param seatHoldId the seat hold identifier

* @param customerEmail the email address of the customer to which the seat hold

is assigned

* @return a reservation confirmation code

*/

String reserveSeats(int seatHoldId, String customerEmail);

}


text:
import os
import os.path, time
import string
import json
import shutil
import PIL
from optparse import OptionParser
from datetime import datetime
from PIL import Image, ImageOps, ImageFont, ImageDraw

def generate_original_icon(source):
    image = Image.open(source)
    image.save("../chrome/icon.png", "PNG")
    return image

def generate_base_icon(source, version, icon_type):
    image = Image.open(source)
    w,h = image.size

    font = ImageFont.truetype("Roboto/Roboto-bold.ttf", 25)

    draw = ImageDraw.Draw(image)
    box = [(20, 40), (122, 74)]
    draw.rectangle(box, fill=(50, 50, 50))
    draw.text((25, 40), version, (255, 255, 255), font=font)
    draw = ImageDraw.Draw(image)

    image.save("../chrome/icon.png", "PNG")

    return image

    print "Generated icon %s %s %s %d %d" % (source, version, icon_type, w, h)

def generate_resized_icon(base_icon, width, height):
    new_image = base_icon.resize((width, height), PIL.Image.ANTIALIAS)
    new_image.save("../chrome/icon_" + str(width) + ".png")

def generate_icon(source, version, icon_type):
    if icon_type == "beta":
        base_icon = generate_base_icon(source, version, icon_type)
        generate_resized_icon(base_icon, 128, 128)
        generate_resized_icon(base_icon, 48, 48)
        generate_resized_icon(base_icon, 32, 32)
        generate_resized_icon(base_icon, 16, 16)
    else:
        base_icon = generate_original_icon(source)
        generate_resized_icon(base_icon, 128, 128)
        generate_resized_icon(base_icon, 48, 48)
        generate_resized_icon(base_icon, 32, 32)
        generate_resized_icon(base_icon, 16, 16)

    return True

def main():
    print "Attach a version number to Postman app icon"

    parser = OptionParser(usage="Usage: %prog [options] filename")
    parser.add_option("-s", "--source", dest="source", help="Source icon PNG file")
    parser.add_option("-v", "--version", dest="version", help="Version number")
    parser.add_option("-t", "--type", dest="type", help="alpha/beta/final")

    (options, args) = parser.parse_args()

    source = options.source
    version = options.version
    icon_type = options.type

    generate_icon(source, version, icon_type)

if __name__ == "__main__":
    main()