text:
package com.redhat.virtualsummit.hackathon.service;

import java.net.URISyntaxException;
import java.util.logging.Logger;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.core.MediaType;

import org.apache.http.HttpStatus;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;

import com.redhat.virtualsummit.hackathon.model.Service;
import com.redhat.virtualsummit.hackathon.util.Constants;

@LocalBean
@Stateless
public class ProxyNotificationService extends AbstractRestClient {

	@Inject
	Logger log;

	public boolean notify(Service service) {
		log.info("Notifying proxy");
		StringBuilder pathBuilder = new StringBuilder();
		pathBuilder.append(getEnvProperty(Constants.PROXY_REQUESTPATH_ENV));
		ClientRequest request;
		try {
			request = buildRequest(pathBuilder.toString());
			request.body(MediaType.APPLICATION_JSON_TYPE, service);
			ClientResponse<?> clientResponse = request.post(Service.class);
			if (checkStatus(clientResponse.getStatus(), HttpStatus.SC_OK)) {
				log.info("Returned ok from notification");
				return true;
			} else {
				log.severe("Returned error status from notification");
				return false;
			}
		} catch (Exception e) {
			// TODO throw error (so far, just reject)
			log.severe("Error in notification: " + e.getMessage()!=null?e.getMessage():"(none)");
			return false;
		}
	}

	private ClientRequest buildRequest(String path) throws URISyntaxException {
		return new ClientRequest(
				buildURI(Constants.PROTOCOL, getEnvProperty(Constants.PROXY_HOST_ENV),
						getEnvProperty(Constants.PROXY_PORT_ENV), path)).accept(MediaType.APPLICATION_JSON);
	}
}


text:
//
// Copyright (C) 2015 OpenSim Ltd.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//

#ifndef __INET_IEEE80211HTSIGNALCODE_H
#define __INET_IEEE80211HTSIGNALCODE_H

#include "inet/physicallayer/contract/bitlevel/ICode.h"
#include "inet/physicallayer/ieee80211/bitlevel/Ieee80211HTInterleaving.h"
#include "inet/physicallayer/ieee80211/bitlevel/Ieee80211ConvolutionalCode.h"
#include "inet/physicallayer/common/bitlevel/AdditiveScrambling.h"
#include "inet/physicallayer/ieee80211/mode/Ieee80211OFDMModulation.h"

namespace inet {
namespace physicallayer {

class INET_API Ieee80211HTCode : public ICode
{
    protected:
        const IForwardErrorCorrection *forwardErrorCorrection;
        const Ieee80211HTInterleaving *interleaving;
        const AdditiveScrambling *scrambling;

    public:
        Ieee80211HTCode(const IForwardErrorCorrection *forwardErrorCorrection, const Ieee80211HTInterleaving *interleaving, const AdditiveScrambling *scrambling);

        const IForwardErrorCorrection *getForwardErrorCorrection() const { return forwardErrorCorrection; }
        const AdditiveScrambling *getScrambling() const { return scrambling; }
        const Ieee80211HTInterleaving *getInterleaving() const { return interleaving; }

        virtual ~Ieee80211HTCode();

};

class INET_API Ieee80211HTCompliantCodes
{
    public:
        // Convolutional codes (TODO: LDPC codes).
        // Note: 1/2, 2/3, 3/4 rates are defined in Ieee80211OFDMCompliantCodes.
        static const Ieee80211ConvolutionalCode htConvolutionalCode5_6;

        static const Ieee80211HTCode *getCompliantCode(const Ieee80211ConvolutionalCode *convolutionalCode, const Ieee80211OFDMModulation *stream1Modulation, const Ieee80211OFDMModulation *stream2Modulation, const Ieee80211OFDMModulation *stream3Modulation, const Ieee80211OFDMModulation *stream4Modulation, Hz bandwidth, bool withScrambling = true);

};

} /* namespace physicallayer */
} /* namespace inet */

#endif // ifndef __INET_IEEE80211HTSIGNALCODE_H

redpajama_set_name: RedPajamaGithub


text:
"""Notebook related utilities

Authors:

* Brian Granger
"""

#-----------------------------------------------------------------------------
#  Copyright (C) 2011  The IPython Development Team
#
#  Distributed under the terms of the BSD License.  The full license is in
#  the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

def url_path_join(*pieces):
    """Join components of url into a relative url

    Use to prevent double slash when joining subpath. This will leave the
    initial and final / in place
    """
    initial = pieces[0].startswith('/')
    final = pieces[-1].endswith('/')
    striped = [s.strip('/') for s in pieces]
    result = '/'.join(s for s in striped if s)
    if initial: result = '/' + result
    if final: result = result + '/'
    if result == '//': result = '/'
    return result


text:
package io.fabianterhorst.iron;

class IronTable<T> {

    private T mContent;

    @SuppressWarnings("UnusedDeclaration")
    IronTable() {
    }

    IronTable(T content) {
        mContent = content;
    }

    public T getContent() {
        return mContent;
    }
}


text:
package com.axway.ats.environment;

@SuppressWarnings( "serial")
public class EnvironmentCleanupException extends Exception {

    public EnvironmentCleanupException( String message ) {

        super(message);
    }

    public EnvironmentCleanupException( String message,
                                        Throwable cause ) {

        super(message, cause);
    }

}


text:
package org.osanchezh.keepnotes.persistence.dao;

import java.util.Date;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.osanchezh.keepnotes.persistence.dao.impl.newsentry.NewsEntryDao;
import org.osanchezh.keepnotes.soa.model.entity.NewsEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ContextConfiguration(locations = {"file:src/main/resources/spring/keepnotes-soa-persistence/keepnotes-dbconfig-persistenceAppCtx.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class JpaNewsEntryDaoTest {
	private static final Logger LOGGER =  LoggerFactory.getLogger(JpaNewsEntryDaoTest.class);

	@Autowired
	@Qualifier("jpaNewsEntryDao")
	private NewsEntryDao jpaNewsEntryDao;

	@Test
    public void testkntuserDAO() {
      LOGGER.info("INFO");

      long timestamp = System.currentTimeMillis() - 1000 * 60 * 60 * 24;

      for (int i = 0; i < 10; i++) {
			NewsEntry newsEntry = new NewsEntry();
			newsEntry.setContent("This is example content " + i);
			newsEntry.setDate(new Date(timestamp));
			this.jpaNewsEntryDao.save(newsEntry);
			timestamp += 1000 * 60 * 60;
			LOGGER.debug("--tiempo.insersion="+timestamp);

		}
      int resultado = jpaNewsEntryDao.findAll().size();

      LOGGER.debug("RESULTADO="+resultado);
      LOGGER.debug("TEST");
    }

	public NewsEntryDao getJpaNewsEntryDao() {
		return jpaNewsEntryDao;
	}

	public void setJpaNewsEntryDao(NewsEntryDao jpaNewsEntryDao) {
		this.jpaNewsEntryDao = jpaNewsEntryDao;
	}

}


text:
package com.lyncode.testy.matchers;

import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.core.AllOf;

import java.util.ArrayList;
import java.util.List;

public class AbstractMatcherBuilder<M extends AbstractMatcherBuilder, T> extends BaseMatcher<T> {
    private List<Matcher<? super T>> matchers = new ArrayList<>();

    @Override
    public boolean matches(Object input) {
        return matcher().matches(input);
    }

    private Matcher<T> matcher() {
        return AllOf.allOf(matchers);
    }

    @Override
    public void describeTo(Description description) {
        description.appendDescriptionOf(matcher());
    }

    @Override
    public void describeMismatch(Object item, Description description) {
        matcher().describeMismatch(item, description);
    }

    protected M with (Matcher<? super T> matcher) {
        this.matchers.add(matcher);
        return (M) this;
    }
}


text:
/**
 * TransferreversalController
 *
 * <%= whatIsThis %>.
 *
 * @description :: Controller for Stripe Transferreversal Model
 * @help        :: See http://links.sailsjs.org/docs/controllers
 */
 module.exports = {

 }


text:
.class Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;
.super Ljava/lang/Object;
.source "DataConnection.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/telephony/dataconnection/DataConnection;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "ConnectionParams"
.end annotation

# instance fields
.field mApnContext:Lcom/android/internal/telephony/dataconnection/ApnContext;

.field mInitialMaxRetry:I

.field mOnCompletedMsg:Landroid/os/Message;

.field mProfileId:I

.field mTag:I

# direct methods
.method constructor <init>(Lcom/android/internal/telephony/dataconnection/ApnContext;IILandroid/os/Message;)V
    .locals 0
    .parameter "apnContext"
    .parameter "initialMaxRetry"
    .parameter "profileId"
    .parameter "onCompletedMsg"

    .prologue
    .line 111
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 112
    iput-object p1, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mApnContext:Lcom/android/internal/telephony/dataconnection/ApnContext;

    .line 113
    iput p2, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mInitialMaxRetry:I

    .line 114
    iput p3, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mProfileId:I

    .line 115
    iput-object p4, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mOnCompletedMsg:Landroid/os/Message;

    .line 116
    return-void
.end method

# virtual methods
.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 120
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "{mTag="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mTag:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " mApnContext="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mApnContext:Lcom/android/internal/telephony/dataconnection/ApnContext;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " mInitialMaxRetry="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mInitialMaxRetry:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " mProfileId="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mProfileId:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " mOnCompletedMsg="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/telephony/dataconnection/DataConnection$ConnectionParams;->mOnCompletedMsg:Landroid/os/Message;

    #calls: Lcom/android/internal/telephony/dataconnection/DataConnection;->msgToString(Landroid/os/Message;)Ljava/lang/String;
    invoke-static {v1}, Lcom/android/internal/telephony/dataconnection/DataConnection;->access$000(Landroid/os/Message;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "}"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


text:
@implementation Person

- (BOOL)isEqualToPickableItem:(id<DBPickableItem>)item
{
    if (self == item)
    {
        return YES;
    }
    else if ([item isKindOfClass:[Person class]])
    {
        return ([self.pID compare:[(Person *)item pID]] == NSOrderedSame);
    }

    return NO;
}

- (NSString *)displayString
{
    return [NSString stringWithFormat:@"%@ %@", self.firstName, self.lastName];
}

@end


text:
import Ember from "ember";
import { module, test } from 'qunit';
import startApp from '../helpers/start-app';
import mobileDetection from "ember-mobiletouch/utils/is-mobile";
import ghostTap from '../helpers/ghost-tap';
var App;

module('GhostClick', {

  beforeEach: function() {
    mobileDetection.fake(true);
    App = startApp();
  },
  afterEach: function() {
    Ember.run(App, App.destroy);
    mobileDetection.detect();
  }

});

test("A tap does not focus an input inserted by the tap.", function(assert) {

  assert.expect(8);

  visit('/ghosts');

  andThen(function () {

    ghostTap('#originalTarget', '#unintendedTarget');

    andThen(function() {

      var view = Ember.View.views['unintendedTarget'];
      var $element = view.$();

      assert.equal(view.taps, 0, 'a tap was not observed');
      assert.notEqual(document.activeElement, $element.get(0), 'The input receives focus.');
      assert.equal(view.focuses, 0, 'The view has not been focused.');

      Ember.run.later(function () {
        assert.equal(view.fastClicks, 0, 'a fastclick was not observed');
        assert.equal(view.internalClicks, 0, 'a regular click was never observed');
        assert.equal(view.clicks, 1, 'a single click was observed');
        assert.notEqual(document.activeElement, $element.get(0), 'The input maintains focus.');
        assert.equal(view.focuses, 0, 'The view has not been focused.');
      }, 350);

    });

  });
});


text:
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F2xx_IT_H
#define __STM32F2xx_IT_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f2xx.h"

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
 /*----------------------------------------------------------------------------
   Notes:
   The length of the receive and transmit buffers must be a power of 2.
   Each buffer has a next_in and a next_out index.
   If next_in = next_out, the buffer is empty.
   (next_in - next_out) % buffer_size = the number of characters in the buffer.
  *----------------------------------------------------------------------------*/
 #define TBUF_SIZE   256	     /*** Must be a power of 2 (2,4,8,16,32,64,128,256,512,...) ***/
 #define RBUF_SIZE   256      /*** Must be a power of 2 (2,4,8,16,32,64,128,256,512,...) ***/

 /*----------------------------------------------------------------------------
  *----------------------------------------------------------------------------*/
 #if TBUF_SIZE < 2
 #error TBUF_SIZE is too small.  It must be larger than 1.
 #elif ((TBUF_SIZE & (TBUF_SIZE-1)) != 0)
 #error TBUF_SIZE must be a power of 2.
 #endif

 #if RBUF_SIZE < 2
 #error RBUF_SIZE is too small.  It must be larger than 1.
 #elif ((RBUF_SIZE & (RBUF_SIZE-1)) != 0)
 #error RBUF_SIZE must be a power of 2.
 #endif

 /*----------------------------------------------------------------------------
  *----------------------------------------------------------------------------*/

 /* Exported functions ------------------------------------------------------- */

void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void USARTx_IRQHandler(void);

void USART3_buffer_Init (void);
int USART3_GetKey (void);
int USART3_SendChar (int c);
void USART3_SendString(char *mass,int size);

#ifdef __cplusplus
}
#endif

#endif /* __STM32F2xx_IT_H */

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/


text:
class AppDelegate
  attr_reader :window

  def application(application, didFinishLaunchingWithOptions:launchOptions)
    @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)

    # This is just here to test that you can call rmq in AppDelegate
    o = rmq

    main_controller = MainController.alloc.initWithNibName(nil, bundle: nil)
    @window.rootViewController = UINavigationController.alloc.initWithRootViewController(main_controller)

    @window.makeKeyAndVisible
    true
  end

  def application(application, willChangeStatusBarOrientation: new_orientation, duration: duration)
    # Manually set RMQ's orientation before the device is actually oriented
    # So that we can do stuff like style views before the rotation begins
    rmq.device.orientation = new_orientation
  end
