text:
namespace rubinius {
  using namespace utilities;

  namespace metrics {
    FileEmitter::FileEmitter(MetricsMap& map, std::string path)
      : MetricsEmitter()
      , metrics_map_(map)
      , path_(path)
      , fd_(-1)
    {
      initialize();
    }

    FileEmitter::~FileEmitter() {
      cleanup();
    }

#define RBX_METRICS_FILE_BUFLEN   256

    void FileEmitter::send_metrics() {
      char buf[RBX_METRICS_FILE_BUFLEN];

      for(MetricsMap::iterator i = metrics_map_.begin();
          i != metrics_map_.end();
          ++i)
      {
        snprintf(buf, RBX_METRICS_FILE_BUFLEN, "%s%lld",
            i == metrics_map_.begin() ? "" : " ", (long long unsigned int)(*i)->second);
        if(write(fd_, buf, strlen(buf)) < 0) {
          logger::error("%s: unable to write file metrics", strerror(errno));
        }
      }

      if(write(fd_, "\n", 1)) {
        logger::error("%s: unable to write file metrics", strerror(errno));
      }
    }

    void FileEmitter::initialize() {
      if(!(fd_ = ::open(path_.c_str(), O_CREAT | O_WRONLY | O_CLOEXEC, 0660))) {
        logger::error("%s: unable to open metrics file", strerror(errno));
      }

      if(lseek(fd_, 0, SEEK_END) == 0) {
        char buf[RBX_METRICS_FILE_BUFLEN];

        for(MetricsMap::iterator i = metrics_map_.begin();
            i != metrics_map_.end();
            ++i)
        {
          snprintf(buf, RBX_METRICS_FILE_BUFLEN, "%s%s",
              i == metrics_map_.begin() ? "" : ", ", (*i)->first.c_str());
          if(write(fd_, buf, strlen(buf)) < 0) {
            logger::error("%s: unable to write file metrics", strerror(errno));
          }
        }

        if(write(fd_, "\n", 1)) {
          logger::error("%s: unable to write file metrics", strerror(errno));
        }
      }
    }

    void FileEmitter::cleanup() {
      if(fd_ > 0) {
        close(fd_);
        fd_ = -1;
      }
    }

    void FileEmitter::reinit() {
      // Don't turn on FileEmitter in children by default.
      cleanup();
    }

    StatsDEmitter::StatsDEmitter(MetricsMap& map, std::string server, std::string prefix)
      : MetricsEmitter()
      , metrics_map_(map)
      , socket_fd_(-1)
    {
      size_t colon = server.find(':');
      if(colon == std::string::npos) {
        host_ = "localhost";
        if(server.size() > 0) {
          port_ = server;
        } else {
          port_ = "8125";
        }
      } else {
        host_ = server.substr(0, colon);
        port_ = server.substr(colon + 1);
      }

      size_t index = prefix.find("$nodename");
      if(index != std::string::npos) {
        struct utsname name;

        if(uname(&name)) {
          prefix_ = "";
        } else {
          std::ostringstream parts;
          std::string n = name.nodename;

          for(size_t p = n.size(), i = p; i != 0; p = i - 1) {
            if((i = n.rfind('.', p)) == std::string::npos) {
              parts << n.substr(0, p + 1);
              break;
            } else {
              parts << n.substr(i + 1, p - i) << ".";
            }

          }

          prefix_ = prefix;
          prefix_.replace(index, strlen("$nodename"), parts.str());
        }
      } else {
        prefix_ = prefix;
      }

      index = prefix_.find("$pid");
      if(index != std::string::npos) {
        std::ostringstream pid;
        pid << getpid();

        prefix_.replace(index, strlen("$pid"), pid.str());
      }

      if(prefix_.size() > 0) prefix_ += ".";

      initialize();
    }

    StatsDEmitter::~StatsDEmitter() {
      cleanup();
    }

#define RBX_METRICS_STATSD_BUFLEN   256

    void StatsDEmitter::send_metrics() {
      char buf[RBX_METRICS_STATSD_BUFLEN];

      for(MetricsMap::iterator i = metrics_map_.begin();
          i != metrics_map_.end();
          ++i)
      {
        snprintf(buf, RBX_METRICS_STATSD_BUFLEN, "%s%s:%lld|g",
            prefix_.c_str(), (*i)->first.c_str(), (long long unsigned int)(*i)->second);
        if(send(socket_fd_, buf, strlen(buf), 0) < 0) {
          logger::error("%s: unable to send StatsD metrics", strerror(errno));
        }
      }
    }

