text:
namespace google {
namespace protobuf {
namespace python {

// Owns a python object and decrements the reference count on destruction.
// This class is not threadsafe.
template <typename PyObjectStruct>
class ScopedPythonPtr {
 public:
  // Takes the ownership of the specified object to ScopedPythonPtr.
  // The reference count of the specified py_object is not incremented.
  explicit ScopedPythonPtr(PyObjectStruct* py_object = nullptr)
      : ptr_(py_object) {}

  // If a PyObject is owned, decrement its reference count.
  ~ScopedPythonPtr() { Py_XDECREF(ptr_); }

  // Deletes the current owned object, if any.
  // Then takes ownership of a new object without incrementing the reference
  // count.
  // This function must be called with a reference that you own.
  //   this->reset(this->get()) is wrong!
  //   this->reset(this->release()) is OK.
  PyObjectStruct* reset(PyObjectStruct* p = nullptr) {
    Py_XDECREF(ptr_);
    ptr_ = p;
    return ptr_;
  }

  // Releases ownership of the object without decrementing the reference count.
  // The caller now owns the returned reference.
  PyObjectStruct* release() {
    PyObject* p = ptr_;
    ptr_ = nullptr;
    return p;
  }

  PyObjectStruct* get() const { return ptr_; }

  PyObject* as_pyobject() const { return reinterpret_cast<PyObject*>(ptr_); }

  // Increments the reference count of the current object.
  // Should not be called when no object is held.
  void inc() const { Py_INCREF(ptr_); }

  // True when a ScopedPyObjectPtr and a raw pointer refer to the same object.
  // Comparison operators are non reflexive.
  bool operator==(const PyObjectStruct* p) const { return ptr_ == p; }
  bool operator!=(const PyObjectStruct* p) const { return ptr_ != p; }

 private:
  PyObjectStruct* ptr_;

  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ScopedPythonPtr);
};

typedef ScopedPythonPtr<PyObject> ScopedPyObjectPtr;

}  // namespace python
}  // namespace protobuf
}  // namespace google
#endif  // GOOGLE_PROTOBUF_PYTHON_CPP_SCOPED_PYOBJECT_PTR_H__


text:
layout: post
title: Scheduling of AWS Spot instances
---

Outdated...

At Small Town Heroes we recently started scheduling our Auto Scaling Groups on our staging environment to remove unnecessary costs. To further decrease these costs we decided to start using Spot Instances.

Amazon recently introduced the concept of these spot instances which let's you bid a certain price for an EC2 instance for you to use. These Spot instances are basically unused capacity they are opening up for us to use.

But as Amazon has not yet implemented a scheduling feature for these instances we decided to write a simple Lambda function to do it for us. Combining AWS Cloudwatch rules with the following function gets the job done.

{% highlight js %}
const AWS = require('aws-sdk');
const _ = require('lodash');
const ec2 = new AWS.EC2();

exports.getTimeFromEvent = event => {
    return new Promise((resolve, reject) => {
        if (event.time) {
            const date = new Date(event.time);
            resolve(date.getHours());
        }
        else console.error('No time found in event');
    });
}

exports.getSpotInstanceRequest = time => {
    return new Promise((resolve, reject) => {
        const params = {};
        ec2.describeSpotInstanceRequests(params, (err, data) => {
            if (err) reject(err);
            const requests = _.filter(data.SpotInstanceRequests, i => i.LaunchSpecification.IamInstanceProfile.Name.split('-')[0] === 'foo' || i.LaunchSpecification.IamInstanceProfile.Name.split('-')[0] === 'bar');
            const names = _.map(requests, i => i.LaunchSpecification.IamInstanceProfile.Name);
            const tags = _.flatten(_.map(requests, i => i.Tags));
            const ids = _.map(tags, i => i.Value);
            resolve({ ids, time, names });
        });
    });
}

exports.modifySpotInstances = request => {
    return new Promise((resolve, reject) => {
        let check = [];
        _.forEach(request.ids, (id, index) => {
            if (check.indexOf(id) < 0) {
                const count = ((request.names[index].split('-')[0] === 'foo') ? process.env.FOO_SPOT_INSTANCE_COUNT : process.env.BAR_SPOT_INSTANCE_COUNT);
                const capacity = ((request.time === 6) ? count : 0);
                const params = {
                    SpotFleetRequestId: id,
                    TargetCapacity: capacity
                };
                ec2.modifySpotFleetRequest(params, (err, data) => {
                    if (err) reject(err);
                    resolve(data);
                });
                check.push(id);
            }
        });
    });
}
{% endhighlight %}

{% highlight js %}
exports.handle = (event, context) => {
    instance.getTimeFromEvent(event)
    .then(instance.getSpotInstanceRequest)
    .then(instance.modifySpotInstances)
    .catch(err => {
        console.error(err);
    });
}
{% endhighlight %}

redpajama_set_name: RedPajamaGithub


text:
from django.core.urlresolvers import reverse
from tastypie import authorization
from tastypie.authentication import MultiAuthentication

from crits.events.event import Event
from crits.events.handlers import add_new_event
from crits.core.api import CRITsApiKeyAuthentication, CRITsSessionAuthentication
from crits.core.api import CRITsSerializer, CRITsAPIResource

from crits.vocabulary.events import EventTypes

class EventResource(CRITsAPIResource):
    """
    Class to handle everything related to the Event API.

    Currently supports GET and POST.
    """

    class Meta:
        object_class = Event
        allowed_methods = ('get', 'post', 'patch')
        resource_name = "events"
        authentication = MultiAuthentication(CRITsApiKeyAuthentication(),
                                             CRITsSessionAuthentication())
        authorization = authorization.Authorization()
        serializer = CRITsSerializer()

    def get_object_list(self, request):
        """
        Use the CRITsAPIResource to get our objects but provide the class to get
        the objects from.

        :param request: The incoming request.
        :type request: :class:`django.http.HttpRequest`
        :returns: Resulting objects in the specified format (JSON by default).
        """

        return super(EventResource, self).get_object_list(request, Event)

    def obj_create(self, bundle, **kwargs):
        """
        Handles creating Events through the API.

        :param bundle: Bundle containing the information to create the Event.
        :type bundle: Tastypie Bundle object.
        :returns: HttpResponse.
        """

        analyst = bundle.request.user.username
        title = bundle.data.get('title', None)
        description = bundle.data.get('description', None)
        event_type = bundle.data.get('event_type', None)
        source = bundle.data.get('source', None)
        method = bundle.data.get('method', None)
        reference = bundle.data.get('reference', None)
        date = bundle.data.get('date', None)
        bucket_list = bundle.data.get('bucket_list', None)
        ticket = bundle.data.get('ticket', None)

        content = {'return_code': 0,
                   'type': 'Event'}
        if not title or not event_type or not source or not description:
            content['message'] = 'Must provide a title, event_type, source, and description.'
            self.crits_response(content)
        if event_type not in EventTypes.values():
            content['message'] = 'Not a valid Event Type.'
            self.crits_response(content)

        result = add_new_event(title,
                               description,
                               event_type,
                               source,
                               method,
                               reference,
                               date,
                               analyst,
                               bucket_list,
                               ticket)

        if result.get('message'):
            content['message'] = result.get('message')
        content['id'] = result.get('id', '')
        if result.get('id'):
            url = reverse('api_dispatch_detail',
                          kwargs={'resource_name': 'events',
                                  'api_name': 'v1',
                                  'pk': result.get('id')})
            content['url'] = url
        if result['success']:
            content['return_code'] = 0
        self.crits_response(content)