end


text:
from __future__ import print_function

import sys, gym

#
# Test yourself as a learning agent! Pass environment name as a command-line argument.
#

env = gym.make('LunarLander-v2' if len(sys.argv)<2 else sys.argv[1])

ACTIONS = env.action_space.n
ROLLOUT_TIME = 1000
SKIP_CONTROL = 0    # Use previous control decision SKIP_CONTROL times, that's how you
                    # can test what skip is still usable.

human_agent_action = 0
human_wants_restart = False
human_sets_pause = False

def key_press(key, mod):
    global human_agent_action, human_wants_restart, human_sets_pause
    if key==0xff0d: human_wants_restart = True
    if key==32: human_sets_pause = not human_sets_pause
    a = int( key - ord('0') )
    if a <= 0 or a >= ACTIONS: return
    human_agent_action = a

def key_release(key, mod):
    global human_agent_action
    a = int( key - ord('0') )
    if a <= 0 or a >= ACTIONS: return
    if human_agent_action == a:
        human_agent_action = 0

env.render()
env.viewer.window.on_key_press = key_press
env.viewer.window.on_key_release = key_release

def rollout(env):
    global human_agent_action, human_wants_restart, human_sets_pause
    human_wants_restart = False
    obser = env.reset()
    skip = 0
    for t in range(ROLLOUT_TIME):
        if not skip:
            #print("taking action {}".format(human_agent_action))
            a = human_agent_action
            skip = SKIP_CONTROL
        else:
            skip -= 1

        obser, r, done, info = env.step(a)
        env.render()
        if done: break
        if human_wants_restart: break
        while human_sets_pause:
            env.render()
            import time
            time.sleep(0.1)

print("ACTIONS={}".format(ACTIONS))
print("Press keys 1 2 3 ... to take actions 1 2 3 ...")
print("No keys pressed is taking action 0")

while 1:
    rollout(env)


text:
function [post nlZ dnlZ] = infExact_fast(hyp, mean, cov, lik, x, y)

