text:
import itertools
import unittest

import dimod
from dimod import make_quadratic, make_quadratic_cqm, poly_energy, poly_energies

class TestMakeQuadratic(unittest.TestCase):

    def test__spin_prod(self):

        cqm = dimod.higherorder.utils._spin_product(['a', 'b', 'p', 'aux'])

        for v in ['a', 'b', 'p', 'aux']:
            self.assertIn(v, cqm.variables)
        self.assertEqual(len(cqm), 4)  # has an auxiliary variable

        seen = set()
        samples = dimod.ExactSolver().sample(cqm)
        for sample, energy in samples.data(['sample', 'energy']):
            if energy == 0:
                self.assertEqual(sample['a'] * sample['b'], sample['p'])
                seen.add((sample['a'], sample['b'], sample['p']))
            if sample['a'] * sample['b'] != sample['p']:
                self.assertGreaterEqual(energy, 1)  # gap 1
        self.assertEqual(seen, {(-1, -1, +1),
                                (-1, +1, -1),
                                (+1, -1, -1),
                                (+1, +1, +1)})

    def test_empty(self):
        cqm = make_quadratic_cqm({}, dimod.SPIN)
        self.assertTrue(cqm.is_almost_equal(dimod.ConstrainedQuadraticModel()))

    def test_no_higher_order(self):
        poly = {(0, 1): -1, (1, 2): 1}

        cqm = make_quadratic_cqm(poly, dimod.SPIN)

        variables = set().union(*poly)
        aux_variables = tuple(set(cqm.variables) - variables)
        variables = tuple(variables)
        for config in itertools.product((-1, 1), repeat=len(variables)):
            sample = dict(zip(variables, config))
            energy = poly_energy(sample, poly)

            reduced_energies = []
            for aux_config in itertools.product((-1, 1),
                                                repeat=len(aux_variables)):
                aux_sample = dict(zip(aux_variables, aux_config))
                aux_sample.update(sample)
                if cqm.check_feasible(aux_sample):
                    reduced_energies.append(cqm.objective.energy(aux_sample))

            self.assertAlmostEqual(energy, min(reduced_energies))

    def test_simple(self):
        poly = {(0, 1, 2): -1}

        cqm = make_quadratic_cqm(poly, dimod.SPIN)

        variables = set().union(*poly)
        aux_variables = tuple(set(cqm.variables) - variables)
        variables = tuple(variables)
        self.assertTrue(aux_variables)
        for config in itertools.product((-1, 1), repeat=len(variables)):
            sample = dict(zip(variables, config))
            energy = poly_energy(sample, poly)

            reduced_energies = []
            for aux_config in itertools.product((-1, 1),
                                                repeat=len(aux_variables)):
                aux_sample = dict(zip(aux_variables, aux_config))
                aux_sample.update(sample)
                if cqm.check_feasible(aux_sample):
                    reduced_energies.append(cqm.objective.energy(aux_sample))

            self.assertAlmostEqual(energy, min(reduced_energies))

    def test_several_terms(self):
        poly = {(0, 1, 2): -1, (1, 2, 3): 1, (0, 2, 3): .5,
                (0,): .4,
                (): .5}

        cqm = make_quadratic_cqm(poly, dimod.SPIN, cqm=dimod.ConstrainedQuadraticModel())

        variables = set().union(*poly)
        aux_variables = tuple(set(cqm.variables) - variables)
        variables = tuple(variables)
        self.assertTrue(aux_variables)
        for config in itertools.product((-1, 1), repeat=len(variables)):
            sample = dict(zip(variables, config))

            energy = poly_energy(sample, poly)

            reduced_energies = []
            for aux_config in itertools.product((-1, 1),
                                                repeat=len(aux_variables)):
                aux_sample = dict(zip(aux_variables, aux_config))
                aux_sample.update(sample)
                if cqm.check_feasible(aux_sample):
                    reduced_energies.append(cqm.objective.energy(aux_sample))

            self.assertAlmostEqual(energy, min(reduced_energies))

    def test_bug(self):
        # from a bug report
        # https://support.dwavesys.com/hc/en-us/community/posts/360035719954-dimod-make-quadratic-returns-error
        H = {(0, 1, 0, 1): -4.61898,
             (0, 1, 1, 0): 4.61898,
             (0, 2, 0, 2): -5.18353,
             (0, 2, 2, 0): 5.18353,
             (1, 0, 0, 1): 4.61898,
             (1, 0, 1, 0): -4.61898,
             (1, 2, 2, 1): 4.97017,
             (2, 0, 0, 2): 5.18353,
             (2, 0, 2, 0): -5.18353,
             (2, 1, 1, 2): 4.97017,
             }

        cqm = make_quadratic_cqm(H, 'BINARY')

        # should be no aux variables
        self.assertEqual(set(cqm.variables), {0, 1, 2})

    def test_another(self):
        J = {(0, 1, 2): -1, (0, 1, 3): -1, (2, 3, 0): 1, (3, 2, 0): -1}
        h = {0: 0, 1: 0, 2: 0, 3: 0}
        off = .5
        obj = dimod.BinaryQuadraticModel.from_ising(h, {}, off)

        poly = J.copy()
        poly.update({(v,): bias for v, bias in h.items()})
        poly[()] = off

        cqm0 = dimod.ConstrainedQuadraticModel()
        cqm0.set_objective(obj)
        cqm = make_quadratic_cqm(J, dimod.SPIN, cqm=cqm0)

        variables = set(h).union(*J)
        aux_variables = tuple(set(cqm.variables) - variables)
        variables = tuple(variables)
        self.assertTrue(aux_variables)
        for config in itertools.product((-1, 1), repeat=len(variables)):
            sample = dict(zip(variables, config))

            energy = poly_energy(sample, poly)

            reduced_energies = []
            for aux_config in itertools.product((-1, 1),
                                                repeat=len(aux_variables)):
                aux_sample = dict(zip(aux_variables, aux_config))
                aux_sample.update(sample)
                if cqm.check_feasible(aux_sample):
                    reduced_energies.append(cqm.objective.energy(aux_sample))

            self.assertAlmostEqual(energy, min(reduced_energies))

    def test_vartype(self):
        poly = {(0, 1, 2): 10, (0, 1): 5}  # make sure (0, 1) is most common

        self.assertTrue(dimod.make_quadratic_cqm(poly, 'SPIN')
                        .is_almost_equal(dimod.make_quadratic_cqm(poly, dimod.SPIN)))
        self.assertTrue(dimod.make_quadratic_cqm(poly, 'BINARY')
                         .is_almost_equal(dimod.make_quadratic_cqm(poly,  dimod.BINARY)))

    def test_quad_to_linear(self):
        J = {(0, 1): -1, (0, 1, 2): 1, (0, 1, 3): 1}
        h = {}
        off = .5

        poly = J.copy()
        poly.update({(v,): bias for v, bias in h.items()})
        poly[()] = off

        cqm0 = dimod.ConstrainedQuadraticModel()
        cqm0.set_objective(dimod.BinaryQuadraticModel.from_ising(h, {}, off))
        cqm = make_quadratic_cqm(J, dimod.SPIN, cqm=cqm0)

        variables = set(h).union(*J)
        aux_variables = tuple(set(cqm.variables) - variables)
        variables = tuple(variables)
        self.assertTrue(aux_variables)
        for config in itertools.product((-1, 1), repeat=len(variables)):
            sample = dict(zip(variables, config))

            energy = poly_energy(sample, poly)

            reduced_energies = []
            for aux_config in itertools.product((-1, 1),
                                                repeat=len(aux_variables)):
                aux_sample = dict(zip(aux_variables, aux_config))
                aux_sample.update(sample)
                if cqm.check_feasible(aux_sample):
                    reduced_energies.append(cqm.objective.energy(aux_sample))

            self.assertAlmostEqual(energy, min(reduced_energies))

    def test_linear_and_offset(self):

        poly = {(0,): .5, tuple(): 1.3}

        cqm = dimod.make_quadratic_cqm(poly, dimod.BINARY)
        obj = dimod.BinaryQuadraticModel({0: .5}, {}, 1.3, dimod.BINARY)

        self.assertTrue(cqm.is_almost_equal(dimod.ConstrainedQuadraticModel.from_bqm(obj)))

    def test_binary_polynomial(self):

        HUBO = {(0, 1, 2): .5, (0, 1): 1.3, (2, 4, 1): -1, (3, 2): -1}

        cqm = make_quadratic_cqm(HUBO, dimod.BINARY)

        variables = set().union(*HUBO)
        aux_variables = tuple(set(cqm.variables) - variables)
        variables = tuple(variables)
        self.assertTrue(aux_variables)
        for config in itertools.product((0, 1), repeat=len(variables)):
            sample = dict(zip(variables, config))

            energy = poly_energy(sample, HUBO)

            reduced_energies = []
            for aux_config in itertools.product((0, 1),
                                                repeat=len(aux_variables)):
                aux_sample = dict(zip(aux_variables, aux_config))
                aux_sample.update(sample)
                if cqm.check_feasible(aux_sample):
                    reduced_energies.append(cqm.objective.energy(aux_sample))

            self.assertAlmostEqual(energy, min(reduced_energies))

    def test_poly_energies(self):
        linear = {0: 1.0, 1: 1.0}
        j = {(0, 1, 2): 0.5}
        poly = dimod.BinaryPolynomial.from_hising(linear, j)
        samples = [[1, 1, -1], [1, -1, 1], [1, 1, 1], [-1, 1, -1]]

        en = poly_energies(samples, poly)
        self.assertListEqual(list(en), [1.5, -0.5, 2.5, 0.5])

        en = poly_energy(samples[0], poly)
        self.assertAlmostEqual(en, 1.5)

        with self.assertRaises(ValueError):
            poly_energy(samples, poly)

        poly = {('a',): 1.0, ('b',): 1.0, ('a', 'b', 'c'): 0.5}
        samples = [{'a': 1, 'b': 1, 'c': -1},
                   {'a': 1, 'b': -1, 'c': 1},
                   {'a': 1, 'b': 1, 'c': 1},
                   {'a': -1, 'b': 1, 'c': -1}]
        en = poly_energies(samples, poly)
        self.assertListEqual(list(en), [1.5, -0.5, 2.5, 0.5])

        en = poly_energy(samples[0], poly)
        self.assertAlmostEqual(en, 1.5)

        with self.assertRaises(ValueError):
            poly_energy(samples, poly)


