text:
package org.typemeta.funcj.util;

import org.typemeta.funcj.functions.*;
import org.typemeta.funcj.functions.Functions.F;

/**
 * Utility functions relating to exceptions.
 */
@SuppressWarnings("unchecked")
public abstract class Exceptions {

    /**
     * Rethrow a checked exception, hiding it at the type level using a Java quirk.
     * @param ex        the exception
     * @param <X>       the exception type
     * @param <T>       the return type
     * @return          never returns
     * @throws X        the hidden checked exception
     */
    public static <X extends Exception, T> T throwUnchecked(Exception ex) throws X {
        throw (X) ex;
    }

    /**
     * Wrap a function which throws a checked exception
     * into one that that throws a hidden checked exception.
     * The original exception can be rethrown by an enclosing
     * call to {@link #unwrap(SideEffectGenEx.F0)}.
     * @param thrower   the function that may throw
     */
    public static void wrap(SideEffectEx.F0 thrower) {
        try {
            thrower.apply();
        } catch(Exception ex) {
            throwUnchecked(ex);
        }
    }

    public static <T> SideEffect.F<T> wrap(SideEffectEx.F<T> thrower) {
        return t -> {
            try {
                thrower.apply(t);
            } catch(Exception ex) {
                throwUnchecked(ex);
            }
        };
    }

    /**
     * Wrap a function which throws a checked exception
     * into one that that throws a hidden checked exception.
     * The original exception can be rethrown by an enclosing call to {@link #unwrap(Functions.F0)}.
     * @param thrower   the function that may throw
     * @param <R>       the return type of function
     * @return          the result of function if it doesn't throw
     */
    public static <R> R wrap(FunctionsEx.F0<R> thrower) {
        try {
            return thrower.apply();
        } catch(Exception ex) {
            return throwUnchecked(ex);
        }
    }

    /**
     * Wrap a function which throws a checked exception
     * into one that that throws a hidden checked exception.
     * The original exception can be rethrown by an enclosing call to {@link #unwrap(Functions.F0)}.
     * @param thrower   the function that may throw
     * @param <T>       the input type of the function
     * @param <R>       the return type of function
     * @return          a function which throws an unchecked exception
     */
    public static <T, R> F<T, R> wrap(FunctionsEx.F<T, R> thrower) {
        return t -> {
            try {
                return thrower.apply(t);
            } catch(Exception ex) {
                return throwUnchecked(ex);
            }
        };
    }

    /**
     * Wrap a function which throws a checked exception
     * into one that that throws a hidden checked exception.
     * The original exception can be rethrown by an enclosing call to {@link #unwrap(Functions.F0)}.
     * @param thrower   the function that may throw
     * @param <A>       the type of the first argument of the function
     * @param <B>       the type of the second argument of the function
     * @param <R>       the return type of function
     * @return          a function which throws an unchecked exception
     */
    public static <A, B, R>
    Functions.F2<A, B, R> wrap(FunctionsEx.F2<A, B, R> thrower) {
        return (a, b) -> {
            try {
                return thrower.apply(a, b);
            } catch(Exception ex) {
                return throwUnchecked(ex);
            }
        };
    }

    /**
     * Undo the effect of {@code wrap} by catching the exception,
     * and rethrowing the original checked exception.
     * @param thrower   the function that may throw an exception
     * @param <X>       the original exception type
     * @throws X        the original exception
     */
    public static <X extends Exception> void unwrap(SideEffectGenEx.F0<X> thrower) throws X {
        try {
            thrower.apply();
        } catch (Exception ex) {
            throw (X)ex;
        }
    }

    /**
     * Undo the effect of {@code wrap} by catching the exception,
     * and rethrowing the original checked exception.
     * @param thrower   the function that may throw an exception
     * @param <R>       the return type of the function
     * @param <X>       the original exception type
     * @return          the function value, if it doesn't throw
     * @throws X        the original exception
     */
    public static <R, X extends Exception> R unwrap(Functions.F0<R> thrower) throws X {
        try {
            return thrower.apply();
        } catch (Exception ex) {
            throw (X)ex;
        }
    }