text:
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->

    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8088
    -->
    <!-- hon: why the redirectPort="8443" ??? -->
    <!--
    <Connector port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- hon: try without redirectPort="8443" ??? -->
    <Connector executor="tomcatThreadPool"
               port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000" />

    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="honsys.com">
      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>
      <!-- hon: all currently leased domain-names (note 1and1 supports 5 sub-domains each:
           barterbot.biz
           bureacracy.org bureacracy.biz bureacracy.com
           eviz.biz geo.eviz.biz invest.eviz.biz sci.eviz.biz
           honhedge.com
           honsys.com
           honsys.net ci.honsys.net mom.honsys.net scm.honsys.net solr.honsys.net
           jaxanasa.net
           redmjne.org
           90ghz.net
           ircobe.net
           innerplanets.org
           earthlimb.net
           planetlimb.net
      -->
      <Host name="honsys.com" appBase="domains/honsys.com" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="honsys.com_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="honsys.net" appBase="domains/honsys.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="honsys.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="ci.honsys.net" appBase="domains/ci.honsys.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="ci.honsys.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="mom.honsys.net" appBase="domains/mom.honsys.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="mom.honsys.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="scm.honsys.net" appBase="domains/scm.honsys.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="scm.honsys.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="solr.honsys.net" appBase="domains/solr.honsys.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="solr.honsys.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="eviz.biz"  appBase="domains/eviz.biz" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="eviz.biz_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="sci.eviz.biz"  appBase="domains/sci.eviz.biz" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="sci.eviz.biz_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="geo.eviz.biz"  appBase="domains/geo.eviz.biz" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="geo.eviz.biz_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="invest.eviz.biz"  appBase="domains/invest.eviz.biz" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="invest.eviz.biz_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="honhedge.com"  appBase="domains/honhedge.com" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes: all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="honhedge.com_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="90ghz.net"  appBase="domains/90ghz.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="90ghz.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="ircobe.net"  appBase="domains/ircobe.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="ircobe.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="redmjne.org"  appBase="domains/redmjne.org" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="redmjne.org_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="jaxanasa.net"  appBase="domains/jaxanasa.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="jaxanasa.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="innerplanets.org"  appBase="domains/innerplanets.org" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="innerplanets.org_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
      <Host name="earthlimb.net"  appBase="domains/earthlimb.net" unpackWARs="true" autoDeploy="true">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="earthlimb.net_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Listener className="org.apache.catalina.startup.UserConfig"
                  homeBase="/home" directoryName="public_html"
                  userClass="org.apache.catalina.startup.HomesUserDatabase" />
      </Host>
    </Engine>
  </Service>
</Server>


text:
order: 7
zh-CN:
	title: 大量数据
	placeholder: 选择一项
en-US:
	title: Tons of options
	placeholder: Select an option..
---

```js
import { Select } from 'zent';
import { FixedSizeList } from 'react-window';

const OPTIONS = Array(100000)
	.fill(null)
	.map((_, index) => ({
		key: String(index),
		text: `Option ${index}`,
	}));

function renderOptionList(options, renderOption) {
	return (
		<FixedSizeList
			height={8.5 * 32}
			itemCount={options.length}
			itemSize={32}
			width={240}
		>
			{({ index, style }) => (
				<div style={style}>{renderOption(options[index], index)}</div>
			)}
		</FixedSizeList>
	);
}

ReactDOM.render(
	<Select clearable options={OPTIONS} placeholder="{i18n.placeholder}" renderOptionList={renderOptionList} />,
	mountNode
);
```


text:
package bam.sample.config;

import org.jbox2d.callbacks.ContactImpulse;
import org.jbox2d.callbacks.ContactListener;
import org.jbox2d.collision.Manifold;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.World;
import org.jbox2d.dynamics.contacts.Contact;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WorldConfig {

    @Bean
    World world() {
        final Vec2 gravity = new Vec2(0.0f, -9.8f);
        final World world = new World(gravity);
        world.setContactListener(new ContactListener() {
            @Override
            public void beginContact(Contact contact) {
            }

            @Override
            public void endContact(Contact contact) {
            }

            @Override
            public void preSolve(Contact contact, Manifold oldManifold) {
            }

            @Override
            public void postSolve(Contact contact, ContactImpulse impulse) {
            }
        });
        world.setAllowSleep(true);
        return world;
    }
}


text:
<?php

namespace Omnipay\PayPal;

use Omnipay\Tests\GatewayTestCase;

class GatewayTest extends GatewayTestCase
{
    public $gateway;

    private $purse          = 'purse@company.co';
    private $secret         = 'sDf#$Sdf#$%';
    private $testMode       = true;
    private $transactionId  = 'sadf2345asf';
    private $description    = 'Test completePurchase description';
    private $currency       = 'USD';
    private $amount         = '12.46';

    public function setUp()
    {
        parent::setUp();

        $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest());
        $this->gateway->setPurse($this->purse);
        $this->gateway->setSecret($this->secret);
        $this->gateway->setTestMode($this->testMode);
    }

    public function testGateway()
    {
        $this->assertSame($this->purse,     $this->gateway->getPurse());
        $this->assertSame($this->secret,    $this->gateway->getSecret());
        $this->assertSame($this->testMode,  $this->gateway->getTestMode());
    }

    public function testCompletePurchase()
    {
        $request = $this->gateway->completePurchase([
            'transactionId' => $this->transactionId,
        ]);

        $this->assertSame($this->purse,         $request->getPurse());
        $this->assertSame($this->secret,        $request->getSecret());
        $this->assertSame($this->testMode,      $request->getTestMode());
        $this->assertSame($this->transactionId, $request->getTransactionId());
    }

    public function testPurchase()
    {
        $request = $this->gateway->purchase([
            'transactionId' => $this->transactionId,
            'description'   => $this->description,
            'currency'      => $this->currency,
            'amount'        => $this->amount,
        ]);

        $this->assertSame($this->transactionId, $request->getTransactionId());
        $this->assertSame($this->description,   $request->getDescription());
        $this->assertSame($this->currency,      $request->getCurrency());
        $this->assertSame($this->amount,        $request->getAmount());
    }
}


text:
import Register from './../../src/register';