text:
package de.bitdroid.flooding.network;

import com.google.android.gms.auth.GoogleAuthException;

import java.util.concurrent.TimeUnit;

import de.bitdroid.flooding.auth.LoginManager;
import retrofit.RetrofitError;
import rx.Observable;
import rx.functions.Func1;
import timber.log.Timber;

/**
 * RxJava function which refreshes the google auth key on errors
 * and retries the network request.
 */
public class RetryFunc implements Func1<Observable<? extends Throwable>, Observable<?>> {

	private static final int MAX_RETRY = 1;
	private static final long DELAY = 200; // ms

	private final LoginManager loginManager;

	private int retryCount = 0;
	private int currentDelay = 0;

	RetryFunc(LoginManager loginManager) {
		this.loginManager = loginManager;
	}

	@Override
	public Observable<?> call(Observable<? extends Throwable> observable) {
		return observable.flatMap(new Func1<Throwable, Observable<?>>() {
			@Override
			public Observable<?> call(Throwable throwable) {
				// check for max retries
				++retryCount;
				if (retryCount > MAX_RETRY) return Observable.error(throwable);

				if (throwable instanceof RetrofitError) {
					// if unauthorized try resetting access token
					RetrofitError error = (RetrofitError) throwable;
					if (error.getKind() == RetrofitError.Kind.HTTP && error.getResponse().getStatus() == 401) {
						loginManager.clearToken();
						return Observable.just(null);
					}

					// if problem getting the token then forward exception
					Throwable cause = error.getCause();
					if (cause != null && cause instanceof GoogleAuthException) {
						Timber.d("found GoogleAuthException, should log out");
						return Observable.error(throwable);
					}
				}

				// linear backoff
				currentDelay += DELAY;
				return Observable.timer(currentDelay, TimeUnit.MILLISECONDS);
			}
		});
	}
}

redpajama_set_name: RedPajamaGithub