% Fast, robust inference for a GP with Gaussian likelihood. Compute a
% parametrization of the posterior, the negative log marginal likelihood
% and its derivatives w.r.t. the hyperparameters. See also "help infMethods".
%
% To be used in combination with 'fast' covariance functions (e.g.
% covSEard_fast and such).
%
% This implementation also handles badly conditioned covariance matrices,
% which sometimes become non-positive definite and cause a failure of the
% Cholesky decomposition. In these cases, the covariance matrix is corrected
% to the nearest symmetric positive semidefinite (SPD) matrix in Frobenius
% norm (see [1]; based on an implementation by John d'Errico).
%
% [1] Higham NJ, "Computing a nearest symmetric positive semidefinite
% matrix", Linear Algebra Appl, 1988.
% http://www.sciencedirect.com/science/article/pii/0024379588902236
%
% Added support for 'fast' inference and robust Cholesky decomposition by
% Luigi Acerbi, 2016-01-03.
% Original code by Carl Edward Rasmussen and Hannes Nickisch, 2015-07-13.
%
% See also INFMETHODS.M.

if iscell(lik), likstr = lik{1}; else likstr = lik; end
if ~ischar(likstr), likstr = func2str(likstr); end
if ~strcmp(likstr,'likGauss')               % NOTE: no explicit call to likGauss
  error('Exact inference only possible with Gaussian likelihood');
end

[n, D] = size(x);
if nargout > 2                                      % do we want derivatives?
  [K,dK] = feval(cov{:}, hyp.cov, x);                 % evaluate covariance matrix and derivatives
else
  K = feval(cov{:}, hyp.cov, x);                      % evaluate covariance matrix
end
m = feval(mean{:}, hyp.mean, x);                          % evaluate mean vector

sn2 = exp(2*hyp.lik);                               % noise variance of likGauss

smallnoise = sn2 < 1e-6;       % very tiny sn2 can lead to numerical trouble

if smallnoise
    M = K+sn2*eye(n);           % Covariance with noise
else
    M = K/sn2+eye(n);           % B matrix
end
[L,p] = chol(M);                % Try computing Cholesky factor

% M
%[V,D] = eig(M);
% V(:,1)'
%if D(1,1) < 0
%    M/max(M(:))
%   diag(D)
%   V(:,1)
%   sn2
%   pause
%end

%[D(1,1)/D(2,2)]
%[D(1,1),D(2,2),sn2]

% log10(diag(lambda))'
% max(lambda)/min(lambda)

if p~=0     % Failed Cholesky decomposition, compute nearest SPD matrix
    error('a');
    Mold = M;

    M = (M + M')/2;         % Ensure M is symmetric
    [U,Sigma,V] = svd(M);
    H = V*Sigma*V';         % Symmetric polar factor H is SPD
    M = (M+H)/2;
    M = (M + M')/2;         % Ensure symmetry again
    [L,p] = chol(M);        % Retry Cholesky decomposition
    k = 0;
    while p ~= 0            % Failed again, add a small diagonal component
        k = k + 1;
        % We do not want to change the matrix too much
        if k > 5; error('Cannot compute Cholesky decomposition.'); end
        lambda = eig(M);

        mineig = min(lambda);

        mineigold = log10(abs(min(eig(Mold))));

        [log10(abs(max(lambda))),log10(abs(mineig)),mineigold,log10(sn2)]
        kappa = 0.125;       % Sometimes even a small nudge is sufficient
        % kappa = 0.125;      % Sometimes even a small nudge is sufficient
        % M = M + (-kappa*mineig*k.^2 + eps(mineig))*eye(size(M));
        % M = M + (-kappa*mineig*k.^2 + sqrt(eps)*mineig)*eye(size(M));
        M = M + kappa*abs(mineig)*k.^2*eye(size(M));
        % M = M + kappa*mineig*k.^2*eye(size(M));
        % k, [lambda';eig(M)']
        [L,p] = chol(M);
    end

    % [sort(eig(M))'; sort(eig(Mold))']

end

if smallnoise
    sl = 1;
    pL = -solve_chol(L,eye(n));     % L = -inv(K+inv(sW^2))
else
    sl = sn2;
    pL = L;                         % L = chol(eye(n)+sW*sW'.*K)
end

alpha = solve_chol(L,y-m)/sl;

post.alpha = alpha;                            % return the posterior parameters
post.sW = ones(n,1)/sqrt(sn2);                  % sqrt of noise precision vector
post.L = pL;

if nargout>1                               % do we want the marginal likelihood?
  nlZ = (y-m)'*alpha/2 + sum(log(diag(L))) + n*log(2*pi*sl)/2;   % -log marg lik
  if nargout>2                                         % do we want derivatives?
    dnlZ = hyp;                                 % allocate space for derivatives
    Q = solve_chol(L,eye(n))/sl - alpha*alpha';     % precompute for convenience
    for i = 1:numel(hyp.cov)
      dnlZ.cov(i) = sum(sum(Q.*dK(:,:,i)))/2;
    end
    dnlZ.lik = sn2*trace(Q);
    for i = 1:numel(hyp.mean)
      dnlZ.mean(i) = -feval(mean{:}, hyp.mean, x, i)'*alpha;
    end
  end
end


text:
package org.apache.solr.update;

import org.apache.lucene.util.InfoStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * An {@link InfoStream} implementation which passes messages on to Solr's logging.
 */
public class LoggingInfoStream extends InfoStream {
  public static final Logger log = LoggerFactory.getLogger(LoggingInfoStream.class);

  @Override
  public void message(String component, String message) {
    log.info("[" + component + "][" + Thread.currentThread().getName() + "]: " + message);
  }

  @Override
  public boolean isEnabled(String component) {
    // ignore testpoints so this can be used with tests without flooding logs with verbose messages
    return !"TP".equals(component) && log.isInfoEnabled();
  }

  @Override
  public void close() throws IOException {}
}


text:
package io.milton.common;

import io.milton.http.Request;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author brad
 */
public class ContentTypeUtils {

    private static Logger log = LoggerFactory.getLogger(ContentTypeUtils.class);
    private static final ContentTypeService contentTypeService = new DefaultContentTypeService(); // will load props file ;

    public static String findContentTypes(String name) {
        List<String> list = contentTypeService.findContentTypes(name);
        return buildContentTypeText(list);
    }

    public static String findContentTypes(File file) {
        return buildContentTypeText(contentTypeService.findContentTypes(file.getName()));
    }

    public static String findAcceptableContentType(String canProvide, String accepts) {
        return contentTypeService.getPreferedMimeType(accepts, toList(canProvide));
    }

    public static String findAcceptableContentTypeForName(String name, String accepts) {
        String canProvide = findContentTypes(name);
        List<String> canProvideList = toList(canProvide);
        String s = contentTypeService.getPreferedMimeType(accepts, canProvideList);
        return s;
    }

    private static String buildContentTypeText(List<String> mimeTypes) {
        return Utils.toCsv(mimeTypes);
    }

    public static List<String> toList(String s) {
        List<String> list = new ArrayList<String>();
        if (s != null) {
            for (String x : s.split(",")) {
                x = x.trim();
                list.add(x);
            }
        }
        return list;
    }
}


text:
import { Permissions, Notifications } from 'expo';
import { AsyncStorage } from 'react-native';
import axios from 'axios';

const PUSH_ENDPOINT = 'http://rallycoding.herokuapp.com/api/tokens';

export default async () => {
  // check if we have ever created a token
  let previousToken = await AsyncStorage.getItem('pushToken');
  console.log(previousToken);
  if (previousToken) {
    return;
  } else {
    // asks for permission
    let { status } = await Permissions.askAsync(Permissions.REMOTE_NOTIFICATIONS);
    if (status !== 'granted') {
      return;
    }
    // if user granted permission, create and save token created by expo to backend service
    let token = await Notifications.getExponentPushTokenAsync();
    await axios.post(PUSH_ENDPOINT, { token: { token } });
    // save token to AsyncStorage
    AsyncStorage.setItem('pushToken', token);
  }
};


text:
module Ramom

  module Command

    extend  Operation::Registrar::Callsite
    include Operation

    def one(relation_name, attributes)
      model = backend[relation_name]
      model.get(*keys(attributes, model))
    end

    def create(input, record = nil, &block)
      record = block ? transaction(&block) : record
      if record && record.saved?
        success(dress(output, record.attributes))
      else
        failure(input)
      end
    end

    def update(record, attributes)
      if record && record.update(attributes)
        success(dress(output, record.attributes))
      else
        failure(attributes)
      end
    end

    def delete(record, attributes)
      update(record, attributes.fetch(:stamps), output)
    end

    def transaction(&block)
      backend.transaction(:default, &block)
    end

    def keys(attributes, model)
      attributes.values_at(model.key)
    end
  end # Command
end # Ramom


text:
{-# LANGUAGE CPP, OverloadedStrings #-}
module Haste.PrimOps (genOp) where
import Prelude hiding (LT, GT)
import PrimOp
import Data.JSTarget
import Haste.Config

-- | Dummy State# RealWorld value for where one is needed.
defState :: Exp
defState = litN 0

-- | Generate primops.
--   Many of these ops return lifted Bool values; however, no thunk is
--   generated for them in order to conserve space and CPU time. This relies
--   on the evaluation operation in the RTS being able to handle plain values
--   as though they were thunks. If this were to change, all those ops MUST
--   be changed to return thunks!
genOp :: Config -> PrimOp -> [Exp] -> Either String (Exp)
genOp cfg op xs =
  case op of
    -- negations
    IntNegOp       -> Right $ binOp Sub (litN 0) (head xs)
    DoubleNegOp    -> Right $ binOp Sub (litN 0) (head xs)
    FloatNegOp     -> Right $ binOp Sub (litN 0) (head xs)
    NotOp          -> Right $ not_ (head xs) -- bitwise
    NotIOp         -> Right $ not_ (head xs) -- bitwise

    -- Conversions
    ChrOp          -> Right $ head xs
    OrdOp          -> Right $ head xs
    Word2IntOp     -> Right $ binOp BitAnd (head xs) (litN 0xffffffff)
    Int2WordOp     -> Right $ binOp ShrL (head xs) (litN 0)
    Int2FloatOp    -> Right $ head xs
    Int2DoubleOp   -> Right $ head xs
    Word2FloatOp   -> Right $ head xs
    Word2DoubleOp  -> Right $ head xs
    Double2IntOp   -> Right $ binOp (BitAnd) (head xs) (litN 0xffffffff)
    Double2FloatOp -> Right $ head xs
    Float2IntOp    -> Right $ binOp (BitAnd) (head xs) (litN 0xffffffff)
    Float2DoubleOp -> Right $ head xs

    -- Narrowing ops
    Narrow8IntOp   -> Right $ binOp BitAnd (head xs) (lit (0xff :: Double))
    Narrow16IntOp  -> Right $ binOp BitAnd (head xs) (lit (0xffff :: Double))
    Narrow32IntOp  -> Right $ binOp BitAnd (head xs) (lit (0xffffffff :: Double))
    Narrow8WordOp  -> Right $ binOp BitAnd (head xs) (lit (0xff :: Double))
    Narrow16WordOp -> Right $ binOp BitAnd (head xs) (lit (0xffff :: Double))
    Narrow32WordOp -> Right $ binOp ShrL (binOp BitAnd (head xs) (lit (0xffffffff :: Double))) (litN 0)

    -- Char ops
    CharGtOp -> bOp GT
    CharGeOp -> bOp GTE
    CharEqOp -> bOp Eq
    CharNeOp -> bOp Neq
    CharLtOp -> bOp LT
    CharLeOp -> bOp LTE

    -- Int ops
    IntAddOp ->        intMath $ bOp Add
    IntSubOp ->        intMath $ bOp Sub
    IntMulOp ->        intMath $ Right $ multiplyIntOp cfg (xs !! 0) (xs !! 1)
    -- FIXME: this is correct but slow!
    IntMulMayOfloOp -> intMath $ Right $ multiplyIntOp cfg (xs !! 0) (xs !! 1)
    IntQuotOp ->       callF "quot"
    IntQuotRemOp ->    callF "quotRemI"
    IntRemOp ->        bOp Mod -- JS % operator is actually rem, not mod!
    IntAddCOp -> callF "addC"
    IntSubCOp -> callF "subC"
    ISllOp ->    bOp Shl
    ISraOp ->    bOp ShrA
    ISrlOp ->    bOp ShrL
    IntGtOp ->   bOp GT
    IntGeOp ->   bOp GTE
    IntLtOp ->   bOp LT
    IntLeOp ->   bOp LTE
    IntEqOp ->   bOp Eq
    IntNeOp ->   bOp Neq
    AndIOp ->    bOp BitAnd
    OrIOp ->     bOp BitOr
    XorIOp ->    bOp BitXor

    -- Word ops
    WordAddOp ->  wordMath $ bOp Add
    WordSubOp ->  wordMath $ bOp Sub
    WordMulOp ->  wordMath $ callF "imul"
    WordQuotOp -> callF "quot"
    WordQuotRemOp -> callF "quotRemI"
    WordRemOp ->  bOp Mod
    AndOp ->      wordMath $ bOp BitAnd
    OrOp ->       wordMath $ bOp BitOr
    XorOp ->      wordMath $ bOp BitXor
    SllOp ->      wordMath $ bOp Shl
    SrlOp ->      bOp ShrL
    WordGtOp ->   bOp GT
    WordGeOp ->   bOp GTE
    WordEqOp ->   bOp Eq
    WordNeOp ->   bOp Neq
    WordLtOp ->   bOp LT
    WordLeOp ->   bOp LTE

    -- Double ops
    DoubleExpOp    -> Right $ callForeign "Math.exp" xs
    DoubleLogOp    -> Right $ callForeign "Math.log" xs
    DoubleSqrtOp   -> Right $ callForeign "Math.sqrt" xs
    DoubleCosOp    -> Right $ callForeign "Math.cos" xs
    DoubleSinOp    -> Right $ callForeign "Math.sin" xs
    DoubleTanOp    -> Right $ callForeign "Math.tan" xs
    DoubleAcosOp   -> Right $ callForeign "Math.acos" xs
    DoubleAsinOp   -> Right $ callForeign "Math.asin" xs
    DoubleAtanOp   -> Right $ callForeign "Math.atan" xs
    DoubleCoshOp   -> Right $ callForeign "cosh" xs
    DoubleSinhOp   -> Right $ callForeign "sinh" xs
    DoubleTanhOp   -> Right $ callForeign "tanh" xs
    DoubleDecode_2IntOp -> Right $ callForeign "decodeDouble" xs
    DoubleGtOp ->    bOp GT
    DoubleGeOp ->    bOp GTE
    DoubleEqOp ->    bOp Eq
    DoubleNeOp ->    bOp Neq
    DoubleLtOp ->    bOp LT
    DoubleLeOp ->    bOp LTE
    DoubleAddOp ->   bOp Add
    DoubleSubOp ->   bOp Sub
    DoubleMulOp ->   bOp Mul
    DoubleDivOp ->   bOp Div
    DoublePowerOp -> callF "Math.pow"

    -- Float ops
    FloatExpOp     -> Right $ callForeign "Math.exp" xs
    FloatLogOp     -> Right $ callForeign "Math.log" xs
    FloatSqrtOp    -> Right $ callForeign "Math.sqrt" xs
    FloatCosOp     -> Right $ callForeign "Math.cos" xs
    FloatSinOp     -> Right $ callForeign "Math.sin" xs
    FloatTanOp     -> Right $ callForeign "Math.tan" xs
    FloatAcosOp    -> Right $ callForeign "Math.acos" xs
    FloatAsinOp    -> Right $ callForeign "Math.asin" xs
    FloatAtanOp    -> Right $ callForeign "Math.atan" xs
    FloatCoshOp    -> Right $ callForeign "cosh" xs
    FloatSinhOp    -> Right $ callForeign "sinh" xs
    FloatTanhOp    -> Right $ callForeign "tanh" xs
    FloatDecode_IntOp -> Right $ callForeign "decodeFloat" xs
    FloatGtOp ->  bOp GT
    FloatGeOp ->  bOp GTE
    FloatEqOp ->  bOp Eq
    FloatNeOp ->  bOp Neq
    FloatLtOp ->  bOp LT
    FloatLeOp ->  bOp LTE
    FloatAddOp -> bOp Add
    FloatSubOp -> bOp Sub
    FloatMulOp -> bOp Mul
    FloatDivOp -> bOp Div
    FloatPowerOp -> callF "Math.pow"

    -- Array ops
    NewArrayOp -> callF "newArr"
    SameMutableArrayOp -> fmap (thunk True . ret) $ bOp Eq
    ReadArrayOp -> Right $ index arr ix
    WriteArrayOp -> Right $ assignEx (index arr ix) rhs
      where (_arr:_ix:rhs:_) = xs
    SizeofArrayOp -> Right $ index (head xs) (litS "length")
    SizeofMutableArrayOp -> Right $ index (head xs) (litS "length")
    IndexArrayOp -> Right $ index arr ix
    UnsafeFreezeArrayOp -> Right $ head xs
    UnsafeThawArrayOp -> Right $ head xs
    -- TODO: copy, clone, freeze, thaw

    -- Byte Array ops
    NewByteArrayOp_Char      -> callF "newByteArr"
    NewPinnedByteArrayOp_Char-> callF "newByteArr"
    SameMutableByteArrayOp   -> fmap (thunk True . ret) $ bOp Eq
    IndexByteArrayOp_Char    -> readArr xs "i8"
    IndexByteArrayOp_Int     -> readArr xs "i32"
    IndexByteArrayOp_Int8    -> readArr xs "i8"
    IndexByteArrayOp_Int16   -> readArr xs "i16"
    IndexByteArrayOp_Int32   -> readArr xs "i32"
    IndexByteArrayOp_Word    -> readArr xs "w32"
    IndexByteArrayOp_Word8   -> readArr xs "w8"
    IndexByteArrayOp_Word16  -> readArr xs "w16"
    IndexByteArrayOp_Word32  -> readArr xs "w32"
    IndexByteArrayOp_WideChar-> readArr xs "w32"
    IndexByteArrayOp_Float   -> readArr xs "f32"
    IndexByteArrayOp_Double  -> readArr xs "f64"

    ReadByteArrayOp_Char     -> readArr xs "i8"
    ReadByteArrayOp_Int      -> readArr xs "i32"
    ReadByteArrayOp_Int8     -> readArr xs "i8"
    ReadByteArrayOp_Int16    -> readArr xs "i16"
    ReadByteArrayOp_Int32    -> readArr xs "i32"
    ReadByteArrayOp_Word     -> readArr xs "w32"
    ReadByteArrayOp_Word8    -> readArr xs "w8"
    ReadByteArrayOp_Word16   -> readArr xs "w16"
    ReadByteArrayOp_Word32   -> readArr xs "w32"
    ReadByteArrayOp_WideChar -> readArr xs "w32"
    ReadByteArrayOp_Float    -> readArr xs "f32"
    ReadByteArrayOp_Double   -> readArr xs "f64"

    WriteByteArrayOp_Char    -> writeArr xs "i8"
    WriteByteArrayOp_Int     -> writeArr xs "i32"
    WriteByteArrayOp_Int8    -> writeArr xs "i8"
    WriteByteArrayOp_Int16   -> writeArr xs "i16"
    WriteByteArrayOp_Int32   -> writeArr xs "i32"
    WriteByteArrayOp_Word    -> writeArr xs "w32"
    WriteByteArrayOp_Word8   -> writeArr xs "w8"
    WriteByteArrayOp_Word16  -> writeArr xs "w16"
    WriteByteArrayOp_Word32  -> writeArr xs "w32"
    WriteByteArrayOp_WideChar-> writeArr xs "w32"
    WriteByteArrayOp_Float   -> writeArr xs "f32"
    WriteByteArrayOp_Double  -> writeArr xs "f64"

    SizeofByteArrayOp        -> Right $ index (head xs) (litS "byteLength")
    SizeofMutableByteArrayOp -> Right $ index (head xs) (litS "byteLength")
    NewAlignedPinnedByteArrayOp_Char -> Right $ callForeign "newByteArr" [xs!!0]
    UnsafeFreezeByteArrayOp  -> Right $ head xs
    ByteArrayContents_Char   -> Right $ head xs

    -- Mutable variables
    NewMutVarOp -> callF "nMV"
    ReadMutVarOp -> callF "rMV"
    WriteMutVarOp -> callF "wMV"
    SameMutVarOp -> bOp Eq
    AtomicModifyMutVarOp -> callF "mMV"

    -- TVars - since there's no parallelism and no preemption, TVars behave
    -- just like normal IORefs.
    NewTVarOp   -> callF "nMV"
    ReadTVarOp  -> callF "rMV"
    WriteTVarOp -> callF "wMV"
    SameTVarOp  -> bOp Eq

    -- Pointer ops
    ReallyUnsafePtrEqualityOp -> bOp Eq
    WriteOffAddrOp_Char    -> writeOffAddr xs "i8"  1
    WriteOffAddrOp_Int     -> writeOffAddr xs "i32" 4
    WriteOffAddrOp_Int8    -> writeOffAddr xs "i8"  1
    WriteOffAddrOp_Int16   -> writeOffAddr xs "i16" 2
    WriteOffAddrOp_Int32   -> writeOffAddr xs "i32" 4
    WriteOffAddrOp_Word    -> writeOffAddr xs "w32" 4
    WriteOffAddrOp_Word8   -> writeOffAddr xs "w8"  1
    WriteOffAddrOp_Word16  -> writeOffAddr xs "w16" 2
    WriteOffAddrOp_Word32  -> writeOffAddr xs "w32" 4
    WriteOffAddrOp_WideChar-> writeOffAddr xs "w32" 4
    WriteOffAddrOp_Float   -> writeOffAddr xs "f32" 4
    WriteOffAddrOp_Double  -> writeOffAddr xs "f64" 8
    ReadOffAddrOp_Char     -> readOffAddr xs "i8"   1
    ReadOffAddrOp_Int      -> readOffAddr xs "i32"  4
    ReadOffAddrOp_Int8     -> readOffAddr xs "i8"   1
    ReadOffAddrOp_Int16    -> readOffAddr xs "i16"  2
    ReadOffAddrOp_Int32    -> readOffAddr xs "i32"  4
    ReadOffAddrOp_Word     -> readOffAddr xs "w32"  4
    ReadOffAddrOp_Word8    -> readOffAddr xs "w8"   1
    ReadOffAddrOp_Word16   -> readOffAddr xs "w16"  2
    ReadOffAddrOp_Word32   -> readOffAddr xs "w32"  4
    ReadOffAddrOp_WideChar -> readOffAddr xs "w32"  4
    ReadOffAddrOp_Float    -> readOffAddr xs "f32"  4
    ReadOffAddrOp_Double   -> readOffAddr xs "f64"  8
    AddrAddOp              -> callF "plusAddr"
    AddrSubOp              ->
        Right $ callForeign "plusAddr" [addr, binOp Sub (litN 0) off]
      where (addr:off:_) = xs
    AddrEqOp               -> callF "addrEq"
    AddrNeOp               ->
        Right $ binOp Sub (litN 0) $ callForeign "addrEq" [a, b]
      where (a:b:_) = xs
    AddrLtOp               -> callF "addrLT"
    AddrGtOp               -> callF "addrGT"
    AddrLeOp               ->
        Right $ binOp Sub (litN 0) $ callForeign "addrGT" [a, b]
      where (a:b:_) = xs
    AddrGeOp               ->
        Right $ binOp Sub (litN 0) $ callForeign "addrLT" [a, b]
      where (a:b:_) = xs
    Addr2IntOp             ->
        Right $ index x (litS "off")
      where
        (x:_) = xs

    -- MVars
    NewMVarOp     -> callF "newMVar"
    TakeMVarOp    -> callF "takeMVar"
    TryTakeMVarOp -> callF "tryTakeMVar"
    PutMVarOp     -> callF "putMVar"
    TryPutMVarOp  -> callF "tryPutMVar"
    SameMVarOp    -> callF "sameMVar"
    IsEmptyMVarOp -> callF "isEmptyMVar"

    -- Stable names
    MakeStableNameOp  -> callF "makeStableName"
    EqStableNameOp    -> callF "eqStableName"
    StableNameToIntOp -> Right $ head xs

    -- Stable pointers - all pointers are stable in JS!
    MakeStablePtrOp   -> Right $ head xs
    EqStablePtrOp     -> bOp Eq
    DeRefStablePtrOp  -> Right $ head xs

    -- Weak pointers - no concern of GC in JS
    MkWeakOp            -> callF "mkWeak"
    MkWeakNoFinalizerOp -> callF "mkWeak"
    DeRefWeakOp         -> callF "derefWeak"
    FinalizeWeakOp      -> callF "finalizeWeak"

    -- Exception masking
    -- There's only one thread anyway, so async exceptions can't happen.
    MaskAsyncExceptionsOp   -> Right $ callSaturated (head xs) []
    UnmaskAsyncExceptionsOp -> Right $ callSaturated (head xs) []
    MaskStatus              -> Right $ litN 0

    -- Misc. ops
    PopCntOp       -> Right $ callForeign "popCnt" [head xs]
    PopCnt8Op      -> Right $ callForeign "popCnt" [head xs]
    PopCnt16Op     -> Right $ callForeign "popCnt" [head xs]
    PopCnt32Op     -> Right $ callForeign "popCnt" [head xs]
    PopCnt64Op     -> Right $ callForeign "popCnt64" [head xs]
    DelayOp        -> Right $ defState
    SeqOp          -> Right $ eval $ head xs
    AtomicallyOp   -> Right $ callSaturated (xs !! 0) []
    -- Get the data constructor tag from a value.
    DataToTagOp    -> callF "dataToTag"
    -- Basically unsafeCoerce :: Int# -> <enumeration type>
    TagToEnumOp    -> Right $ head xs
    TouchOp        -> Right $ defState
    RaiseOp        -> callF "die"
    RaiseIOOp      -> callF "die"
    -- noDuplicate is only relevant in a threaded environment.
    NoDuplicateOp  -> Right $ defState
    CatchOp        -> callF "jsCatch"
    x              -> Left $ "Unsupported PrimOp: " ++ showOutputable cfg x
  where
    (arr:ix:_) = xs

    writeArr (a:i:rhs:_) etype =
      Right $ assignEx (index (index (index a (litS "v")) (litS etype)) i) rhs
    writeArr _ _ =
      error "writeArray primop with too few arguments!"

    readArr (a:i:_) elemtype =
      Right $ index (index (index a (litS "v")) (litS elemtype)) i
    readArr _ _ =
      error "writeArray primop with too few arguments!"

    writeOffAddr (addr:off:rhs:_) etype esize =
      Right $ callForeign "writeOffAddr" [litS etype,litN esize,addr,off,rhs]
    writeOffAddr _ _ _ =
      error "writeOffAddr primop with too few arguments!"

    readOffAddr (addr:off:_) etype esize =
      Right $ callForeign "readOffAddr" [litS etype,litN esize,addr,off]
    readOffAddr _ _ _ =
      error "readOffAddr primop with too few arguments!"

    callF f = Right $ callForeign f xs

    bOp bop =
      case xs of
        [x, y] -> Right $ binOp bop x y
        _      -> error $ "PrimOps.binOp failed! op is " ++ show bop

    -- Bitwise ops on words need to be unsigned; exploit the fact that >>> is!
    wordMath = fmap (\oper -> binOp ShrL oper (litN 0))
    intMath = fmap (wrapIntMath cfg)


text:
<configuration>

  <appender name="ROLLING"
    class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>${randomOutputDir}z${testId}</File>
    <rollingPolicy
      class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <FileNamePattern>
        ${randomOutputDir}${testId}-%d{yyyy-MM-dd_HH_mm_ss}.%i
      </FileNamePattern>
      <TimeBasedFileNamingAndTriggeringPolicy
        class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
        <MaxFileSize>${sizeThreshold}</MaxFileSize>
      </TimeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    <encoder>
      <Pattern>%msg%n</Pattern>
      <outputPatternAsPresentationHeader>false</outputPatternAsPresentationHeader>
    </encoder>
  </appender>

  <root level="debug">
    <appender-ref ref="ROLLING" />
  </root>

</configuration>


text:
<!DOCTYPE html>

  <title>Browser Underscore templates with JavaScript</title>
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">

Browser Underscore templates with JavaScript

          <button id="home-btn" type="button" class="btn btn-default">Home</button>
          <button id="oldest-clients-btn" type="button" class="btn btn-default">Oldest clients</button>
          <button id="best-clients-btn" type="button" class="btn btn-default">Best clients</button>

Home

            Panel content


text:
SpreeInventorySync
===================

SpreeInventorySync provides functionality for importing inventory status from an external inventory system

More information can be found on the [wiki](https://github.com/freerunningtech/spree_inventory_sync/wiki)

Installation
------------

Add spree_inventory_sync to your Gemfile:

```rubygem
gem 'spree_inventory_sync', github: 'freerunningtech/spree_inventory_sync'
```

Bundle your dependencies and run the installation generator:

```shell
bundle
bundle exec rails g spree_inventory_sync:install
```

Configure your inventory sync by doing the following in your application:

In ``config/initializers/spree_inventory_sync.rb`

```ruby
Spree::InventorySync.configure do |config|
  config.import_class = "" # A string containing the class to use for importing (i.e. Spree::InventorySync::Source::CoreWarhouse)
  config.options      = {} # A hash contianing options to be passed to the source
end
```

Support
-------

The following back ends are currently supported:

- Core Warehouse

Testing
-------

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

```shell
bundle
bundle exec rake test_app
bundle exec rspec spec
```

When testing your applications integration with this extension you may use it's factories.
Simply add this require statement to your spec_helper:

```ruby
require 'spree_inventory_sync/factories'
```

Copyright (c) 2014 FreeRunning Technologies, released under the New BSD License


text:
"use strict";

set_global("$", global.make_zjquery());

const _people = {
    small_avatar_url_for_person() {
        return "http://example.com/example.png";
    },
};

set_global("people", _people);

zrequire("compose_pm_pill");
zrequire("input_pill");
zrequire("user_pill");

let pills = {
    pill: {},
};

run_test("pills", () => {
    const othello = {
        user_id: 1,
        email: "othello@example.com",
        full_name: "Othello",
    };

    const iago = {
        email: "iago@zulip.com",
        user_id: 2,
        full_name: "Iago",
    };

    const hamlet = {
        email: "hamlet@example.com",
        user_id: 3,
        full_name: "Hamlet",
    };

    people.get_realm_users = function () {
        return [iago, othello, hamlet];
    };

    const recipient_stub = $("#private_message_recipient");
    const pill_container_stub = $('.pill-container[data-before="You and"]');
    recipient_stub.set_parent(pill_container_stub);
    let create_item_handler;

    const all_pills = new Map();

    pills.appendValidatedData = function (item) {
        const id = item.user_id;
        assert(!all_pills.has(id));
        all_pills.set(id, item);
    };
    pills.items = function () {
        return Array.from(all_pills.values());
    };

    let text_cleared;
    pills.clear_text = function () {
        text_cleared = true;
    };

    let pills_cleared;
    pills.clear = function () {
        pills_cleared = true;
        pills = {
            pill: {},
        };
        all_pills.clear();
    };

    let appendValue_called;
    pills.appendValue = function (value) {
        appendValue_called = true;
        assert.equal(value, "othello@example.com");
        this.appendValidatedData(othello);
    };

    let get_by_email_called = false;
    people.get_by_email = function (user_email) {
        get_by_email_called = true;
        if (user_email === iago.email) {
            return iago;
        }
        if (user_email === othello.email) {
            return othello;
        }
    };

    let get_by_user_id_called = false;
    people.get_by_user_id = function (id) {
        get_by_user_id_called = true;
        if (id === othello.user_id) {
            return othello;
        }
        assert.equal(id, 3);
        return hamlet;
    };

    function test_create_item(handler) {
        (function test_rejection_path() {
            const item = handler(othello.email, pills.items());
            assert(get_by_email_called);
            assert.equal(item, undefined);
        })();

        (function test_success_path() {
            get_by_email_called = false;
            const res = handler(iago.email, pills.items());
            assert(get_by_email_called);
            assert.equal(typeof res, "object");
            assert.equal(res.user_id, iago.user_id);
            assert.equal(res.display_value, iago.full_name);
        })();
    }

    function input_pill_stub(opts) {
        assert.equal(opts.container, pill_container_stub);
        create_item_handler = opts.create_item_from_text;
        assert(create_item_handler);
        return pills;
    }

    input_pill.create = input_pill_stub;

    compose_pm_pill.initialize();
    assert(compose_pm_pill.widget);

    compose_pm_pill.set_from_typeahead(othello);
    compose_pm_pill.set_from_typeahead(hamlet);

    const user_ids = compose_pm_pill.get_user_ids();
    assert.deepEqual(user_ids, [othello.user_id, hamlet.user_id]);

    const user_ids_string = compose_pm_pill.get_user_ids_string();
    assert.equal(user_ids_string, "1,3");

    const emails = compose_pm_pill.get_emails();
    assert.equal(emails, "othello@example.com,hamlet@example.com");

    const persons = [othello, iago, hamlet];
    const items = compose_pm_pill.filter_taken_users(persons);
    assert.deepEqual(items, [{email: "iago@zulip.com", user_id: 2, full_name: "Iago"}]);

    test_create_item(create_item_handler);

    compose_pm_pill.set_from_emails("othello@example.com");
    assert(compose_pm_pill.widget);

    assert(get_by_user_id_called);
    assert(pills_cleared);
    assert(appendValue_called);
    assert(text_cleared);
});

run_test("has_unconverted_data", () => {
    compose_pm_pill.widget = {
        is_pending: () => true,
    };

    // If the pill itself has pending data, we have unconverted
    // data.
    assert.equal(compose_pm_pill.has_unconverted_data(), true);

    compose_pm_pill.widget = {
        is_pending: () => false,
        items: () => [{user_id: 99}],
    };

    // Our pill is complete and all items contain user_id, so
    // we do NOT have unconverted data.
    assert.equal(compose_pm_pill.has_unconverted_data(), false);

    compose_pm_pill.widget = {
        is_pending: () => false,
        items: () => [{user_id: 99}, {email: "random@mit.edu"}],
    };

    // One of our items only knows email (as in a bridge-with-zephyr
    // scenario where we might not have registered the user yet), so
    // we have some unconverted data.
    assert.equal(compose_pm_pill.has_unconverted_data(), true);
});


text:
module V1
  class GroupsController < ApiController
    respond_to :json
    before_action :load_group, only: [:show, :destroy]

    def index
      render json: Group.all
    end

    def create
      param = group_params.merge!({owner_id: current_user.id.to_s})
      render json: current_user.groups.create(param)
    end

    def show
      render json: @group
    end

    def destroy
      render json: @group.destroy
    end

    private

    def group_params
      params.require(:group).permit(:name, :public)
    end

    def load_group
      @group = current_user.groups.where(id: params[:id])
    end
  end
end


text:
if (self.importScripts) {
  importScripts('../resources/fetch-test-helpers.js');
  importScripts('../resources/fetch-access-control-util.js');
}

var TEST_TARGETS = [
  // Redirect: same origin -> same origin
  [REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=GET&headers=CUSTOM',
   [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
   [methodIsGET, noCustomHeader, authCheck1]],

  // Redirect: same origin -> other origin
  [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
   '&mode=no-cors&method=GET&headers=CUSTOM',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])],

  // Status code tests for mode="no-cors"
  // The 301 redirect response changes POST method to GET method.
  [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
   '&mode=no-cors&method=POST&Status=301',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])],
  // The 302 redirect response changes POST method to GET method.
  [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
   '&mode=no-cors&method=POST',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])],
  // GET method must be used for 303 redirect.
  [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
   '&mode=no-cors&method=POST&Status=303',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])],
  // The 307 redirect response doesn't change the method.
  [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
   '&mode=no-cors&method=POST&Status=307',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck2])],
  // The 308 redirect response doesn't change the method.
  // FIXME: disabled due to https://crbug.com/451938
  // [REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
  // '&mode=no-cors&method=POST&Status=308',
  // [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
  // onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck2])],

  // Redirect: other origin -> same origin
  [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=GET',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])],
  [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=GET&headers=CUSTOM',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck1])],

  // Status code tests for mode="no-cors"
  // The 301 redirect response MAY change the request method from POST to GET.
  [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=POST&Status=301',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])],
  // The 302 redirect response MAY change the request method from POST to GET.
  [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=POST',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])],
  // GET method must be used for 303 redirect.
  [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=POST&Status=303',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck1])],
  // The 307 redirect response MUST NOT change the method.
  [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
   '&mode=no-cors&method=POST&Status=307',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck1])],
  // The 308 redirect response MUST NOT change the method.
  // FIXME: disabled due to https://crbug.com/451938
  // [OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL) +
  //  '&mode=no-cors&method=POST&Status=308',
  //  [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
  //  onlyOnServiceWorkerProxiedTest([methodIsPOST, authCheck1])],

  // Redirect: other origin -> same origin
  [OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL) +
   '&mode=no-cors&method=GET',
   [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque],
   onlyOnServiceWorkerProxiedTest([methodIsGET, authCheck2])],
];

if (self.importScripts) {
  executeTests(TEST_TARGETS);
  done();
}


text:
Functions are the main entity in Kubeless. It is possible to write Functions in different languages but all of them share common properties like the generic interface, the default timeout or the runtime UID. In this document we are going to explain some these common properties and different runtimes availables in Kubeless. You can find in depth details about the Function specification [here](/docs/advanced-function-deployment).

## Functions Interface

Every function receives two arguments: `event` and `context`. The first argument contains information about the source of the event that the function has received. The second contains general information about the function like its name or maximum timeout. This is a representation in YAML of a Kafka event:

```yaml
event:
  data:                                         # Event data
    foo: "bar"                                  # The data is parsed as JSON when required
  event-id: "2ebb072eb24264f55b3fff"            # Event ID
  event-type: "application/json"                # Event content type
  event-time: "2009-11-10 23:00:00 +0000 UTC"   # Timestamp of the event source
  event-namespace: "kafkatriggers.kubeless.io"  # Event emitter
  extensions:                                   # Optional parameters
    request: ...                                # Reference to the request received
    response: ...                               # Reference to the response to send
                                                # (specific properties will depend on the function language)
context:
    function-name: "pubsub-nodejs"
    timeout: "180"
    runtime: "nodejs6"
    memory-limit: "128M"
```

Functions should return a string that will be used as the HTTP response for the caller. Some runtimes may support different types (like objects) for the returned values.

You can check basic examples of every language supported in the [examples](https://github.com/kubeless/kubeless/tree/master/examples) folder.

## Functions Timeout

Runtimes have a maximum timeout set by the environment variable FUNC_TIMEOUT. This environment variable can be set using the CLI option `--timeout`. The default value is 180 seconds. If a function takes more than that in being executed, the process will be terminated.

## Runtime User

As a [Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) functions are configured to run with an unprivileged user (UID 1000) by default (except for OpenShift where the UID is automatically set). This prevent functions from having root privileges. This default behaviour can be overridden specifying a different Security Context in the `Deployment` template that is part of the Function Spec.

## Scheduled functions

It is possible to deploy functions that should be triggered following a certain schedule. For specifying the execution frequency we use the [Cron](https://en.wikipedia.org/wiki/Cron) format. Every time a scheduled function is executed, a [Job](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/) is started. This Job will do a HTTP GET request to the function service and will be successful as far as the function returns 200 OK.

For executing scheduled functions we use Kubernetes [CronJobs](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) using mostly the default options which means:
 - If a Job fails, it won't be restarted but it will be retried in the next scheduled event. The maximum time that a Job will exist is specified with the function timeout (180 seconds by default).
 - The concurrency policy is set to `Allow` so concurrent jobs may exists.
 - The history limit is set to maintain as maximum three successful jobs (and one failed).

If for some reason you want to modify one of the default values for a certain function you can execute `kubectl edit cronjob trigger-<func_name>` (where `func_name` is the name of your function) and modify the fields required. Once it is saved the CronJob will be updated.

## Monitoring functions

Some Kubeless runtimes expose metrics at `/metrics` endpoint and these metrics will be collected by Prometheus. We also include a prometheus setup in [`manifests/monitoring`](https://github.com/kubeless/kubeless/blob/master/manifests/monitoring/prometheus.yaml) to help you easier set it up. The metrics collected are: Number of calls, succeeded and error executions and the time spent per call.

## Runtime variants

Check [this document](/docs/runtimes) to get more details about supported runtimes and languages.


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

import java.io.Serializable;
import java.util.TreeSet;

/**
 *
 * @author Oliver Rolle <oliver.rolle@the-urban-institute.de>
 */
public class Routing<KEY extends Serializable & Comparable<KEY>> {
  private final NodeInformation<KEY> myself = new NodeInformation<>();
  TreeSet<NodeInformation<KEY>> others = new TreeSet<>();

  public NodeInformation<KEY> myself() {
    return myself;
  }

}


text:
'use strict';

const Promise = require('bluebird');
const HookRunner = require('lib/worker/runner/test-runner/hook-runner');
const ExecutionThread = require('lib/worker/runner/test-runner/execution-thread');
const {Suite, Test} = require('../../../_mocha');

describe('worker/runner/test-runner/hook-runner', () => {
    const sandbox = sinon.sandbox.create();

    const mkRunner_ = (opts = {}) => {
        const test = opts.test || Test.create(Suite.create());

        return HookRunner.create(test, Object.create(ExecutionThread.prototype));
    };

    beforeEach(() => {
        sandbox.stub(ExecutionThread.prototype, 'run').callsFake(async (runnable) => {
            await runnable.fn();
        });
    });

    afterEach(() => sandbox.restore());

    describe('runBeforeEachHooks', () => {
        it('should run hook in execution thread', async () => {
            const test = Test.create();

            const suite = Suite.create()
                .beforeEach(() => {})
                .addTest(test);

            await mkRunner_({test}).runBeforeEachHooks();

            assert.calledWithMatch(ExecutionThread.prototype.run, suite.beforeEachHooks[0]);
        });

        it('should protect hook from modification during run in execution thread', async () => {
            const test = Test.create();

            const suite = Suite.create()
                .beforeEach(() => {})
                .addTest(test);

            ExecutionThread.prototype.run.callsFake((hook) => hook.foo = 'bar');

            await mkRunner_({test}).runBeforeEachHooks();

            assert.notProperty(suite.beforeEachHooks[0], 'foo');
        });

        it('should call beforeEach hooks for all parents', async () => {
            const topLevelHook1 = sinon.spy().named('topLevelHook1');
            const topLevelHook2 = sinon.spy().named('topLevelHook2');
            const hook1 = sinon.spy().named('hook1');
            const hook2 = sinon.spy().named('hook2');

            const test = Test.create();

            Suite.create()
                .beforeEach(topLevelHook1)
                .beforeEach(topLevelHook2)
                .addSuite(
                    Suite.create()
                        .beforeEach(hook1)
                        .beforeEach(hook2)
                        .addTest(test)
                );

            await mkRunner_({test}).runBeforeEachHooks();

            assert.callOrder(
                topLevelHook1,
                topLevelHook2,
                hook1,
                hook2
            );
        });

        it('should wait until first hook finished before next hook started', async () => {
            const afterFirstHook = sinon.spy().named('afterFirstHook');
            const firstHook = sinon.stub().callsFake(() => Promise.delay(10).then(afterFirstHook));
            const secondHook = sinon.spy().named('secondHook');

            const test = Test.create();

            Suite.create()
                .beforeEach(firstHook)
                .beforeEach(secondHook)
                .addTest(test);

            await mkRunner_({test}).runBeforeEachHooks();

            assert.callOrder(
                afterFirstHook,
                secondHook
            );
        });

        it('should wait until parent hook finished before child hook start', async () => {
            const afterParentHook = sinon.spy().named('afterParentHook');
            const parentHook = sinon.stub().callsFake(() => Promise.delay(10).then(afterParentHook));
            const childHook = sinon.spy().named('childHook');

            const test = Test.create();

            Suite.create()
                .beforeEach(parentHook)
                .addSuite(
                    Suite.create()
                        .beforeEach(childHook)
                        .addTest(test)
                );

            await mkRunner_({test}).runBeforeEachHooks();

            assert.callOrder(
                afterParentHook,
                childHook
            );
        });

        it('should fail on first hook fail', async () => {
            const secondParentHook = sinon.spy().named('secondParentHook');
            const childHook = sinon.spy().named('childHook');

            const test = Test.create();

            Suite.create()
                .beforeEach(() => Promise.reject(new Error('foo')))
                .beforeEach(secondParentHook)
                .addSuite(
                    Suite.create()
                        .beforeEach(childHook)
                        .addTest(test)
                );

            const runner = mkRunner_({test});

            await assert.isRejected(runner.runBeforeEachHooks(), /foo/);
            assert.notCalled(secondParentHook);
            assert.notCalled(childHook);
        });
    });

    describe('runAfterEachHooks', () => {
        it('should run hook in execution thread', async () => {
            const test = Test.create();

            const suite = Suite.create()
                .afterEach(() => {})
                .addTest(test);

            await mkRunner_({test}).runAfterEachHooks();

            assert.calledWithMatch(ExecutionThread.prototype.run, suite.afterEachHooks[0]);
        });

        it('should protect hook from modification during run in execution thread', async () => {
            const test = Test.create();

            const suite = Suite.create()
                .afterEach(() => {})
                .addTest(test);

            ExecutionThread.prototype.run.callsFake((hook) => hook.foo = 'bar');

            await mkRunner_({test}).runAfterEachHooks();

            assert.notProperty(suite.afterEachHooks[0], 'foo');
        });

        it('should call afterEach hooks for all parents', async () => {
            const topLevelHook1 = sinon.spy().named('topLevelHook1');
            const topLevelHook2 = sinon.spy().named('topLevelHook2');
            const hook1 = sinon.spy().named('hook1');
            const hook2 = sinon.spy().named('hook2');

            const test = Test.create();

            Suite.create()
                .afterEach(topLevelHook1)
                .afterEach(topLevelHook2)
                .addSuite(
                    Suite.create()
                        .afterEach(hook1)
                        .afterEach(hook2)
                        .addTest(test)
                );

            await mkRunner_({test}).runAfterEachHooks();

            assert.callOrder(
                hook1,
                hook2,
                topLevelHook1,
                topLevelHook2
            );
        });

        it('should wait until first hook finished before next hook started', async () => {
            const afterFirstHook = sinon.spy().named('afterFirstHook');
            const firstHook = sinon.stub().callsFake(() => Promise.delay(10).then(afterFirstHook));
            const secondHook = sinon.spy().named('secondHook');

            const test = Test.create();

            Suite.create()
                .afterEach(firstHook)
                .afterEach(secondHook)
                .addTest(test);

            await mkRunner_({test}).runAfterEachHooks();

            assert.callOrder(
                afterFirstHook,
                secondHook
            );
        });

        it('should wait until child hook finished before parent hook start', async () => {
            const afterChildHook = sinon.spy().named('afterChildHook');
            const childHook = sinon.stub().callsFake(() => Promise.delay(10).then(afterChildHook));
            const parentHook = sinon.spy().named('parentHook');

            const test = Test.create();

            Suite.create()
                .afterEach(parentHook)
                .addSuite(
                    Suite.create()
                        .afterEach(childHook)
                        .addTest(test)
                );

            await mkRunner_({test}).runAfterEachHooks();

            assert.callOrder(
                afterChildHook,
                parentHook
            );
        });

        it('should fail on first hook fail in suite', async () => {
            const secondHook = sinon.spy().named('secondHook');

            const test = Test.create();

            Suite.create()
                .afterEach(() => Promise.reject(new Error('foo')))
                .afterEach(secondHook)
                .addTest(test);

            const runner = mkRunner_({test});

            await assert.isRejected(runner.runAfterEachHooks(), /foo/);
            assert.notCalled(secondHook);
        });

        it('should run parent hook even if child hook failed', async () => {
            const parentHook = sinon.spy().named('parentHook');

            const test = Test.create();

            Suite.create()
                .afterEach(parentHook)
                .addSuite(
                    Suite.create()
                        .afterEach(() => Promise.reject(new Error('foo')))
                        .addTest(test)
                );

            const runner = mkRunner_({test});

            await assert.isRejected(runner.runAfterEachHooks(), /foo/);
            assert.calledOnce(parentHook);
        });

        it('should reject with child hook error if both child and parent hooks failed', async () => {
            const test = Test.create();

            Suite.create()
                .afterEach(() => Promise.reject(new Error('bar')))
                .addSuite(
                    Suite.create()
                        .afterEach(() => Promise.reject(new Error('foo')))
                        .addTest(test)
                );

            const runner = mkRunner_({test});

            await assert.isRejected(runner.runAfterEachHooks(), /foo/);
        });

        it('should run only parent afterEach hook if parent beforeEach hook failed', async () => {
            const parentHook = sinon.spy().named('parentHook');
            const childHook = sinon.spy().named('childHook');

            const test = Test.create();

            Suite.create()
                .beforeEach(() => Promise.reject(new Error()))
                .afterEach(parentHook)
                .addSuite(
                    Suite.create()
                        .afterEach(childHook)
                        .addTest(test)
                );

            const runner = mkRunner_({test});
            await runner.runBeforeEachHooks().catch(() => {});

            await runner.runAfterEachHooks();

            assert.calledOnce(parentHook);
            assert.notCalled(childHook);
        });
    });
});


text:
{% extends "templates/web.html" %}

{% block page_content %}

{{ _("Javascript is disabled on your browser") }}

{{ _("You need to enable JavaScript for your app to work.") }}
{{ _("To enable it follow the instructions in the following link: {0}").format("enable-javascript.com
") }}

		<form class="form-signin form-login" role="form">

			<input type="text" id="login_email"
				class="form-control"
				placeholder="{% if login_name_placeholder %}{{ login_name_placeholder  }}{% else %}{{ _('Email Address') }}{% endif %}"
				required autofocus>

				<input type="password" id="login_password"
						class="form-control" placeholder="{{ _('Password') }}" required>

				{{ _('Show') }}

			<button class="btn btn-sm btn-primary btn-block btn-login" type="submit">
				{{ _("Login") }}</button>

			{% if ldap_settings and ldap_settings.enabled %}
			<button class="btn btn-sm btn-default btn-block btn-login btn-ldap-login">
				{{ _("Login with LDAP") }}</button>
			{% endif %}
		</form>

			{%- if social_login -%}

{{ _("Or login with") }}

				{% for provider in provider_logins %}

							{{ provider.icon }} {{ provider.provider_name }}
				{% endfor %}

			{%- endif -%}

	{%- if not disable_signup -%}

			{{ _("Don't have an account? Sign up") }}

	{%- endif -%}

		{{ _("Forgot Password?") }}

	{%- if not disable_signup -%}
		<form class="form-signin form-signup hide" role="form">

			<input type="text" id="signup_fullname"
				class="form-control" placeholder="{{ _('Full Name') }}" required autofocus>
			<input type="email" id="signup_email"
				class="form-control" placeholder="{{ _('Email Address') }}" required>
			<button class="btn btn-sm btn-primary btn-block btn-signup" type="submit">{{ _("Sign up") }}</button>
		</form>
	{%- else -%}

			{{_("Signup Disabled")}}

{{_("Signups have been disabled for this website.")}}

{{ _("Home") }}

	{%- endif -%}

		{{ _("Have an account? Login") }}

	<form class="form-signin form-forgot hide" role="form">

		<input type="email" id="forgot_email"
			class="form-control" placeholder="{{ _('Email Address') }}" required autofocus>
		<button class="btn btn-sm btn-primary btn-block btn-forgot" type="submit">{{ _("Reset Password") }}</button>
	</form>

		{{ _("Back to Login") }}

{% endblock %}

{% block script %}

{% endblock %}

{% block sidebar %}{% endblock %}


text:
namespace Microsoft.DocAsCode.Build.ManagedReference.BuildOutputs
{
    using System;
    using System.Collections.Generic;

    using Newtonsoft.Json;
    using YamlDotNet.Serialization;

    using Microsoft.DocAsCode.DataContracts.ManagedReference;

    [Serializable]
    public class ApiLinkInfoBuildOutput
    {
        [YamlMember(Alias = "linkType")]
        [JsonProperty("linkType")]
        public LinkType LinkType { get; set; }

        [YamlMember(Alias = "type")]
        [JsonProperty("type")]
        public ApiNames Type { get; set; }

        [YamlMember(Alias = "url")]
        [JsonProperty("url")]
        public string Url { get; set; }

        private bool _needExpand = true;

        public static ApiLinkInfoBuildOutput FromModel(LinkInfo model)
        {
            if (model == null) return null;

            if (model.LinkType == LinkType.CRef)
            {
                return new ApiLinkInfoBuildOutput
                {
                    LinkType = LinkType.CRef,
                    Type = ApiNames.FromUid(model.LinkId),
                };
            }
            else
            {
                return new ApiLinkInfoBuildOutput
                {
                    LinkType = LinkType.HRef,
                    Url = ApiBuildOutputUtility.GetHref(model.LinkId, model.AltText),
                };
            }
        }

        public static ApiLinkInfoBuildOutput FromModel(LinkInfo model, Dictionary<string, ApiReferenceBuildOutput> references, string[] supportedLanguages)
        {
            if (model == null) return null;

            if (model.LinkType == LinkType.CRef)
            {
                return new ApiLinkInfoBuildOutput
                {
                    LinkType = LinkType.CRef,
                    Type = ApiBuildOutputUtility.GetApiNames(model.LinkId, references, supportedLanguages),
                    _needExpand = false,
                };
            }
            else
            {
                return new ApiLinkInfoBuildOutput
                {
                    LinkType = LinkType.HRef,
                    Url = ApiBuildOutputUtility.GetHref(model.LinkId, model.AltText),
                };
            }
        }

        public void Expand(Dictionary<string, ApiReferenceBuildOutput> references, string[] supportedLanguages)
        {
            if (_needExpand)
            {
                _needExpand = false;
                Type = ApiBuildOutputUtility.GetApiNames(Type?.Uid, references, supportedLanguages);
            }
        }
    }
}


text:
KNOWN_ADDONS = %w(
  chef-ha
  chef-sync
  opscode-analytics
  opscode-manage
  opscode-push-jobs-server
  opscode-reporting
)

add_command_under_category "install", "general", "Install addon package by name, with optional --path parameter indicating directory containing packages", 2 do
  package = ARGV[3]
  path_arg = "--path"
  if (ARGV.include?(path_arg))
    install_path = ARGV[ARGV.index(path_arg) + 1]
  end

  attributes_path = "#{base_path}/embedded/cookbooks/install_params.json"
  command = ["chef-client -z",
    "--config #{base_path}/embedded/cookbooks/solo.rb",
    "--json-attributes #{attributes_path}",
    "--log_level fatal"]

  if package.nil?
    STDERR.puts "You must supply an addon name. Valid names include: #{KNOWN_ADDONS.join(', ')}."
    exit 1
  elsif !KNOWN_ADDONS.include?(package)
    STDERR.puts  "#{package} does not appear to be a valid addon name. Valid names include: #{KNOWN_ADDONS.join(', ')}."
    exit 1
  end

  json_src = { "run_list" => ["recipe[private-chef::add_ons_wrapper]"],
    "private_chef" => { "addons"=> {
        "install" => true,
        "packages" => [package],
        "path" => install_path
      }}}
  File.open(attributes_path, "w") do |file|
    file.write json_src.to_json
  end

  status = run_command(command.join(" "))
  exit!(status.success? ? 0 : 1)
end


text:
package com.github.sofn.trpc.server.netty;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import java.util.List;

/**
 * 因为Thrift固定前4位为Frame长度,更简洁直接的写法代替 LengthFieldBasedFrameDecoder
 */
public class ThriftFramedDecoder extends ByteToMessageDecoder {

    private static final int FRAME_LENGTH_FIELD_LENGTH = 4;

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        if (in.readableBytes() < FRAME_LENGTH_FIELD_LENGTH) {
            return;
        }

        in.markReaderIndex();
        int frameLength = in.readInt();

        if (in.readableBytes() < frameLength) {
            in.resetReaderIndex();
            return;
        }

        ByteBuf frame = in.readSlice(frameLength).retain();
        out.add(frame);
    }
}


text:
<TITLE>Review for Malicious (1995)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Malicious (1995)

reviewed by
Justin Felix

MALICIOUS (1995)
A "Turkey of the Week" film review by Justin Felix
Copyright 1998 Justin Felix

Rating: ** (out of five)

Written by George Saunders.
Directed by Ian Corson.
Starring Molly Ringwald, John Vernon, Mimi Kuzyk.
Rated R (contains nudity, violence, and profanity)  92 mins.

Synopsis:  Melissa, a mentally-disturbed woman who likes to smoke, seduces
Doug, a minor-league baseball player who likes to study anatomy, work on
motorcycles, and make out with his girlfriend in a public library.  When
Doug decides to stop seeing her, Melissa maliciously takes revenge on those
around him, including his girlfriend, his mother, and his cat.

Comments:  MALICIOUS, I suppose, is an acceptable moview for what it is: a
cheap, B-movie thriller which rips off dozens and dozens of
spurned-psycho-lover-who-wants-revenge films (like FATAL ATTRACTION, HAND
THAT ROCKS THE CRADLE, etc. etc.) that have come before it.  MALICIOUS,
however, really doesn't provide very many particularly suspenseful moments.
 The plot starts off energetically enough, the main characters are
introduced and the affair between Doug and Melissa begins and ends pretty
early on in the film.  It starts to drag, unfortunately, after this.
Melissa will obviously try to take her revenge on Doug (as always seems to
happen in movies like these), but she does so in unimaginative ways that
have been done in other, better thrillers before.  She drugs someone.  She
kills a family pet and leaves it in the girlfriend's apartment.  And, of
course, she stalks, so we see a number of shots, which are supposed to be
suspenseful, where she's spying on Doug and his girlfriend.  I won't reveal
the ludicrous ending to this turkey, but I warn you that it's both
painfully obvious and a real yawner.

John Vernon does a remarkably good job at playing the not-so-bright
baseball jock who initially gets swept away by Melissa (one of the script's
faults is to try to pass off a character like this as a pre-med student).
The same cannot be said, though, for Molly Ringwald.  At times, she can
effectively pull off the obsessed lover routine, especially during her
silent, I'm-going-to-stare-you-down scenes.  At other times, however, she
just seems somehow goofy and out of place.  In one particular scene which I
guess was supposed to be suspenseful, she screeches "f--k you, you b-----d"
and throws a phone.  She delivers the line so ridiculously that one can't
help but laugh.

MALICIOUS certainly isn't the worst thriller of its kind out in the video
racks (a number of really fat turkies in this genre are out there), but it
isn't all that good or original either.  Feel free to treat this film
maliciously, watch something else.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
### Single-subject level

Add data files in the Process1 tab, use the pipeline editor:

![pipeline_induced_1](../../imgs/pipeline_induced_1.png)

![pipeline_induced_2](../../imgs/pipeline_induced_2.png)

![pipeline_induced_3](../../imgs/pipeline_induced_3.png)

View spatial patterns:

![pipeline_induced_result_1](../../imgs/pipeline_induced_result_1.png)

View scanning results:

![pipeline_induced_result_2](../../imgs/pipeline_induced_result_2.png)

### Group level


text:
@interface PodsDummy_Pods_Haneke : NSObject
@end
@implementation PodsDummy_Pods_Haneke
@end


text:
import numpy as np
from numpy import diag, sqrt, hstack, ones, eye
from numpy.linalg import inv
from scipy.linalg import qr, solve_triangular, cholesky, svd

def ols(A, b):
    """
    Ordinary Least-Squares Regression
    Coefficients Estimation.

    This is the linear algebra solution to
    OLS; minimising |Ax-b| means we want the
    values where the perpendicular is zero.
    This means we want columnwise-multiplication
    with A, giving A.T(Ax-b), therefore
    0 = A.T*Ax - A.T*b, therefore
    x = A.T*b / A.T*A. QED.
    """
    return np.linalg.inv(A.T @ A) @ A.T @ b

def ols_qr(A, b):
    """
    Ordinary Least-Squares Regression
    Coefficients Estimation.

    This is the QR Factorization solution
    to OLS; Ax = b, A = QR, QRx = b,
    therefore Rx = Q.T * b
    """
    Q, R = qr(A, mode='economic')
    return solve_triangular(R, Q.T @ b)

def ols_cholesky(A, b):
    """
    Ordinary Least-Squares Regression Coefficients
    Estimation.

    If (A.T @ A) @ x = A.T @ b and A is full rank
    then there exists an upper triangular matrix
    R such that:

    (R.T @ R) @ x = A.T @ b
    R.T @ w = A.T @ b
    R @ x = w

    Find R using Cholesky decomposition.
    """
    R = cholesky(A.T @ A)
    w = solve_triangular(R, A.T @ b, trans='T')
    return solve_triangular(R, w)

def ols_svd(A, b):
    """
    Ordinary Least-Squares Regression Coefficients
    Estimation.

    A @ x = b
    A = U @ Σ @ Vh (singular value decomposition of A)
    Σ @ Vh @ x = U.T @ b
    Σ @ w = U.T @ b
    x = Vh.T @ w
    """
    U, sigma, Vh = svd(A, full_matrices=False)
    w = (U.T @ b) / sigma
    return Vh.T @ w

def add_intercept(A):
    """
    Adds an intercept (column of ones) to a supplied array A
    such that the intercept is the first (leftmost) column
    """
    n = A.shape[0]
    intercept = ones(n).reshape(n, 1)
    return hstack((intercept, A))

def _hat(A):
    """
    The 'hat' matrix for an array A
    """
    return A @ np.linalg.inv(A.T @ A) @ A.T

def _m_matrix(A):
    """
    The 'hat' matrix for a vector of ones whose size is
    equal to the first dimension of the supplied array A
    """
    n = A.shape[0]
    l = np.ones(n).reshape(n, 1)
    return _hat(l)

def sum_of_squared_residuals(A, b):
    """
    The sum of squared residuals
    """
    n = A.shape[0]
    I = np.eye(n)
    H = _hat(A)
    return b.T @ (I - H) @ b

def total_sum_of_squares(A, b):
    """
    The total sum of squares
    """
    n = A.shape[0]
    I = np.eye(n)
    M = _m_matrix(A)
    return b.T @ (I - M) @ b

def r_squared(A, b):
    """
    The r-squared value (a.k.a. coefficient of determination)
    """
    ssr = sum_of_squared_residuals(A, b)
    sst = total_sum_of_squares(A, b)
    return 1.0 - ssr / sst

def r_squared_no_intercept(A, b):
    """
    The r-squared value (a.k.a. coefficient of determination) in the
    case where A has no intercept, per statsmodels - compare the
    slope-only model to a model that simply makes a constant
    prediction of 0 for all observations
    """
    fitted = fitted_values(A, b)
    return (fitted.T @ fitted) / (b.T @ b)

def adjusted_r_squared(A, b):
    """
    The adjusted r-squared value
    """
    n, k = A.shape
    return 1 - (n - 1) / (n - k) * (1 - r_squared(A, b))

def adjusted_r_squared_no_intercept(A, b):
    """
    The adjusted r-squared value in the case where no intercept term is present
    """
    n, k = A.shape
    return 1 - n / (n - k) * (1 - r_squared_no_intercept(A, b))

def fitted_values(A, b):
    """
    The predicted values for b
    """
    return _hat(A) @ b

def _residual_maker(A, b):
    """
    Returns a matrix which can be used to make residuals from b
    """
    n = A.shape[0]
    I = eye(n)
    return I - _hat(A)

def residuals(A, b):
    """
    The residuals of the model
    """
    return _residual_maker(A, b) @ b

def mean_standard_error_residuals(A, b):
    """
    Mean squared error of the residuals. The sum of squared residuals
    divided by the residual degrees of freedom.
    """
    n, k = A.shape
    ssr = sum_of_squared_residuals(A, b)
    return ssr / (n - k)

def mean_standard_error_model(A, b):
    """
    Mean squared error the model.
    """
    k = A.shape[1]

    sst = total_sum_of_squares(A, b)
    ssr = sum_of_squared_residuals(A, b)
    sse = sst - ssr

    return sse / (k - 1)

def mean_standard_error_model_no_intercept(A, b):
    """
    Mean squared error the model in the case where A has no
    intercept and the model is slope-only.
    """
    k = A.shape[1]

    fitted = fitted_values(A, b)
    sse = fitted.T @ fitted

    return sse / k

def standard_error(A, b):
    """
    The standard errors of the parameter estimates.
    """
    mse = mean_standard_error_residuals(A, b)
    C = inv(A.T @ A)
    return sqrt(diag(C) * mse)

def t_statistic(A, b):
    """
    t-statistics for the model.
    """
    betas = ols(A, b)
    se = standard_error(A, b)
    return betas / se

def f_statistic(A, b):
    """
    F-statistic of the fully specified model.
    """
    mse_model = mean_standard_error_model(A, b)
    mse_resid = mean_standard_error_residuals(A, b)
    return mse_model / mse_resid

def f_statistic_no_intercept(A, b):
    """
    F-statistic of the fully specified model in the case where
    A has no intercept (a slope-only model).
    """
    mse_model = mean_standard_error_model_no_intercept(A, b)
    mse_resid = mean_standard_error_residuals(A, b)
    return mse_model / mse_resid

def drop_missing(A, b):
    """
    Returns a filtration of A (features) and b (targets) where all
    values are finite, with the intention that OLS can then be
    performed on dense / 'complete' observations.

    This is analogous to the statsmodels missing='drop' mechanism.

    >>> import numpy as np
    >>> A = np.array([[1, 1.1], [2, np.nan], [3, 3.1], [4, 4.1]])
    >>> b = np.array([5, 6, 7, 8])

    >>> drop_missing(A, b)
    (array([[1. , 1.1],
            [3. , 3.1],
            [4. , 4.1]]), array([5, 7, 8]))
    """
    m = A.shape[0]
    assert m == len(b)

    A_bar = np.empty_like(A)
    b_bar = np.empty_like(b)

    ctr = 0

    for i in range(m):
        feature_row = A[i, :]
        target = b[i]
        if np.all(np.isfinite(feature_row)) and np.isfinite(target):
            A_bar[ctr, :] = feature_row
            b_bar[ctr] = target
            ctr += 1

    return A_bar[:ctr, :], b_bar[:ctr]

if __name__ == '__main__':
    import pytest
    pytest.main([__file__])


text:
import { Injectable, Inject, Component } from '@angular/core';
import { Observable } from "rxjs/Observable";
import { HttpServices } from 'app/AppCommon/httpservices.service';

@Injectable()
export class AutomaticCallbackService {

    constructor(private httpservices: HttpServices) { }

    getAutomaticCallbackService(acbUrl, postACBGet) {

        this.httpservices.httpGetRequest(acbUrl)
            .subscribe((res) => {
                var acbParsedJson = res.json();
                postACBGet(acbParsedJson);
            }, (err) => {
                postACBGet(null);
            });
    }

    putAutomaticCallbackService(acbUrl, isAutomaticCallbackChecked, postACBPut) {

        var body = '<?xml version="1.0" encoding="UTF-8"?> <AutomaticCallback xmlns="http://schema.broadsoft.com/xsi"><active>' + isAutomaticCallbackChecked + '</active></AutomaticCallback>';
        this.httpservices.httpPutRequest(acbUrl, body)
            .subscribe((res) => {
                postACBPut(res);
            }, (err) => {
                postACBPut(err);
            });
    }

}


text:
id: bad87fee1348bd9aeda08845
title: Responsively Style Checkboxes
challengeType: 0
forumTopicId: 18269
required:
  - link: >-
      https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css
    raw: true
dashedName: responsively-style-checkboxes
---

# --description--

Since Bootstrap's `col-xs-*` classes are applicable to all `form` elements, you can use them on your checkboxes too! This way, the checkboxes will be evenly spread out across the page, regardless of how wide the screen resolution is.

# --instructions--

Nest all three of your checkboxes in a `<div class="row">` element. Then nest each of them in a `<div class="col-xs-4">` element.

# --hints--

All of your checkboxes should be nested inside one `div` with the class `row`.

```js
assert($('div.row:has(input[type="checkbox"])').length > 0);
```

Each of your checkboxes should be nested inside its own `div` with the class `col-xs-4`.

```js
assert($('div.col-xs-4:has(input[type="checkbox"])').length > 2);
```

All of your `div` elements should have closing tags.

```js
assert(
  code.match(/<\/div>/g) &&
    code.match(/<div/g) &&
    code.match(/<\/div>/g).length === code.match(/<div/g).length
);
```

# --seed--

## --seed-contents--

```html
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  h2 {
    font-family: Lobster, Monospace;
  }

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

</style>

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-8">
      <h2 class="text-primary text-center">CatPhotoApp</h2>
    </div>
    <div class="col-xs-4">
      <a href="#"><img class="img-responsive thick-green-border" src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
    </div>
  </div>
  <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg" class="img-responsive" alt="Three kittens running towards the camera.">
  <div class="row">
    <div class="col-xs-4">
      <button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button>
    </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button>
    </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button>
    </div>
  </div>
  <p>Things cats <span class="text-danger">love:</span></p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
  <form action="https://freecatphotoapp.com/submit-cat-photo">
    <div class="row">
      <div class="col-xs-6">
        <label><input type="radio" name="indoor-outdoor"> Indoor</label>
      </div>
      <div class="col-xs-6">
        <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
      </div>
    </div>
    <label><input type="checkbox" name="personality"> Loving</label>
    <label><input type="checkbox" name="personality"> Lazy</label>
    <label><input type="checkbox" name="personality"> Crazy</label>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</div>
```

# --solutions--

```html
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  h2 {
    font-family: Lobster, Monospace;
  }

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

</style>

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-8">
      <h2 class="text-primary text-center">CatPhotoApp</h2>
    </div>
    <div class="col-xs-4">
      <a href="#"><img class="img-responsive thick-green-border" src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
    </div>
  </div>
  <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg" class="img-responsive" alt="Three kittens running towards the camera.">
  <div class="row">
    <div class="col-xs-4">
      <button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button>
    </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button>
    </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button>
    </div>
  </div>
  <p>Things cats <span class="text-danger">love:</span></p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
  <form action="https://freecatphotoapp.com/submit-cat-photo">
    <div class="row">
      <div class="col-xs-6">
        <label><input type="radio" name="indoor-outdoor"> Indoor</label>
      </div>
      <div class="col-xs-6">
        <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-4">
        <label><input type="checkbox" name="personality"> Loving</label>
      </div>
      <div class="col-xs-4">
         <label><input type="checkbox" name="personality"> Lazy</label>
      </div>
      <div class="col-xs-4">
         <label><input type="checkbox" name="personality"> Crazy</label>
      </div>
    </div>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</div>
```