describe('register module', () => {
  const register = new Register();

  let todo = {
    title: 'one todo',
    arr: [
      {
        todo: '1'
      },
      {
        todo: '2'
      }
    ]
  };

  let oldValue, newValue, combine;
  const callbackNormal = (old, now) => {
    oldValue = old;
    newValue = now;
  };
  const callbackCombine = (old, now) => {
    combine = `${old} is now ${now}`;
  };

  register.regist(todo, 'title', callbackNormal);
  register.regist(todo, 'title', callbackCombine);
  register.regist(todo, ['arr', '1'], callbackNormal);
  register.regist(todo, ['arr', 1], callbackCombine);
  register.build();

  describe('#callbackArray', () => {
    it('回调函数数组', (done) => {
      todo.title = 'observer test';
      oldValue.should.be.exactly('one todo');
      newValue.should.be.exactly('observer test');
      combine.should.be.exactly('one todo is now observer test')
      done();
    });
    it('作为数组的参数', (done) => {
      todo.arr[1].todo = '3';
      oldValue.should.be.exactly('2');
      newValue.should.be.exactly('3');
      combine.should.be.exactly('2 is now 3')
      done();
    })
  });
})


text:
{% extends "base.html" %}

{% block content %}

Página não encontrada

Não foi possível encontrar a página solicitada.

        Voltar à página inicial.

{% endblock %}


text:
package net.umask.common.base.query;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
public class QueryServiceImpl implements QueryService {

    @Autowired
    SessionFactory sessionFactory;

    public <R> R executeQuery(Query<R> query) {
        return query.execute(sessionFactory.getCurrentSession());
    }
}


text:
behat_for_php_workshop
======================


text:
package com.tle.core.qti.dao.impl;

import com.tle.annotation.NonNullByDefault;
import com.tle.annotation.Nullable;
import com.tle.beans.item.Item;
import com.tle.common.beans.exception.NotFoundException;
import com.tle.common.institution.CurrentInstitution;
import com.tle.common.qti.entity.QtiAssessmentTest;
import com.tle.core.guice.Bind;
import com.tle.core.hibernate.dao.GenericInstitionalDaoImpl;
import com.tle.core.qti.dao.QtiAssessmentTestDao;
import java.util.List;
import javax.inject.Singleton;
import org.hibernate.criterion.Restrictions;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/** @author aholland */
@SuppressWarnings("nls")
@NonNullByDefault
@Bind(QtiAssessmentTestDao.class)
@Singleton
public class QtiAssessmentTestDaoImpl extends GenericInstitionalDaoImpl<QtiAssessmentTest, Long>
    implements QtiAssessmentTestDao {
  public QtiAssessmentTestDaoImpl() {
    super(QtiAssessmentTest.class);
  }

  @Override
  public QtiAssessmentTest getByUuid(String uuid) {
    final QtiAssessmentTest test = findByUuid(uuid);
    if (test == null) {
      throw new NotFoundException("Cannot find test with uuid " + uuid);
    }
    return test;
  }

  @Nullable
  @Override
  public QtiAssessmentTest findByUuid(String uuid) {
    final QtiAssessmentTest test =
        findByCriteria(
            Restrictions.eq("institution", CurrentInstitution.get()),
            Restrictions.eq("uuid", uuid));
    return test;
  }

  @Override
  public QtiAssessmentTest findByItem(Item item) {
    final QtiAssessmentTest test = findByCriteria(Restrictions.eq("item", item));
    return test; // NOSONAR (keeping local var for readability)
  }

  @Override
  public QtiAssessmentTest findByItemId(long itemId) {
    final QtiAssessmentTest test = findByCriteria(Restrictions.eq("item.id", itemId));
    return test; // NOSONAR (keeping local var for readability)
  }

  @SuppressWarnings("unchecked")
  private List<QtiAssessmentTest> listAll() {
    return getHibernateTemplate()
        .find(
            "FROM QtiAssessmentTest WHERE institution = ?",
            new Object[] {CurrentInstitution.get()});
  }

  @Transactional(propagation = Propagation.MANDATORY)
  @Override
  public void deleteAll() {
    for (QtiAssessmentTest test : listAll()) {
      delete(test);
      flush();
      clear();
    }
  }
}


text:
template <class T>
void test_is_standard_layout()
{
    static_assert( std::is_standard_layout<T>::value, "");
    static_assert( std::is_standard_layout<const T>::value, "");
    static_assert( std::is_standard_layout<volatile T>::value, "");
    static_assert( std::is_standard_layout<const volatile T>::value, "");
#if TEST_STD_VER > 14
    static_assert( std::is_standard_layout_v<T>, "");
    static_assert( std::is_standard_layout_v<const T>, "");
    static_assert( std::is_standard_layout_v<volatile T>, "");
    static_assert( std::is_standard_layout_v<const volatile T>, "");
#endif
}

template <class T>
void test_is_not_standard_layout()
{
    static_assert(!std::is_standard_layout<T>::value, "");
    static_assert(!std::is_standard_layout<const T>::value, "");
    static_assert(!std::is_standard_layout<volatile T>::value, "");
    static_assert(!std::is_standard_layout<const volatile T>::value, "");
#if TEST_STD_VER > 14
    static_assert(!std::is_standard_layout_v<T>, "");
    static_assert(!std::is_standard_layout_v<const T>, "");
    static_assert(!std::is_standard_layout_v<volatile T>, "");
    static_assert(!std::is_standard_layout_v<const volatile T>, "");
#endif
}

template <class T1, class T2>
struct pair
{
    T1 first;
    T2 second;
};