text:
import supertest from 'supertest';
import { expect } from 'chai';
import jwt from 'jsonwebtoken';
import dotenv from 'dotenv';

import app from '../../../index';

dotenv.config();
const request = supertest(app);
let token;

describe('POST /api/v1/user/forgotPassword', () => {
  before((done) => {
    request
      .post('/api/v1/user/signin')
      .send({
        username: 'enodi',
        password: 'password',
      })
      .end((err, response) => {
        expect(response.status).to.equal(200);
        expect(response.body.success).to.equal(true);
        expect(response.body).to.be.an('object');
        expect(response.body).to.have.all.keys('success', 'token');
        token = response.body.token;
        done();
      });
  });
  describe('handles sending reset password email', () => {
    it('should return 404 when an invalid email is specified', (done) => {
      request
        .post('/api/v1/user/forgotPassword')
        .send({
          email: 'audu@gmail.com'
        })
        .end((err, response) => {
          expect(response.status).to.equal(404);
          expect(response.body).to.be.an('object');
          expect(response.body).to.have.property('message');
          expect(response.body.message).to.equal('Email doesn\'t exist');
          done();
        });
    });

    it('should return 200 when email is sent successfully', (done) => {
      request
        .post('/api/v1/user/forgotPassword')
        .send({
          email: 'enodiaudu5@gmail.com'
        })
        .end((err, response) => {
          expect(response.status).to.equal(200);
          expect(response.body).to.be.an('object');
          expect(response.body).to.have.property('message');
          expect(response.body.message)
            .to.equal('Please check your mail for the reset link');
          done();
        });
    });
  });
});

describe('PUT /api/v1/user/resetPassword', () => {
  describe('handles resetting user password', () => {
    it('should return 400 when no password is supplied', (done) => {
      request
        .put('/api/v1/user/resetPassword')
        .end((err, response) => {
          expect(response.status).to.equal(400);
          expect(response.body).to.be.an('object');
          expect(response.body).to.have.property('message');
          expect(response.body.message).to.equal('All fields are required');
          done();
        });
    });
    it('should return 409 when password supplied doesn\'t match', (done) => {
      request
        .put('/api/v1/user/resetPassword')
        .send({
          password: 'password',
          confirmPassword: 'hello'
        })
        .end((err, response) => {
          expect(response.status).to.equal(409);
          expect(response.body).to.be.an('object');
          expect(response.body).to.have.property('message');
          expect(response.body.message).to.equal('Password doesn\'t match');
          done();
        });
    });
    it('should return 401 when no token is supplied', (done) => {
      request
        .put('/api/v1/user/resetPassword')
        .send({
          password: 'password',
          confirmPassword: 'password'
        })
        .end((err, response) => {
          expect(response.status).to.equal(401);
          expect(response.body).to.be.an('object');
          expect(response.body).to.have.property('message');
          expect(response.body.message).to.equal('Unauthorized');
          done();
        });
    });
    it('should return 200 on successful password reset', (done) => {
      const tokn = jwt.sign({
        email: 'enodiaudu5@gmail.com.ng'
      }, process.env.JWT_SECRET, {
          expiresIn: process.env.JWT_EXPIRY_TIME
        });
      request
        .put(`/api/v1/user/resetPassword?token=${tokn}`)
        .send({
          password: 'password',
          confirmPassword: 'password'
        })
        .end((err, response) => {
          expect(response.status).to.equal(200);
          expect(response.body).to.be.an('object');
          expect(response.body).to.have.property('message');
          expect(response.body.message).to.equal('Password reset successful');
          done();
        });
    });
  });
});


text:
/*
 */
package org.apache.tomcat.lite.http;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;

import org.apache.tomcat.lite.http.HttpConnector.HttpConnection;
import org.apache.tomcat.lite.io.IOChannel;
import org.apache.tomcat.lite.io.IOConnector;

/**
 * - Holds references to all active and kept-alive connections.
 * - makes decisions on accepting more connections, closing old
 * connections, etc
 *
 */
public class HttpConnectionPool {
    // TODO: add timeouts, limits per host/total, expire old entries

    public static interface HttpConnectionPoolEvents {
        public void newTarget(RemoteServer host);

        public void targetRemoved(RemoteServer host);

        public void newConnection(RemoteServer host, HttpConnection con);
        public void closedConnection(RemoteServer host, HttpConnection con);
    }

    /**
     * Connections for one remote host.
     * This should't be restricted by IP:port or even hostname,
     * for example if a server has multiple IPs or LB replicas - any would work.
     */
    public static class RemoteServer {
        // all access sync on RemoteServer
        private SpdyConnection spdy;

        // all access sync on RemoteServer
        private ArrayList<Http11Connection> connections
            = new ArrayList<Http11Connection>();

        Queue<HttpChannel> pending = new LinkedList<HttpChannel>();

        // TODO: setter, default from connector
        private int maxConnections = 20;

        AtomicInteger activeRequests = new AtomicInteger();
        AtomicInteger totalRequests = new AtomicInteger();
        private volatile long lastActivity;

        public String target;

        public synchronized List<HttpConnector.HttpConnection> getConnections()
        {
            return new ArrayList<HttpConnection>(connections);
        }

        public synchronized Collection<HttpChannel> getActives() {
            ArrayList<HttpChannel> actives = new ArrayList();
            for (Http11Connection con: connections) {
                if (con.activeHttp != null) {
                    actives.add(con.activeHttp);
                }
            }
            if (spdy != null) {
                actives.addAll(spdy.getActives());
            }

            return actives;
        }

        public synchronized void touch() {
            lastActivity = System.currentTimeMillis();
        }
    }

    private HttpConnectionPoolEvents poolEvents;

    private static Logger log = Logger.getLogger("HttpConnector");

    // visible for debugging - will be made private, with accessor
    /**
     * Map from client names to socket pools.
     */
    public Map<CharSequence, HttpConnectionPool.RemoteServer> hosts = new HashMap<CharSequence,
        HttpConnectionPool.RemoteServer>();

    // Statistics
    public AtomicInteger waitingSockets = new AtomicInteger();
    public AtomicInteger closedSockets = new AtomicInteger();

    public AtomicInteger hits = new AtomicInteger();
    public AtomicInteger misses = new AtomicInteger();
    public AtomicInteger queued = new AtomicInteger();