    /**
     * Used to mark incomplete pieces of code.
     * @return          an exception
     */
    public static RuntimeException TODO() {
        return new RuntimeException("TODO");
    }
}


text:
var express    = require('express');        // call express
var compress   = require('compression');
var app        = express();                 // define our app using express
var bunyan     = require('bunyan');         // load bunyan

// configure app to use bunyan as logger
var logger = bunyan.createLogger({name: 'StaticContentServer'});

// set our port
var port = process.env.PORT || 3000;

// middleware to use for all request
var commonMiddleware = function(req, res, next){
    logger.info('Captured ' + req.method + ' request to ' + req.baseUrl+req.url);
    next(); // make sure to go to the next route
};

app.use(commonMiddleware);

// Use compress middleware to gzip content
app.use(compress());

//app.use('/', express.static(__dirname + '/public'));
app.use(express.static('public'));

// START THE SERVER
// =============================================================================
var server = app.listen(port, function(){
    logger.info('Magic happens on port ' + port);
});

redpajama_set_name: RedPajamaGithub


text: Rails.application.config.session_store :cookie_store, key: '_sidekiq-opsworks-example_session'


text:
var expect = require('chai').expect;
var sinon = require('sinon');
var KnexStrategy = require('./../lib/KnexStrategy.js');
var FileSystemManager = require('xtens-fs').FileSystemManager;

/* a test connection according to sails format */
var dbConnection = require('./../config/local.js').connection;
var fsConnection = require('./../config/local.js').fsConnection;

// test data object
var dataObj = {
    files: [
        {uri: "/path/to/file01.ext"},
        {uri: "/another/path/to/file02.ext"},
        {uri: "/yet/another/path/to/file03.ext"}
    ],
    type: 2,
    date: new Date(),
    tags: ["tag", "another tag"],
    notes: "let me test you with knex",
    metadata: {
        attribute1: { value: ["test value"]},
        attribute2: { value: [1.0], unit: ["s"]}
    },
    parentData: undefined,
    parentSample: undefined,
    parentSubject: 1
};

describe('KnexStrategy', function() {

    describe('#constructor', function() {

        it ("should create a new knex object with the proper connection", function() {
            var strategy = new KnexStrategy(dbConnection, fsConnection);
            expect(strategy.knex).to.exist;
            expect(strategy.knex).to.have.property('select');
            expect(strategy.knex).to.have.property('insert');
            expect(strategy.knex).to.have.property('update');
        });

    });

    describe('#createData', function() {

        var strategy = new KnexStrategy(dbConnection, fsConnection);

        before(function() {
            return strategy.knex('data').truncate()
            .then(function() {
                strategy.knex("data_file").truncate();
            }).then(function() {
                console.log("tables truncated");
            });
        });

        it("# should create the proper query strategy", function() {
            var mock = sinon.mock(FileSystemManager.prototype);
            var dataTypeName = "testDataType";
            /* TODO find a way to mock connections to DB and FileSystem
            return strategy.createData(dataObj, dataTypeName).then(function() {
                console.log("done");
            }).catch(function(err) {
                console.log("error");
            }) ;
           */
        });

    });

});


text:
// Location.java
// Abstract superclass representing location in simulation
package com.deitel.jhtp5.elevator.model;

// Deitel packages
import com.deitel.jhtp5.elevator.event.*;

public abstract class Location {

   // name of Location
   private String locationName;

   // set name of Location
   protected void setLocationName( String name )
   {
      locationName = name;
   }

   // return name of Location
   public String getLocationName()
   {
      return locationName;
   }

   // return Button at Location
   public abstract Button getButton();

   // return Door object at Location
   public abstract Door getDoor();
}