    void StatsDEmitter::initialize() {
      struct addrinfo hints, *res, *res0;

      memset(&hints, 0, sizeof(hints));
      hints.ai_family = PF_UNSPEC;
      hints.ai_socktype = SOCK_DGRAM;

      if(int error = getaddrinfo(host_.c_str(), port_.c_str(), &hints, &res0) < 0) {
        logger::error("%s: unable to get StatsD server address info",
            gai_strerror(error));
        return;
      }

      for(res = res0; res; res = res->ai_next) {
        if((socket_fd_ = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) {
          continue;
        }

        if(connect(socket_fd_, res->ai_addr, res->ai_addrlen) < 0) {
          close(socket_fd_);
          socket_fd_ = -1;
          continue;
        }

        break;
      }

      freeaddrinfo(res0);

      if(socket_fd_ < 0) {
        logger::error("unable to create StatsD UDP socket");
        return;
      }

      fcntl(socket_fd_, F_SETFL, O_NONBLOCK);
    }

    void StatsDEmitter::cleanup() {
      if(socket_fd_ > 0) close(socket_fd_);
    }

    void StatsDEmitter::reinit() {
      cleanup();
      initialize();
    }

    Metrics::Metrics(STATE)
      : InternalThread(state, "rbx.metrics", InternalThread::eSmall)
      , enabled_(true)
      , values_(state)
      , interval_(state->shared().config.system_metrics_interval)
      , timer_(NULL)
      , metrics_lock_()
      , metrics_data_()
      , metrics_history_()
      , metrics_map_()
      , emitter_(NULL)
    {
      map_metrics();

      if(!state->shared().config.system_metrics_target.value.compare("statsd")) {
        emitter_ = new StatsDEmitter(metrics_map_,
            state->shared().config.system_metrics_statsd_server.value,
            state->shared().config.system_metrics_statsd_prefix.value);
      } else if(state->shared().config.system_metrics_target.value.compare("none")) {
        emitter_ = new FileEmitter(metrics_map_,
            state->shared().config.system_metrics_target.value);
      }
    }

    Metrics::~Metrics() {
      if(timer_) delete timer_;
      if(emitter_) delete emitter_;

      for(MetricsMap::iterator i = metrics_map_.begin();
          i != metrics_map_.end();
          ++i)
      {
        delete (*i);
      }
    }

    void Metrics::map_metrics() {
      // CodeDB metrics
      metrics_map_.push_back(new MetricsItem(
            "codedb.load.us", metrics_data_.codedb.load_us));

      // Console metrics
      metrics_map_.push_back(new MetricsItem(
            "console.requests.received", metrics_data_.console.requests_received));
      metrics_map_.push_back(new MetricsItem(
            "console.responses.sent", metrics_data_.console.responses_sent));

      // GC metrics
      metrics_map_.push_back(new MetricsItem(
            "gc.young.count", metrics_data_.gc.young_count));
      metrics_map_.push_back(new MetricsItem(
            "gc.young.ms", metrics_data_.gc.young_ms));
      metrics_map_.push_back(new MetricsItem(
            "gc.immix.count", metrics_data_.gc.immix_count));
      metrics_map_.push_back(new MetricsItem(
            "gc.immix.stop.ms", metrics_data_.gc.immix_stop_ms));
      metrics_map_.push_back(new MetricsItem(
            "gc.immix.concurrent.ms", metrics_data_.gc.immix_concurrent_ms));
      metrics_map_.push_back(new MetricsItem(
            "gc.large.count", metrics_data_.gc.large_count));
      metrics_map_.push_back(new MetricsItem(
            "gc.large.sweep.us", metrics_data_.gc.large_sweep_us));

      // JIT metrics
      metrics_map_.push_back(new MetricsItem(
            "jit.methods.queued", metrics_data_.jit.methods_queued));
      metrics_map_.push_back(new MetricsItem(
            "jit.methods.compiled", metrics_data_.jit.methods_compiled));
      metrics_map_.push_back(new MetricsItem(
            "jit.methods.failed", metrics_data_.jit.methods_failed));
      metrics_map_.push_back(new MetricsItem(
            "jit.compile_time.us", metrics_data_.jit.compile_time_us));
      metrics_map_.push_back(new MetricsItem(
            "jit.uncommon_exits", metrics_data_.jit.uncommon_exits));
      metrics_map_.push_back(new MetricsItem(
            "jit.inlined.accessors", metrics_data_.jit.inlined_accessors));
      metrics_map_.push_back(new MetricsItem(
            "jit.inlined.methods", metrics_data_.jit.inlined_methods));
      metrics_map_.push_back(new MetricsItem(
            "jit.inlined.blocks", metrics_data_.jit.inlined_blocks));
      metrics_map_.push_back(new MetricsItem(
            "jit.inlined.primitives", metrics_data_.jit.inlined_primitives));
      metrics_map_.push_back(new MetricsItem(
            "jit.inlined.ffi", metrics_data_.jit.inlined_ffi));

      // Lock metrics
      metrics_map_.push_back(new MetricsItem(
            "lock.stop_the_world.ns", metrics_data_.lock.stop_the_world_ns));

      // Machine metrics
      metrics_map_.push_back(new MetricsItem(
            "machine.inline_cache.resets", metrics_data_.machine.inline_cache_resets));
      metrics_map_.push_back(new MetricsItem(
            "machine.methods.invoked", metrics_data_.machine.methods_invoked));
      metrics_map_.push_back(new MetricsItem(
            "machine.blocks.invoked", metrics_data_.machine.blocks_invoked));

      // Memory metrics
      metrics_map_.push_back(new MetricsItem(
            "memory.young.bytes", metrics_data_.memory.young_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.young.objects", metrics_data_.memory.young_objects));
      metrics_map_.push_back(new MetricsItem(
            "memory.young.occupancy", metrics_data_.memory.young_occupancy));
      metrics_map_.push_back(new MetricsItem(
            "memory.immix.bytes", metrics_data_.memory.immix_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.immix.objects", metrics_data_.memory.immix_objects));
      metrics_map_.push_back(new MetricsItem(
            "memory.immix.chunks", metrics_data_.memory.immix_chunks));
      metrics_map_.push_back(new MetricsItem(
            "memory.large.bytes", metrics_data_.memory.large_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.large.objects", metrics_data_.memory.large_objects));
      metrics_map_.push_back(new MetricsItem(
            "memory.symbols", metrics_data_.memory.symbols));
      metrics_map_.push_back(new MetricsItem(
            "memory.symbols.bytes", metrics_data_.memory.symbols_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.code.bytes", metrics_data_.memory.code_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.jit.bytes", metrics_data_.memory.jit_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.promoted.bytes", metrics_data_.memory.promoted_bytes));
      metrics_map_.push_back(new MetricsItem(
            "memory.promoted.objects", metrics_data_.memory.promoted_objects));
      metrics_map_.push_back(new MetricsItem(
            "memory.slab.refills", metrics_data_.memory.slab_refills));
      metrics_map_.push_back(new MetricsItem(
            "memory.slab.refills.fails", metrics_data_.memory.slab_refills_fails));
      metrics_map_.push_back(new MetricsItem(
            "memory.data_objects", metrics_data_.memory.data_objects));
      metrics_map_.push_back(new MetricsItem(
            "memory.capi_handles", metrics_data_.memory.capi_handles));
      metrics_map_.push_back(new MetricsItem(
            "memory.inflated_headers", metrics_data_.memory.inflated_headers));

      // System metrics
      metrics_map_.push_back(new MetricsItem(
            "system.read.bytes", metrics_data_.system.read_bytes));
      metrics_map_.push_back(new MetricsItem(
            "system.write.bytes", metrics_data_.system.write_bytes));
      metrics_map_.push_back(new MetricsItem(
            "system.signals.received", metrics_data_.system.signals_received));
      metrics_map_.push_back(new MetricsItem(
            "system.signals.processed", metrics_data_.system.signals_processed));
      metrics_map_.push_back(new MetricsItem(
            "system.threads.created", metrics_data_.system.threads_created));
      metrics_map_.push_back(new MetricsItem(
            "system.threads.destroyed", metrics_data_.system.threads_destroyed));

    }

    void Metrics::init_ruby_metrics(STATE) {
      LookupTable* map = LookupTable::create(state);
      Module* mod = as<Module>(G(rubinius)->get_const(state, state->symbol("Metrics")));
      mod->set_const(state, "Map", map);

      Tuple* values = Tuple::create(state, metrics_map_.size());
      values_.set(values);
      mod->set_const(state, "Values", values);

      int index = 0;

      for(MetricsMap::iterator i = metrics_map_.begin();
          i != metrics_map_.end();
          ++i)
      {
        values->put(state, index, Integer::from(state, (*i)->second));

        Object* key = reinterpret_cast<Object*>(state->symbol((*i)->first.c_str()));
        map->store(state, key, Fixnum::from(index++));
      }
    }

    void Metrics::update_ruby_values(STATE) {
      GCDependent guard(state, 0);

      Tuple* values = values_.get();
      int index = 0;

      for(MetricsMap::iterator i = metrics_map_.begin();
          i != metrics_map_.end();
          ++i)
      {
        values->put(state, index++, Integer::from(state, (*i)->second));
      }
    }

    void Metrics::initialize(STATE) {
      InternalThread::initialize(state);

      enabled_ = true;

      timer_ = new timer::Timer;

      metrics_lock_.init();
      metrics_data_ = MetricsData();
      metrics_history_ = MetricsData();
    }

    void Metrics::wakeup(STATE) {
      InternalThread::wakeup(state);

      if(timer_) {
        timer_->clear();
        timer_->cancel();
      }
    }

    void Metrics::after_fork_child(STATE) {
      if(emitter_) emitter_->reinit();

      InternalThread::after_fork_child(state);
    }

    void Metrics::add_historical_metrics(MetricsData& metrics) {
      if(!enabled_) return;

      {
        utilities::thread::Mutex::LockGuard guard(metrics_lock_);

        metrics_history_.add(metrics);
      }
    }

    void Metrics::run(STATE) {
      timer_->set(interval_);

      while(!thread_exit_) {
        if(timer_->wait_for_tick() < 0) {
          logger::error("metrics: error waiting for timer, exiting thread");
          break;
        }

        if(thread_exit_) break;

        metrics_data_ = MetricsData();
        ThreadList* threads = state->shared().threads();

        for(ThreadList::iterator i = threads->begin();
            i != threads->end();
            ++i) {
          if(VM* vm = (*i)->as_vm()) {
            metrics_data_.add(vm->metrics());
          }
        }

#ifdef ENABLE_LLVM
        if(LLVMState* llvm_state = state->shared().llvm_state) {
          metrics_data_.add(llvm_state->vm()->metrics());
        }
#endif

        {
          utilities::thread::Mutex::LockGuard guard(metrics_lock_);

          metrics_data_.add(metrics_history_);
        }

        update_ruby_values(state);

        if(emitter_) emitter_->send_metrics();
      }

      timer_->clear();
    }
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="vertical"
        xmlns:android="http://schemas.android.com/apk/res/android">

    <android.support.v7.widget.CardView
            android:id="@+id/cardview_item"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:foreground="?android:attr/selectableItemBackground"
            >

        <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="24dp"
                android:layout_marginRight="24dp"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                xmlns:android="http://schemas.android.com/apk/res/android">
            <de.hdodenhof.circleimageview.CircleImageView
                    android:id="@+id/user_profile"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
            <TextView
                    android:id="@+id/tv_username"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_marginLeft="4dp"
                    android:textSize="14sp"
                    android:layout_toEndOf="@+id/user_profile"/>
            <TextView
                    android:id="@+id/tv_createdAt"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="12sp"
                    android:layout_alignParentTop="true"
                    android:layout_alignEnd="@+id/de_detail"/>
            <com.zkx.weipo.app.util.ContentTextView
                    android:id="@+id/de_detail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textSize="16sp"
                    android:layout_marginTop="8dp"
                    android:textColor="#000000"
                    android:layout_below="@+id/tv_username"
                    android:layout_alignStart="@+id/tv_username"
                    android:layout_centerHorizontal="true"/>
        </RelativeLayout>

    </android.support.v7.widget.CardView>

</LinearLayout>

redpajama_set_name: RedPajamaGithub


text:
const utility = require("utility");

module.exports = {
    selectRole: function (creeps) {
        if (Memory.traveler === void 0) {
            return;
        }

        let groupedCreeps = _.groupBy(creeps, c => c.room);

        for (let cr in groupedCreeps) {
            let room = groupedCreeps[cr][0].room;

            groupedCreeps[cr] = _.sortBy(groupedCreeps[cr], c => c.memory.no);
            let i = 0;
            let count = 0;

            count += Memory.traveler.harvester !== void 0 ? Memory.traveler.harvester : 0;
            for (; i < count && i < groupedCreeps[cr].length; ++i) {
                groupedCreeps[cr][i].memory.role = "THarvester";
                groupedCreeps[cr][i].memory.homeRoomName = Memory.greenRooms[0];
                groupedCreeps[cr][i].memory.targetRoomName = Memory.greenRooms[1];
            }

            count += Memory.traveler.upgrader !== void 0 ? Memory.traveler.upgrader : 0;
            for (; i < count && i < groupedCreeps[cr].length; ++i) {
                groupedCreeps[cr][i].memory.role = "TUpgrader";
                groupedCreeps[cr][i].memory.homeRoomName = Memory.greenRooms[0];
                groupedCreeps[cr][i].memory.targetRoomName = Memory.greenRooms[1];
            }

            count += Memory.traveler.builder !== void 0 ? Memory.traveler.builder : 0;
            for (; i < count && i < groupedCreeps[cr].length; ++i) {
                groupedCreeps[cr][i].memory.role = "TBuilder";
                groupedCreeps[cr][i].memory.homeRoomName = Memory.greenRooms[0];
                groupedCreeps[cr][i].memory.targetRoomName = Memory.greenRooms[1];
            }
        }
    },

    getCreepCount: function () {
        let count = 0;
        count += Memory.traveler.harvester;
        count += Memory.traveler.upgrader;
        count += Memory.traveler.builder;
        return count;
    },
};


text:
module GPhoto2
  class PortInfoList
    include FFI::GPhoto2Port
    include GPhoto2::Struct

    def initialize
      new
      load
    end

    # @param [String] port
    # @return [Integer]
    def lookup_path(port)
      _lookup_path(port)
    end
    alias_method :index, :lookup_path

    # @param [Integer] index
    # @return [GPhoto2::PortInfo]
    def at(index)
      PortInfo.new(self, index)
    end
    alias_method :[], :at

    private

    def new
      ptr = FFI::MemoryPointer.new(:pointer)
      rc = gp_port_info_list_new(ptr)
      GPhoto2.check!(rc)
      @ptr = GPPortInfoList.new(ptr.read_pointer)
    end

    def load
      rc = gp_port_info_list_load(ptr)
      GPhoto2.check!(rc)
    end

    def _lookup_path(port)
      index = rc = gp_port_info_list_lookup_path(ptr, port)
      GPhoto2.check!(rc)
      index
    end
  end
end


text:
package org.jrgss.api;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.utils.ScreenUtils;
import lombok.Data;
import lombok.ToString;
import org.jrgss.FileUtil;
import org.jrgss.JRGSSGame;
import org.jrgss.shaders.TextShaderProgram;

import java.nio.IntBuffer;

import static org.jrgss.JRGSSGame.runWithGLContext;

/**
 * Created by matty on 6/27/14.
 */
@Data
@ToString(exclude = {"camera", "font", "frameBuffer", "region", "pixmap"})
public class Bitmap {
    String path;
    Font font = new Font();
    int width;
    int height;
    FrameBuffer frameBuffer;
    TextureRegion region;
    Pixmap pixmap;
    OrthographicCamera camera;
    boolean isDisposed;

    public Bitmap(Pixmap img) {
        frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, img.getWidth(), img.getHeight(), false);
        frameBuffer.getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
        OrthographicCamera camera = new OrthographicCamera();
        camera.setToOrtho(false, img.getWidth(), img.getHeight());
        img.getPixels().rewind();
        batch = new SpriteBatch();
        batch.setProjectionMatrix(camera.combined);
        frameBuffer.begin();
        batch.begin();
        Gdx.gl.glClearColor(1, 1, 1, 0f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.draw(new Texture(img), 0, 0);
        batch.end();
        frameBuffer.end();
        region = new TextureRegion(new Texture(img));

        this.width = img.getWidth();
        this.height = img.getHeight();
        this.camera = new OrthographicCamera(width, height);
        this.camera.setToOrtho(true, width, height);
    }

    public Bitmap(String path) {
        long t = System.currentTimeMillis();
        final Pixmap img;
        FileHandle file = FileUtil.loadImg(path);
        img = new Pixmap(file);

        long endTime = System.currentTimeMillis();
        this.path = path;
        runWithGLContext(new Runnable() {
            @Override
            public void run() {
                frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, img.getWidth(), img.getHeight(), false);
                OrthographicCamera camera = new OrthographicCamera();
                camera.setToOrtho(false, img.getWidth(), img.getHeight());
                batch = new SpriteBatch();
                batch.setProjectionMatrix(camera.combined);
                frameBuffer.begin();
                batch.begin();
                Gdx.gl.glClearColor(1, 1, 1, 0f);
                Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
                batch.draw(new Texture(img), 0, 0);
                batch.end();
                frameBuffer.end();
                region = new TextureRegion(frameBuffer.getColorBufferTexture());
            }
        });
        this.width = img.getWidth();
        this.height = img.getHeight();
        endTime = System.currentTimeMillis();
        this.camera = new OrthographicCamera(width, height);
        this.camera.setToOrtho(true, width, height);
    }

    public Bitmap(final int width, final int height) {
        this.width = width;
        this.height = height;
        this.camera = new OrthographicCamera(width, height);
        this.camera.setToOrtho(true, width, height);
        runWithGLContext(() -> {
            if (width == 0 || height == 0) {
                frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, 1, 1, false);
            } else {
                frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
            }
            frameBuffer.begin();
            Gdx.gl.glClearColor(1, 1, 1, 0f);
            Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
            frameBuffer.end();
            region = new TextureRegion(frameBuffer.getColorBufferTexture());
            batch = new SpriteBatch();
        });
        clear();
    }

    public static int clamp(int x, int a, int b) {
        return (x < a) ? a : (x > b) ? b : x;
    }

    public static void blur(IntBuffer in, IntBuffer out, int width, int height, int radius) {
        int widthMinus1 = width - 1;
        int tableSize = 2 * radius + 1;
        int divide[] = new int[256 * tableSize];

        for (int i = 0; i < 256 * tableSize; i++)
            divide[i] = i / tableSize;

        int inIndex = 0;

        for (int y = 0; y < height; y++) {
            int outIndex = y;
            int ta = 0, tr = 0, tg = 0, tb = 0;

            for (int i = -radius; i <= radius; i++) {
                int rgb = in.get(inIndex + clamp(i, 0, width - 1));
                ta += (rgb >> 24) & 0xff;
                tr += (rgb >> 16) & 0xff;
                tg += (rgb >> 8) & 0xff;
                tb += rgb & 0xff;
            }

            for (int x = 0; x < width; x++) {
                out.put(outIndex, (divide[ta] << 24) | (divide[tr] << 16) | (divide[tg] << 8) | 0xff);

                int i1 = x + radius + 1;
                if (i1 > widthMinus1)
                    i1 = widthMinus1;
                int i2 = x - radius;
                if (i2 < 0)
                    i2 = 0;
                int rgb1 = in.get(inIndex + i1);
                int rgb2 = in.get(inIndex + i2);

                ta += ((rgb1 >> 24) & 0xff) - ((rgb2 >> 24) & 0xff);
                tr += ((rgb1 >> 16) & 0xff) - ((rgb2 >> 16) & 0xff);
                tg += ((rgb1 >> 8) & 0xff) - ((rgb2 >> 8) & 0xff);
                tb += (rgb1 & 0xff) - (rgb2 & 0xff);
                outIndex += height;
            }
            inIndex += width;
        }
    }

    public Bitmap clone() {
        return new Bitmap(getPixmap());
    }

    public void hue_change(float hue) {
        hue = (hue / 360f) - ((int) (hue / 360f));
        if (hue < 0) hue = 1 - hue;
        final float finalHue = hue;
        Gdx.app.log("Bitmap", "Hue change to " + hue);
        JRGSSGame.runWithGLContext(new Runnable() {
            @Override
            public void run() {
                Pixmap p = getPixmap();
                IntBuffer inPixels = p.getPixels().duplicate().asIntBuffer();
                IntBuffer outPixels = IntBuffer.allocate(inPixels.remaining());
                while (inPixels.remaining() > 0) {
                    Color c = new Color(inPixels.get());
                    float[] hsv = rgbToHSV(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f);
                    hsv[0] = finalHue;
                    outPixels.put(hsvToRGB(hsv, c.getAlpha()));
                }
                inPixels.rewind();
                inPixels.put(outPixels);
                inPixels.rewind();
                OrthographicCamera camera = new OrthographicCamera();
                camera.setToOrtho(false, getWidth(), getHeight());
                SpriteBatch batch = new SpriteBatch();
                batch.setProjectionMatrix(camera.combined);
                frameBuffer.begin();
                batch.begin();
                Gdx.gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
                Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
                batch.draw(new Texture(p), 0, 0);
                batch.end();
                frameBuffer.end();
                region = new TextureRegion(frameBuffer.getColorBufferTexture());
                pixmap = null;
            }
        });
    }

    private int hsvToRGB(float[] hsv, int alpha) {
        float r, g, b;
        if (hsv[1] == 0) {
            return new Color((int) (hsv[2] * 255f), (int) (hsv[2] * 255f), (int) (hsv[2] * 255f), alpha).toPackedInt();
        }
        float h = hsv[0] * 6;
        if (h >= 6) h = 0;
        int i = (int) h;
        float v1 = hsv[2] * (1 - hsv[1]);
        float v2 = hsv[2] * (1 - (hsv[1] * (h - i)));
        float v3 = hsv[2] * (1 - (hsv[1] * (1 - h + i)));

        switch (i) {
            case 0:
                r = hsv[2];
                g = v3;
                b = v1;
                break;
            case 1:
                r = v2;
                g = hsv[2];
                b = v1;
                break;
            case 2:
                r = v1;
                g = hsv[2];
                b = v3;
                break;
            case 3:
                r = v1;
                g = v2;
                b = hsv[2];
                break;
            case 4:
                r = v3;
                g = v1;
                b = hsv[2];
                break;
            default:
                r = hsv[2];
                g = v1;
                b = v2;
                break;
        }
        return new Color((int) (r * 255), (int) (g * 255), (int) (b * 255), alpha).toPackedInt();

    }

    private float[] rgbToHSV(float r, float g, float b) {
        float min = Math.min(Math.min(r, g), b);
        float max = Math.max(Math.max(r, g), b);
        float delta = max - min;
        float[] hsv = new float[3];
        hsv[2] = max;
        if (delta == 0) {
            return hsv;
        }

        hsv[1] = delta / max;

        float deltaR = (((max - r) / 6) + (max / 2)) / max;
        float deltaG = (((max - g) / 6) + (max / 2)) / max;
        float deltaB = (((max - b) / 6) + (max / 2)) / max;

        if (r == max) hsv[0] = deltaB - deltaG;
        if (g == max) hsv[0] = (1f / 3f) + r - b;
        if (b == max) hsv[0] = (2f / 3f) + g - r;

        if (hsv[0] < 0) hsv[0] += 1;
        if (hsv[0] > 1) hsv[0] -= 1;

        return hsv;
    }

    public Rect text_size(final String str) {
        if(font.bitmapFont == null) {
            Gdx.app.log("Bitmap","Bitmap font is null.");
        }
        float multiplier = str.length() == 1?0.9f:0.95f;
        GlyphLayout layout = new GlyphLayout(font.outlineFont, str);
        return new Rect(0, 0, (int)((" ".equals(str)?font.outlineFont.getSpaceWidth():(layout.width))*multiplier), (int)(layout.height));
    }

    public Rect rect() {
        return new Rect(0, 0, width, height);
    }

    public Pixmap getPixmap() {
        if (pixmap == null) {
            Gdx.app.log("Bitmap", "Generating Pixmap. Loaded from " + path);
            frameBuffer.begin();
            Pixmap ret = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
            byte[] bytes = ScreenUtils.getFrameBufferPixels(0, 0, getWidth(), getHeight(), true);
            ret.getPixels().put(bytes).rewind();
            Gdx.app.log("Bitmap", "Returned Pixmap is " + ret.getFormat());
            frameBuffer.end();
            pixmap = ret;
            return ret;
        }
        return pixmap;
    }

    public void blt(final int x, final int y, final Bitmap src_bitmap, final Rect src_rect) {
        blt(x, y, src_bitmap, src_rect, 255);
    }

    public void blt(final int x, final int y, final Bitmap src_bitmap, final Rect src_rect, final int opacity) {
        internalBlit(x, y, src_rect.getWidth(), src_rect.getHeight(), src_bitmap, src_rect, opacity);
    }

    private void internalBlit(final int x, final int y, final int width, final int height,
                              final Bitmap src_bitmap, final Rect src_rect, final int opacity) {

        JRGSSGame.runWithGLContext(() -> {
            batch.enableBlending();
            batch.setProjectionMatrix(camera.combined);
            frameBuffer.begin();
            batch.setColor(1.0f, 1.0f, 1.0f, (opacity / 255f));
            batch.begin();
            src_bitmap.render(batch, x, y, width, height, src_rect);
            batch.end();
            frameBuffer.end();
            pixmap = null;
        });

    }

    public void stretch_blt(final Rect dest_rect, final Bitmap src_bitmap, final Rect src_rect, final int opacity) {
        internalBlit(dest_rect.getX(), dest_rect.getY(), dest_rect.getWidth(), dest_rect.getHeight(), src_bitmap, src_rect, opacity);
    }

    public void stretch_blt(final Rect dest_rect, final Bitmap src_bitmap, final Rect src_rect) {
        internalBlit(dest_rect.getX(), dest_rect.getY(), dest_rect.getWidth(), dest_rect.getHeight(), src_bitmap, src_rect, 255);
    }

    public void dispose() {
        if(isDisposed) return;
        isDisposed = true;
        //Gdx.app.log("Bitmap","Calling dispose for "+path);
        if (frameBuffer != null) {
            runWithGLContext(new Runnable() {
                FrameBuffer fb = frameBuffer;

                @Override
                public void run() {
                    fb.dispose();
                }
            });
            frameBuffer = null;
        }
        runWithGLContext(() ->{

            if (pixmap != null) pixmap.dispose();
            if (region != null) region.getTexture().dispose();
            if (batch != null) batch.dispose();
        });
    }

    public void blur() {
        JRGSSGame.runWithGLContext(() -> {
            Pixmap p = getPixmap();
            IntBuffer inPixels = p.getPixels().asIntBuffer();
            Gdx.app.log("Graphics", "Length of IntBuffer = " + inPixels.remaining());
            IntBuffer outPixels = IntBuffer.allocate(inPixels.remaining());
            blur(inPixels, outPixels, getWidth(), getHeight(), 2);
            blur(outPixels, inPixels, getHeight(), getWidth(), 2);
            OrthographicCamera camera1 = new OrthographicCamera();
            camera1.setToOrtho(false, getWidth(), getHeight());
            SpriteBatch batch1 = new SpriteBatch();
            batch1.setProjectionMatrix(camera1.combined);
            frameBuffer.begin();
            batch1.begin();
            Gdx.gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
            Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
            batch1.draw(new Texture(p), 0, 0);
            batch1.end();
            frameBuffer.end();
            region = new TextureRegion(frameBuffer.getColorBufferTexture());
            batch1.dispose();
            pixmap = null;
        });

    }

    public void gradient_fill_rect(Rect rect, Color color1, Color color2) {
        gradient_fill_rect(rect, color1, color2, false);
    }

    public void gradient_fill_rect(Rect rect, Color color1, Color color2, boolean vertical) {
        gradient_fill_rect(rect.x, rect.y, rect.width, rect.height, color1, color2, vertical);
    }

    public void gradient_fill_rect(int x, int y, int width, int height, Color color1, Color color2) {
        gradient_fill_rect(x, y, width, height, color1, color2, false);
    }

    public void gradient_fill_rect(final int x, final int y, final int width, final int height, final Color color1, final Color color2, final boolean vertical) {
        runWithGLContext(() -> {
            ShapeRenderer shapeRenderer = new ShapeRenderer();
            shapeRenderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
            shapeRenderer.setProjectionMatrix(camera.combined);
            frameBuffer.begin();
            shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
            if (vertical) {
                shapeRenderer.rect(x, y, width, height, color1.toGDX(), color1.toGDX(), color2.toGDX(), color2.toGDX());
            } else {
                shapeRenderer.rect(x, y, width, height, color1.toGDX(), color2.toGDX(), color2.toGDX(), color1.toGDX());
            }
            shapeRenderer.end();
            frameBuffer.end();
            pixmap = null;
        });

    }

    public void fill_rect(Rect rect, Color color) {
        fill_rect(rect.x, rect.y, rect.width, rect.height, color);
    }

    public void fill_rect(final int x, final int y, final int width, final int height, final Color color) {
        runWithGLContext(() -> {
            batch.disableBlending();
            batch.setProjectionMatrix(camera.combined);
            frameBuffer.begin();
            batch.begin();
            batch.setColor(color.toGDX());
            batch.draw(Sprite.getColorTexture(), x, y, width, height);
            batch.end();
            batch.enableBlending();
            frameBuffer.end();
            pixmap = null;
        });
    }

    public void render(SpriteBatch batch, int x, int y) {
        batch.draw(region, x, y);
    }

    public void render(SpriteBatch batch, int x, int y, int srcx, int srcy, int srcwidth, int srcheight) {
        if (isDisposed) {
            Gdx.app.log("Bitmap", "Trying to draw a disposed Bitmap. BUG");
            throw new RuntimeException("Trying to draw a disposed Bitmap");
        }
        batch.draw(frameBuffer.getColorBufferTexture(), x, y, srcx, (height - srcheight) - srcy,
                srcwidth, srcheight);
    }

    public void clear_rect(final int x, final int y, final int width, final int height) {
        runWithGLContext(() -> {
            batch.disableBlending();
            batch.setProjectionMatrix(camera.combined);
            frameBuffer.begin();
            batch.begin();
            batch.setColor(0f, 0f, 0f, 0f);
            batch.draw(Sprite.getColorTexture(), x, y, width, height);
            batch.end();
            batch.enableBlending();
            frameBuffer.end();
            pixmap = null;
        });
    }

    public void clear_rect(Rect rect) {
        clear_rect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
    }

    public void render(SpriteBatch batch, int x, int y, Rect srcRect) {
        render(batch, x, y, srcRect.getWidth(), srcRect.getHeight(), srcRect);
    }

    public void render(SpriteBatch batch, int x, int y, int width, int height, Rect srcRect) {
        if (frameBuffer != null) {
            batch.draw(frameBuffer.getColorBufferTexture(), x, y, width, height, srcRect.getX(), (this.height - srcRect.getHeight()) - srcRect.getY(),
                    srcRect.getWidth(), srcRect.getHeight(), false, false);
        }

    }

    public boolean isDisposed() {
        return frameBuffer == null;
    }

    public void clear() {
        runWithGLContext(new Runnable() {
            @Override
            public void run() {
                frameBuffer.begin();
                Gdx.gl.glClearColor(0, 0, 0, 0f);
                Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
                frameBuffer.end();
            }
        });
        pixmap = null;
    }

    public Color get_pixel(int x, int y) {
        Pixmap p = getPixmap();
        return new Color(p.getPixel(x, y));
    }

    public void set_pixel(final int x, final int y, Color c) {
        final Pixmap temp = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
        runWithGLContext(() -> {
            final Texture texture = new Texture(temp);
            frameBuffer.begin();
            batch.begin();
            batch.draw(texture, x, y);
            batch.end();
            frameBuffer.end();
        });
        pixmap = null;
    }

    SpriteBatch batch;

    public void draw_text(final int x, final int y, final int width, final int height, final Object obj,
                          final int align) {
        final String string = obj.toString();
        if(obj.toString().length() > 10) {
            Gdx.app.log("Bitmap", String.format("%d, %d, %d, %d, %d, %s", x, y, width, height, align, obj));
        }
        JRGSSGame.runWithGLContext(() -> {
            BitmapFont f = font.getBitmapFont();
            BitmapFont outline = font.getOutlineFont();

            Color innerColor = font.getColor();
            Color outerColor = font.getOutColor();
            f.setColor(innerColor.toGDX());
            outline.setColor(outerColor.toGDX());
            GlyphLayout layout = new GlyphLayout(f, string);
            GlyphLayout outlineLayout = new GlyphLayout(outline, string);
            if (layout.width > width) {
                float xScale = Math.max(0.6f, width / layout.width);
                batch.setProjectionMatrix(camera.combined.cpy().scale(xScale, 1.0f, 1.0f));
            } else {
                batch.setProjectionMatrix(camera.combined);
            }
            float drawX = x;
            if (align == 2) {
                drawX += width - layout.width;
            } else if (align == 1) {
                if(string.length() > 10) {
                    Gdx.app.log("Bitmap", "Width is "+layout.width);
                }
                drawX += (width - (layout.width)) / 2;
            }
            int drawY = y + (int) (height - outlineLayout.height) / 2;
            drawY--;

            frameBuffer.begin();
            batch.setColor(com.badlogic.gdx.graphics.Color.WHITE);
            batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
            batch.begin();

            float fontDrawX = drawX;

            for(char c : string.toCharArray()) {
                if(c == ' ') {
                    fontDrawX += f.getSpaceWidth();
                    continue;
                }
                String current = Character.toString(c);
                layout = new GlyphLayout(f, current);
                outlineLayout = new GlyphLayout(outline, current);
                outline.draw(batch, outlineLayout, fontDrawX - ((outlineLayout.width - layout.width) / 2), drawY);
                fontDrawX+=(outlineLayout.width * 0.885);
            }
            fontDrawX = drawX;
            for(char c : string.toCharArray()) {
                if(c == ' ') {
                    fontDrawX += f.getSpaceWidth();
                    continue;
                }
                String current = Character.toString(c);
                layout = new GlyphLayout(f, current);
                outlineLayout = new GlyphLayout(outline, current);

                f.draw(batch, layout, fontDrawX, drawY);
                fontDrawX+=(outlineLayout.width * 0.885);
            }

            batch.end();

            frameBuffer.end();
            batch.setProjectionMatrix(camera.combined);
            if (path == null) {
                path = string;
            } else {
                path += string;
            }
        });
        pixmap = null;

    }

    public void draw_text(int x, int y, int width, int height, Object string) {
        draw_text(x, y, width, height, string, 0);
    }

    public void draw_text(Rect rect, Object str, int align) {
        draw_text(rect.x, rect.y, rect.width, rect.height, str, align);
    }

    public void draw_text(Rect rect, Object str) {
        draw_text(rect.x, rect.y, rect.width, rect.height, str, 0);
    }

    public void setFont(Font font) {
        if(font.getBitmapFont() == null) {
            Gdx.app.log("Bitmap", "Font is null!");
        }
    }

}


text:
using System;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
    [ExecuteInEditMode]
    [RequireComponent (typeof(Camera))]
    [AddComponentMenu ("Image Effects/Rendering/Global Fog")]
    public class GlobalFog : PostEffectsBase
	{
		[Tooltip("Apply distance-based fog?")]
        public bool  distanceFog = true;
		[Tooltip("Distance fog is based on radial distance from camera when checked")]
		public bool  useRadialDistance = false;
		[Tooltip("Apply height-based fog?")]
		public bool  heightFog = true;
		[Tooltip("Fog top Y coordinate")]
        public float height = 1.0f;
        [Range(0.001f,10.0f)]
        public float heightDensity = 2.0f;
		[Tooltip("Push fog away from the camera by this amount")]
        public float startDistance = 0.0f;

        public Shader fogShader = null;
        private Material fogMaterial = null;

        public override bool CheckResources ()
		{
            CheckSupport (true);

            fogMaterial = CheckShaderAndCreateMaterial (fogShader, fogMaterial);

            if (!isSupported)
                ReportAutoDisable ();
            return isSupported;
        }

        [ImageEffectOpaque]
        void OnRenderImage (RenderTexture source, RenderTexture destination)
		{
            if (CheckResources()==false || (!distanceFog && !heightFog))
            {
                Graphics.Blit (source, destination);
                return;
            }

			Camera cam = GetComponent<Camera>();
			Transform camtr = cam.transform;
			float camNear = cam.nearClipPlane;
			float camFar = cam.farClipPlane;
			float camFov = cam.fieldOfView;
			float camAspect = cam.aspect;

            Matrix4x4 frustumCorners = Matrix4x4.identity;

			float fovWHalf = camFov * 0.5f;

			Vector3 toRight = camtr.right * camNear * Mathf.Tan (fovWHalf * Mathf.Deg2Rad) * camAspect;
			Vector3 toTop = camtr.up * camNear * Mathf.Tan (fovWHalf * Mathf.Deg2Rad);

			Vector3 topLeft = (camtr.forward * camNear - toRight + toTop);
			float camScale = topLeft.magnitude * camFar/camNear;

            topLeft.Normalize();
			topLeft *= camScale;

			Vector3 topRight = (camtr.forward * camNear + toRight + toTop);
            topRight.Normalize();
			topRight *= camScale;

			Vector3 bottomRight = (camtr.forward * camNear + toRight - toTop);
            bottomRight.Normalize();
			bottomRight *= camScale;

			Vector3 bottomLeft = (camtr.forward * camNear - toRight - toTop);
            bottomLeft.Normalize();
			bottomLeft *= camScale;

            frustumCorners.SetRow (0, topLeft);
            frustumCorners.SetRow (1, topRight);
            frustumCorners.SetRow (2, bottomRight);
            frustumCorners.SetRow (3, bottomLeft);

			var camPos= camtr.position;
            float FdotC = camPos.y-height;
            float paramK = (FdotC <= 0.0f ? 1.0f : 0.0f);
            fogMaterial.SetMatrix ("_FrustumCornersWS", frustumCorners);
            fogMaterial.SetVector ("_CameraWS", camPos);
            fogMaterial.SetVector ("_HeightParams", new Vector4 (height, FdotC, paramK, heightDensity*0.5f));
            fogMaterial.SetVector ("_DistanceParams", new Vector4 (-Mathf.Max(startDistance,0.0f), 0, 0, 0));

            var sceneMode= RenderSettings.fogMode;
            var sceneDensity= RenderSettings.fogDensity;
            var sceneStart= RenderSettings.fogStartDistance;
            var sceneEnd= RenderSettings.fogEndDistance;
            Vector4 sceneParams;
            bool  linear = (sceneMode == FogMode.Linear);
            float diff = linear ? sceneEnd - sceneStart : 0.0f;
            float invDiff = Mathf.Abs(diff) > 0.0001f ? 1.0f / diff : 0.0f;
            sceneParams.x = sceneDensity * 1.2011224087f; // density / sqrt(ln(2)), used by Exp2 fog mode
            sceneParams.y = sceneDensity * 1.4426950408f; // density / ln(2), used by Exp fog mode
            sceneParams.z = linear ? -invDiff : 0.0f;
            sceneParams.w = linear ? sceneEnd * invDiff : 0.0f;
            fogMaterial.SetVector ("_SceneFogParams", sceneParams);
			fogMaterial.SetVector ("_SceneFogMode", new Vector4((int)sceneMode, useRadialDistance ? 1 : 0, 0, 0));

            int pass = 0;
            if (distanceFog && heightFog)
                pass = 0; // distance + height
            else if (distanceFog)
                pass = 1; // distance only
            else
                pass = 2; // height only
            CustomGraphicsBlit (source, destination, fogMaterial, pass);
        }

        static void CustomGraphicsBlit (RenderTexture source, RenderTexture dest, Material fxMaterial, int passNr)
		{
            RenderTexture.active = dest;

            fxMaterial.SetTexture ("_MainTex", source);

            GL.PushMatrix ();
            GL.LoadOrtho ();

            fxMaterial.SetPass (passNr);

            GL.Begin (GL.QUADS);

            GL.MultiTexCoord2 (0, 0.0f, 0.0f);
            GL.Vertex3 (0.0f, 0.0f, 3.0f); // BL

            GL.MultiTexCoord2 (0, 1.0f, 0.0f);
            GL.Vertex3 (1.0f, 0.0f, 2.0f); // BR

            GL.MultiTexCoord2 (0, 1.0f, 1.0f);
            GL.Vertex3 (1.0f, 1.0f, 1.0f); // TR

            GL.MultiTexCoord2 (0, 0.0f, 1.0f);
            GL.Vertex3 (0.0f, 1.0f, 0.0f); // TL

            GL.End ();
            GL.PopMatrix ();
        }
    }
}


text:
using Anotar.Serilog;

public class GenericClass<T>
{
    public void Debug()
    {
        LogTo.Debug();
    }
}


text: from proof.analysis import Analysis, never_cache


text:
<!--
Copyright 2015 Development Entropy (deventropy.org) Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Resource Location Formats

This document lists the Resource URL formats supported by the `UrlResourceUtil` class that is used by multiple
Development Entropy projects.

## Classpath

Loads resoruces from the classpath. Resource Locations should be prefixed with `classpath:` and be fully qualified paths
in the classpath, with `.` replaced by `/`.

*Example:* `classpath:/org/deventropy/junithelper/utils/file.ext`

## File

Refers to a resource on a local or mounted file system. Resource Locations should be prefixed with `file:` and be fully
qualified paths.

*Example:* `file:/path/to/file/file.ext`

## HTTP / HTTPS

A remote HTTP / HTTPS resource. Regular HTTP/HTTPs URL format should be used.

*Example:* `http://example.com/file.ext`


text:
<?php
/*
 * Cancel an order using the Mollie API.
 */

try {
    /*
     * Initialize the Mollie API library with your API key or OAuth access token.
     */
    require "../initialize.php";

    /*
     * Cancel the order with ID "ord_pbjz8x"
     *
     * See: https://docs.mollie.com/reference/v2/orders-api/cancel-order
     */
    $order = $mollie->orders->get("ord_pbjz8x");
    if ($order->isCancelable) {
        $canceledOrder = $order->cancel();
        echo "Your order " . $order->id . " has been canceled.";
    } else {
        echo "Unable to cancel your order " . $order->id . ".";
    }
} catch (\Mollie\Api\Exceptions\ApiException $e) {
    echo "API call failed: " . htmlspecialchars($e->getMessage());
}


text:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <To s:mustUnderstand="1" xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</To>
  </s:Header>
  <s:Body>
    <RetDateTimeResponse xmlns="http://tempuri.org/">
      <RetDateTimeResult>2005-11-04T14:41:00.4361008-08:00</RetDateTimeResult>
    </RetDateTimeResponse>
  </s:Body>
</s:Envelope>


text:
package com.strato.hidrive.api.utils.multipart;

import org.apache.http.util.ByteArrayBuffer;
import org.apache.http.util.EncodingUtils;

abstract class BasePart implements Part {

    protected static final byte[] CRLF = EncodingUtils.getAsciiBytes(MultipartEntity.CRLF);

    protected interface IHeadersProvider {
        public String getContentDisposition();
        public String getContentType();
        public String getContentTransferEncoding();
    }

    protected IHeadersProvider headersProvider; // must be initialized in descendant constructor

    private byte[] header;

    protected byte[] getHeader(Boundary boundary) {
        if (header == null) {
            header = generateHeader(boundary); // lazy init
        }
        return header;
    }

    private byte[] generateHeader(Boundary boundary) {
        if (headersProvider == null) {
            throw new RuntimeException("Uninitialized headersProvider");    //$NON-NLS-1$
        }
        final ByteArrayBuffer buf = new ByteArrayBuffer(256);
        append(buf, boundary.getStartingBoundary());
        append(buf, headersProvider.getContentDisposition());
        append(buf, CRLF);
        append(buf, headersProvider.getContentType());
        append(buf, CRLF);
        append(buf, headersProvider.getContentTransferEncoding());
        append(buf, CRLF);
        append(buf, CRLF);
        return buf.toByteArray();
    }

    private static void append(ByteArrayBuffer buf, String data) {
        append(buf, EncodingUtils.getAsciiBytes(data));
    }

    private static void append(ByteArrayBuffer buf, byte[] data) {
        buf.append(data, 0, data.length);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:jee="http://www.springframework.org/schema/jee"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/jee
    http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.1.xsd
    http://mybatis.org/schema/mybatis-spring
    http://mybatis.org/schema/mybatis-spring.xsd"
	default-lazy-init="true"  default-autowire="byName">

	<description>main configuration</description>

    <context:component-scan base-package="tk.cpusoft" >
    </context:component-scan>

	<!-- 3.1>=PropertySourcesPlaceholderConfigurer  <3.1 PropertyPlaceholderConfigurer  -->
	<context:property-placeholder
			ignore-resource-not-found="false"
			ignore-unresolvable="false"
			file-encoding="utf-8"
			location="classpath*:config/*.properties" />

    <bean id="configurationFactory"
        class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean">
        <!-- define configuration as a set of spring resources -->
        <property name="locations" value="classpath:config/*.properties" />
    </bean>

    <bean id="config" factory-bean="&configurationFactory"
        factory-method="getConfiguration" />

</beans>


text:
package org.wso2.appcloud.core.dto;

public class ApplicationType {

    private String appTypeName;
    private String description;
    private boolean buildable;

    public String getAppTypeName() {
        return appTypeName;
    }

    public void setAppTypeName(String appTypeName) {
        this.appTypeName = appTypeName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isBuildable() {
        return buildable;
    }

    public void setBuildable(boolean buildable) {
        this.buildable = buildable;
    }
}


text:
package org.apache.camel.component.http;

import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.handler.DrinkQueryValidationHandler;
import org.apache.http.impl.bootstrap.HttpServer;
import org.apache.http.impl.bootstrap.ServerBootstrap;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.http.HttpMethods.GET;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class HttpQueryParameterTest extends BaseHttpTest {

    private HttpServer localServer;

    @BeforeEach
    @Override
    public void setUp() throws Exception {
        localServer = ServerBootstrap.bootstrap().setHttpProcessor(getBasicHttpProcessor())
                .setConnectionReuseStrategy(getConnectionReuseStrategy()).setResponseFactory(getHttpResponseFactory())
                .setExpectationVerifier(getHttpExpectationVerifier()).setSslContext(getSSLContext())
                .registerHandler("/moes", new DrinkQueryValidationHandler(GET.name(), null, null, "drink"))
                .registerHandler("/joes", new DrinkQueryValidationHandler(GET.name(), null, null, "drink")).create();
        localServer.start();

        super.setUp();
    }

    @AfterEach
    @Override
    public void tearDown() throws Exception {
        super.tearDown();

        if (localServer != null) {
            localServer.stop();
        }
    }

    @Override
    protected RoutesBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:moes")
                        .to("http://localhost:" + localServer.getLocalPort()
                            + "/moes?drink=beer");

                from("direct:joes")
                        .to("http://localhost:" + localServer.getLocalPort()
                            + "/joes?drink=wine");
            }
        };
    }

    @Test
    public void testQueryParameter() throws Exception {
        String out = fluentTemplate.to("direct:moes").request(String.class);
        assertEquals("Drinking /moes?drink=beer", out);

        out = fluentTemplate.to("direct:joes").request(String.class);
        assertEquals("Drinking /joes?drink=wine", out);
    }

}


text:
thisfile=$(readlink -ne "${BASH_SOURCE[0]}")
current_time=$(date "+%Y-%m-%d-%H-%M-%S")
result_file_name=cloud_prod_result.$current_time.html
echo $result_file_name

main() {
  source grpc_docker.sh
  test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response)
  auth_test_cases=(service_account_creds compute_engine_creds)
  clients=(cxx java go ruby node csharp_mono)
  for test_case in "${test_cases[@]}"
  do
    for client in "${clients[@]}"
    do
      if grpc_cloud_prod_test $test_case grpc-docker-testclients $client
      then
        echo "          ['$test_case', '$client', 'prod', true]," >> /tmp/cloud_prod_result.txt
      else
        echo "          ['$test_case', '$client', 'prod', false]," >> /tmp/cloud_prod_result.txt
      fi
    done
  done
  for test_case in "${auth_test_cases[@]}"
  do
    for client in "${clients[@]}"
    do
      if grpc_cloud_prod_auth_test $test_case grpc-docker-testclients $client
      then
        echo "          ['$test_case', '$client', 'prod', true]," >> /tmp/cloud_prod_result.txt
      else
        echo "          ['$test_case', '$client', 'prod', false]," >> /tmp/cloud_prod_result.txt
      fi
    done
  done
  if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
    cat pre.html /tmp/cloud_prod_result.txt post.html > /tmp/cloud_prod_result.html
    gsutil cp /tmp/cloud_prod_result.txt gs://stoked-keyword-656-output/cloud_prod_result.txt
    gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/cloud_prod_result.html
    gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/result_history/$result_file_name
    rm /tmp/cloud_prod_result.txt
    rm /tmp/cloud_prod_result.html
  fi
}

set -x
main "$@"


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using System.Diagnostics;
using Microsoft.Scripting;
using System.Threading;
using System.Windows.Threading;
using System.Windows.Forms;

namespace RMSCmdExecutor
{
    [Regeneration(RegenerationOption.Manual)]
    [Transaction(TransactionMode.Manual)]
    public class RMSGitRepoLinkCommand : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            System.Diagnostics.Process.Start("https://github.com/hdm-dt-fb/rvt_model_services");
            return Result.Succeeded;
        }

    }

    public class RMSGitRepoLinkCommandAvail : IExternalCommandAvailability
    {
        public RMSGitRepoLinkCommandAvail()
        {
        }

        public bool IsCommandAvailable(UIApplication uiApp, CategorySet selectedCategories)
        {
            return true;
        }
    }
}


text:
'use strict';

/**
 * @ngdoc function
 * @name anyandgoApp.controller:MemosNewCtrl
 * @description
 * # MemosNewCtrl
 * Controller of the anyandgoApp
 */
angular.module('anyandgoApp')
  .controller('MemosNewCtrl', function ($scope, $routeParams, PeopleService, $interval) {

      if(typeof chatInterval !== 'undefined') {
        //Cancel it
        $interval.cancel(chatInterval);
      }

      var CKupdate = function(){
        var instance;
        for(instance in CKEDITOR.instances) {
          CKEDITOR.instances[instance].updateElement();
        }
        CKEDITOR.instances[instance].setData('');
      }

      $scope.usersto = {};

      var configS2 = {
            placeholder: "Destinatarios...",
            ajax: {
                url : '/services/search/people/tags',
                dataType: 'json',
                quietMillis: 250,
                data: function (term, page) {
                    return {
                        keyword: term
                    };
                },
                results: function (data, page) {
                    console.log(data);
                    return { results: data };
                },
                cache: true
            },
            tags:[],
            //minimumInputLength: 3,
            id: function(data){ return data._id; },
            dropdownCssClass: "bigdrop",
            initSelection: function(element, callback) {
                //console.log(element, callback);
                callback(data);
            },
            formatSelection: function(data) {
                return data.name;
            },
            formatResult: function(data) {
                var markup = '
';
                markup += data.name + " - " + data.email;
                markup += '
';
                return markup;
            }
        };
      var usuario = $('#usuarios');
      usuario.select2(configS2);
      usuario.on('select2-selecting', function(e) {
          //console.log(e);
      });

      // https://github.com/lemonde/angular-ckeditor
      //$('#message').wysihtml5();
      // Editor options.
      $scope.options = {
        language: 'en',
        allowedContent: true,
        entities: false
      };

      // Called when the editor is completely ready.
      $scope.onReady = function () {
        // ...
      };

      $scope.sendMemo = function (e) {
        e.preventDefault();
        e.stopPropagation();
        // You cannot use double binding with hidden field.
        // http://stackoverflow.com/questions/18446359/angularjs-does-not-send-hidden-field-value
        PeopleService.sendMemo($('#usuarios').val(), $scope.memocontent).then(function(r){
            // console.log(r.data);
            // Clear the form
            CKupdate();
            $('#usuarios').select2('data',null);
        });
      };

  });


text:
<!DOCTYPE html>

  <title>polymer::sheet</title>

  <link rel="import" href="x-style.html">

  <x-test></x-test>
  <x-test class="bold"></x-test>

  <x-test2></x-test2>
  <x-test2 class="bold"></x-test2>

  <polymer-element name="x-test">
    <template>
      <x-style ref="shared-sheet" on-load="{{load}}"></x-style>

test1

    </template>

  </polymer-element>

  <polymer-element name="x-test2" noscript>
    <template>
      <x-style ref="shared-sheet"></x-style>

test2

    </template>
  </polymer-element>

  <x-style id="shared-sheet" variables='{"bgColor": "Orange", "borderColor": "Red"}'>
    @import url(sheet1.css);

    .colorful {
      padding: 10px;
      background: {{bgColor}};
    }
  </x-style>


text:
package ru.kuzn_evg.vacancyHHjson;

import java.util.List;

import com.google.gson.Gson;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Vacancy {

    @SerializedName("alternate_url")
    @Expose
    private String alternateUrl;
    @SerializedName("code")
    @Expose
    private Object code;
    @SerializedName("premium")
    @Expose
    private boolean premium;
    @SerializedName("description")
    @Expose
    private String description;
    @SerializedName("schedule")
    @Expose
    private Schedule schedule;
    @SerializedName("suitable_resumes_url")
    @Expose
    private Object suitableResumesUrl;
    @SerializedName("site")
    @Expose
    private Site site;
    @SerializedName("billing_type")
    @Expose
    private BillingType billingType;
    @SerializedName("published_at")
    @Expose
    private String publishedAt;
    @SerializedName("test")
    @Expose
    private Object test;
    @SerializedName("accept_handicapped")
    @Expose
    private boolean acceptHandicapped;
    @SerializedName("experience")
    @Expose
    private Experience experience;
    @SerializedName("address")
    @Expose
    private Address address;
    @SerializedName("key_skills")
    @Expose
    private List<KeySkill> keySkills = null;
    @SerializedName("allow_messages")
    @Expose
    private boolean allowMessages;
    @SerializedName("employment")
    @Expose
    private Employment employment;
    @SerializedName("id")
    @Expose
    private String id;
    @SerializedName("response_url")
    @Expose
    private Object responseUrl;
    @SerializedName("salary")
    @Expose
    private Salary salary;
    @SerializedName("archived")
    @Expose
    private boolean archived;
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("contacts")
    @Expose
    private Contacts contacts;
    @SerializedName("employer")
    @Expose
    private Employer employer;
    @SerializedName("created_at")
    @Expose
    private String createdAt;
    @SerializedName("area")
    @Expose
    private Area area;
    @SerializedName("relations")
    @Expose
    private List<Object> relations = null;
    @SerializedName("accept_kids")
    @Expose
    private boolean acceptKids;
    @SerializedName("response_letter_required")
    @Expose
    private boolean responseLetterRequired;
    @SerializedName("apply_alternate_url")
    @Expose
    private String applyAlternateUrl;
    @SerializedName("quick_responses_allowed")
    @Expose
    private boolean quickResponsesAllowed;
    @SerializedName("negotiations_url")
    @Expose
    private Object negotiationsUrl;
    @SerializedName("department")
    @Expose
    private Object department;
    @SerializedName("branded_description")
    @Expose
    private String brandedDescription;
    @SerializedName("hidden")
    @Expose
    private boolean hidden;
    @SerializedName("type")
    @Expose
    private Type type;
    @SerializedName("specializations")
    @Expose
    private List<Specialization> specializations = null;

    /**
     * No args constructor for use in serialization
     */
    public Vacancy(String json) {
        if (json == null)
            return;
        Gson gson = new Gson();
        Vacancy vacancyhh = gson.fromJson(json, Vacancy.class);
        System.out.println("\nВакансия № " + vacancyhh.getId() + "\n" + vacancyhh.getName() + "\nГород: " + vacancyhh.getArea().getName());
        if (vacancyhh.getSalary() != null) {
            System.out.print("Зарплата: ");
            if (vacancyhh.getSalary().getFrom() != null) {
                int from = (int) Double.parseDouble(vacancyhh.getSalary().getFrom().toString());
                System.out.print("от " + from);
                if (vacancyhh.getSalary().getTo() != null) {
                    int to = (int) Double.parseDouble(vacancyhh.getSalary().getTo().toString());
                    System.out.print(" до " + to);
                }
            } else if (vacancyhh.getSalary().getTo() != null) {
                int to = (int) Double.parseDouble(vacancyhh.getSalary().getTo().toString());
                System.out.print("до " + to);
            }
            System.out.print(" " + vacancyhh.getSalary().getCurrency());
            if (vacancyhh.getSalary().isGross() != null)
                System.out.print(vacancyhh.getSalary().isGross().equals("true") ? " до вычета налогов" : " на руки");
            System.out.println();
        }
        System.out.println("Компания(№" + vacancyhh.getEmployer().getId() + "): " + vacancyhh.getEmployer().getName());
        if (vacancyhh.getContacts() != null) {
            System.out.print("Контакты:");
            if (vacancyhh.getContacts().getName() != null)
                System.out.print("\nИмя - " + vacancyhh.getContacts().getName());
            if (vacancyhh.getContacts().getEmail() != null)
                System.out.print("\nEmail - " + vacancyhh.getContacts().getEmail());
            if (vacancyhh.getContacts().getPhones().size() > 0) {
                System.out.print("\nТелефон(ы) -");
                for (int i = 0; i < vacancyhh.getContacts().getPhones().size(); i++) {
                    System.out.print(" " + vacancyhh.getContacts().getPhones().get(i).getCountry() + "(" + vacancyhh.getContacts().getPhones().get(i).getCity() + ")" + vacancyhh.getContacts().getPhones().get(i).getNumber());
                }
            }
            System.out.println();
        }
        System.out.println("Url вакансии - " + vacancyhh.getAlternateUrl());
        if (vacancyhh.keySkills.size() > 0) {
            System.out.print("Ключевые навыки: ");
            for (int i = 0; ; i++) {
                System.out.print(vacancyhh.keySkills.get(i).getName());
                if ((i + 1) < vacancyhh.keySkills.size())
                    System.out.print(", ");
                else if ((i + 1) == vacancyhh.keySkills.size()) {
                    System.out.print(".");
                    break;
                }
            }
        }
        StringBuffer description = new StringBuffer(vacancyhh.getDescription());
        for (; ; ) {
            if (description.indexOf("
") != -1)
                description.replace(description.indexOf("
"), description.indexOf("
") + 3, "\n");
            if (description.indexOf("
") != -1)
                description.replace(description.indexOf("
"), description.indexOf("
") + 4, "\n");
            if (description.indexOf("
") != -1)
                description.replace(description.indexOf("
"), description.indexOf("
") + 6, "\n");
            if (description.indexOf("
") != -1)
                description.replace(description.indexOf("
"), description.indexOf("
") + 4, "\n* ");
            if (description.indexOf("
") == -1 && description.indexOf("
") == -1 && description.indexOf("
") == -1 && description.indexOf("
") == -1)
                break;
        }
        for (; ; ) {
            if (description.indexOf("<") == -1 && description.indexOf(">") == -1)
                break;
            description.delete(description.indexOf("<"), description.indexOf(">") + 1);
        }
        System.out.println(description.toString());
    }

    /**
     * @param employment
     * @param acceptKids
     * @param test
     * @param department
     * @param employer
     * @param specializations
     * @param type
     * @param contacts
     * @param publishedAt
     * @param id
     * @param area
     * @param acceptHandicapped
     * @param archived
     * @param description
     * @param createdAt
     * @param applyAlternateUrl
     * @param name
     * @param responseUrl
     * @param experience
     * @param billingType
     * @param negotiationsUrl
     * @param salary
     * @param site
     * @param quickResponsesAllowed
     * @param premium
     * @param code
     * @param keySkills
     * @param schedule
     * @param alternateUrl
     * @param relations
     * @param address
     * @param hidden
     * @param responseLetterRequired
     * @param allowMessages
     * @param suitableResumesUrl
     * @param brandedDescription
     */
    public Vacancy(String alternateUrl, Object code, boolean premium, String description, Schedule schedule, Object suitableResumesUrl, Site site, BillingType billingType, String publishedAt, Object test, boolean acceptHandicapped, Experience experience, Address address, List<KeySkill> keySkills, boolean allowMessages, Employment employment, String id, Object responseUrl, Salary salary, boolean archived, String name, Contacts contacts, Employer employer, String createdAt, Area area, List<Object> relations, boolean acceptKids, boolean responseLetterRequired, String applyAlternateUrl, boolean quickResponsesAllowed, Object negotiationsUrl, Object department, String brandedDescription, boolean hidden, Type type, List<Specialization> specializations) {
        super();
        this.alternateUrl = alternateUrl;
        this.code = code;
        this.premium = premium;
        this.description = description;
        this.schedule = schedule;
        this.suitableResumesUrl = suitableResumesUrl;
        this.site = site;
        this.billingType = billingType;
        this.publishedAt = publishedAt;
        this.test = test;
        this.acceptHandicapped = acceptHandicapped;
        this.experience = experience;
        this.address = address;
        this.keySkills = keySkills;
        this.allowMessages = allowMessages;
        this.employment = employment;
        this.id = id;
        this.responseUrl = responseUrl;
        this.salary = salary;
        this.archived = archived;
        this.name = name;
        this.contacts = contacts;
        this.employer = employer;
        this.createdAt = createdAt;
        this.area = area;
        this.relations = relations;
        this.acceptKids = acceptKids;
        this.responseLetterRequired = responseLetterRequired;
        this.applyAlternateUrl = applyAlternateUrl;
        this.quickResponsesAllowed = quickResponsesAllowed;
        this.negotiationsUrl = negotiationsUrl;
        this.department = department;
        this.brandedDescription = brandedDescription;
        this.hidden = hidden;
        this.type = type;
        this.specializations = specializations;
    }

    public String getAlternateUrl() {
        return alternateUrl;
    }

    public void setAlternateUrl(String alternateUrl) {
        this.alternateUrl = alternateUrl;
    }

    public Object getCode() {
        return code;
    }

    public void setCode(Object code) {
        this.code = code;
    }

    public boolean isPremium() {
        return premium;
    }

    public void setPremium(boolean premium) {
        this.premium = premium;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Schedule getSchedule() {
        return schedule;
    }

    public void setSchedule(Schedule schedule) {
        this.schedule = schedule;
    }

    public Object getSuitableResumesUrl() {
        return suitableResumesUrl;
    }

    public void setSuitableResumesUrl(Object suitableResumesUrl) {
        this.suitableResumesUrl = suitableResumesUrl;
    }

    public Site getSite() {
        return site;
    }

    public void setSite(Site site) {
        this.site = site;
    }

    public BillingType getBillingType() {
        return billingType;
    }

    public void setBillingType(BillingType billingType) {
        this.billingType = billingType;
    }

    public String getPublishedAt() {
        return publishedAt;
    }

    public void setPublishedAt(String publishedAt) {
        this.publishedAt = publishedAt;
    }

    public Object getTest() {
        return test;
    }

    public void setTest(Object test) {
        this.test = test;
    }

    public boolean isAcceptHandicapped() {
        return acceptHandicapped;
    }

    public void setAcceptHandicapped(boolean acceptHandicapped) {
        this.acceptHandicapped = acceptHandicapped;
    }

    public Experience getExperience() {
        return experience;
    }

    public void setExperience(Experience experience) {
        this.experience = experience;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public List<KeySkill> getKeySkills() {
        return keySkills;
    }

    public void setKeySkills(List<KeySkill> keySkills) {
        this.keySkills = keySkills;
    }

    public boolean isAllowMessages() {
        return allowMessages;
    }

    public void setAllowMessages(boolean allowMessages) {
        this.allowMessages = allowMessages;
    }

    public Employment getEmployment() {
        return employment;
    }

    public void setEmployment(Employment employment) {
        this.employment = employment;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Object getResponseUrl() {
        return responseUrl;
    }

    public void setResponseUrl(Object responseUrl) {
        this.responseUrl = responseUrl;
    }

    public Salary getSalary() {
        return salary;
    }

    public void setSalary(Salary salary) {
        this.salary = salary;
    }

    public boolean isArchived() {
        return archived;
    }

    public void setArchived(boolean archived) {
        this.archived = archived;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Contacts getContacts() {
        return contacts;
    }

    public void setContacts(Contacts contacts) {
        this.contacts = contacts;
    }

    public Employer getEmployer() {
        return employer;
    }

    public void setEmployer(Employer employer) {
        this.employer = employer;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public List<Object> getRelations() {
        return relations;
    }

    public void setRelations(List<Object> relations) {
        this.relations = relations;
    }

    public boolean isAcceptKids() {
        return acceptKids;
    }

    public void setAcceptKids(boolean acceptKids) {
        this.acceptKids = acceptKids;
    }

    public boolean isResponseLetterRequired() {
        return responseLetterRequired;
    }

    public void setResponseLetterRequired(boolean responseLetterRequired) {
        this.responseLetterRequired = responseLetterRequired;
    }

    public String getApplyAlternateUrl() {
        return applyAlternateUrl;
    }

    public void setApplyAlternateUrl(String applyAlternateUrl) {
        this.applyAlternateUrl = applyAlternateUrl;
    }

    public boolean isQuickResponsesAllowed() {
        return quickResponsesAllowed;
    }

    public void setQuickResponsesAllowed(boolean quickResponsesAllowed) {
        this.quickResponsesAllowed = quickResponsesAllowed;
    }

    public Object getNegotiationsUrl() {
        return negotiationsUrl;
    }

    public void setNegotiationsUrl(Object negotiationsUrl) {
        this.negotiationsUrl = negotiationsUrl;
    }

    public Object getDepartment() {
        return department;
    }

    public void setDepartment(Object department) {
        this.department = department;
    }

    public String getBrandedDescription() {
        return brandedDescription;
    }

    public void setBrandedDescription(String brandedDescription) {
        this.brandedDescription = brandedDescription;
    }

    public boolean isHidden() {
        return hidden;
    }

    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public List<Specialization> getSpecializations() {
        return specializations;
    }

    public void setSpecializations(List<Specialization> specializations) {
        this.specializations = specializations;
    }

}


text:
package com.renren.infra.xweb.repository;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import com.renren.infra.xweb.entity.Mario_server_state;

/**
 * 通过@MapperScannerConfigurer扫描目录中的所有接口, 动态在Spring Context中生成实现.
 * 方法名称必须与Mapper.xml中保持一致.
 *
 * @author yong.cao
 * @create-time 2014-3-21
 * @revision 1.0.0
 * @E_mail yong.cao@renren-inc.com
 */
@MyBatisRepository
public interface Mario_server_stateMybatisDao {

	List<Mario_server_state> findAll();

	List<Mario_server_state> find(Map<String, Object> parameters);

	List<Mario_server_state> find(Map<String, Object> filterParams,
			RowBounds buildRowBounds);

	int findTotalNum(Map<String, Object> filterParams);

	Mario_server_state getMario_server_stateById(Integer id);

	List<Mario_server_state> findBetweenTimeStamp(
			@Param(value = "server_id") Integer server_id,
			@Param(value = "start_time_stamp") Long start_time_stamp,
			@Param(value = "end_time_stamp") Long end_time_stamp);

	Mario_server_state findLastStateByServerId(
			@Param(value = "server_id") Integer server_id);

}


text:
package ca.dal.cs.scavenger;

import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.test.mock.MockPackageManager;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.android.gms.maps.model.LatLng;

import java.util.EnumMap;
import java.util.Map;

public class CompleteLocationTask extends Activity {

    private static final float DEGREES_PER_POINT = (float) 22.5;
    Button btnShowLocation;
    private static final int REQUEST_CODE_PERMISSION = 2;
    String mPermission = Manifest.permission.ACCESS_FINE_LOCATION;

    private static final String[] COMPASS_POINT_STRINGS = {"north", //0
            "north-northeast",         //1
            "northeast",               //2
            "east-northeast",          //3
            "east",                    //4
            "east-southeast",          //5
            "southeast",               //6
            "south-southeast",         //7
            "south",                   //8
            "south-southwest",         //9
            "southwest",               //10
            "west-southwest",          //11
            "west",                    //12
            "west-northwest",          //13
            "northwest",               //14
            "north-northwest"};        //15

    // GPSTracker class
    GPSService gps;
    Task mTask;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_complete_location_task);

        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();
        mTask = bundle.getParcelable("task");

        try {
            if (ActivityCompat.checkSelfPermission(this, mPermission)
                    != MockPackageManager.PERMISSION_GRANTED) {

                ActivityCompat.requestPermissions(this, new String[]{mPermission},
                        REQUEST_CODE_PERMISSION);

                // If any permission above not allowed by user, this condition will
                //execute every time, else your else part will work
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        btnShowLocation = (Button) findViewById(R.id.button);

        // show location button click event
        btnShowLocation.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // create class object
                gps = new GPSService(CompleteLocationTask.this);

                // check if GPS enabled
                if(gps.canGetLocation()){
                    Location requestedLocation = new Location("");
                    requestedLocation.setLatitude(mTask.requestedLocation.latitude);
                    requestedLocation.setLongitude(mTask.requestedLocation.longitude);

                    Location currentLocation = gps.getLocation();
                    double latitude = currentLocation.getLatitude();
                    double longitude = currentLocation.getLongitude();

                    float[] distance = new float[1];
                    Location.distanceBetween(mTask.requestedLocation.latitude,
                            mTask.requestedLocation.longitude,
                            latitude,
                            longitude,
                            distance);

                    float bearing = currentLocation.bearingTo(requestedLocation);

                    int compassPoint = Math.round(bearing/DEGREES_PER_POINT);

                    String compassPointString = COMPASS_POINT_STRINGS[compassPoint];

                    if (distance[0] < 50) {
                        Toast.makeText(getApplicationContext(), "Made it! Checking in...",
                                Toast.LENGTH_LONG).show();
                        mTask.submittedLocation = new LatLng(latitude, longitude);
                        completeLocationTask();
                    } else if(distance[0] < 200) {
                        Toast.makeText(getApplicationContext(), "Getting warmer. Head " +
                                compassPointString + "!",
                                Toast.LENGTH_LONG).show();
                    } else if(distance[0] < 500) {
                        Toast.makeText(getApplicationContext(), "Warmer... Look to the " +
                                compassPointString + "!",
                                Toast.LENGTH_LONG).show();
                    } else {
                        Toast.makeText(getApplicationContext(), "Still a ways to go.\n" +
                                "What you seek lies to the " + compassPointString + "!",
                                Toast.LENGTH_LONG).show();
                    }

                    // \n is for new line
//                    Toast.makeText(getApplicationContext(), "Your Location is - \nLat: "
//                            + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
                }else{
                    // can't get location
                    // GPS or Network is not enabled
                    // Ask user to enable GPS/network in settings
                    gps.showSettingsAlert();
                }

            }
        });
    }

    @Override
    public void onBackPressed() {
        if (gps != null) {
            gps.stopUsingGPS();
        }
        super.onBackPressed();
    }

    private void completeLocationTask() {
        gps.stopUsingGPS();
        Bundle bundle = new Bundle();
        bundle.putParcelable("task", mTask);

        Intent intent = new Intent();
        intent.putExtras(bundle);
        setResult(RESULT_OK, intent);
        finish();
    }
}


text:
package com.brandon.snake.graphics;

import static org.lwjgl.opengl.GL11.GL_FLOAT;
import static org.lwjgl.opengl.GL11.GL_TRIANGLES;
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_INT;
import static org.lwjgl.opengl.GL11.glDrawElements;
import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER;
import static org.lwjgl.opengl.GL15.GL_ELEMENT_ARRAY_BUFFER;
import static org.lwjgl.opengl.GL15.GL_STATIC_DRAW;
import static org.lwjgl.opengl.GL15.glBindBuffer;
import static org.lwjgl.opengl.GL15.glBufferData;
import static org.lwjgl.opengl.GL15.glDeleteBuffers;
import static org.lwjgl.opengl.GL15.glGenBuffers;
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
import static org.lwjgl.opengl.GL30.glBindVertexArray;
import static org.lwjgl.opengl.GL30.glDeleteVertexArrays;
import static org.lwjgl.opengl.GL30.glGenVertexArrays;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import com.brandon.snake.util.BufferUtil;

public class Mesh {
	private int vao, vbo, ibo, tbo, cbo;
	private int count;

	public Mesh() {
		vao = glGenVertexArrays();
	}

	public Mesh putVertices(FloatBuffer vertexBuffer) {
		glBindVertexArray(vao);
		vbo = glGenBuffers();
		glBindBuffer(GL_ARRAY_BUFFER, vbo);
		glBufferData(GL_ARRAY_BUFFER, vertexBuffer, GL_STATIC_DRAW);

		glEnableVertexAttribArray(0);
		glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);

		return this;
	}

	public Mesh putVertices(float[] vertices) {
		return putVertices(BufferUtil.createFlippedBuffer(vertices));
	}

	public Mesh putTexCoords(FloatBuffer coordBuffer) {
		glBindVertexArray(vao);
		tbo = glGenBuffers();
		glBindBuffer(GL_ARRAY_BUFFER, tbo);
		glBufferData(GL_ARRAY_BUFFER, coordBuffer, GL_STATIC_DRAW);

		glEnableVertexAttribArray(1);
		glVertexAttribPointer(1, 2, GL_FLOAT, false, 0, 0);

		return this;
	}

	public Mesh putTexCoords(float[] texCoords) {
		return putTexCoords(BufferUtil.createFlippedBuffer(texCoords));
	}

	public Mesh putColors(FloatBuffer colorBuffer) {
		glBindVertexArray(vao);
		cbo = glGenBuffers();
		glBindBuffer(GL_ARRAY_BUFFER, cbo);
		glBufferData(GL_ARRAY_BUFFER, colorBuffer, GL_STATIC_DRAW);

		glEnableVertexAttribArray(2);
		glVertexAttribPointer(2, 3, GL_FLOAT, false, 0, 0);

		return this;
	}

	public Mesh putColors(float[] colors) {
		return putColors(BufferUtil.createFlippedBuffer(colors));
	}

	public Mesh putIndices(IntBuffer indexBuffer) {
		glBindVertexArray(vao);
		count = indexBuffer.limit();
		ibo = glGenBuffers();
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
		glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexBuffer, GL_STATIC_DRAW);

		return this;
	}

	public Mesh putIndices(int[] indices) {
		return putIndices(BufferUtil.createFlippedBuffer(indices));
	}

	public void bind() {
		glBindVertexArray(vao);
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
	}

	public void render() {
		bind();
		glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, 0);
	}

	public void unbind() {
		glBindVertexArray(0);
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
	}

	public void destroy() {
		glDeleteBuffers(vbo);
		glDeleteBuffers(ibo);
		glDeleteBuffers(tbo);
		glDeleteBuffers(cbo);
		glDeleteVertexArrays(vao);
	}
}


text:
#ifndef PULSAR_PRODUCERCONFIGURATION_H_
#define PULSAR_PRODUCERCONFIGURATION_H_
#include <pulsar/CompressionType.h>
#include <pulsar/MessageRoutingPolicy.h>
#include <pulsar/Result.h>
#include <pulsar/Message.h>
#include <boost/function.hpp>
#pragma GCC visibility push(default)

namespace pulsar {

typedef boost::function<void(Result, const Message& msg)> SendCallback;
typedef boost::function<void(Result)> CloseCallback;

class ProducerConfigurationImpl;
class PulsarWrapper;

/**
 * Class that holds the configuration for a producer
 */
class ProducerConfiguration {
 public:
    enum PartitionsRoutingMode {
        UseSinglePartition,
        RoundRobinDistribution,
        CustomPartition
    };
    ProducerConfiguration();
    ~ProducerConfiguration();
    ProducerConfiguration(const ProducerConfiguration&);
    ProducerConfiguration& operator=(const ProducerConfiguration&);

    ProducerConfiguration& setSendTimeout(int sendTimeoutMs);
    int getSendTimeout() const;

    ProducerConfiguration& setCompressionType(CompressionType compressionType);
    CompressionType getCompressionType() const;

    ProducerConfiguration& setMaxPendingMessages(int maxPendingMessages);
    int getMaxPendingMessages() const;

    ProducerConfiguration& setPartitionsRoutingMode(const PartitionsRoutingMode& mode);
    PartitionsRoutingMode getPartitionsRoutingMode() const;

    ProducerConfiguration& setMessageRouter(const MessageRoutingPolicyPtr& router);
    const MessageRoutingPolicyPtr& getMessageRouterPtr() const;

    ProducerConfiguration& setBlockIfQueueFull(bool);
    bool getBlockIfQueueFull() const;

    // Zero queue size feature will not be supported on consumer end if batching is enabled
    ProducerConfiguration& setBatchingEnabled(const bool& batchingEnabled);
    const bool& getBatchingEnabled() const;

    ProducerConfiguration& setBatchingMaxMessages(const unsigned int& batchingMaxMessages);
    const unsigned int& getBatchingMaxMessages() const;

    ProducerConfiguration& setBatchingMaxAllowedSizeInBytes(
            const unsigned long& batchingMaxAllowedSizeInBytes);
    const unsigned long& getBatchingMaxAllowedSizeInBytes() const;

    ProducerConfiguration& setBatchingMaxPublishDelayMs(
            const unsigned long& batchingMaxPublishDelayMs);
    const unsigned long& getBatchingMaxPublishDelayMs() const;
    friend class PulsarWrapper;

 private:
    struct Impl;
    boost::shared_ptr<ProducerConfigurationImpl> impl_;
};
}
#pragma GCC visibility pop
#endif /* PULSAR_PRODUCERCONFIGURATION_H_ */


text:
Rails.application.routes.draw do

  mount Sancho::Engine => "/sancho"
end


text:
// source:

package nl.esciencecenter.vlet.gui.panels.resourcetable;

import java.awt.Component;
import java.awt.Container;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JViewport;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;

import nl.esciencecenter.vlet.gui.GuiSettings;
import nl.esciencecenter.vlet.gui.UILogger;

public class TableMouseListener implements MouseListener
{
    private ResourceTable table;

    public TableMouseListener(ResourceTable source)
    {
        table=source;
    }

    @Override
    public void mouseClicked(MouseEvent e)
    {
        Component comp=(Component)e.getSource();

        // click on header:
        if (comp instanceof JTableHeader)
        {
          //  click on header
          if (GuiSettings.isSelection(e))
          {
              String name=this.getColumnNameOf(e);
              if (name==null)
                  return; // no column;

              table.sortColumn(name);

           }
        }
    }

    @Override
    public void mouseEntered(MouseEvent e)
    {

    }

    @Override
    public void mouseExited(MouseEvent e)
    {

    }

    @Override
    public void mousePressed(MouseEvent e)
    {
        Component comp=(Component)e.getSource();
        //Point clickPoint=e.getPoint();

        debugPrintf("MouseClicked:%s\n",e);

        //boolean ctrl=((e.getModifiersEx() & e.CTRL_DOWN_MASK) !=0);
        Container parent = comp.getParent();

        // Show Header Popup!
        if ((comp instanceof JTableHeader) && (GuiSettings.isPopupTrigger(e)))
        {
            String  name=this.getColumnNameOf(e);
            if(name!=null)
            {
                HeaderPopupMenu popupMenu=new HeaderPopupMenu(table,name);
                popupMenu.show(comp,e.getX(),e.getY());
            }
            else
            {
                debugPrintf("No Column Header name!:%s\n",e);
            }
        }
        else if (comp.equals(table))
        {
            if (GuiSettings.isPopupTrigger(e))
            {
                TablePopupMenu popupMenu=table.getPopupMenu(e,false);
                if (popupMenu!=null)
                    popupMenu.show(comp,e.getX(),e.getY());
            }
        }
        else if (comp.equals(parent))
        {
            if (GuiSettings.isPopupTrigger(e))
            {
                TablePopupMenu popupMenu=table.getPopupMenu(e,true);
                if (popupMenu!=null)
                    popupMenu.show(comp,e.getX(),e.getY());
            }
        }
        else if (comp instanceof javax.swing.JScrollPane)
        {
            // Check whether resourcepanel is embedded in a ScrollPane
            JViewport viewPort = ((javax.swing.JScrollPane)comp).getViewport();
            Component viewPortView=null;
            if (viewPort!=null)
                viewPortView= viewPort.getView();

            if (viewPortView==table)
            {
                // show!
                TablePopupMenu popupMenu=table.getPopupMenu(e,true);
                if (popupMenu!=null)
                    popupMenu.show(comp,e.getX(),e.getY());
            }

        }
        else
        {
            // System.err.printf("Click on:%s\n",comp);
            // System.err.printf("Table Parent=:%s\n",table.getParent());
        }
    }

    private void debugPrintf(String format,Object... args)
    {
      UILogger.debugPrintf(this,format,args);
    }

    @Override
    public void mouseReleased(MouseEvent e)
    {
    }

    private String getColumnNameOf(MouseEvent e)
    {
        // Warning: Apply coordinates to VIEW model !
        TableColumnModel columnModel = table.getColumnModel();

        int colnr=columnModel.getColumnIndexAtX(e.getX());

        if (colnr<0)
            return null;

        TableColumn column = columnModel.getColumn(colnr);
        String name=(String)column.getHeaderValue();
        return name;
    }

}


text:
nahlc-g
=======

A Tetris clone created with LibGDX. Targets Android, mainly. Uses newer gradle project setup.