    public AtomicInteger activeRequests = new AtomicInteger();

    private static boolean debug = false;
    HttpConnector httpConnector;

    public HttpConnectionPool(HttpConnector httpConnector) {
        this.httpConnector = httpConnector;
    }

    public int getTargetCount() {
        return hosts.size();
    }

    public int getSocketCount() {
        return waitingSockets.get();
    }

    public int getClosedSockets() {
        return closedSockets.get();
    }

    public Set<CharSequence> getKeepAliveTargets() {
        return hosts.keySet();
    }

    public List<RemoteServer> getServers() {
        return new ArrayList<RemoteServer>(hosts.values());
    }

    public void setEvents(HttpConnectionPoolEvents events) {
        this.poolEvents = events;
    }
    /**
     * Stop all cached connections.
     */
    public void clear() throws IOException {
        synchronized (hosts) {
            int active = 0;
            for (RemoteServer rs: hosts.values()) {
                synchronized (rs) {
                    int hostActive = 0;
                    if (rs.spdy != null) {
                        if (rs.spdy.channels.size() == 0) {
                            rs.spdy.close();
                            rs.spdy = null;
                        } else {
                            hostActive += rs.spdy.channels.size();
                        }
                    }
                    for (Http11Connection con: rs.connections) {
                        if (con.activeHttp == null) {
                            con.close();
                        } else {
                            hostActive++;
                        }
                    }
                    if (hostActive != rs.activeRequests.get()) {
                        log.warning("Active missmatch " + rs.target + " " +
                                hostActive + " "
                                + rs.activeRequests.get());
                        rs.activeRequests.set(hostActive);
                    }
                    active += hostActive;
                }
            }
            if (active != this.activeRequests.get()) {
                log.warning("Active missmatch " + active + " "
                        + activeRequests.get());
                activeRequests.set(active);
            }
        }
    }

    /**
     * Stop all active and cached connections
     * @throws IOException
     */
    public void abort() throws IOException {
        // TODO
        clear();
        hosts.clear();
    }

    /**
     * @param key host:port, or some other key if multiple hosts:ips
     * are connected to equivalent servers ( LB )
     * @param httpCh
     * @throws IOException
     */
    public void send(HttpChannel httpCh)
            throws IOException {
        String target = httpCh.getTarget();
        HttpConnection con = null;
        // TODO: check ssl on connection - now if a second request
        // is received on a ssl connection - we just send it
        boolean ssl = httpCh.getRequest().isSecure();

        HttpConnectionPool.RemoteServer remoteServer = null;
        synchronized (hosts) {
            remoteServer = hosts.get(target);
            if (remoteServer == null) {
                remoteServer = new HttpConnectionPool.RemoteServer();
                remoteServer.target = target;
                hosts.put(target, remoteServer);
            }
        }

        // TODO: remove old servers and connections

        // Temp magic - until a better negotiation is defined
        boolean forceSpdy = "SPDY/1.0".equals(httpCh.getRequest().getProtocol());
        if (forceSpdy) {
            // switch back the protocol
            httpCh.getRequest().setProtocol("HTTP/1.1");
        }

        activeRequests.incrementAndGet();
        remoteServer.activeRequests.incrementAndGet();

        // if we already have a spdy connection or explicitely
        // requested.
        if (forceSpdy || remoteServer.spdy != null) {
            synchronized (remoteServer) {
                if (remoteServer.spdy == null) {
                    remoteServer.spdy = new SpdyConnection(httpConnector,
                            remoteServer);
                }
                con = remoteServer.spdy;
            }

            // Will be queued - multiple threads may try to send
            // at the same time, and we need to queue anyways.
            con.sendRequest(httpCh);
        } else {
            synchronized (remoteServer) {
                Http11Connection hcon;
                for (int i = 0; i < remoteServer.connections.size(); i++) {
                    hcon = (Http11Connection) remoteServer.connections.get(i);
                    if (hcon != null && hcon.activeHttp == null) {
                        hcon.beforeRequest(); // recycle

                        hcon.activeHttp = httpCh;
                        con = hcon;
                        break;
                    }
                }
                if (con == null) {
//                    if (remoteServer.connections.size() > remoteServer.maxConnections) {
//                        remoteServer.pending.add(httpCh);
//                        queued.incrementAndGet();
//                        if (debug) {
//                            log.info("Queue: " + target + " " + remoteServer.connections.size());
//                        }
//                        return;
//                    }
                    hcon = new Http11Connection(httpConnector);
                    hcon.setTarget(target);
                    hcon.activeHttp = httpCh;
                    hcon.remoteHost = remoteServer;
                    remoteServer.connections.add(hcon);
                    con = hcon;
                }
            }

            // we got a connection - make sure we're connected
            http11ConnectOrSend(httpCh, target, con, ssl);
        }
    }

    private void http11ConnectOrSend(HttpChannel httpCh, String target,
            HttpConnection con, boolean ssl) throws IOException {
        httpCh.setConnection(con);

        if (con.isOpen()) {
            hits.incrementAndGet();
//            if (debug) {
//                log.info("HTTP_CONNECT: Reuse connection " + target + " " + this);
//            }
            con.sendRequest(httpCh);
        } else {
            misses.incrementAndGet();
            if (debug) {
                log.info("HTTP_CONNECT: Start connection " + target + " " + this);
            }
            httpConnect(httpCh, target, ssl,
                    (Http11Connection) con);
        }
    }

    void httpConnect(HttpChannel httpCh, String target,
            boolean ssl, IOConnector.ConnectedCallback cb)
            throws IOException {
        if (debug) {
            log.info("HTTP_CONNECT: New connection " + target);
        }
        String[] hostPort = target.split(":");

        int targetPort = ssl ? 443 : 80;
        if (hostPort.length > 1) {
            targetPort = Integer.parseInt(hostPort[1]);
        }

        httpConnector.getIOConnector().connect(hostPort[0], targetPort,
                cb);
    }

    public void afterRequest(HttpChannel http, HttpConnection con,
            boolean keepAlive)
                throws IOException {
        activeRequests.decrementAndGet();
        if (con.remoteHost != null) {
            con.remoteHost.touch();
            con.remoteHost.activeRequests.decrementAndGet();
        }
        if (con.serverMode) {
            afterServerRequest(con, keepAlive);
        } else {
            afterClientRequest(con);
        }
    }