int main(int, char**)
{
    test_is_standard_layout<int> ();
    test_is_standard_layout<int[3]> ();
    test_is_standard_layout<pair<int, double> > ();

    test_is_not_standard_layout<int&> ();

  return 0;
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Mes boissons chaudes</title>

  <meta name="theme-color" content="#ffc40d">
  <meta name="msapplication-config" content="static/icons/browserconfig.xml">

  <link href="static/css/demo.css" rel="stylesheet"/>

  <link rel="mask-icon" href="static/icons/beverages-pinned-tab.svg" color="#ffc40d">

    Beverages.js by cyChop
    - See on Github
    - How-to and developer doc


text:
class AutoSigninFirstRunDialogAndroidTest
    : public ChromeRenderViewHostTestHarness {
 public:
  AutoSigninFirstRunDialogAndroidTest() {}

  AutoSigninFirstRunDialogAndroidTest(
      const AutoSigninFirstRunDialogAndroidTest&) = delete;
  AutoSigninFirstRunDialogAndroidTest& operator=(
      const AutoSigninFirstRunDialogAndroidTest&) = delete;

  ~AutoSigninFirstRunDialogAndroidTest() override {}

  PrefService* prefs();

 protected:
  AutoSigninFirstRunDialogAndroid* CreateDialog();
};

AutoSigninFirstRunDialogAndroid*
AutoSigninFirstRunDialogAndroidTest::CreateDialog() {
  return new AutoSigninFirstRunDialogAndroid(web_contents());
}

PrefService* AutoSigninFirstRunDialogAndroidTest::prefs() {
  Profile* profile =
      Profile::FromBrowserContext(web_contents()->GetBrowserContext());
  return profile->GetPrefs();
}

TEST_F(AutoSigninFirstRunDialogAndroidTest,
       CheckPrefValueAfterFirstRunMessageWasShown) {
  prefs()->SetBoolean(
      password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false);
  AutoSigninFirstRunDialogAndroid* dialog = CreateDialog();
  dialog->Destroy(base::android::AttachCurrentThread(), nullptr);
  EXPECT_FALSE(prefs()->GetBoolean(
      password_manager::prefs::kWasAutoSignInFirstRunExperienceShown));
}

TEST_F(AutoSigninFirstRunDialogAndroidTest,
       CheckResetOfPrefAfterFirstRunMessageWasShownOnTurnOkClicked) {
  base::HistogramTester histogram_tester;
  prefs()->SetBoolean(
      password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false);
  prefs()->SetBoolean(password_manager::prefs::kCredentialsEnableAutosignin,
                      true);
  AutoSigninFirstRunDialogAndroid* dialog = CreateDialog();
  dialog->OnOkClicked(base::android::AttachCurrentThread(), nullptr);
  dialog->Destroy(base::android::AttachCurrentThread(), nullptr);
  EXPECT_TRUE(prefs()->GetBoolean(
      password_manager::prefs::kWasAutoSignInFirstRunExperienceShown));
  EXPECT_TRUE(prefs()->GetBoolean(
      password_manager::prefs::kCredentialsEnableAutosignin));
  histogram_tester.ExpectUniqueSample(
      "PasswordManager.AutoSigninFirstRunDialog",
      password_manager::metrics_util::AUTO_SIGNIN_OK_GOT_IT, 1);
}

TEST_F(AutoSigninFirstRunDialogAndroidTest,
       CheckResetOfPrefAfterFirstRunMessageWasShownOnTurnOffClicked) {
  base::HistogramTester histogram_tester;
  prefs()->SetBoolean(
      password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false);
  prefs()->SetBoolean(password_manager::prefs::kCredentialsEnableAutosignin,
                      true);
  AutoSigninFirstRunDialogAndroid* dialog = CreateDialog();
  dialog->OnTurnOffClicked(base::android::AttachCurrentThread(), nullptr);
  dialog->Destroy(base::android::AttachCurrentThread(), nullptr);
  EXPECT_TRUE(prefs()->GetBoolean(
      password_manager::prefs::kWasAutoSignInFirstRunExperienceShown));
  EXPECT_FALSE(prefs()->GetBoolean(
      password_manager::prefs::kCredentialsEnableAutosignin));
  histogram_tester.ExpectUniqueSample(
      "PasswordManager.AutoSigninFirstRunDialog",
      password_manager::metrics_util::AUTO_SIGNIN_TURN_OFF, 1);
}


text:
package codingdojo;

import org.junit.Test;

import java.util.List;

import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;

public class DiamondTest{

    @Test
    public void shouldPrintA() throws Exception {
        Diamond diamond = new Diamond('A');

        String result = diamond.print();

        assertThat(result).isEqualTo("A\n");
    }

    @Test
    public void shouldPrintUpperPart() throws Exception {
        Diamond diamond = new Diamond('C');

        ResultDiamond result = new ResultDiamond(diamond.print());

        assertThat(result.line(0)).isEqualTo("  A");
        assertThat(result.line(1)).isEqualTo(" B B");
        assertThat(result.line(2)).isEqualTo("C   C");
    }

    @Test
    public void shouldPrintDiamond() throws Exception {
        Diamond diamond = new Diamond('C');

        ResultDiamond result = new ResultDiamond(diamond.print());

        assertThat(result.line(0)).isEqualTo("  A");
        assertThat(result.line(1)).isEqualTo(" B B");
        assertThat(result.line(2)).isEqualTo("C   C");
        assertThat(result.line(3)).isEqualTo(" B B");
        assertThat(result.line(4)).isEqualTo("  A");
    }

    @Test
    public void testName() throws Exception {

        System.out.printf(new Diamond('Z').print());

    }

    private class ResultDiamond {

        private final List<String> lines;

        public ResultDiamond(String result) {
            lines = asList(result.split("\n"));
        }

        public String line(int i) {
            return lines.get(i);
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta content="" name="description" />
    <meta content="Coda 1 Ltd" name="author" />
    <title>Velocity-Velocity placement agency</title>
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800,400italic' rel='stylesheet' type='text/css'>
    <?php
    echo link_tag('assets/css/font-awesome.min.css');
    echo link_tag('assets/css/bootstrap.min.css');
    echo link_tag('assets/css/rs-style.css');
    echo link_tag('assets/css/settings.css');
    echo link_tag('assets/css/style-metronic.css');
    echo link_tag('assets/css/style.css');
    echo link_tag('assets/css/blue.css');
    echo link_tag('assets/css/style-responsive.css');
    echo link_tag('assets/css/custom.css');
    ?>
    <link rel="shortcut icon" href="favicon.ico" />

            <button class="navbar-toggle btn navbar-btn" data-toggle="collapse" data-target=".navbar-collapse">

            </button>
            <a class="navbar-brand logo-v1" href="<?php echo base_url('');?>">
                <img src="<?php echo base_url('assets/img/logo_1.png');?>" id="logoimg" alt="">

                    <a href="<?php echo base_url('');?>">
                        Home

                    <a href="<?php echo base_url('about-us');?>">
                        About us

                    <a href="<?php echo base_url('services')?>">
                        Services

                    <a href="<?php echo base_url('franchise');?>">
                        Franchise

                    <a href="<?php echo base_url('clients')?>">
                        Clients

                    <a href="<?php echo base_url('placements')?>">
                        Placements

                    <a href="<?php echo base_url('contact-us');?>">
                        Contact Us

                    <a href="<?php echo base_url('register')?>">
                        Register

Velocity Placement Services - Admin Panel

<a href="<?php echo base_url('');?>">Home

Admin Panel

                    <img src="<?php echo base_url('assets/img/topbanners/register.png');?>" class="img img-responsive">

Admin Manage Branch office

                <form class="horizontal-form margin-bottom-40" role="form" method="post">

                        Branch Office Name*

                            <input type="text" class="form-control" name="branch_office_name" id="branch_office_name"/>

                        Location*

                            <select class="form-control" name="location" id="location">
                                <option value="">----Select----</option>
                                <option value="Belongs to Mumbai">Branch office Mumbai</option>
                                <option value="Belongs to Pune">Branch office Pune</option>
                            </select>

                        <button type="button" class="btn btn-default theme-btn" name="btn-save-branch" id="btn-save-branch"> Save Branch </button>
                        <button type="button" class="btn btn-default">Cancel</button>

                </form>

                    2016 © Developed By PrimeValue ALL Rights Reserved.

<a href="<?php echo 'uk.linkedin.com/in/';?>">

<?php
echo script_tag('assets/js/jquery-1.10.2.min.js');
echo script_tag('assets/js/bootstrap.min.js');
echo script_tag('assets/js/jquery-migrate-1.2.1.min.js');
echo script_tag('assets/js/hover-dropdown.js');
echo script_tag('assets/js/back-to-top.js');
echo script_tag('assets/js/jquery.fancybox.pack.js');
//echo script_tag('assets/js/app.js');
echo script_tag('assets/js/index.js');
?>


text:
'use strict';

var path = require('path');
var conf = {
    paths: {
        src: 'src',
        spec: 'spec',
        bower: 'bower_components'
    }
};

module.exports = function(config) {

  var configuration = {
    files: [
        path.join(conf.paths.bower, '/angular/angular.js'),
        path.join(conf.paths.bower, '/angular-mocks/angular-mocks.js'),
        path.join(conf.paths.src, '/module.js'),
        path.join(conf.paths.src, '/service.js'),
        path.join(conf.paths.src, '/directive.js'),
        path.join(conf.paths.spec, '/*.js')
    ],

    singleRun: true,

    autoWatch: false,

    frameworks: ['jasmine'],

    browsers : ['PhantomJS'],

    plugins : [
      'karma-phantomjs-launcher',
      'karma-angular-filesort',
      'karma-jasmine'
    ],
  };

  config.set(configuration);
};


text:
% Template:     Informe LaTeX
% Documento:    Funciones para insertar elementos
% Versión:      DEV
% Codificación: UTF-8
%
% Autor: Pablo Pizarro R.
%        pablo@ppizarror.com
%
% Manual template: [https://latex.ppizarror.com/informe]
% Licencia MIT:    [https://opensource.org/licenses/MIT]

% Insertar párrafo
\newcommand{\newp}{%
	\hbadness=10000 \vspace{\baselinestretch\baselineskip} \par%
}

% Crea un salto de columna en el entorno multicol
\ifthenelse{\isundefined{\newcolumn}}{
	\newcommand{\newcolumn}{%
		\checkinsidemulticol\vfill\null\columnbreak%
	}
}{
	\renewcommand{\newcolumn}{%
		\checkinsidemulticol\vfill\null\columnbreak%
	}
}

% Salto de página en entorno multicol
\newcommand{\newpagemulticol}{%
	\newcolumn\newcolumn\clearpage%
}

% Redimensiona un ítem
% 	#1	Tamaño del nuevo objeto (En linewidth)
%	#2	Objeto a redimensionar
\newcommand{\itemresize}[2]{%
	\emptyvarerr{\itemresize}{#1}{Tamano del nuevo objeto no definido}%
	\emptyvarerr{\itemresize}{#2}{Objeto a redimensionar no definido}%
	\resizebox{#1\linewidth}{!}{#2}%
}

% Crea una página vacía sin header o footer
\newcommand{\insertemptypage}{%
	\clearpage%
	\thispagestyle{empty}%
	\null%
	\clearpage%
}

% Inserta una página vacía, aunque conserva header, footer y numeración
\newcommand{\insertblankpage}{%
	\clearpage%
	\null%
	\clearpage%
}

% Función personalizada \cleardoublepage
\def\corecleardoublepage {%
	\clearpage %
	\ifthenelse{\equal{\GLOBALtwoside}{true}}{%
		\ifodd\thepage %
		\else%
			\emptypagespredocformat%
		\fi%
	}{}%
}

% Ejecuta una función dependiendo si la página es par o impar
%	#1	Par
%	#2	Impar
\newcommand{\coretriggeronpage}[2]{%
	\ifthenelse{\isodd{\value{templatePageCounter}}}{%
		#2%
	}{%
		#1%
	}%
}

% Añade un archivo pdf con el header
%	#1	Parámetros (opcional)
%	#2	Nombre del archivo pdf
\newcommand{\includehfpdf}[2][]{%
	\includepdf[pagecommand={\pagestyle{fancy}},#1]{#2}%
}

% Añade un archivo pdf con el header
%	#1	Parámetros (opcional)
%	#2	Nombre del archivo pdf
\newcommand{\includefullhfpdf}[2][]{%
	\includepdf[pages=-,pagecommand={\pagestyle{fancy}},#1]{#2}%
}

% Inserta un texto entre comillas
%	#1 	Texto
\newcommand{\quotes}[1]{%
	\enquote*{#1}%
}

% Inserta un texto entre comillas y negrita
%	#1 	Texto
\newcommand{\quotesbf}[1]{%
	\quotes{\textbf{#1}}%
}

% Inserta un texto entre comillas e itálico
%	#1 	Texto
\newcommand{\quotesit}[1]{%
	\quotes{\textit{#1}}%
}

% Inserta un texto entre comillas y typewriter
%	#1 	Texto
\newcommand{\quotesttt}[1]{%
	\quotes{\texttt{#1}}%
}

% Inserta un texto entre comillas dobles
%	#1 	Texto
\newcommand{\doublequotes}[1]{%
	\enquote{#1}%
}

% Inserta una cita con texto elevado
%	#1	Cita
\newcommand{\scite}[1]{%
	\textsuperscript{\cite{#1}}%
}

% Fuerza la indentación
\newcommand{\forceindent}{%
	~ \\ %

	\vspace{-2\baselineskip}%
}

% Inserta un texto con el formato de enlace
% 	#1 	Enlace
\newcommand{\hreftext}[1]{%
	\ifthenelse{\equal{\fonturl}{same}}{%
		#1%
	}{%
	\ifthenelse{\equal{\fonturl}{tt}}{%
		\texttt{#1}%
	}{%
	\ifthenelse{\equal{\fonturl}{rm}}{%
		\textrm{#1}%
	}{%
	\ifthenelse{\equal{\fonturl}{sf}}{%
		\textsf{#1}%
	}{}}}}%
}

% Inserta un email con un link cliqueable
%	#1 	Dirección email
\newcommand{\insertemail}[1]{%
	\href{mailto:#1}{\hreftext{#1}}%
}

% Inserta un teléfono celular
%	#1	Teléfono celular
\newcommand{\insertphone}[1]{%
	\href{tel:#1}{\hreftext{#1}}%
}

% Reinicia el número de ecuaciones
\newcommand{\restartequation}{%
	\setcounter{equation}{0}%
}

% Desactiva el margen de las leyendas
\newcommand{\disablecaptionmargin}{%
	\setcaptionmargincm{0}%
}

% Reinicia el margen de las leyendas
\newcommand{\resetcaptionmargin}{%
	\setcaptionmargincm{\captionlrmargin}%
}

% Modifica el color de las tablas
%	#1	Posición inicial del inicio de colores
\newcommand{\settablerowcolors}[1]{%
	\emptyvarerr{\settablerowcolors}{#1}{Posicion de fila no definida}%
	\ifthenelse{\equal{\GLOBALtablerowcolorswitch}{false}}{ % Usa colores normales
		\ifthenelse{\equal{\tablerowfirstcolor}{none}}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{#1}{}{}%
			}{%
				\rowcolors{#1}{\tablerowsecondcolor}{}%
			}%
		}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{#1}{}{\tablerowfirstcolor}%
			}{%
				\rowcolors{#1}{\tablerowsecondcolor}{\tablerowfirstcolor}%
			}%
		}%
	}{ % Usa colores alternados
		\ifthenelse{\equal{\tablerowfirstcolor}{none}}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{#1}{}{}%
			}{%
				\rowcolors{#1}{}{\tablerowsecondcolor}%
			}%
		}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{#1}{\tablerowfirstcolor}{}%
			}{%
				\rowcolors{#1}{\tablerowfirstcolor}{\tablerowsecondcolor}%
			}%
		}%
	}%

	% Actualiza el índice previo
	\global\def\GLOBALtablerowcolorindex {#1}%
}

% Alterna los colores de las tablas a la última ejecución
\newcommand{\settablerowcolorslast}{
	\ifthenelse{\equal{\GLOBALtablerowcolorswitch}{false}}{ % Usa colores normales
		\ifthenelse{\equal{\tablerowfirstcolor}{none}}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{\GLOBALtablerowcolorindex}{}{}%
			}{%
				\rowcolors{\GLOBALtablerowcolorindex}{\tablerowsecondcolor}{}%
			}%
		}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{\GLOBALtablerowcolorindex}{}{\tablerowfirstcolor}%
			}{%
				\rowcolors{\GLOBALtablerowcolorindex}{\tablerowsecondcolor}{\tablerowfirstcolor}%
			}%
		}%
	}{ % Usa colores alternados
		\ifthenelse{\equal{\tablerowfirstcolor}{none}}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{\GLOBALtablerowcolorindex}{}{}%
			}{%
				\rowcolors{\GLOBALtablerowcolorindex}{}{\tablerowsecondcolor}%
			}%
		}{%
			\ifthenelse{\equal{\tablerowsecondcolor}{none}}{%
				\rowcolors{\GLOBALtablerowcolorindex}{\tablerowfirstcolor}{}%
			}{%
				\rowcolors{\GLOBALtablerowcolorindex}{\tablerowfirstcolor}{\tablerowsecondcolor}%
			}%
		}%
	}%
}

% Activa el color de las filas de las tablas
%	#1	Posición inicial del inicio de colores
\newcommand{\enabletablerowcolor}[1][]{%
	\ifx\hfuzz#1\hfuzz%
		\settablerowcolors{2}%
	\else%
		\settablerowcolors{#1}%
	\fi%
}

% Desactiva el color de las filas de las tablas
\newcommand{\disabletablerowcolor}{\rowcolors{2}{}{}}

% Alterna los colores de las filas de las tablas
\newcommand{\switchtablerowcolors}{%
	\ifthenelse{\equal{\GLOBALtablerowcolorswitch}{false}}{%
		\global\def\GLOBALtablerowcolorswitch {true}%
	}{%
		\global\def\GLOBALtablerowcolorswitch {false}%
	}%
	\settablerowcolorslast%
}

% Actualiza el padding de las celdas de las tablas
%	#1	Padding horizontal (em)
%	#2	Padding vertical (em)
\newcommand{\settablecellpadding}[2]{%
	\emptyvarerr{\settablecellpadding}{#1}{Padding horizontal no definido}%
	\emptyvarerr{\settablecellpadding}{#2}{Padding vertical no definido}%
	\setlength{\tabcolsep}{#1 em} % Horizontal
	\def\arraystretch {#2} % Vertical
}

% Resetea el padding de las celdas de las tablas
\newcommand{\resettablecellpadding}{%
	\settablecellpadding{\tablepaddingh}{\tablepaddingv}%
}

% Cambia el tamaño de la página
%	#1	Orientacion de la página, puede ser 0 o 90. Por defecto es cero
%	#2	Ancho de la página (cm)
%	#3	Alto de la página (cm)
\newcommand{\changepagesize}[3][]{%
	% \emptyvarerr{\changepagesize}{#1}{Orientacion de la pagina}
	\emptyvarerr{\changepagesize}{#2}{Ancho de la pagina no definida}%
	\emptyvarerr{\changepagesize}{#3}{Altura de la pagina no definida}%
	\ifthenelse{\equal{\compilertype}{lualatex}}{%
		\throwwarning{Funcion no valida en compilador lualatex}%
	}{%
		\clearpage%
		\ifthenelse{\equal{#1}{}}{%
			\newgeometry{left=\pagemarginleft cm, top=\pagemargintop cm, right=\pagemarginright cm, bottom=\pagemarginbottom cm, paperwidth=#2 cm, paperheight=#3 cm}%
		}{%
		\ifthenelse{\equal{#1}{0}}{%
			\newgeometry{left=\pagemarginleft cm, top=\pagemargintop cm, right=\pagemarginright cm, bottom=\pagemarginbottom cm, paperwidth=#2 cm, paperheight=#3 cm}%
		}{%
		\ifthenelse{\equal{#1}{90}}{%
			\newgeometry{left=\pagemarginleft cm, top=\pagemargintop cm, right=\pagemarginright cm, bottom=\pagemarginbottom cm, paperwidth=#3 cm, paperheight=#2 cm}%
		}{%
			\throwbadconfig{Orientacion de pagina no valido}{\changepagesize}{0,90}}}%
		}%
	}%
}

% Ofrece diferentes formatos de pagina
% https://www.prepressure.com/library/paper-size
%	#1	Indica la rotación, puede ser 0 o 90
%	#2	Formato de la pagina
\newcommand{\changepagesizeformat}[2][]{%
	\emptyvarerr{\changepagesizeformat}{#2}{Formato de pagina no definido}%
	\ifthenelse{\equal{#2}{4A0}}{%
		\changepagesize[#1]{168.2}{237.8}%
	}{%
	\ifthenelse{\equal{#2}{2A0}}{%
		\changepagesize[#1]{118.9}{168.2}%
	}{%
	\ifthenelse{\equal{#2}{A0}}{%
		\changepagesize[#1]{84.1}{118.9}%
	}{%
	\ifthenelse{\equal{#2}{A1}}{%
		\changepagesize[#1]{59.4}{84.1}%
	}{%
	\ifthenelse{\equal{#2}{A2}}{%
		\changepagesize[#1]{42.0}{84.1}%
	}{%
	\ifthenelse{\equal{#2}{A3}}{%
		\changepagesize[#1]{29.7}{42.0}%
	}{%
	\ifthenelse{\equal{#2}{A4}}{%
		\changepagesize[#1]{21.0}{29.7}%
	}{%
	\ifthenelse{\equal{#2}{A5}}{%
		\changepagesize[#1]{14.8}{21.0}%
	}{%
	\ifthenelse{\equal{#2}{A6}}{%
		\changepagesize[#1]{10.5}{14.8}%
	}{%
	\ifthenelse{\equal{#2}{letter}}{%
		\changepagesize[#1]{21.59}{27.94}%
	}{%
	\ifthenelse{\equal{#2}{legal}}{%
		\changepagesize[#1]{21.59}{35.6}%
	}{%
	\ifthenelse{\equal{#2}{foolscap}}{%
		\changepagesize[#1]{20.3}{33.0}%
	}{%
	\ifthenelse{\equal{#2}{executive}}{%
		\changepagesize[#1]{18.41}{26.67}%
	}{%
	\ifthenelse{\equal{#2}{ledger}}{%
		\changepagesize[#1]{27.94}{43.18}%
	}{%
	\ifthenelse{\equal{#2}{tabloid}}{%
		\changepagesize[#1]{43.18}{27.94}%
	}{%
	\ifthenelse{\equal{#2}{ANSIC}}{%
		\changepagesize[#1]{55.9}{43.2}%
	}{%
	\ifthenelse{\equal{#2}{ANSID}}{%
		\changepagesize[#1]{86.4}{55.9}%
	}{%
	\ifthenelse{\equal{#2}{ANSIE}}{%
		\changepagesize[#1]{111.8}{86.4}%
	}{%
	\ifthenelse{\equal{#2}{B0}}{%
		\changepagesize[#1]{100}{141.4}%
	}{%
	\ifthenelse{\equal{#2}{B1}}{%
		\changepagesize[#1]{70.7}{100}%
	}{%
	\ifthenelse{\equal{#2}{B2}}{%
		\changepagesize[#1]{50}{70.7}%
	}{%
	\ifthenelse{\equal{#2}{B3}}{%
		\changepagesize[#1]{35.3}{50}%
	}{%
	\ifthenelse{\equal{#2}{B4}}{%
		\changepagesize[#1]{25}{35.3}%
	}{%
	\ifthenelse{\equal{#2}{B5}}{%
		\changepagesize[#1]{17.6}{25}%
	}{%
	\ifthenelse{\equal{#2}{B6}}{%
		\changepagesize[#1]{12.5}{17.6}%
	}{%
		\throwbadconfig{Estilo de pagina no valido}{\changepagesizeformat}{4A0,2A0,A0,A1,A2,A3,A4,A5,A6,letter,legal,foolscap,executive,ledger,tabloid,ANSIC,ANSID,ANSIE,B0,B1,B2,B3,B4,B5,B6}}}}}}}}}}}}}}}}}}}}}}}}}%
	}%
}

% END


text:
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
// app
import { AppRoutes } from './app.routes';

@NgModule({
    imports: [
        RouterModule.forRoot(AppRoutes, { useHash: true })
    ],
    exports: [RouterModule]
})
export class AppRoutingModule { }


text:
<?php

namespace Tests\App\Unit\Repositories\CategoryRepository;

use Tests\TestCase;
use App\Repositories\CategoryRepository\Query\CategoryQuery;
use App\Dumps\CategoryDump;
use Tests\DatabaseRefreshTable;
use App\Exceptions\EntityNotFoundException;

class CategoryQueryTest extends TestCase
{
    use DatabaseRefreshTable;

    /**
     * @var CategoryQuery
     */
    private $categoryQuery;

    /**
     * @var CategoryDump
     */
    private $categoryDump;

    public function setUp()
    {
        parent::setUp();

        $this->categoryQuery = $this->container->get(CategoryQuery::class);
        $this->categoryDump = $this->container->get(CategoryDump::class);
    }

    public function testGetCategoryByNameMustReturnNonNull()
    {
        $category = $this->categoryDump->create();

        $categorySearch = $this->categoryQuery->getCategoryByName($category->getSlug());

        $this->assertNotNull($categorySearch);
    }

    public function testGetNonExistentCategoryMutThownException()
    {
        $this->expectException(EntityNotFoundException::class);

        $this->categoryQuery->getCategoryByName('cookies');
    }
}


text:
<!DOCTYPE html>

	<title>chartCreator demo-autoinit 自动生成</title>
	<meta name="referrer" content="always" />
    <meta charset='utf-8' />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>

    <link type="text/css" rel="stylesheet" href="../css/chart.css"/>

       <canvas></canvas>

       <canvas></canvas>


text:
'use strict';

var df = require('datafixture.js');
var _ = require('lodash');
var moment = require('moment');
moment.suppressDeprecationWarnings = true;

var fcb = require('./fallbackConverterBuilder');

var WHITESPACE = /\s/;
var NEWLINE = /\n/g;
var GUID = /.*-.*-.*-.*/;
var DECIMAL = /\d*$/;
var DATE = /^YYYY-MM-DD.$/;

function stringConverter(stringValue) {
    var hasWhitespace = stringValue.match(WHITESPACE);
    var hasNewLine = stringValue.match(NEWLINE);
    if (hasWhitespace && !hasNewLine) {
        return 'lorem:1...' + (hasWhitespace.length + 1);
    } else if (hasWhitespace && hasNewLine) {
        return 'plorem:' + (hasNewLine.length + 1);
    } else if (stringValue.length === 0) {
        return 'lorem:0...1';
    } else if (moment(stringValue)._f) {
        return function () {
            var detectedFormat = moment(stringValue)._f;
            var formatToUse = detectedFormat.match(DATE) ? detectedFormat.substring(0,10) : detectedFormat;
            return moment().format(formatToUse);
        };
    }
    return stringValue.match(GUID) ? 'GUID' : 'lorem:1';
}

var arrayConverter = function (arrayValue, compositeConverter) {
    return function () {
        return _.map(arrayValue, function (elementValue) {
            var elementConverter = converter(elementValue, compositeConverter);
            return _.isFunction(elementConverter) ? elementConverter() : df.generate(elementConverter);
        });
    };
};

var booleanConverter = function () {
    return function () {
        return df.getRandom(0, 1) === 0;
    };
};

var objectConverter = new fcb.FallbackConverterBuilder()
    .thenMatch(_.isDate, function () {
        return function () {
            return new Date();
        };
    }).buildWithDefault(function (objectValue, compositeConverter) {
        return  _.reduce(objectValue, function (memo, propertyValue, name) {
            memo[name] = converter(propertyValue, compositeConverter);
            return memo;
        }, {});
    });

var numberConverter = new fcb.FallbackConverterBuilder()
    .thenMatch(_.partial(_.isEqual, Infinity), _.constant(Infinity))
    .thenMatch(_.partial(_.isEqual, -Infinity), _.constant(-Infinity))
    .thenMatch(_.isNaN, _.constant(NaN)).
    buildWithDefault(function (numberValue) {
        var mainRange = numberValue <= 0 ? Math.floor(numberValue) + '...0' : '1...' + Math.ceil(numberValue);
        return mainRange + (numberValue % 1 === 0 ? '' : ':' + DECIMAL.exec(numberValue)[0].length);
    });

var converter = new fcb.FallbackConverterBuilder()
    .thenMatch(_.isNull, _.constant(undefined))
    .thenMatch(_.isUndefined, _.constant(undefined))
    .thenMatch(_.isBoolean, booleanConverter)
    .thenMatch(_.isString, stringConverter)
    .thenMatch(_.isArray, arrayConverter)
    .thenMatch(_.isNumber, numberConverter)
    .thenMatch(_.isFunction, function(value) {
        return value;
    })
    .thenMatch(_.isObject, objectConverter)
    .buildWithDefault(function (value) {
        throw new Error('no converter found for ' + JSON.stringify(value));
    });

module.exports = converter;


text:
package example.boot;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author Oliver Gierke
 */
@Configuration
@ComponentScan
@EnableAutoConfiguration
class Application {

}


text:
#import "CCAnimationCache.h"
#import "ccMacros.h"
#import "CCSpriteFrameCache.h"
#import "CCAnimation.h"
#import "CCSprite.h"
#import "Support/CCFileUtils.h"

@implementation CCAnimationCache

#pragma mark CCAnimationCache - Alloc, Init & Dealloc

static CCAnimationCache *sharedAnimationCache_=nil;

+ (CCAnimationCache *)sharedAnimationCache
{
	if (!sharedAnimationCache_)
		sharedAnimationCache_ = [[CCAnimationCache alloc] init];

	return sharedAnimationCache_;
}

+(id)alloc
{
	NSAssert(sharedAnimationCache_ == nil, @"Attempted to allocate a second instance of a singleton.");
	return [super alloc];
}

+(void)purgeSharedAnimationCache
{
	[sharedAnimationCache_ release];
	sharedAnimationCache_ = nil;
}

-(id) init
{
	if( (self=[super init]) ) {
		animations_ = [[NSMutableDictionary alloc] initWithCapacity: 20];
	}

	return self;
}

- (NSString*) description
{
	return [NSString stringWithFormat:@"<%@ = %08X | num of animations =  %i>", [self class], self, [animations_ count]];
}

-(void) dealloc
{
	CCLOGINFO(@"cocos2d: deallocing %@", self);

	[animations_ release];
	[super dealloc];
}

#pragma mark CCAnimationCache - load/get/del

-(void) addAnimation:(CCAnimation*)animation name:(NSString*)name
{
	[animations_ setObject:animation forKey:name];
}

-(void) removeAnimationByName:(NSString*)name
{
	if( ! name )
		return;

	[animations_ removeObjectForKey:name];
}

-(CCAnimation*) animationByName:(NSString*)name
{
	return [animations_ objectForKey:name];
}

#pragma mark CCAnimationCache - from file

-(void)addAnimationsWithDictionary:(NSDictionary *)dictionary
{
	NSDictionary *animations = [dictionary objectForKey:@"animations"];

	if ( animations == nil ) {
		CCLOG(@"cocos2d: CCAnimationCache: No animations were found in provided dictionary.");
		return;
	}

	NSArray* animationNames = [animations allKeys];

	for( NSString *name in animationNames ) {
		NSDictionary* animationDict = [animations objectForKey:name];
		NSArray *frameNames = [animationDict objectForKey:@"frames"];
		NSNumber *delay = [animationDict objectForKey:@"delay"];
		CCAnimation* animation = nil;

		if ( frameNames == nil ) {
			CCLOG(@"cocos2d: CCAnimationCache: Animation '%@' found in dictionary without any frames - cannot add to animation cache.", name);
			continue;
		}

		NSMutableArray *frames = [NSMutableArray arrayWithCapacity:[frameNames count]];

		for( NSString *frameName in frameNames ) {
			CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:frameName];
			CCLOG(@"cocos2d: CCAnimationCache: Animation '%@' refers to frame '%@' which is not currently in the CCSpriteFrameCache. This frame will not be added to the animation.", name, frameName);

			if ( frame != nil ) {
				[frames addObject:frame];
			}
		}

		if ( [frames count] == 0 ) {
			CCLOG(@"cocos2d: CCAnimationCache: None of the frames for animation '%@' were found in the CCSpriteFrameCache. Animation is not being added to the Animation Cache.", name);
			continue;
		} else if ( [frames count] != [frameNames count] ) {
			CCLOG(@"cocos2d: CCAnimationCache: An animation in your dictionary refers to a frame which is not in the CCSpriteFrameCache. Some or all of the frames for the animation '%@' may be missing.", name);
		}

		if ( delay != nil ) {
			animation = [CCAnimation animationWithFrames:frames delay:[delay floatValue]];
		} else {
			animation = [CCAnimation animationWithFrames:frames];
		}

		[[CCAnimationCache sharedAnimationCache] addAnimation:animation name:name];
	}
}

/** Read an NSDictionary from a plist file and parse it automatically for animations */
-(void)addAnimationsWithFile:(NSString *)plist
{
	NSAssert( plist, @"Invalid texture file name");

    NSString *path = [CCFileUtils fullPathFromRelativePath:plist];
	NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];

	NSAssert1( dict, @"CCAnimationCache: File could not be found: %@", plist);

	[self addAnimationsWithDictionary:dict];
}

@end


text:
layout: post
title: " Participe da coleta de assinaturas para fundar o Partido Piratas no DF"
date: 2014-10-08 18:23:08.000000000 -03:00
type: post
author: piratas
published: true
status: publish
categories:
- Ações
- Organização
tags:
- coleta de assinaturas
- partido pirata distrito federal
- Registro Legal do Partido Pirata
meta:
  _wpas_skip_facebook: '1'
  _wpas_skip_google_plus: '1'
  _wpas_skip_twitter: '1'
  _wpas_skip_linkedin: '1'
  _wpas_skip_tumblr: '1'
  _wpas_skip_path: '1'
  _edit_last: '1180877'
  _publicize_pending: '1'
  geo_public: '0'

  login: d1t4
  email: amanditas.vieira@gmail.com
  display_name: Amanda
  first_name: Amanda
  last_name: Vieira
---

Os membros e simpatizantes do Partido Pirata no Distrito Federal já estão coletando assinaturas para a criação do partido. Os pontos de coleta estão espalhados em alguns locais da cidade (rodoviárias, faculdades...), porém precisamos acelerar esse processo. Para que o partido seja fundado é necessário 500 mil assinaturas nacionalmente!

Quer colaborar com a gente? Para isso, clique aqui na ficha de coleta, em PDF para imprimir. Após o devido preenchimento das assinaturas, encaminhe para a Caixa Postal 10809 - CEP 70306970 -Brasília - DF -  que o diretório de Brasília irá receber e contabilizar as adesões.

Atenção: a coleta é para obtenção do Registro Legal do Partido Pirata - não representa filiação.


text:
package com.sungardas.enhancedsnapshots.aws.dynamodb.model;

import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;

@DynamoDBTable(tableName = "Snapshots")
public class SnapshotEntry {

    @DynamoDBHashKey
    private String snapshotId;

    @DynamoDBAttribute
    private String volumeId;

    public SnapshotEntry() {
    }

    public SnapshotEntry(String snapshotId, String volumeId) {
        this.snapshotId = snapshotId;
        this.volumeId = volumeId;
    }

    public String getSnapshotId() {
        return snapshotId;
    }

    public void setSnapshotId(String snapshotId) {
        this.snapshotId = snapshotId;
    }

    public String getVolumeId() {
        return volumeId;
    }

    public void setVolumeId(String volumeId) {
        this.volumeId = volumeId;
    }

}


text:
require 'spec_helper'
require 'chef/knife/role_inspect'

RSpec.describe Chef::Knife::RoleInspect do
  it_behaves_like 'a knife inspect runner' do
    let :checklist do
      HealthInspector::Checklists::Roles
    end
  end
end