    private void afterClientRequest(HttpConnection con)
            throws IOException {
        RemoteServer remoteServer = con.remoteHost;
        HttpChannel req = null;

        // If we have pending requests ( because too many active limit ), pick
        // one and send it.
        synchronized (remoteServer) {
            // If closed - we can remove the object - or
            // let a background thread do it, in case it's needed
            // again.
            if (remoteServer.pending.size() == 0) {
                con.activeHttp = null;
                return;
            }
            req = remoteServer.pending.remove();
            con.activeHttp = req;
            if (debug) {
                log.info("After request: send pending " + remoteServer.pending.size());
            }
        }

        http11ConnectOrSend(req, con.getTarget().toString(),
                con, req.getRequest().isSecure());
    }

    RemoteServer serverPool = new RemoteServer();

    public void afterServerRequest(HttpConnection con, boolean keepAlive)
            throws IOException {
        con.activeHttp = null;
        if (!keepAlive) {
            synchronized (serverPool) {
                // I could also reuse the object.
                serverPool.connections.remove(con);
            }
        }
    }

    public HttpConnection accepted(IOChannel accepted) {
        Http11Connection con = new Http11Connection(httpConnector);
        con.remoteHost = serverPool;
        synchronized (serverPool) {
            serverPool.connections.add(con);
        }
        return con;
    }

    // Called by handleClosed
    void stopKeepAlive(IOChannel schannel) {
        CharSequence target = schannel.getTarget();
        HttpConnectionPool.RemoteServer remoteServer = null;
        synchronized (hosts) {
            remoteServer = hosts.get(target);
            if (remoteServer == null) {
                return;
            }
        }
        synchronized (remoteServer) {
            if (remoteServer.connections.remove(schannel)) {
                waitingSockets.decrementAndGet();
                if (remoteServer.connections.size() == 0) {
                    hosts.remove(target);
                }
            }
        }
    }

}


text:
package org.apache.cassandra.utils;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;

import org.junit.Assert;
import org.junit.Test;

import org.apache.cassandra.io.util.DataOutputBuffer;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;

public class ByteBufferUtilTest
{
    private static final String s = "cassandra";

    private ByteBuffer fromStringWithPosition(String s, int pos, boolean direct)
    {
        int l = s.length();
        ByteBuffer bb;
        if (direct)
        {
            bb = ByteBuffer.allocateDirect(l + pos);
        }
        else
        {
            ByteBuffer tmp = ByteBuffer.allocate(l + pos + 3);
            tmp.position(3);
            bb = tmp.slice(); // make bb have a non null arrayOffset
        }
        bb.position(pos);
        bb.mark();
        bb.put(s.getBytes());
        bb.reset();
        assert bb.position() == pos;
        return bb;
    }

    @Test
    public void testString() throws Exception
    {
        assert s.equals(ByteBufferUtil.string(ByteBufferUtil.bytes(s)));

        int pos = 10;
        ByteBuffer bb = fromStringWithPosition(s, 10, false);
        assert s.equals(ByteBufferUtil.string(bb, 10, s.length()));

        bb = fromStringWithPosition(s, 10, true);
        assert s.equals(ByteBufferUtil.string(bb, 10, s.length()));
    }

    @Test
    public void testGetArray()
    {
        byte[] t = s.getBytes();

        ByteBuffer bb = ByteBufferUtil.bytes(s);
        assertArrayEquals(t, ByteBufferUtil.getArray(bb));

        bb = fromStringWithPosition(s, 10, false);
        assertArrayEquals(t, ByteBufferUtil.getArray(bb));

        bb = fromStringWithPosition(s, 10, true);
        assertArrayEquals(t, ByteBufferUtil.getArray(bb));
    }

    @Test
    public void testLastIndexOf()
    {
        ByteBuffer bb = ByteBufferUtil.bytes(s);
        checkLastIndexOf(bb);

        bb = fromStringWithPosition(s, 10, false);
        checkLastIndexOf(bb);

        bb = fromStringWithPosition(s, 10, true);
        checkLastIndexOf(bb);
    }

    private void checkLastIndexOf(ByteBuffer bb)
    {
        assert bb.position() + 8 == ByteBufferUtil.lastIndexOf(bb, (byte) 'a', bb.position() + 8);
        assert bb.position() + 4 == ByteBufferUtil.lastIndexOf(bb, (byte) 'a', bb.position() + 7);
        assert bb.position() + 3 == ByteBufferUtil.lastIndexOf(bb, (byte) 's', bb.position() + 8);
        assert -1 == ByteBufferUtil.lastIndexOf(bb, (byte) 'o', bb.position() + 8);
        assert -1 == ByteBufferUtil.lastIndexOf(bb, (byte) 'd', bb.position() + 5);
    }

    @Test
    public void testClone()
    {
        ByteBuffer bb = ByteBufferUtil.bytes(s);
        ByteBuffer clone1 = ByteBufferUtil.clone(bb);
        assert bb != clone1;
        assert bb.equals(clone1);
        assert bb.array() != clone1.array();

        bb = fromStringWithPosition(s, 10, false);
        ByteBuffer clone2 = ByteBufferUtil.clone(bb);
        assert bb != clone2;
        assert bb.equals(clone2);
        assert clone1.equals(clone2);
        assert bb.array() != clone2.array();

        bb = fromStringWithPosition(s, 10, true);
        ByteBuffer clone3 = ByteBufferUtil.clone(bb);
        assert bb != clone3;
        assert bb.equals(clone3);
        assert clone1.equals(clone3);
    }

    @Test
    public void testArrayCopy()
    {
        ByteBuffer bb = ByteBufferUtil.bytes(s);
        checkArrayCopy(bb);

        bb = fromStringWithPosition(s, 10, false);
        checkArrayCopy(bb);

        bb = fromStringWithPosition(s, 10, true);
        checkArrayCopy(bb);
    }

    private void checkArrayCopy(ByteBuffer bb)
    {

        byte[] bytes = new byte[s.length()];
        ByteBufferUtil.copyBytes(bb, bb.position(), bytes, 0, s.length());
        assertArrayEquals(s.getBytes(), bytes);

        bytes = new byte[5];
        ByteBufferUtil.copyBytes(bb, bb.position() + 3, bytes, 1, 4);
        assertArrayEquals(Arrays.copyOfRange(s.getBytes(), 3, 7), Arrays.copyOfRange(bytes, 1, 5));
    }

    @Test
    public void testReadWrite() throws IOException
    {
        ByteBuffer bb = ByteBufferUtil.bytes(s);
        checkReadWrite(bb);

        bb = fromStringWithPosition(s, 10, false);
        checkReadWrite(bb);

        bb = fromStringWithPosition(s, 10, true);
        checkReadWrite(bb);
    }

    private void checkReadWrite(ByteBuffer bb) throws IOException
    {
        DataOutputBuffer out = new DataOutputBuffer();
        ByteBufferUtil.writeWithLength(bb, out);
        ByteBufferUtil.writeWithShortLength(bb, out);

        DataInputStream in = new DataInputStream(new ByteArrayInputStream(out.toByteArray()));
        assert bb.equals(ByteBufferUtil.readWithLength(in));
        assert bb.equals(ByteBufferUtil.readWithShortLength(in));
    }

    @Test
    public void testInputStream() throws IOException
    {
        ByteBuffer bb = ByteBuffer.allocate(13);
        bb.putInt(255);
        bb.put((byte) -3);
        bb.putLong(42L);
        bb.clear();

        DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(bb));
        assert in.readInt() == 255;
        assert in.readByte() == (byte)-3;
        assert in.readLong() == 42L;
    }

    @Test
    public void testIntBytesConversions()
    {
        // positive, negative, 1 and 2 byte cases, including a few edges that would foul things up unless you're careful
        // about masking away sign extension.
        int[] ints = new int[]
        {
            -20, -127, -128, 0, 1, 127, 128, 65534, 65535, -65534, -65535
        };

        for (int i : ints) {
            ByteBuffer ba = ByteBufferUtil.bytes(i);
            int actual = ByteBufferUtil.toInt(ba);
            assertEquals(i, actual);
        }
    }

    @Test(expected=CharacterCodingException.class)
    public void testDecode() throws IOException
    {
        ByteBuffer bytes = ByteBuffer.wrap(new byte[]{(byte)0xff, (byte)0xfe});
        ByteBufferUtil.string(bytes);
    }

    @Test
    public void testHexBytesConversion()
    {
        for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++)
        {
            ByteBuffer bb = ByteBuffer.allocate(1);
            bb.put((byte) i);
            bb.clear();
            String s = ByteBufferUtil.bytesToHex(bb);
            ByteBuffer bb2 = ByteBufferUtil.hexToBytes(s);
            assertEquals(bb, bb2);
        }
        // check that non-zero buffer positions work,
        // i.e. that conversion accounts for the buffer offset and limit correctly
        ByteBuffer bb = ByteBuffer.allocate(4);
        for (int i = 0; i < 4; i++)
        {
            bb.put((byte) i);
        }
        // use a chunk out of the middle of the buffer
        bb.position(1);
        bb.limit(3);
        assertEquals(2, bb.remaining());
        String s = ByteBufferUtil.bytesToHex(bb);
        ByteBuffer bb2 = ByteBufferUtil.hexToBytes(s);
        assertEquals(bb, bb2);
        assertEquals("0102", s);
    }

    @Test
    public void testStartsAndEndsWith()
    {
        byte[] bytes = new byte[512];
        ThreadLocalRandom random = ThreadLocalRandom.current();

        random.nextBytes(bytes);

        ByteBuffer a = ByteBuffer.wrap(bytes);
        ByteBuffer b = a.duplicate();

        // let's take random slices of a and match
        for (int i = 0; i < 512; i++)
        {
            // prefix from the original offset
            b.position(0).limit(a.remaining() - random.nextInt(0, a.remaining() - 1));
            Assert.assertTrue(ByteBufferUtil.startsWith(a, b));
            Assert.assertTrue(ByteBufferUtil.startsWith(a, b.slice()));

            // prefix from random position inside of array
            int pos = random.nextInt(1, a.remaining() - 5);
            a.position(pos);
            b.limit(bytes.length - 1).position(pos);

            Assert.assertTrue(ByteBufferUtil.startsWith(a, b));

            a.position(0);

            // endsWith at random position
            b.limit(a.remaining()).position(random.nextInt(0, a.remaining() - 1));
            Assert.assertTrue(ByteBufferUtil.endsWith(a, b));
            Assert.assertTrue(ByteBufferUtil.endsWith(a, b.slice()));

        }

        a.limit(bytes.length - 1).position(0);
        b.limit(bytes.length - 1).position(1);

        assertFalse(ByteBufferUtil.startsWith(a, b));
        assertFalse(ByteBufferUtil.startsWith(a, b.slice()));

        Assert.assertTrue(ByteBufferUtil.endsWith(a, b));
        Assert.assertTrue(ByteBufferUtil.endsWith(a, b.slice()));

        a.position(5);

        assertFalse(ByteBufferUtil.startsWith(a, b));
        assertFalse(ByteBufferUtil.endsWith(a, b));
    }

    @Test
    public void testWriteZeroes()
    {
        byte[] initial = new byte[1024];
        Arrays.fill(initial, (byte) 1);
        for (ByteBuffer b : new ByteBuffer[] { ByteBuffer.allocate(1024), ByteBuffer.allocateDirect(1024) })
        {
            for (int i = 0; i <= 32; ++i)
                for (int j = 1024; j >= 1024 - 32; --j)
                {
                    b.clear();
                    b.put(initial);
                    b.flip();
                    b.position(i);
                    ByteBufferUtil.writeZeroes(b, j-i);
                    assertEquals(j, b.position());
                    int ii = 0;
                    for (; ii < i; ++ii)
                        assertEquals(initial[ii], b.get(ii));
                    for (; ii < j; ++ii)
                        assertEquals(0, b.get(ii));
                    for (; ii < 1024; ++ii)
                        assertEquals(initial[ii], b.get(ii));

                    b.clear();
                    b.put(initial);
                    b.limit(j).position(i);
                    ByteBuffer slice = b.slice();
                    ByteBufferUtil.writeZeroes(slice, slice.capacity());
                    assertFalse(slice.hasRemaining());
                    b.clear();  // reset position and limit for check
                    ii = 0;
                    for (; ii < i; ++ii)
                        assertEquals(initial[ii], b.get(ii));
                    for (; ii < j; ++ii)
                        assertEquals(0, b.get(ii));
                    for (; ii < 1024; ++ii)
                        assertEquals(initial[ii], b.get(ii));

                    slice.clear();
                    try
                    {
                        ByteBufferUtil.writeZeroes(slice, slice.capacity() + 1);
                        fail("Line above should throw.");
                    }
                    catch (BufferOverflowException | IndexOutOfBoundsException e)
                    {
                        // correct path
                    }
                }
        }
    }
}


text:
@charset "UTF-8";
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */
/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */
html {
  color: #222;
  font-size: 1em;
  line-height: 1.4; }

/*
 * Remove text-shadow in selection highlight: h5bp.com/i
 * These selection rule sets have to be separate.
 * Customize the background color to match your design.
 */
::-moz-selection {
  background: #b3d4fc;
  text-shadow: none; }

::selection {
  background: #b3d4fc;
  text-shadow: none; }

/*
 * A better looking default horizontal rule
 */
hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0; }

/*
 * Remove the gap between images, videos, audio and canvas and the bottom of
 * their containers: h5bp.com/i/440
 */
audio,
canvas,
img,
svg,
video {
  vertical-align: middle; }

/*
 * Remove default fieldset styles.
 */
fieldset {
  border: 0;
  margin: 0;
  padding: 0; }

/*
 * Allow only vertical resizing of textareas.
 */
textarea {
  resize: vertical; }

/* ==========================================================================
   Browse Happy prompt
   ========================================================================== */
.browsehappy {
  margin: 0.2em 0;
  background: #ccc;
  color: #000;
  padding: 0.2em 0; }

/* ==========================================================================
   Author's custom styles
   ========================================================================== */
/* ==========================================================================
   Helper classes
   ========================================================================== */
/*
 * Hide visually and from screen readers: h5bp.com/u
 */
.hidden {
  display: none !important;
  visibility: hidden; }

/*
 * Hide only visually, but have it available for screen readers: h5bp.com/v
 */
.visuallyhidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px; }

/*
 * Extends the .visuallyhidden class to allow the element to be focusable
 * when navigated to via the keyboard: h5bp.com/p
 */
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  width: auto; }

/*
 * Hide visually and from screen readers, but maintain layout
 */
.invisible {
  visibility: hidden; }

/*
 * Clearfix: contain floats
 *
 * For modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *    `contenteditable` attribute is included anywhere else in the document.
 *    Otherwise it causes space to appear at the top and bottom of elements
 *    that receive the `clearfix` class.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */
.clearfix:before,
.clearfix:after {
  content: " ";
  /* 1 */
  display: table;
  /* 2 */ }

.clearfix:after {
  clear: both; }

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */
@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */ }
@media print, (-o-min-device-pixel-ratio: 5 / 4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */ }
/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request: h5bp.com/r
   ========================================================================== */
@media print {
  *,
  *:before,
  *:after {
    background: transparent !important;
    color: #000 !important;
    /* Black prints faster: h5bp.com/s */
    box-shadow: none !important;
    text-shadow: none !important; }

  a,
  a:visited {
    text-decoration: underline; }

  a[href]:after {
    content: " (" attr(href) ")"; }

  abbr[title]:after {
    content: " (" attr(title) ")"; }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: ""; }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid; }

  thead {
    display: table-header-group;
    /* h5bp.com/t */ }

  tr,
  img {
    page-break-inside: avoid; }

  img {
    max-width: 100% !important; }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3; }

  h2,
  h3 {
    page-break-after: avoid; } }
/* We're splitting fonts into "preferred" and "performance" in order to optimize
   page loading. For important text, such as the body, we want it to load
   immediately and not wait for the web font load, whereas for other sections,
   such as headers and titles, we're OK with things taking a bit longer to load.
   We do have some optional classes and parameters in the mixins, in case you
   definitely want to make sure you're using the preferred font and don't mind
   the performance hit.
   We should be able to improve on this once CSS Font Loading L3 becomes more
   widely available.
*/
html, body {
  font-family: "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px; }

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
  padding: 0; }

/**
 * Styles for HTML elements
 */
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0.54;
  font-size: 0.6em; }

h1 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em; }

h2 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 45px;
  font-weight: 400;
  line-height: 48px; }

h3 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 40px; }

h4 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
  -moz-osx-font-smoothing: grayscale; }

h5 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em; }

h6 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em; }

p {
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em;
  margin: 0 0 16px 0; }

a {
  font-weight: bold; }

blockquote {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 24px;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  letter-spacing: 0.08em; }
  blockquote:before {
    content: '"';
    opacity: 0.54; }
  blockquote:after {
    content: '"';
    opacity: 0.54; }

mark {
  background-color: #f4ff81; }

dt {
  font-weight: 700; }

/**
 * Class Name Styles
 */
.wsk-typography--display-4 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 112px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em; }

.wsk-typography--display-4--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 112px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
  opacity: 0.54; }

.wsk-typography--display-3 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em; }

.wsk-typography--display-3--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0.54; }

.wsk-typography--display-2 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 45px;
  font-weight: 400;
  line-height: 48px; }

.wsk-typography--display-2--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 45px;
  font-weight: 400;
  line-height: 48px;
  opacity: 0.54; }

.wsk-typography--display-1 {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 40px; }

.wsk-typography--display-1--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 40px;
  opacity: 0.54; }

.wsk-typography--headline {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
  -moz-osx-font-smoothing: grayscale; }

.wsk-typography--headline--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0.87; }

.wsk-typography--title {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em; }

.wsk-typography--title--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  opacity: 0.87; }

.wsk-typography--subhead {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em; }

.wsk-typography--subhead--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--body-2 {
  font-size: 14px;
  font-weight: bold;
  line-height: 24px;
  letter-spacing: 0.04em; }

.wsk-typography--Body-2--colorContrast {
  font-size: 14px;
  font-weight: bold;
  line-height: 24px;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--body-1 {
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em; }

.wsk-typography--body-1--colorContrast {
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--body-2--forcePreferredFont {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 0.04em; }

.wsk-typography--Body-2--forcePreferredFont--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--body-1--forcePreferredFont {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em; }

.wsk-typography--body-1--forcePreferredFont--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--caption {
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em; }

.wsk-typography--caption--forcePreferredFont {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em; }

.wsk-typography--caption--colorContrast {
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  opacity: 0.54; }

.wsk-typography--caption--forcePreferredFont--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  opacity: 0.54; }

.wsk-typography--menu {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em; }

.wsk-typography--menu--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--button {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: 0.04em; }

.wsk-typography--button--colorContrast {
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: 0.04em;
  opacity: 0.87; }

.wsk-typography--textLeft {
  text-align: left; }

.wsk-typography--textRight {
  text-align: right; }

.wsk-typography--textCenter {
  text-align: center; }

.wsk-typography--textJustify {
  text-align: justify; }

.wsk-typography--textNowrap {
  white-space: nowrap; }

.wsk-typography--textLowercase {
  text-transform: lowercase; }

.wsk-typography--textUppercase {
  text-transform: uppercase; }

.wsk-typography--textCapitalize {
  text-transform: capitalize; }

.wsk-typography--tableStriped > tbody > tr:nth-child(odd) > td,
.wsk-typography--tableStriped > tbody > tr:nth-child(odd) > th {
  background-color: #f9f9f9; }

.wsk-typography--tableStriped > tbody > tr:nth-child(odd) > td,
.wsk-typography--tableStriped > tbody > tr:nth-child(odd) > th {
  background-color: #f9f9f9; }

/**
*
* Material design color palettes.
* @see http://www.google.com/design/spec/style/color.html
*
**/
/* ==========  Color Palettes  ========== */
html, body {
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0; }

body {
  padding: 24px;
  box-sizing: border-box;
  background: #FFF; }

body > h2 {
  margin-top: 24px;
  margin-bottom: 12px; }

.PreviewBlock {
  background: #f5f5f5;
  padding: 20px; }

/**
*
* Material design color palettes.
* @see http://www.google.com/design/spec/style/color.html
*
**/
/* ==========  Color Palettes  ========== */
/* ==========  Color & Themes  ========== */
/* ==========  Typography  ========== */
/* ==========  Components  ========== */
/* ==========  Standard Buttons  ========== */
/* ==========  Icon Toggles  ========== */
/* ==========  Radio Buttons  ========== */
/* ==========  Ripple effect  ========== */
/* ==========  Layout  ========== */
/* ==========  Content Tabs  ========== */
/* ==========  Checkboxes  ========== */
/* ==========  Switches  ========== */
/* ==========  Spinner  ========== */
/* ==========  Text fields  ========== */
/* ==========  Card  ========== */
/* Heading back */
/* ==========  Sliders ========== */
/* ==========  List ========== */
/* ==========  Item ========== */
/* ==========  Dropdown menu ========== */
/* ==========  Tooltips  ========== */
/* ==========  Footer  ========== */
/**
*
* Material design color palettes.
* @see http://www.google.com/design/spec/style/color.html
*
**/
/* ==========  Color Palettes  ========== */
.wsk-ripple {
  background: #212121;
  border-radius: 50%;
  height: 50px;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: translate(-50%, -50%);
  width: 50px;
  overflow: hidden; }
  .wsk-ripple.is-animating {
    transition: transform 0.6s cubic-bezier(0, 0, 0.2, 1), width 0.6s cubic-bezier(0, 0, 0.2, 1), height 0.6s cubic-bezier(0, 0, 0.2, 1), opacity 0.6s cubic-bezier(0, 0, 0.2, 1); }

.wsk-radio {
  position: relative;
  font-size: 16px;
  line-height: 24px;
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  margin: 12px 0;
  padding-left: 0; }
  .wsk-radio.is-upgraded {
    padding-left: 24px; }

.wsk-radio__button {
  line-height: 24px; }
  .wsk-radio.is-upgraded .wsk-radio__button {
    position: absolute;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    -ms-appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    border: none; }

.wsk-radio__outer-circle {
  position: absolute;
  top: 2px;
  left: 0;
  display: inline-block;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  border: 2px solid rgba(0, 0, 0, 0.54);
  border-radius: 50%;
  z-index: 2; }
  .wsk-radio.is-checked .wsk-radio__outer-circle {
    border: 2px solid #2196f3; }
  .wsk-radio.is-disabled .wsk-radio__outer-circle {
    border: 2px solid rgba(0, 0, 0, 0.26);
    cursor: auto; }

.wsk-radio__inner-circle {
  position: absolute;
  z-index: 1;
  margin: 0;
  top: 6px;
  left: 4px;
  box-sizing: border-box;
  width: 8px;
  height: 8px;
  cursor: pointer;
  transition-duration: 0.28s;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-property: transform;
  transform: scale3d(0, 0, 0);
  border-radius: 50%;
  background: #2196f3; }
  .wsk-radio.is-checked .wsk-radio__inner-circle {
    transform: scale3d(1, 1, 1); }
  .wsk-radio.is-disabled .wsk-radio__inner-circle {
    background: rgba(0, 0, 0, 0.26);
    cursor: auto; }
  .wsk-radio.is-focused .wsk-radio__inner-circle {
    box-shadow: 0 0 0px 10px rgba(0, 0, 0, 0.1); }

.wsk-radio__label {
  cursor: pointer; }
  .wsk-radio.is-disabled .wsk-radio__label {
    color: rgba(0, 0, 0, 0.26);
    cursor: auto; }

.wsk-radio__ripple-container {
  position: absolute;
  z-index: 2;
  top: -9px;
  left: -13px;
  box-sizing: border-box;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  -webkit-mask-image: -webkit-radial-gradient(circle, white, black); }
  .wsk-radio__ripple-container .wsk-ripple {
    background: #2196f3; }
  .wsk-radio.is-disabled .wsk-radio__ripple-container {
    cursor: auto; }
  .wsk-radio.is-disabled .wsk-radio__ripple-container .wsk-ripple {
    background: transparent; }

/*# sourceMappingURL=demo.css.map */