text:
require "rails_helper"

describe Node, type: :model do
  class PlainNode < ActiveRecord::Base
    include Releaf::Content::Node
    self.table_name = "nodes"
  end

  let(:plain_subject){ PlainNode.new }

  it { is_expected.to accept_nested_attributes_for(:content) }
  it { is_expected.to belong_to(:content).required(false) }

  it "includes Releaf::Content::Node module" do
    expect( Node.included_modules ).to include Releaf::Content::Node
  end

  describe "validations" do
    it { is_expected.to validate_presence_of(:name) }
    it { is_expected.to validate_presence_of(:slug) }
    it { is_expected.to validate_presence_of(:content_type) }
    it { is_expected.to validate_uniqueness_of(:slug).scoped_to(:parent_id).case_insensitive }
    it { is_expected.to validate_length_of(:name).is_at_most(255) }
    it { is_expected.to validate_length_of(:slug).is_at_most(255) }
  end

  describe "after save" do
    it "sets node update to current time" do
      expect( Node ).to receive(:updated).once
      create(:node)
    end
  end

  describe ":active scope" do
    it "returns active nodes" do
      item_1 = create(:node, active: true, locale: "en")
      item_2 = create(:node, active: false, locale: "de")
      item_3 = create(:node, active: true, locale: "lv")
      expect(Node.active).to eq [item_1, item_3]
    end
  end

  describe "#content_class" do
    context 'when #content_type is nil' do
      it 'returns nil' do
        subject.content_type = nil
        expect( subject.content_class ).to be nil
      end
    end

    context "when #content_type is blank string" do
      it 'returns nil' do
        subject.content_type = ""
        expect( subject.content_class ).to be nil
      end
    end

    context "when #content_type is not blank" do
      it "constantizes it" do
        subject.content_type = "Node"
        expect( subject.content_class ).to eq Node
      end
    end
  end

  describe "#to_s" do
    it "returns name" do
      expect(subject.to_s).to eq(subject.name)
    end
  end

  describe "#locale" do
    before do
      root = create(:node, locale: "lv")
      parent = create(:text_page_node, locale: nil, parent_id: root.id)
      @child1 = create(:text_page_node, locale: nil, parent_id: parent.id)
      @child2 = create(:text_page_node, parent_id: parent.id, locale: "en")
    end

    context "when node locale is nil" do
      it "uses closest parent locale" do
        expect(@child1.locale).to eq("lv")
      end
    end

    context "when object node have locale" do
      it "uses closest parent locale" do
        expect(@child2.locale).to eq("en")
      end
    end
  end

  describe "#destroy" do
    context "when content object class exists" do
      let!(:node) { create(:home_page_node) }

      it "deletes record" do
        expect { node.destroy }.to change { Node.count }.by(-1)
      end

      it "deletes associated record" do
        expect { node.destroy }.to change { HomePage.count }.by(-1)
      end
    end

    context "when content object class doesn't exists" do
      let!(:node) { create(:home_page_node) }
      before do
        node.update_columns(content_type: 'NonExistingTestModel')
      end

      it "deletes record" do
        expect { node.destroy }.to change { Node.count }.by(-1)
      end
    end

    it "sets node update to current time" do
      node = create(:node)
      expect( Node ).to receive(:updated).once
      node.destroy
    end
  end

  describe "#attributes_to_not_copy" do
    it "returns array with attributes" do
      subject.locale = "lv"
      expect( subject.attributes_to_not_copy ).to match_array %w[content_id depth id item_position lft rgt created_at updated_at]
    end

    context "when locale is blank" do
      it "includes locale within returned list" do
        expect( subject.attributes_to_not_copy ).to match_array %w[content_id depth id item_position lft rgt created_at updated_at locale]
      end
    end
  end

  describe "#attributes_to_copy" do
    it "returns object attributes excluding #attributes_to_not_copy" do
      node = Node.new
      allow( node ).to receive(:attributes_to_not_copy).and_return(%w[lft rgt])
      expect( node.attributes_to_copy ).to eq(Node.column_names - %w[lft rgt])
    end
  end

  describe "#reasign_slug" do
    it "updates slug" do
      node = create(:node)
      old_slug = node.slug
      node.name = 'woo hoo'
      expect { node.reasign_slug }.to change { node.slug }.from(old_slug).to('woo-hoo')
    end
  end

  describe "#assign_attributes_from" do
    let(:source_node) { create(:node, active: false) }

    it "copies #attributes_to_copy attributes" do

      allow( source_node ).to receive(:attributes_to_copy).and_return(['name'])

      expect( source_node ).to receive(:name).and_call_original
      expect( source_node ).to_not receive(:parent_id)
      expect( source_node ).to_not receive(:content_type)
      expect( source_node ).to_not receive(:active)

      new_node = Node.new

      new_node.assign_attributes_from source_node

      expect( new_node.parent_id ).to be nil
      expect( new_node.content_type ).to be nil
      expect( new_node.active ).to be true
    end
  end

  describe ".children_max_item_position" do
    before do
      @home_page_node   = create(:home_page_node, item_position: 1, locale: "lv")
      @home_page_node_2 = create(:home_page_node, item_position: 2, locale: "en")
      @text_page_node_3 = create(:text_page_node, parent_id: @home_page_node_2.id, item_position: 1)
      @text_page_node_4 = create(:text_page_node, parent_id: @home_page_node_2.id, item_position: 2)

      # it is important to reload nodes, otherwise associations will return empty set
      @home_page_node.reload
      @home_page_node_2.reload
      @text_page_node_3.reload
      @text_page_node_4.reload
    end

    context "when passing nil" do
      it "returns max item_position of root nodes" do
        expect( Node.children_max_item_position(nil) ).to eq 2
      end
    end

    context "when passing node with children" do
      it "returns max item_position of node children" do
        expect( Node.children_max_item_position(@home_page_node_2) ).to eq 2
      end
    end

    context "when passing node without children" do
      it "returns 0" do
        expect( Node.children_max_item_position(@text_page_node_4) ).to eq 0
      end
    end
  end

  describe "#move" do
    it "calls Node move service" do
      expect(Releaf::Content::Node::Move).to receive(:call).with(node: subject, parent_id: 12)
      subject.move(12)
    end
  end

  describe "#maintain_name" do
    let(:root) { create(:home_page_node) }
    let(:node) { create(:text_page_node, parent_id: root.id, name:  "Test node") }
    let(:sibling) { create(:text_page_node, parent_id: root.id, name:  "Test node(1)") }

    context "when node don't have sibling/s with same name" do
      it "does not changes node's name" do
        new_node = Node.new(name:  "another name", parent_id: root.id)
        expect{ new_node.maintain_name }.to_not change{new_node.name}
      end
    end

    context "when node have sibling/s with same name" do
      it "changes node's name" do
        new_node = Node.new(name:  node.name, parent_id: root.id)
        expect{ new_node.maintain_name }.to change{new_node.name}.from(node.name).to("#{node.name}(1)")
      end

      it "increments node's name number" do
        sibling
        new_node = Node.new(name:  node.name, parent_id: root.id)
        expect{ new_node.maintain_name }.to change{new_node.name}.from(node.name).to("#{node.name}(2)")
      end
    end
  end

  describe "#maintain_slug" do
    let(:root) { create(:home_page_node) }
    let(:node) { create(:text_page_node, parent_id: root.id, name:  "Test node", slug: "test-node") }
    let(:sibling) { create(:text_page_node, parent_id: root.id, name:  "Test node(1)", slug: "test-node-1") }

    context "when node don't have sibling/s with same name" do
      it "does not changes node's slug" do
        new_node = Node.new(name:  "another name", parent_id: root.id)
        expect{ new_node.maintain_slug }.to_not change{new_node.slug}
      end
    end

    context "when node have sibling/s with same slug" do
      it "changes node's slug" do
        new_node = Node.new(name:  node.name, slug: node.slug, parent_id: root.id)
        expect{ new_node.maintain_slug }.to change{new_node.slug}.from(node.slug).to("#{node.slug}-1")
      end

      it "increments node's slug number" do
        sibling
        new_node = Node.new(name:  node.name, slug: node.slug, parent_id: root.id)
        expect{ new_node.maintain_slug }.to change{new_node.slug}.from(node.slug).to("#{node.slug}-2")
      end
    end
  end

  describe ".updated_at" do
    it "returns last node update time" do
      expect( Releaf::Settings ).to receive(:[]).with('releaf.content.nodes.updated_at').and_return('test')
      expect( Node.updated_at ).to eq 'test'
    end
  end

  describe ".updated" do
    it "returns last node update time" do
      allow(Time).to receive(:now).and_return("asd")
      expect( Releaf::Settings ).to receive(:[]=).with('releaf.content.nodes.updated_at', "asd")
      Node.updated
    end
  end

  describe "#available?" do
    let(:root) { create(:home_page_node, active: true) }
    let(:node_ancestor) { create(:text_page_node, parent_id: root.id, active: true) }
    let(:node) { create(:text_page_node, parent_id: node_ancestor.id, active: true) }

    context "when object and all its ancestors are active" do
      it "returns true" do
        expect( node ).to be_available
      end
    end

    context "when object itself is not active" do
      it "returns false" do
        node.update_attribute(:active, false)
        expect( node ).to_not be_available
      end
    end

    context "when any of object ancestors are not active" do
      it "returns false" do
        node_ancestor.update_attribute(:active, false)
        expect( node ).to_not be_available
      end
    end
  end

  describe ".valid_node_content_classes" do
    it "returns array of constantized .valid_node_content_class_names" do
      expect( Node ).to receive(:valid_node_content_class_names).with(42).and_return(['TextPage', 'HomePagesController'])
      expect( Node.valid_node_content_classes(42) ).to eq [TextPage, HomePagesController]
    end
  end

  describe ".valid_node_content_class_names" do
    it "returns class names for Node#content_type that can be used to create valid node" do
      expect( ActsAsNode ).to receive(:classes).and_return(%w[BadNode GoodNode])

      node_1 = double('BadNode')
      allow(node_1).to receive(:valid?)
      node_1_errors = double("Node 1 Errors object")
      expect( node_1_errors ).to receive(:[]).with(:content_type).and_return(['some error'])
      allow(node_1).to receive(:errors).and_return(node_1_errors)

      node_2 = double('GoodNode')
      allow(node_2).to receive(:valid?)
      node_2_errors = double("Node 2 Errors object")
      expect( node_2_errors ).to receive(:[]).with(:content_type).and_return(nil)
      allow(node_2).to receive(:errors).and_return(node_2_errors)

      expect( Node ).to receive(:new).with(hash_including(parent_id: 52, content_type: 'BadNode')).and_return(node_1)
      expect( Node ).to receive(:new).with(hash_including(parent_id: 52, content_type: 'GoodNode')).and_return(node_2)

      expect( Node.valid_node_content_class_names(52) ).to eq %w[GoodNode]
    end

  end

  describe "#locale_selection_enabled?" do
    it "returns false" do
      expect( plain_subject.locale_selection_enabled? ).to be false
    end
  end

  describe "#build_content" do
    it "builds new content and assigns to #content" do
      subject.content_type = 'TextPage'
      params = {text_html: 'test'}
      expect( TextPage ).to receive(:new).with(params).and_call_original
      subject.build_content(params)
      expect( subject.content ).to be_an_instance_of TextPage
      expect( subject.content.text_html ).to eq 'test'
    end
  end

  describe "#validate_root_locale_uniqueness?" do
    before do
      allow( subject ).to receive(:root?).and_return(true)
      allow( subject ).to receive(:locale_selection_enabled?).and_return(true)
    end

    context "when #locale_selection_enabled? and #root? both are true" do
      it "returns true" do
        expect( subject.send(:validate_root_locale_uniqueness?) ).to be_truthy
      end
    end

    context "when #locale_selection_enabled? is false" do
      it "returns false" do
        allow( subject ).to receive(:locale_selection_enabled?).and_return(false)
        expect( subject.send(:validate_root_locale_uniqueness?) ).to be_falsy
      end
    end

    context "when #root? is false" do
      it "returns false" do
        allow( subject ).to receive(:root?).and_return(false)
        expect( subject.send(:validate_root_locale_uniqueness?) ).to be_falsy
      end
    end
  end

  describe "#validate_slug" do
    it "is called during validations" do
      expect( subject ).to receive(:validate_slug)
      subject.valid?
    end

    context "when invalid slug" do
      it "adds format error on slug" do
        allow(subject).to receive(:invalid_slug_format?).and_return(true)
        expect{ subject.send(:validate_slug) }.to change{ subject.errors[:slug] }.to(["is invalid"])
      end
    end

    context "when valid slug" do
      it "does not add format error on slug" do
        allow(subject).to receive(:invalid_slug_format?).and_return(false)
        expect{ subject.send(:validate_slug) }.to_not change{ subject.errors[:slug] }.from([])
      end
    end
  end

  describe "#invalid_slug_format?" do
    context "when slug value converted to url differs" do
      it "returns true" do
        subject.slug = "asd xx"
        expect(subject.invalid_slug_format?).to be true
      end
    end

    context "when slug value converted to url is same" do
      it "returns false" do
        subject.slug = "asd-xx"
        expect(subject.invalid_slug_format?).to be false
      end
    end

    context "when slug value is nil" do
      it "returns false" do
        subject.slug = nil
        expect(subject.invalid_slug_format?).to be false
      end
    end
  end

  describe "#validate_parent_node_is_not_self" do
    let(:node1) { create(:node, locale: "lv") }

    it "is called during validations" do
      expect( subject ).to receive(:validate_parent_node_is_not_self)
      subject.valid?
    end

    context "when #parent_id matches #id" do
      it "adds error on #parent_id" do
        node1.parent_id = node1.id
        node1.send(:validate_parent_node_is_not_self)
        expect( node1.errors[:parent_id] ).to include "can't be parent to itself"
      end
    end

    context "when parent is nil" do
      it "does nothing" do
        node1.parent_id = nil
        node1.send(:validate_parent_node_is_not_self)
        expect( node1.errors[:parent_id] ).to be_blank
      end
    end

    context "#id matches #parent_id" do
      it "does nothing" do
        node2 = create(:node, locale: "en")
        node1.parent_id = node2.id
        node1.send(:validate_parent_is_not_descendant)
        expect( node1.errors[:parent_id] ).to be_blank
      end
    end

  end

  describe "#validate_parent_is_not_descendant" do
    before with_tree: true do
      @node1 = create(:home_page_node, locale: "en")
      @node2 = create(:text_page_node, parent: @node1)
      @node3 = create(:text_page_node, parent: @node2)
      @node4 = create(:home_page_node, locale: "lv")

      @node1.reload
      @node2.reload
      @node3.reload
    end

    it "is called during validations" do
      expect( subject ).to receive(:validate_parent_is_not_descendant)
      subject.valid?
    end

    context "when #parent_id matches #id of one of descadents", with_tree: true do
      it "adds error on #parent_id" do
        @node1.parent_id = @node3.id
        @node1.send(:validate_parent_is_not_descendant)
        expect( @node1.errors[:parent_id] ).to include "descendant can't be parent"
      end
    end

    context "when parent is nil", with_tree: true do
      it "does nothing" do
        @node1.parent_id = nil
        @node1.send(:validate_parent_is_not_descendant)
        expect( @node1.errors[:parent_id] ).to be_blank
      end
    end

    context "when there are no descadents with #id is #self#parent_id", with_tree: true do
      it "does nothing" do
        @node1.parent_id = @node4.id
        @node1.send(:validate_parent_is_not_descendant)
        expect( @node1.errors[:parent_id] ).to be_blank
      end
    end
  end

  describe "#prevent_auto_update_settings_timestamp" do
    it "sets #prevent_auto_update_settings_timestamp? to true within block" do
      expect do
        subject.prevent_auto_update_settings_timestamp do
          expect( subject.send(:prevent_auto_update_settings_timestamp?) ).to be_truthy
        end
      end.to_not change { subject.send(:prevent_auto_update_settings_timestamp?) }.from(false)
    end
  end

  describe "#update_settings_timestamp" do
    it "calls .updated" do
      expect( Node ).to receive(:updated).and_call_original
      subject.send(:update_settings_timestamp)
    end

    context "when #prevent_auto_update_settings_timestamp? is false" do
      it "is called after save" do
        node = build(:node)
        allow( node ).to receive(:prevent_auto_update_settings_timestamp?).and_return(false)
        expect( node ).to receive(:update_settings_timestamp).and_call_original
        node.save!
      end
    end

    context "when #prevent_auto_update_settings_timestamp? is true" do
      it "is not called after save" do
        node = build(:node)
        allow( node ).to receive(:prevent_auto_update_settings_timestamp?).and_return(true)
        expect( node ).to_not receive(:update_settings_timestamp)
        node.save!
      end
    end
  end

  describe "#path" do
    before do
      allow(subject).to receive(:path_parts).and_return(["some", "bar", "foo"])
    end

    it "returns relative node path built ny joining node path parts" do
      expect(subject.path).to eq("/some/bar/foo")
    end

    context "when node has parent" do
      it "ads trailing slash to returned node path" do
        allow(subject).to receive(:trailing_slash_for_path?).and_return(true)
        expect(subject.path).to eq("/some/bar/foo/")
      end
    end
  end

  describe "#trailing_slash_for_path?" do
    context "when rails route has trailing slash enabled" do
      it "returns true" do
        allow(Rails.application.routes).to receive(:default_url_options).and_return(trailing_slash: true)
        expect(subject.trailing_slash_for_path?).to be true
      end
    end

    context "when rails route has trailing slash disabled" do
      it "returns false" do
        allow(Rails.application.routes).to receive(:default_url_options).and_return({})
        expect(subject.trailing_slash_for_path?).to be false
      end
    end
  end

  describe "#path_parts" do
    it "returns array with slug" do
      expect(subject.path_parts).to eq([""])
      subject.slug = "foo"
      expect(subject.path_parts).to eq(["foo"])
    end

    context "when node has parent" do
      it "prepends parent path parts to returned array" do
        parent = described_class.new
        allow(parent).to receive(:path_parts).and_return(%w(some bar))

        subject.slug = "foo"
        subject.parent = parent
        expect(subject.path_parts).to eq(["some", "bar", "foo"])
      end
    end
  end
end


text:
require_dependency "coupons_code/application_controller"

module CouponsCode
  class CouponsController < ApplicationController
    before_action :set_coupon, only: [:show, :edit, :update, :destroy]

    # GET /coupons
    def index
      @coupons = Coupon.all
    end

    # GET /coupons/new
    def new
      @coupon = Coupon.new
    end

    # GET /coupons/1/edit
    def edit
    end

    # POST /coupons
    def create
      @coupon = Coupon.new(coupon_params)
      if @coupon.save
        redirect_to coupons_path, notice: 'Coupon was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /coupons/1
    def update
      if @coupon.update(coupon_params)
       redirect_to coupons_path, notice: 'Coupon was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /coupons/1
    def destroy
      @coupon.destroy
      redirect_to coupons_url, notice: 'Coupon was successfully destroyed.'
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_coupon
        @coupon = Coupon.find(params[:id])
      end

      # Only allow a trusted parameter "white list" through.
      def coupon_params
      params.require(:coupon).permit(:code,:description,:valid_from,:valid_until,:amount,:redemption_limit,:discount_type)
      end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Magento\CatalogSearch\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

/**
 * @codeCoverageIgnore
 */
class InstallSchema implements InstallSchemaInterface
{
    /**
     * {@inheritdoc}
     */
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();
        $installer->getConnection()->addColumn(
            $installer->getTable('catalog_eav_attribute'),
            'search_weight',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT,
                'unsigned' => true,
                'nullable' => false,
                'default' => '1',
                'comment' => 'Search Weight'
            ]
        );
        $installer->endSetup();
    }
}


text:
=head1 LICENSE

  Copyright (c) 1999-2011 The European Bioinformatics Institute and
  Genome Research Limited.  All rights reserved.

  This software is distributed under a modified Apache license.
  For license details, please see

    http://www.ensembl.org/info/about/code_licence.html

=head1 CONTACT

  Please email comments or questions to the public Ensembl
  developers list at <dev@ensembl.org>.

  Questions may also be sent to the Ensembl help desk at
  <helpdesk@ensembl.org>.

=cut

=head1 NAME

Bio::EnsEMBL::IdMapping::TinyGene - lightweight gene object

=head1 SYNOPSIS

 # fetch a gene from the db and create a lightweight gene object from it
  my $gene = $gene_adaptor->fetch_by_stable_id('ENSG000345437');
  my $lightweight_gene = Bio::EnsEMBL::IdMapping::TinyGene->new_fast( [
      $gene->dbID,                   $gene->stable_id,
      $gene->version,                $gene->created_date,
      $gene->modified_date,          $gene->start,
      $gene->end,                    $gene->strand,
      $gene->slice->seq_region_name, $gene->biotype,
      $gene->status,                 $gene->analysis->logic_name,
      ( $gene->is_known ? 1 : 0 ),
  ] );

=head1 DESCRIPTION

This is a lightweight gene object for the stable Id mapping. See the
documentation in TinyFeature for general considerations about its
design.

=head1 METHODS

  start
  end
  strand
  seq_region_name
  biotype
  status
  logic_name
  is_known
  add_Transcript
  get_all_Transcripts
  length

=cut

package Bio::EnsEMBL::IdMapping::TinyGene;

# internal data structure (array indices):
#
#  0-4 see TinyFeature
#  5  start
#  6  end
#  7  strand
#  8  seq_region_name
#  9  biotype
# 10  status
# 11  logic_name
# 12  is_known
# 13  [transcripts]

use strict;
use warnings;
no warnings 'uninitialized';

use Bio::EnsEMBL::IdMapping::TinyFeature;
our @ISA = qw(Bio::EnsEMBL::IdMapping::TinyFeature);

use Bio::EnsEMBL::Utils::Exception qw(throw warning);

=head2 start

  Arg[1]      : (optional) Int - the gene's start coordinate
  Description : Getter/setter for the gene's start coordinate.
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub start {
  my $self = shift;
  $self->[5] = shift if (@_);
  return $self->[5];
}

=head2 end

  Arg[1]      : (optional) Int - the gene's end coordinate
  Description : Getter/setter for the gene's end coordinate.
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub end {
  my $self = shift;
  $self->[6] = shift if (@_);
  return $self->[6];
}

=head2 strand

  Arg[1]      : (optional) Int - the gene's strand
  Description : Getter/setter for the gene's strand.
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub strand {
  my $self = shift;
  $self->[7] = shift if (@_);
  return $self->[7];
}

=head2 seq_region_name

  Arg[1]      : (optional) String - seq_region name
  Description : Getter/setter for the seq_region name of the slice the gene is
                on.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub seq_region_name {
  my $self = shift;
  $self->[8] = shift if (@_);
  return $self->[8];
}

=head2 biotype

  Arg[1]      : (optional) String - the gene's biotype
  Description : Getter/setter for the gene's biotype.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub biotype {
  my $self = shift;
  $self->[9] = shift if (@_);
  return $self->[9];
}

=head2 strand

  Arg[1]      : (optional) String - the gene's status
  Description : Getter/setter for the gene's status.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub status {
  my $self = shift;
  $self->[10] = shift if (@_);
  return $self->[10];
}

=head2 logic_name

  Arg[1]      : (optional) String - the gene's analysis' logic_name
  Description : Getter/setter for the gene's analysis' logic_name.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub logic_name {
  my $self = shift;
  $self->[11] = shift if (@_);
  return $self->[11];
}

=head2 is_known

  Arg[1]      : (optional) Boolean - the gene's "known" status
  Description : Getter/setter for the gene's "known" status.
  Return type : Boolean
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub is_known {
  my $self = shift;
  $self->[12] = shift if (@_);
  return $self->[12];
}

=head2 add_Transcript

  Arg[1]      : Bio::EnsEMBL::IdMapping::TinyTranscript $tr - the transcript to
                add
  Example     : $tiny_gene->add_Transcript($tiny_transcript);
  Description : Adds a transcript to a gene.
  Return type : none
  Exceptions  : thrown on wrong or missing argument
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub add_Transcript {
  my $self = shift;
  my $tr = shift;

  unless ($tr && $tr->isa('Bio::EnsEMBL::IdMapping::TinyTranscript')) {
    throw('Need a Bio::EnsEMBL::IdMapping::TinyTranscript.');
  }

  push @{ $self->[13] }, $tr;
}

=head2 get_all_Transcripts

  Example     : foreach my $tr (@{ $tiny_gene->get_all_Transcripts }) {
                  # do something with transcript
                }
  Description : Returns all transcripts attached to that gene.
  Return type : Arrayref of Bio::EnsEMBL::IdMapping::TinyTranscript objects
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub get_all_Transcripts {
  return $_[0]->[13] || [];
}

=head2 length

  Description : Returns the gene length (distance between start and end).
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub length {
  my $self = shift;
  return ($self->end - $self->start + 1);
}

1;


text:
package org.cloudfoundry.client.v2.routes;

import org.junit.Test;

public final class UpdateRouteRequestTest {

    @Test(expected = IllegalStateException.class)
    public void noRouteId() {
        UpdateRouteRequest.builder()
            .build();
    }

    @Test
    public void valid() {
        UpdateRouteRequest.builder()
            .routeId("test-route-id")
            .build();
    }

}


text:
#login {
    position: relative;
    z-index: 2;
    right: 8px;
    font-size: 12px;
}

#login a {
    text-decoration: underline;
    color: black;
    cursor: pointer;
}

#login span {
    background:url(user.png) transparent no-repeat left 2px;
    padding-left: 18px;
}


text:
package org.nd4j.linalg.api.ops.impl.transforms;

import org.nd4j.autodiff.functions.DifferentialFunction;
import org.nd4j.autodiff.samediff.SDVariable;
import org.nd4j.autodiff.samediff.SameDiff;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ops.BaseTransformOp;

import java.util.List;

/**
 * Rint function
 *
 * @author raver119@gmail.com
  */
public class Rint extends BaseTransformOp {
    public Rint(SameDiff sameDiff, SDVariable i_v, boolean inPlace) {
        super(sameDiff, i_v, inPlace);
    }

    public Rint(SameDiff sameDiff, SDVariable i_v, int[] shape, boolean inPlace, Object[] extraArgs) {
        super(sameDiff, i_v, shape, inPlace, extraArgs);
    }

    public Rint(SameDiff sameDiff, SDVariable i_v, Object[] extraArgs) {
        super(sameDiff, i_v, extraArgs);
    }

    public Rint() {}

    public Rint(INDArray x, INDArray z) {
        super(x, z);
    }

    public Rint(INDArray x, INDArray z, long n) {
        super(x, z, n);
    }

    public Rint(INDArray x, INDArray y, INDArray z, long n) {
        super(x, y, z, n);
    }

    public Rint(INDArray x) {
        super(x);
    }

    @Override
    public int opNum() {
        return 87;
    }

    @Override
    public String opName() {
        return "rint";
    }

    @Override
    public String onnxName() {
        return "Rint";
    }

    @Override
    public String tensorflowName() {
        return "Rint";
    }

    @Override
    public List<SDVariable> doDiff(List<SDVariable> i_v) {
        throw new UnsupportedOperationException();
    }

}


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <note/>
    <predicate lemma="convulsion">
        <note/>
        <roleset framnet="" id="convulsion.01" name="" vncls="">
            <roles>
                <role descr="Cause of convulsion" f="" n="0"/>
                <note/>
                <role descr="Entity convulsing" f="" n="1"/>
            </roles>
            <note>Corresponds with convulse.01. Framed by anwen april 2011</note>
            <example name="Arg1" src="" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>Charlie's convulsion stopped only after he was administered anti-seizure drugs.</text>
                <note/>
                <arg f="" n="0">Charlie's</arg>
                <rel f="">convulsion</rel>
            </example>
        </roleset>
    </predicate>
</frameset>


text: !function(a){a.fn.switchClass=function(a,b){return this.hasClass(a)?this.removeClass(a).addClass(b):this.hasClass(b)&&this.removeClass(b).addClass(a),this}}(jQuery);


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Drawing;
using System.IO;

namespace Vestris.ResourceLib
{
    /// <summary>
    /// A device-independent image consists of a BITMAPINFOHEADER where
    /// bmWidth is the width of the image andbmHeight is double the height
    /// of the image, followed by the bitmap color table, followed by the image
    /// pixels, followed by the mask pixels.
    /// </summary>
    public class DeviceIndependentBitmap
    {
        private Gdi32.BITMAPINFOHEADER _header = new Gdi32.BITMAPINFOHEADER();
        private byte[] _data = null;
        private Bitmap _mask = null;
        private Bitmap _color = null;
        private Bitmap _image = null;

        /// <summary>
        /// Raw image data.
        /// </summary>
        public byte[] Data
        {
            get
            {
                return _data;
            }
            set
            {
                _data = value;

                IntPtr pData = Marshal.AllocHGlobal(Marshal.SizeOf(_header));
                try
                {
                    Marshal.Copy(_data, 0, pData, Marshal.SizeOf(_header));
                    _header = (Gdi32.BITMAPINFOHEADER)Marshal.PtrToStructure(
                        pData, typeof(Gdi32.BITMAPINFOHEADER));
                }
                finally
                {
                    Marshal.FreeHGlobal(pData);
                }
            }
        }

        /// <summary>
        /// Bitmap info header.
        /// </summary>
        public Gdi32.BITMAPINFOHEADER Header
        {
            get
            {
                return _header;
            }
        }

        /// <summary>
        /// Bitmap size in bytes.
        /// </summary>
        public int Size
        {
            get
            {
                return _data.Length;
            }
        }

        /// <summary>
        /// A new icon image.
        /// </summary>
        public DeviceIndependentBitmap()
        {

        }

        /// <summary>
        /// A device-independent bitmap.
        /// </summary>
        /// <param name="data">Bitmap data.</param>
        public DeviceIndependentBitmap(byte[] data)
        {
            Data = data;
        }

        /// <summary>
        /// Create a copy of an image.
        /// </summary>
        /// <param name="image">Source image.</param>
        public DeviceIndependentBitmap(DeviceIndependentBitmap image)
        {
            _data = new byte[image._data.Length];
            Buffer.BlockCopy(image._data, 0, _data, 0, image._data.Length);
            _header = image._header;
        }

        /// <summary>
        /// Read icon data.
        /// </summary>
        /// <param name="lpData">Pointer to the beginning of icon data.</param>
        /// <param name="size">Icon data size.</param>
        internal void Read(IntPtr lpData, uint size)
        {
            _header = (Gdi32.BITMAPINFOHEADER)Marshal.PtrToStructure(
                lpData, typeof(Gdi32.BITMAPINFOHEADER));

            _data = new byte[size];
            Marshal.Copy(lpData, _data, 0, _data.Length);
        }

        /// <summary>
        /// Size of the image mask.
        /// </summary>
        private Int32 MaskImageSize
        {
            get
            {
                return (Int32)(_header.biHeight / 2 * GetDIBRowWidth(_header.biWidth));
            }
        }

        private Int32 XorImageSize
        {
            get
            {
                return (Int32)(_header.biHeight / 2 *
                    GetDIBRowWidth(_header.biWidth * _header.biBitCount * _header.biPlanes));
            }
        }

        /// <summary>
        /// Position of the DIB bitmap bits within a DIB bitmap array.
        /// </summary>
        private Int32 XorImageIndex
        {
            get
            {
                return (Int32)(Marshal.SizeOf(_header) +
                    ColorCount * Marshal.SizeOf(new Gdi32.RGBQUAD()));
            }
        }

        /// <summary>
        /// Number of colors in the palette.
        /// </summary>
        private UInt32 ColorCount
        {
            get
            {
                if (_header.biClrUsed != 0)
                    return _header.biClrUsed;

                if (_header.biBitCount <= 8)
                    return (UInt32)(1 << _header.biBitCount);

                return 0;
            }
        }

        private Int32 MaskImageIndex
        {
            get
            {
                return XorImageIndex + XorImageSize;
            }
        }

        /// <summary>
        /// Returns the width of a row in a DIB Bitmap given the number of bits. DIB Bitmap rows always align on a DWORD boundary.
        /// </summary>
        /// <param name="width">Number of bits.</param>
        /// <returns>Width of a row in bytes.</returns>
        private Int32 GetDIBRowWidth(int width)
        {
            return (Int32)((width + 31) / 32) * 4;
        }

        /// <summary>
        /// Bitmap monochrome mask.
        /// </summary>
        public Bitmap Mask
        {
            get
            {
                if (_mask == null)
                {
                    IntPtr hdc = IntPtr.Zero;
                    IntPtr hBmp = IntPtr.Zero;
                    IntPtr hBmpOld = IntPtr.Zero;
                    IntPtr bitsInfo = IntPtr.Zero;
                    IntPtr bits = IntPtr.Zero;

                    try
                    {
                        // extract monochrome mask
                        hdc = Gdi32.CreateCompatibleDC(IntPtr.Zero);
                        if (hdc == null)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        hBmp = Gdi32.CreateCompatibleBitmap(hdc, _header.biWidth, _header.biHeight / 2);
                        if (hBmp == null)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        hBmpOld = Gdi32.SelectObject(hdc, hBmp);

                        // prepare BitmapInfoHeader for mono bitmap:
                        int monoBmHdrSize = (int)_header.biSize + Marshal.SizeOf(new Gdi32.RGBQUAD()) * 2;

                        bitsInfo = Marshal.AllocCoTaskMem(monoBmHdrSize);
                        Marshal.WriteInt32(bitsInfo, Marshal.SizeOf(_header));
                        Marshal.WriteInt32(bitsInfo, 4, _header.biWidth);
                        Marshal.WriteInt32(bitsInfo, 8, _header.biHeight / 2);
                        Marshal.WriteInt16(bitsInfo, 12, 1);
                        Marshal.WriteInt16(bitsInfo, 14, 1);
                        Marshal.WriteInt32(bitsInfo, 16, (Int32)Gdi32.BitmapCompression.BI_RGB);
                        Marshal.WriteInt32(bitsInfo, 20, 0);
                        Marshal.WriteInt32(bitsInfo, 24, 0);
                        Marshal.WriteInt32(bitsInfo, 28, 0);
                        Marshal.WriteInt32(bitsInfo, 32, 0);
                        Marshal.WriteInt32(bitsInfo, 36, 0);
                        // black and white color indices
                        Marshal.WriteInt32(bitsInfo, 40, 0);
                        Marshal.WriteByte(bitsInfo, 44, 255);
                        Marshal.WriteByte(bitsInfo, 45, 255);
                        Marshal.WriteByte(bitsInfo, 46, 255);
                        Marshal.WriteByte(bitsInfo, 47, 0);
                        // prepare mask bits
                        bits = Marshal.AllocCoTaskMem(MaskImageSize);
                        Marshal.Copy(_data, MaskImageIndex, bits, MaskImageSize);

                        if (0 == Gdi32.SetDIBitsToDevice(hdc, 0, 0, (UInt32)_header.biWidth, (UInt32)_header.biHeight / 2,
                            0, 0, 0, (UInt32)_header.biHeight / 2, bits, bitsInfo, (UInt32)Gdi32.DIBColors.DIB_RGB_COLORS))
                        {
                            throw new Win32Exception(Marshal.GetLastWin32Error());
                        }

                        _mask = Bitmap.FromHbitmap(hBmp);
                    }
                    finally
                    {
                        if (bits != IntPtr.Zero) Marshal.FreeCoTaskMem(bits);
                        if (bitsInfo != IntPtr.Zero) Marshal.FreeCoTaskMem(bitsInfo);
                        if (hdc != IntPtr.Zero) Gdi32.SelectObject(hdc, hBmpOld);
                        if (hdc != IntPtr.Zero) Gdi32.DeleteObject(hdc);
                    }
                }

                return _mask;
            }
        }

        /// <summary>
        /// Bitmap color (XOR) part of the image.
        /// </summary>
        public Bitmap Color
        {
            get
            {
                if (_color == null)
                {
                    IntPtr hdcDesktop = IntPtr.Zero;
                    IntPtr hdc = IntPtr.Zero;
                    IntPtr hBmp = IntPtr.Zero;
                    IntPtr hBmpOld = IntPtr.Zero;
                    IntPtr bitsInfo = IntPtr.Zero;
                    IntPtr bits = IntPtr.Zero;

                    try
                    {
                        hdcDesktop = User32.GetDC(IntPtr.Zero); // Gdi32.CreateDC("DISPLAY", null, null, IntPtr.Zero);
                        if (hdcDesktop == null)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        hdc = Gdi32.CreateCompatibleDC(hdcDesktop);
                        if (hdc == null)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        hBmp = Gdi32.CreateCompatibleBitmap(hdcDesktop, _header.biWidth, _header.biHeight / 2);
                        if (hBmp == null)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        hBmpOld = Gdi32.SelectObject(hdc, hBmp);

                        // bitmap header
                        bitsInfo = Marshal.AllocCoTaskMem(XorImageIndex);
                        if (bitsInfo == null)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        Marshal.Copy(_data, 0, bitsInfo, XorImageIndex);
                        // fix the height
                        Marshal.WriteInt32(bitsInfo, 8, _header.biHeight / 2);
                        // XOR bits
                        bits = Marshal.AllocCoTaskMem(XorImageSize);
                        Marshal.Copy(_data, XorImageIndex, bits, XorImageSize);

                        if (0 == Gdi32.SetDIBitsToDevice(hdc, 0, 0, (UInt32)_header.biWidth, (UInt32)_header.biHeight / 2,
                           0, 0, 0, (UInt32)(_header.biHeight / 2), bits, bitsInfo, (Int32)Gdi32.DIBColors.DIB_RGB_COLORS))
                        {
                            throw new Win32Exception(Marshal.GetLastWin32Error());
                        }

                        _color = Bitmap.FromHbitmap(hBmp);
                    }
                    finally
                    {
                        if (hdcDesktop != IntPtr.Zero) Gdi32.DeleteDC(hdcDesktop);
                        if (bits != IntPtr.Zero) Marshal.FreeCoTaskMem(bits);
                        if (bitsInfo != IntPtr.Zero) Marshal.FreeCoTaskMem(bitsInfo);
                        if (hdc != IntPtr.Zero) Gdi32.SelectObject(hdc, hBmpOld);
                        if (hdc != IntPtr.Zero) Gdi32.DeleteObject(hdc);
                    }
                }

                return _color;
            }
        }

        /// <summary>
        /// Complete image.
        /// </summary>
        public Bitmap Image
        {
            get
            {
                if (_image == null)
                {
                    IntPtr hDCScreen = IntPtr.Zero;
                    IntPtr bits = IntPtr.Zero;
                    IntPtr hDCScreenOUTBmp = IntPtr.Zero;
                    IntPtr hBitmapOUTBmp = IntPtr.Zero;

                    try
                    {
                        hDCScreen = User32.GetDC(IntPtr.Zero);
                        if (hDCScreen == IntPtr.Zero)
                            throw new Win32Exception(Marshal.GetLastWin32Error());

                        // Image
                        Gdi32.BITMAPINFO bitmapInfo = new Gdi32.BITMAPINFO();
                        bitmapInfo.bmiHeader = _header;
                        // bitmapInfo.bmiColors = Tools.StandarizePalette(mEncoder.Colors);
                        hDCScreenOUTBmp = Gdi32.CreateCompatibleDC(hDCScreen);
                        hBitmapOUTBmp = Gdi32.CreateDIBSection(hDCScreenOUTBmp, ref bitmapInfo, 0, out bits, IntPtr.Zero, 0);
                        Marshal.Copy(_data, XorImageIndex, bits, XorImageSize);
                        _image = Bitmap.FromHbitmap(hBitmapOUTBmp);
                    }
                    finally
                    {
                        if (hDCScreen != IntPtr.Zero) User32.ReleaseDC(IntPtr.Zero, hDCScreen);
                        if (hBitmapOUTBmp != IntPtr.Zero) Gdi32.DeleteObject(hBitmapOUTBmp);
                        if (hDCScreenOUTBmp != IntPtr.Zero) Gdi32.DeleteDC(hDCScreenOUTBmp);
                    }
                }

                return _image;
            }
        }
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var VisualTest_1 = require("../../common/VisualTest");
var RunVisualTest_1 = require("../../visualtest/RunVisualTest");
var componentIds = [];
componentIds.push({
    selector: '.' + 'Breadcrumb',
    fileName: 'breadcrumb',
    imageSelector: '.' + 'Breadcrumb',
    commands: [RunVisualTest_1.defaultScreenshot]
});
componentIds.push({
    selector: '.' + 'ms-Breadcrumb-listItem',
    fileName: 'breadcrumb',
    imageSelector: '.' + 'Breadcrumb',
    commands: [RunVisualTest_1.mouseMoveScreenshot, RunVisualTest_1.mouseDownScreenshot, RunVisualTest_1.mouseClickScreenshot]
});
casper.
    start(VisualTest_1.baseUrl + 'breadcrumb').
    then(function () {
    RunVisualTest_1.testRunner(componentIds);
});
casper.run(function () { casper.test.done(); });

//# sourceMappingURL=Breadcrumb.visualtest.js.map


text:
title: Example Project
summary: An example of using the in-built project page.
tags:
- Deep Learning
date: "2016-04-27T00:00:00Z"

# Optional external URL for project (replaces project detail page).
external_link: ""

image:
  caption: Photo by rawpixel on Unsplash
  focal_point: Smart

links:
- icon: twitter
  icon_pack: fab
  name: Follow
  url: https://twitter.com/georgecushen
url_code: ""
url_pdf: ""
url_slides: ""
url_video: ""

# Slides (optional).
#   Associate this project with Markdown slides.
#   Simply enter your slide deck's filename without extension.
#   E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
#   Otherwise, set `slides = ""`.
slides: example
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellus ac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam. Quisque risus orci, mollis id ante sit amet, gravida egestas nisl. Sed ac tempus magna. Proin in dui enim. Donec condimentum, sem id dapibus fringilla, tellus enim condimentum arcu, nec volutpat est felis vel metus. Vestibulum sit amet erat at nulla eleifend gravida.

Nullam vel molestie justo. Curabitur vitae efficitur leo. In hac habitasse platea dictumst. Sed pulvinar mauris dui, eget varius purus congue ac. Nulla euismod, lorem vel elementum dapibus, nunc justo porta mi, sed tempus est est vel tellus. Nam et enim eleifend, laoreet sem sit amet, elementum sem. Morbi ut leo congue, maximus velit ut, finibus arcu. In et libero cursus, rutrum risus non, molestie leo. Nullam congue quam et volutpat malesuada. Sed risus tortor, pulvinar et dictum nec, sodales non mi. Phasellus lacinia commodo laoreet. Nam mollis, erat in feugiat consectetur, purus eros egestas tellus, in auctor urna odio at nibh. Mauris imperdiet nisi ac magna convallis, at rhoncus ligula cursus.

Cras aliquam rhoncus ipsum, in hendrerit nunc mattis vitae. Duis vitae efficitur metus, ac tempus leo. Cras nec fringilla lacus. Quisque sit amet risus at ipsum pharetra commodo. Sed aliquam mauris at consequat eleifend. Praesent porta, augue sed viverra bibendum, neque ante euismod ante, in vehicula justo lorem ac eros. Suspendisse augue libero, venenatis eget tincidunt ut, malesuada at lorem. Donec vitae bibendum arcu. Aenean maximus nulla non pretium iaculis. Quisque imperdiet, nulla in pulvinar aliquet, velit quam ultrices quam, sit amet fringilla leo sem vel nunc. Mauris in lacinia lacus.

Suspendisse a tincidunt lacus. Curabitur at urna sagittis, dictum ante sit amet, euismod magna. Sed rutrum massa id tortor commodo, vitae elementum turpis tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean purus turpis, venenatis a ullamcorper nec, tincidunt et massa. Integer posuere quam rutrum arcu vehicula imperdiet. Mauris ullamcorper quam vitae purus congue, quis euismod magna eleifend. Vestibulum semper vel augue eget tincidunt. Fusce eget justo sodales, dapibus odio eu, ultrices lorem. Duis condimentum lorem id eros commodo, in facilisis mauris scelerisque. Morbi sed auctor leo. Nullam volutpat a lacus quis pharetra. Nulla congue rutrum magna a ornare.

Aliquam in turpis accumsan, malesuada nibh ut, hendrerit justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque sed erat nec justo posuere suscipit. Donec ut efficitur arcu, in malesuada neque. Nunc dignissim nisl massa, id vulputate nunc pretium nec. Quisque eget urna in risus suscipit ultricies. Pellentesque odio odio, tincidunt in eleifend sed, posuere a diam. Nam gravida nisl convallis semper elementum. Morbi vitae felis faucibus, vulputate orci placerat, aliquet nisi. Aliquam erat volutpat. Maecenas sagittis pulvinar purus, sed porta quam laoreet at.


text:
package dejv.jfx.radialmenu.internal;

import javafx.beans.binding.DoubleExpression;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.shape.Shape;
import javafx.scene.transform.Rotate;
import javafx.stage.Popup;

import dejv.jfx.radialmenu.dynamic.RadialMenuSectionDynamic;
import dejv.jfx.radialmenu.model.Params;

/**
 * <p>
 *
 * @author dejv78 (www.dejv.info)
 */
public class RadialDebug {

    private final Popup popup;
    private final Params params;

    public RadialDebug(Popup popup, Params params) {
        this.popup = popup;
        this.params = params;

        Circle centerPoint = new Circle();
        setupCircle(centerPoint, params.getAnchorPoint().xProperty(), params.getAnchorPoint().yProperty(), 1.0d);
        decorateShape(centerPoint, null, Color.RED, 1);

        popup.getContent().add(centerPoint);

    }

    public void addPane(RadialMenuSectionDynamic pane) {
        final Line streak = new Line();
        streak.startXProperty().bind(params.getAnchorPoint().xProperty());
        streak.startYProperty().bind(params.getAnchorPoint().yProperty());
        streak.endXProperty().bind(params.getAnchorPoint().xProperty().add(pane.nominalRadiusProperty()));
        streak.endYProperty().bind(params.getAnchorPoint().yProperty());
        streak.setStroke(Color.BLUE);

        final Rotate rotate = new Rotate();
        rotate.angleProperty().bind(pane.streakAngleDegProperty());
        rotate.pivotXProperty().bind(params.getAnchorPoint().xProperty());
        rotate.pivotYProperty().bind(params.getAnchorPoint().yProperty());

        streak.getTransforms().add(rotate);
        popup.getContent().add(streak);
    }

    private void decorateShape(Shape s, Color fill, Color stroke, double opacity) {
        s.setMouseTransparent(true);
        s.setFill(fill);
        s.setStroke(stroke);
        s.setOpacity(opacity);
    }

    private void setupCircle(Circle c, DoubleExpression centerOffset, DoubleExpression radius) {
        c.radiusProperty().bind(radius);
        c.centerXProperty().bind(centerOffset);
        c.centerYProperty().bind(centerOffset);
    }

    private void setupCircle(Circle c, DoubleExpression centerX, DoubleExpression centerY, double radius) {
        c.radiusProperty().set(radius);
        c.centerXProperty().bind(centerX);
        c.centerYProperty().bind(centerY);
    }
}


text:
<?php

namespace TellOP\DAO;

/**
 * "Write an essay" activity.
 * @package TellOP\DAO
 */
class ActivityEssay extends Activity {
    /**
     * The essay title.
     * @var string $title
     */
    private $title;

    /**
     * A description of the task.
     * @var string $description
     */
    private $description;

    /**
     * A list of tags associated to the activity.
     * @var string[] $tags
     */
    private $tags;

    /**
     * The minimum number of words required for the essay.
     * @var int $minimumwords
     */
    private $minimumwords;

    /**
     * The maximum number of words required for the essay.
     * @var int $minimumwords
     */
    private $maximumwords;

    /**
     * The text of the essay.
     * @var string $text
     */
    private $text;

    /**
     * The reference text.
     * @var string $reftext
     */
    private $reftext;

    /**
     * ActivityEssay constructor.
     * @param \TellOP\Application $appObject The application object.
     */
    function __construct($appObject) {
        parent::__construct($appObject);
        $this->title = '';
        $this->description = '';
        $this->reftext = '';
        $this->tags = array();
        $this->minimumwords = 80;
        $this->maximumwords = 250;
    }

    /**
     * Gets the string identifying the object type in a JSON representation.
     * @return string The string identifying the object type.
     */
    static function getJSONType() {
        return 'ESSAY';
    }

    /**
     * Gets the essay title.
     * @return string The essay title.
     */
    public function getTitle() {
        return $this->title;
    }

    /**
     * Gets the essay reference text;
     * @return string The reference text.
     */
    public function getRefText() {
        return $this->reftext;
    }

    /**
     * Gets the task description.
     * @return string The task description.
     */
    public function getDescription() {
        return $this->description;
    }

    /**
     * Gets the list of tags associated to the activity.
     * @return \string[] The list of tags associated to the activity.
     */
    public function getTags() {
        return $this->tags;
    }

    /**
     * Gets the minimum number of words required for the essay.
     * @return int The minimum number of words required for the essay.
     */
    public function getMinimumWords() {
        return $this->minimumwords;
    }

    /**
     * Gets the maximum number of words required for the essay.
     * @return int The maximum number of words required for the essay.
     */
    public function getMaximumWords() {
        return $this->maximumwords;
    }

    /**
     * Gets the text the user should read before performing the activity.
     * @return string The text the user should read before performing the
     * activity.
     */
    public function getText() {
        return $this->text;
    }

    /**
     * Replaces the current activity with one loaded from a set of fields.
     * @param mixed[] $fields The database fields.
     */
    public function getActivityFromFields($fields) {
        parent::getActivityFromFieldsBase($fields);
        if (isset($fields) && is_array($fields)) {
            if (isset($fields['title'])) {
                $this->title = $fields['title'];
            }
            if (isset($fields['description'])) {
                $this->description = $fields['description'];
            }
            if (isset($fields['tags']) && strlen($fields['tags']) > 0) {
                $this->tags = explode(',', $fields['tags']);
            }
            if (isset($fields['minimumwords']) && is_numeric($fields['minimumwords'])) {
                $this->minimumwords = (int) $fields['minimumwords'];
            }
            if (isset($fields['maximumwords']) && is_numeric($fields['maximumwords'])) {
                $this->maximumwords = (int) $fields['maximumwords'];
            }
            if (isset($fields['text'])) {
                $this->text = $fields['text'];
            }
            if (isset($fields['reftext'])) {
                $this->reftext = $fields['reftext'];
            }
        }
    }

    /**
     * Gets a representation suitable for JSON serialization.
     * @return mixed[] An array containing the data to be serialized.
     */
    public function jsonSerialize() {
        $jsonArray = parent::jsonSerializeBase();
        $jsonArray['title'] = $this->title;
        $jsonArray['description'] = $this->description;
        $jsonArray['tags'] = $this->tags;
        $jsonArray['minimumwords'] = $this->minimumwords;
        $jsonArray['maximumwords'] = $this->maximumwords;
        $jsonArray['text'] = $this->text;
        $jsonArray['reftext'] = $this->reftext;
        return $jsonArray;
    }
}


text:
import os
import torch
from options.train_options import TrainOptions
from dataset.aligned_dataset import AlignedDataset
from models.tim_gan import LocalGAN

def main():
  # parse options
  parser = TrainOptions()
  opts = parser.parse()
  if not os.path.exists(os.path.join(opts.output_dir, 'model', opts.name)):
    os.makedirs(os.path.join(opts.output_dir, 'model', opts.name))

  # data loader
  print('\n--- config dataset ---')
  dataset = AlignedDataset(opts)
  loader = torch.utils.data.DataLoader(dataset, batch_size=opts.batch_size, shuffle=True, num_workers=opts.nThreads)

  # model
  print('\n--- create model ---')
  model = LocalGAN(opts)
  model.cuda()

  # training
  print('\n--- training ---')
  total_it = 0
  for ep in range(opts.n_ep):
    for it, (src_img, text, tgt_img) in enumerate(loader):

      # forward
      temperature_rate = max(0, 1 - (ep + 1)/float(opts.n_ep))
      use_gt_attn_rate = max(0, 1 - ep/float(opts.n_ep))
      model.set_input(src_img, text, tgt_img)
      model.forward(use_gt_attn_rate=use_gt_attn_rate,temperature_rate=temperature_rate)

      # update
      model.update_D()
      model.update_G()

      # display
      model.write_display(total_it)

      # print
      if (it + 1) % (len(loader) // 5) == 0:
        print('Iteration {}, EP[{}/{}]'.format(total_it + 1, ep + 1, opts.n_ep))
      total_it += 1

    # write model file
    if (ep + 1) % 10 == 0:
      model.save(os.path.join(opts.output_dir, 'model', opts.name, '{}.pth'.format(ep + 1)), ep, total_it)

  return

if __name__ == '__main__':
  main()


text:
Visit
Vision Mediabecause im amazing, yes...


text:
'''Pythonic configuration.'''

from .conf import Context, Conf, Env, env, context, With, localconf

__all__ = 'Context Conf Env env context With localconf'.split()
__version__ = (0, 2, 2)


text:
module Main (main) where

-- Shared imports
import Imports
-- Testing
import Test.Hspec
-- Tests
import qualified WebSpec
import qualified MarkdownSpec
import qualified MergeSpec

main :: IO ()
main = do
  hspec $ do
    MarkdownSpec.tests
    MergeSpec.tests
  WebSpec.tests

-- TODO: it'd be nice if we could do server-starting tests in hspec as well,
-- but I don't know how to achieve the following flow:
--
--   * before the tests, the server is started
--   * after the tests, the server is killed
--   * if you Ctrl-C during the tests, the server is killed as well

{- Tests left to write:
~~~~~~~~~~~~~~
  * noscript tests
  * test on mobile
  * test that there are no repetitive searches on the admin page
  * test that admin CSS hasn't creeped into main CSS and vice-versa
  * test that the server is throwing no errors whatsoever during the
    execution of tests
  * changes to item description must not persist when doing Cancel and
    then Edit again
  * Markdown tests (e.g. Markdown doesn't work in category names)
  * test that nothing is messed up by things starting and ending with newlines
    (the %js bug, see description of 'mustache')
  -}


text:
from django.contrib import admin

from .forms import FlyForm
from .models import Fly

class FlyAdmin(admin.ModelAdmin):
    form = FlyForm
admin.site.register(Fly, FlyAdmin)


text:
package org.test;

import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;

/**
 * This sample app simulates the JMX Mbean that is exposed by the Spring Boot application.
 */
public class SampleApplication {

	private static final Object lock = new Object();

	public static void main(String[] args) throws Exception {
		MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
		ObjectName name = new ObjectName(
				"org.springframework.boot:type=Admin,name=SpringApplication");
		SpringApplicationAdmin mbean = new SpringApplicationAdmin();
		mbs.registerMBean(mbean, name);

		// Flag the app as ready
		mbean.ready = true;

		int waitAttempts = 0;
		while (!mbean.shutdownInvoked) {
			if (waitAttempts > 10) {
				throw new IllegalStateException(
						"Shutdown should have been invoked by now");
			}
			synchronized (lock) {
				lock.wait(250);
			}
			waitAttempts++;
		}
	}

	public interface SpringApplicationAdminMXBean {

		boolean isReady();

		void shutdown();

	}

	static class SpringApplicationAdmin implements SpringApplicationAdminMXBean {

		private boolean ready;

		private boolean shutdownInvoked;

		@Override
		public boolean isReady() {
			System.out.println("isReady: " + this.ready);
			return this.ready;
		}

		@Override
		public void shutdown() {
			this.shutdownInvoked = true;
			System.out.println("Shutdown requested");
		}

	}

}


text:
<?php
/**
 * Checkout
 *
 * The WooCommerce checkout class handles the checkout process, collecting user data and processing the payment.
 *
 * @class 		WC_Cart
 * @version		1.6.4
 * @package		WooCommerce/Classes
 * @author 		WooThemes
 */
class WC_Checkout {

	/** @var array Array of posted form data. */
	var $posted;

	/** @var array Array of fields to display on the checkout. */
	var $checkout_fields;

	/** @var bool Whether or not the user must create an account to checkout. */
	var $must_create_account;

	/** @var bool True when the user is creating an account. */
	var $creating_account;

	/**
	 * Constructor for the checkout class. Hooks in methods and defines eheckout fields.
	 *
	 * @access public
	 * @return void
	 */
	function __construct () {
		global $woocommerce;

		add_action('woocommerce_checkout_process',array(&$this,'checkout_process'));
		add_action('woocommerce_checkout_billing',array(&$this,'checkout_form_billing'));
		add_action('woocommerce_checkout_shipping',array(&$this,'checkout_form_shipping'));

		$this->must_create_account = get_option('woocommerce_enable_guest_checkout') == 'yes' || is_user_logged_in() ? false : true;

		// Define all Checkout fields
		$this->checkout_fields['billing'] 	= $woocommerce->countries->get_address_fields( $this->get_value('billing_country'), 'billing_' );
		$this->checkout_fields['shipping'] 	= $woocommerce->countries->get_address_fields( $this->get_value('shipping_country'), 'shipping_' );

		if ( get_option( 'woocommerce_registration_email_for_username' ) == 'no' ) {

			$this->checkout_fields['account']['account_username'] = array(
				'type' 			=> 'text',
				'label' 		=> __( 'Account username', 'woocommerce' ),
				'placeholder' 	=> _x( 'Username', 'placeholder', 'woocommerce' )
			);

		}

		$this->checkout_fields['account']['account_password'] = array(
			'type' 				=> 'password',
			'label' 			=> __( 'Account password', 'woocommerce' ),
			'placeholder' 		=> _x( 'Password', 'placeholder', 'woocommerce' ),
			'class' 			=> array( 'form-row-first' )
		);

		$this->checkout_fields['account']['account_password-2'] = array(
			'type' 				=> 'password',
			'label' 			=> __( 'Account password', 'woocommerce' ),
			'placeholder' 		=> _x( 'Password', 'placeholder', 'woocommerce' ),
			'class' 			=> array( 'form-row-last' ),
			'label_class' 		=> array( 'hidden' )
		);

		$this->checkout_fields['order']	= array(
			'order_comments' => array(
				'type' => 'textarea',
				'class' => array('notes'),
				'label' => __('Order Notes', 'woocommerce'),
				'placeholder' => _x('Enter your order notes here.', 'placeholder', 'woocommerce')
				)
			);
		$this->checkout_fields = apply_filters('woocommerce_checkout_fields', $this->checkout_fields);
	}

	/**
	 * Checkout process
	 *
	 * @access public
	 * @return void
	 */
	function checkout_process() {
		// When we process the checkout, lets ensure cart items are rechecked to prevent checkout
		do_action('woocommerce_check_cart_items');
	}

	/**
	 * Output the billing information form
	 *
	 * @access public
	 * @return void
	 */
	function checkout_form_billing() {
		woocommerce_get_template( 'checkout/form-billing.php', array( 'checkout' => $this ) );
	}

	/**
	 * Output the shipping information form
	 *
	 * @access public
	 * @return void
	 */
	function checkout_form_shipping() {
		woocommerce_get_template( 'checkout/form-shipping.php', array( 'checkout' => $this ) );
	}

	/**
	 * Process the checkout after the confirm order button is pressed
	 *
	 * @access public
	 * @return void
	 */
	function process_checkout() {
		global $wpdb, $woocommerce;

		if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) define( 'WOOCOMMERCE_CHECKOUT', true );

		$woocommerce->verify_nonce('process_checkout');

		do_action('woocommerce_before_checkout_process');

		if ( sizeof( $woocommerce->cart->get_cart() ) == 0 )
			$woocommerce->add_error( sprintf(__('Sorry, your session has expired. Return to homepage →', 'woocommerce'), home_url()) );

		do_action('woocommerce_checkout_process');

		// Checkout fields (not defined in checkout_fields)
		$this->posted['shiptobilling'] 		= isset($_POST['shiptobilling']) ? 1 : 0;
		$this->posted['terms'] 				= isset($_POST['terms']) ? 1 : 0;
		$this->posted['createaccount'] 		= isset($_POST['createaccount']) ? 1 : 0;
		$this->posted['payment_method'] 	= isset($_POST['payment_method']) ? woocommerce_clean($_POST['payment_method']) : '';
		$this->posted['shipping_method']	= isset($_POST['shipping_method']) ? woocommerce_clean($_POST['shipping_method']) : '';

		// Ship to billing only option
		if ( $woocommerce->cart->ship_to_billing_address_only() ) $this->posted['shiptobilling'] = 1;

		// Update customer shipping and payment method to posted method
		$_SESSION['_chosen_shipping_method'] 	= $this->posted['shipping_method'];
		$_SESSION['_chosen_payment_method'] 	= $this->posted['payment_method'];

		// Note if we skip shipping
		$skipped_shipping = false;

		// Get validation class
		$validation = $woocommerce->validation();

		// Get posted checkout_fields and do validation
		foreach ( $this->checkout_fields as $fieldset_key => $fieldset ) {

			// Skip shipping if its not needed
			if ( $fieldset_key == 'shipping' && ( $woocommerce->cart->ship_to_billing_address_only() || $this->posted['shiptobilling'] || ( ! $woocommerce->cart->needs_shipping() && get_option('woocommerce_require_shipping_address') == 'no' ) ) ) {
				$skipped_shipping = true;
				continue;
			}

			foreach ( $fieldset as $key => $field ) {

				if ( ! isset( $field['type'] ) ) $field['type'] = 'text';

				// Get Value
				switch ( $field['type'] ) {
					case "checkbox" :
						$this->posted[ $key ] = isset( $_POST[$key] ) ? 1 : 0;
					break;
					default :
						$this->posted[ $key ] = isset( $_POST[$key] ) ? woocommerce_clean( $_POST[ $key ] ) : '';
					break;
				}

				// Hook to allow modification of value
				$this->posted[ $key ] = apply_filters( 'woocommerce_process_checkout_field_' . $key, $this->posted[$key] );

				// Validation: Required fields
				if ( isset( $field['required'] ) && $field['required'] && empty( $this->posted[$key] ) ) $woocommerce->add_error( '' . $field['label'] . ' ' . __('is a required field.', 'woocommerce') );

				if ( ! empty( $this->posted[ $key ] ) ) {

					// Special handling for validation and formatting
					switch ( $key ) {
						case "billing_postcode" :
						case "shipping_postcode" :

							$validate_against = $key == 'billing_postcode' ? 'billing_country' : 'shipping_country';
							$this->posted[ $key ] = strtoupper( str_replace( ' ', '', $this->posted[ $key ] ) );

							if ( ! $validation->is_postcode( $this->posted[ $key ], $_POST[ $validate_against ] ) )
								$woocommerce->add_error( '' . $field['label'] . ' ' . sprintf( __('(%s) is not a valid postcode/ZIP.', 'woocommerce'), $this->posted[ $key ] ) );
							else
								$this->posted[ $key ] = $validation->format_postcode( $this->posted[$key], $_POST[ $validate_against ] );

						break;
						case "billing_state" :
						case "shipping_state" :

							// Get valid states
							$validate_against = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
							$valid_states = $woocommerce->countries->get_states( $_POST[ $validate_against ] );
							if ( $valid_states )
								$valid_state_values = array_flip( array_map( 'strtolower', $valid_states ) );

							// Convert value to key if set
							if ( isset( $valid_state_values[ strtolower( $this->posted[ $key ] ) ] ) )
								 $this->posted[ $key ] = $valid_state_values[ strtolower( $this->posted[ $key ] ) ];

							// Only validate if the country has specific state options
							if ( $valid_states && sizeof( $valid_states ) > 0 )
								if ( ! in_array( $this->posted[ $key ], array_keys( $valid_states ) ) )
									$woocommerce->add_error( '' . $field['label'] . ' ' . __('is not valid. Please enter one of the following:', 'woocommerce') . ' ' . implode( ', ', $valid_states ) );

						break;
						case "billing_phone" :

							$this->posted[ $key ] = $validation->format_phone( $this->posted[ $key ] );

							if ( ! $validation->is_phone( $this->posted[ $key ] ) )
								$woocommerce->add_error( '' . $field['label'] . ' ' . __('is not a valid number.', 'woocommerce') );
						break;
						case "billing_email" :

							$this->posted[ $key ] = strtolower( $this->posted[$key] );

							if ( ! $validation->is_email( $this->posted[$key] ) )
								$woocommerce->add_error( '' . $field['label'] . ' ' . __('is not a valid email address.', 'woocommerce') );
						break;
					}
				}
			}
		}

		// Update customer location to posted location so we can correctly check available shipping methods
		if ( isset( $this->posted['billing_country'] ) )
			$woocommerce->customer->set_country( $this->posted['billing_country'] );
		if ( isset( $this->posted['billing_state'] ) )
			$woocommerce->customer->set_state( $this->posted['billing_state'] );
		if ( isset( $this->posted['billing_postcode'] ) )
			$woocommerce->customer->set_postcode( $this->posted['billing_postcode'] );

		// Shipping Information
		if ( ! $skipped_shipping ) {

			// Update customer location to posted location so we can correctly check available shipping methods
			if ( isset( $this->posted['shipping_country'] ) )
				$woocommerce->customer->set_shipping_country( $this->posted['shipping_country'] );
			if ( isset( $this->posted['shipping_state'] ) )
				$woocommerce->customer->set_shipping_state( $this->posted['shipping_state'] );
			if ( isset( $this->posted['shipping_postcode'] ) )
				$woocommerce->customer->set_shipping_postcode( $this->posted['shipping_postcode'] );

		} else {

			// Update customer location to posted location so we can correctly check available shipping methods
			if ( isset( $this->posted['billing_country'] ) )
				$woocommerce->customer->set_shipping_country( $this->posted['billing_country'] );
			if ( isset( $this->posted['billing_state'] ) )
				$woocommerce->customer->set_shipping_state( $this->posted['billing_state'] );
			if ( isset( $this->posted['billing_postcode'] ) )
				$woocommerce->customer->set_shipping_postcode( $this->posted['billing_postcode'] );

		}

		// Update cart totals now we have customer address
		$woocommerce->cart->calculate_totals();

		// Handle accounts
		if ( is_user_logged_in() )
			$this->creating_account = false;
		elseif ( ! empty( $this->posted['createaccount'] ) )
			$this->creating_account = true;
		elseif ($this->must_create_account)
			$this->creating_account = true;
		else
			$this->creating_account = false;

		if ( $this->creating_account ) {

			if ( get_option( 'woocommerce_registration_email_for_username' ) == 'no' ) {

				if ( empty( $this->posted['account_username'] ) )
					$woocommerce->add_error( __( 'Please enter an account username.', 'woocommerce' ) );

				// Check the username
				if ( ! validate_username( $this->posted['account_username'] ) )
					$woocommerce->add_error( __('Invalid email/username.', 'woocommerce') );

				elseif ( username_exists( $this->posted['account_username'] ) )
					$woocommerce->add_error( __('An account is already registered with that username. Please choose another.', 'woocommerce') );

			} else {

				$this->posted['account_username'] = $this->posted['billing_email'];

			}

			// Validate passwords
			if ( empty($this->posted['account_password']) )
				$woocommerce->add_error( __('Please enter an account password.', 'woocommerce') );

			if ( $this->posted['account_password-2'] !== $this->posted['account_password'] )
				$woocommerce->add_error( __('Passwords do not match.', 'woocommerce') );

			// Check the e-mail address
			if ( email_exists( $this->posted['billing_email'] ) )
				$woocommerce->add_error( __( 'An account is already registered with your email address. Please login.', 'woocommerce' ) );

		}

		// Terms
		if ( ! isset( $_POST['woocommerce_checkout_update_totals'] ) && empty( $this->posted['terms'] ) && woocommerce_get_page_id( 'terms' ) > 0 )
			$woocommerce->add_error( __('You must accept our Terms & Conditions.', 'woocommerce') );

		if ( $woocommerce->cart->needs_shipping() ) {

			// Shipping Method
			$available_methods = $woocommerce->shipping->get_available_shipping_methods();

			if ( ! isset( $available_methods[ $this->posted['shipping_method'] ] ) )
				$woocommerce->add_error( __('Invalid shipping method.', 'woocommerce') );

		}

		if ($woocommerce->cart->needs_payment()) {

			// Payment Method
			$available_gateways = $woocommerce->payment_gateways->get_available_payment_gateways();

			if ( ! isset( $available_gateways[ $this->posted['payment_method'] ] ) )
				$woocommerce->add_error( __('Invalid payment method.', 'woocommerce') );
			else
				$available_gateways[$this->posted['payment_method']]->validate_fields(); // Payment Method Field Validation
		}

		// Action after validation
		do_action( 'woocommerce_after_checkout_validation', $this->posted );

		if ( ! isset( $_POST['woocommerce_checkout_update_totals'] ) && $woocommerce->error_count() == 0 ) :

			$user_id = get_current_user_id();

			while (1) :

				// Create customer account and log them in
				if ($this->creating_account && !$user_id) :

					$reg_errors = new WP_Error();

					do_action('woocommerce_register_post', $this->posted['account_username'], $this->posted['billing_email'], $reg_errors);

					$errors = apply_filters( 'woocommerce_registration_errors', $reg_errors, $this->posted['account_username'], $this->posted['billing_email'] );

	                // if there are no errors, let's create the user account
					if ( !$reg_errors->get_error_code() ) :

		                $user_pass 	= esc_attr( $this->posted['account_password'] );
		                $user_id 	= wp_create_user( $this->posted['account_username'], $user_pass, $this->posted['billing_email'] );

		                if ( !$user_id ) :
		                	$woocommerce->add_error( '' . __('ERROR', 'woocommerce') . ': ' . __('Couldn’t register you… please contact us if you continue to have problems.', 'woocommerce') );
		                    break;
		                endif;

	                    // Change role
	                    wp_update_user( array ('ID' => $user_id, 'role' => 'customer') ) ;

	                    // Action
	                    do_action( 'woocommerce_created_customer', $user_id );

	                    // send the user a confirmation and their login details
	                    $mailer = $woocommerce->mailer();
						$mailer->customer_new_account( $user_id, $user_pass );

	                    // set the WP login cookie
	                    $secure_cookie = is_ssl() ? true : false;
	                    wp_set_auth_cookie($user_id, true, $secure_cookie);

					else :
						$woocommerce->add_error( $reg_errors->get_error_message() );
	                	break;
					endif;

				endif;

				// Create Order (send cart variable so we can record items and reduce inventory). Only create if this is a new order, not if the payment was rejected last time.
				$_tax = new WC_Tax();

				if($_SESSION['pickUp']=="on")
				{
					$_SESSION['pickup_shipname'] = "Pickup From:" . "\n" . str_replace("~","\n",$_SESSION['pickup_shipname']);
					$order_data = array(
						'post_type' 	=> 'shop_order',
						'post_title' 	=> sprintf( __( 'Order – %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce' ) ) ),
						'post_status' 	=> 'publish',
						'ping_status'	=> 'closed',
						'post_excerpt' 	=> $this->posted['order_comments'] . "\n" . $_SESSION['pickup_shipname'],
						'post_author' 	=> 1,
						'post_password'	=> uniqid('order_')	// Protects the post just in case
					);
				}
				if($_SESSION['Delivery']=="on")
				{
					$_SESSION['delivery_warehouse'] = "Delivery From:" . "\n" . str_replace("~","\n",$_SESSION['delivery_warehouse']);
					$order_data = array(
						'post_type' 	=> 'shop_order',
						'post_title' 	=> sprintf( __( 'Order – %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce' ) ) ),
						'post_status' 	=> 'publish',
						'ping_status'	=> 'closed',
						'post_excerpt' 	=> $this->posted['order_comments'] . "\n" . $_SESSION['delivery_warehouse'],
						'post_author' 	=> 1,
						'post_password'	=> uniqid('order_')	// Protects the post just in case
					);
				}
				if($_SESSION['BigPostDB']=="on")
				{
					$_SESSION['BigPost_address'] = "Pickup From :" . "\n" . str_replace("~","\n",$_SESSION['BigPost_address']);
					$order_data = array(
						'post_type' 	=> 'shop_order',
						'post_title' 	=> sprintf( __( 'Order – %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce' ) ) ),
						'post_status' 	=> 'publish',
						'ping_status'	=> 'closed',
						'post_excerpt' 	=> $this->posted['order_comments'] . "\n" . $_SESSION['BigPost_address'],
						'post_author' 	=> 1,
						'post_password'	=> uniqid('order_')	// Protects the post just in case
					);
				}

				// Cart items
				$order_items = array();

				foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {

					$_product = $values['data'];

					// Store any item meta data - item meta class lets plugins add item meta in a standardized way
					$item_meta = new WC_Order_Item_Meta();

					$item_meta->new_order_item( $values );

					// Store variation data in meta so admin can view it
					if ( $values['variation'] && is_array( $values['variation'] ) ) {
						foreach ( $values['variation'] as $key => $value ) {
							$item_meta->add( esc_attr( str_replace( 'attribute_', '', $key ) ), $value );
						}
					}

					// Store backorder status
					if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $values['quantity'] ) )
                   		$item_meta->add( __( 'Backordered', 'woocommerce' ), $values['quantity'] - max( 0, $_product->get_total_stock() ) );

					$order_items[] = apply_filters( 'new_order_item', array(
				 		'id' 				=> $values['product_id'],
				 		'variation_id' 		=> $values['variation_id'],
				 		'name' 				=> $_product->get_title(),
				 		'qty' 				=> (int) $values['quantity'],
				 		'item_meta'			=> $item_meta->meta,
				 		'line_subtotal' 	=> woocommerce_format_decimal( $values['line_subtotal'] ),		// Line subtotal (before discounts)
				 		'line_subtotal_tax' => woocommerce_format_decimal( $values['line_subtotal_tax'] ), 	// Line tax (before discounts)
				 		'line_total'		=> woocommerce_format_decimal( $values['line_total'] ), 		// Line total (after discounts)
				 		'line_tax' 			=> woocommerce_format_decimal( $values['line_tax'] ), 			// Line Tax (after discounts)
				 		'tax_class'			=> $_product->get_tax_class()									// Tax class (adjusted by filters)
				 	), $values );

				}

				// Check order items for errors
				do_action('woocommerce_check_new_order_items', $order_items);

				if ($woocommerce->error_count()>0) break;

				// Insert or update the post data
				$create_new_order = true;

				if (isset($_SESSION['order_awaiting_payment']) && $_SESSION['order_awaiting_payment'] > 0) :

					$order_id = (int) $_SESSION['order_awaiting_payment'];

					/* Check order is unpaid by getting its status */
					$terms = wp_get_object_terms( $order_id, 'shop_order_status', array('fields' => 'slugs') );
					$order_status = (isset($terms[0])) ? $terms[0] : 'pending';

					if ( $order_status == 'pending' ) :

						// Resume the unpaid order
						$order_data['ID'] = $order_id;
						wp_update_post( $order_data );
						do_action('woocommerce_resume_order', $order_id);

						$create_new_order = false;

					endif;

				endif;

				if ($create_new_order) :
					$order_id = wp_insert_post( $order_data );

					if (is_wp_error($order_id)) :
						$woocommerce->add_error( 'Error: Unable to create order. Please try again.' );
		                break;
					else :
						// Inserted successfully
						do_action('woocommerce_new_order', $order_id);
					endif;
				endif;

				// Get better formatted shipping method (title)
				$shipping_method = $this->posted['shipping_method'];
				if ( isset( $available_methods[ $this->posted['shipping_method'] ] ) )
					$shipping_method = $available_methods[ $this->posted['shipping_method'] ]->label;

				// Get better formatted payment method (title/label)
				$payment_method = $this->posted['payment_method'];
				if ( isset( $available_gateways[ $this->posted['payment_method'] ] ) )
					$payment_method = $available_gateways[ $this->posted['payment_method'] ]->get_title();

				// UPDATE ORDER META

				// Save billing and shipping first, also save to user meta if logged in
				if ($this->checkout_fields['billing']) {
					foreach ($this->checkout_fields['billing'] as $key => $field) {

						// Post
						update_post_meta( $order_id, '_' . $key, $this->posted[$key] );

						// User
						if ($user_id>0 && !empty($this->posted[$key])) {
							update_user_meta( $user_id, $key, $this->posted[$key] );

							// Special fields
							switch ($key) {
								case "billing_email" :
									if (!email_exists($this->posted[$key])) wp_update_user( array ( 'ID' => $user_id, 'user_email' => $this->posted[$key] ) ) ;
								break;
								case "billing_first_name" :
									wp_update_user( array ( 'ID' => $user_id, 'first_name' => $this->posted[$key] ) ) ;
								break;
								case "billing_last_name" :
									wp_update_user( array ( 'ID' => $user_id, 'last_name' => $this->posted[$key] ) ) ;
								break;
							}

						}
					}
				}

				if ( $this->checkout_fields['shipping'] && ( $woocommerce->cart->needs_shipping() || get_option('woocommerce_require_shipping_address') == 'yes' ) ) {
					foreach ($this->checkout_fields['shipping'] as $key => $field) {
						if ( $this->posted['shiptobilling'] ) {

							$field_key = str_replace('shipping_', 'billing_', $key);

							// Post
							update_post_meta( $order_id, '_' . $key, $this->posted[$field_key] );
						} else {
							// Post
							update_post_meta( $order_id, '_' . $key, $this->posted[$key] );

							// User
							if ( $user_id > 0 )
								update_user_meta( $user_id, $key, $this->posted[$key] );
						}
					}
				}

				// Save any other user meta
				if ($user_id) do_action('woocommerce_checkout_update_user_meta', $user_id, $this->posted);

				// Prepare order taxes for storage
				$order_taxes = array();

				foreach (array_keys($woocommerce->cart->taxes + $woocommerce->cart->shipping_taxes) as $key) {

					$is_compound = ($woocommerce->cart->tax->is_compound( $key )) ? 1 : 0;

					$cart_tax = (isset($woocommerce->cart->taxes[$key])) ? $woocommerce->cart->taxes[$key] : 0;
					$shipping_tax = (isset($woocommerce->cart->shipping_taxes[$key])) ? $woocommerce->cart->shipping_taxes[$key] : 0;

					$order_taxes[] = array(
						'label' 		=> $woocommerce->cart->tax->get_rate_label( $key ),
						'compound' 		=> $is_compound,
						'cart_tax' 		=> woocommerce_format_total( $cart_tax ),
						'shipping_tax' 	=> woocommerce_format_total( $shipping_tax )
					);
				}

				if($_SESSION['pickUp']=="on")
				{
					$shipping_method = "Local Pickup";
					update_post_meta( $order_id, '_shipping_method', 'local_pickup');

				}
				if($_SESSION['Delivery']=="on")
				{
					$shipping_method = "Local Delivery";
					update_post_meta( $order_id, '_shipping_method', 'local_delivery');

				}
				if($_SESSION['BigPostDB']=="on")
				{
					$shipping_method = "Depot Pickup";
					update_post_meta( $order_id, '_shipping_method', 'local_pickup');

				}

				if(isset($_SESSION['hdsatl'])==true)
				{
					update_post_meta( $order_id, __( 'ATL Service', 'woocommerce' ), $_SESSION['hdsatl'] );
				}

				// Save other order meta fields

				update_post_meta( $order_id, '_payment_method', 		$this->posted['payment_method']);
				update_post_meta( $order_id, '_shipping_method_title', 	$shipping_method );
				update_post_meta( $order_id, '_payment_method_title', 	$payment_method );
//				update_post_meta( $order_id, '_order_shipping', 		woocommerce_format_total( $woocommerce->cart->shipping_total ) );
				update_post_meta( $order_id, '_order_shipping', 		$_SESSION['sval']);
				update_post_meta( $order_id, '_order_discount', 		woocommerce_format_total( $woocommerce->cart->get_order_discount_total() ) );
				update_post_meta( $order_id, '_cart_discount', 			woocommerce_format_total( $woocommerce->cart->get_cart_discount_total() ) );
				update_post_meta( $order_id, '_order_tax', 				woocommerce_format_total( $woocommerce->cart->tax_total ) );
				update_post_meta( $order_id, '_order_shipping_tax', 	woocommerce_format_total( $woocommerce->cart->shipping_tax_total ) );
//				update_post_meta( $order_id, '_order_shipping_tax', 	$_SESSION['sval']);
//				update_post_meta( $order_id, '_order_total', 			woocommerce_format_total( $woocommerce->cart->total ) );
				update_post_meta( $order_id, '_order_total', 			$_SESSION['order_total'] );
				update_post_meta( $order_id, '_order_key', 				apply_filters('woocommerce_generate_order_key', uniqid('order_') ) );
				update_post_meta( $order_id, '_customer_user', 			(int) $user_id );
				update_post_meta( $order_id, '_order_items', 			$order_items );
				update_post_meta( $order_id, '_order_taxes', 			$order_taxes );
				update_post_meta( $order_id, '_order_currency', 		get_woocommerce_currency() );
				update_post_meta( $order_id, '_prices_include_tax', 	get_option('woocommerce_prices_include_tax') );

				// Store technical customer details in meta
				$customer_ip = isset( $_SERVER['HTTP_X_FORWARD_FOR'] ) ? $_SERVER['HTTP_X_FORWARD_FOR'] : $_SERVER['REMOTE_ADDR'];
				$customer_user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';

				update_post_meta( $order_id, __( 'Customer IP Address', 'woocommerce' ), $customer_ip );
				update_post_meta( $order_id, __( 'Customer UA', 'woocommerce' ), $customer_user_agent );

				// Let plugins add meta
				do_action('woocommerce_checkout_update_order_meta', $order_id, $this->posted );

				// Order status
				wp_set_object_terms( $order_id, 'pending', 'shop_order_status' );

				// Discount code meta
				if ( $applied_coupons = $woocommerce->cart->get_applied_coupons() ) {

					update_post_meta( $order_id, 'coupons', implode(', ', $applied_coupons) );

					if ( empty( $order ) )
						$order = new WC_Order( $order_id );

					$order->add_order_note( sprintf( __( 'Coupon Code Used: %s', 'woocommerce' ), implode(', ', $applied_coupons ) ) );
				}

				// Order is saved
				do_action('woocommerce_checkout_order_processed', $order_id, $this->posted);

				// Prevent timeout
				@set_time_limit(0);

				// Process payment
				if ($woocommerce->cart->needs_payment()) :

					// Store Order ID in session so it can be re-used after payment failure
					$_SESSION['order_awaiting_payment'] = $order_id;

					// Process Payment
					$result = $available_gateways[$this->posted['payment_method']]->process_payment( $order_id );

					// Redirect to success/confirmation/payment page
					if ($result['result']=='success') :

						$result = apply_filters('woocommerce_payment_successful_result', $result );

						if (is_ajax()) :
							echo json_encode( $result ) . '';
							exit;
						else :
							wp_redirect( $result['redirect'] );
							exit;
						endif;

					endif;

				else :

					if ( empty( $order ) )
						$order = new WC_Order( $order_id );

					// No payment was required for order
					$order->payment_complete();

					// Empty the Cart
					$woocommerce->cart->empty_cart();

					// Get redirect
					$return_url = get_permalink(woocommerce_get_page_id('thanks'));
					$return_url = add_query_arg('key', $order->order_key, add_query_arg('order', $order->id, $return_url));

					// Redirect to success/confirmation/payment page
					if (is_ajax()) :
						echo json_encode(
							array(
								'result' 	=> 'success',
								'redirect' => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order)
							)
						) . '';
						exit;
					else :
						wp_safe_redirect(
							apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order)
						);
						exit;
					endif;

				endif;

				// Break out of loop
				break;

			endwhile;

		endif;

		// If we reached this point then there were errors
		if (is_ajax()) :

			ob_start();
			$woocommerce->show_messages();
			$messages = ob_get_clean();

			echo json_encode(
				array(
					'result'	=> 'failure',
					'messages' 	=> $messages,
					'refresh' 	=> (isset($_SESSION['refresh_totals'])) ? 'true' : 'false'
				)
			) . '';

			unset($_SESSION['refresh_totals']);
			exit;
		endif;
	}

	/**
	 * Gets the value either from the posted data, or from the users meta data
	 *
	 * @access public
	 * @param string $input
	 * @return string
	 */
	function get_value( $input ) {
		global $woocommerce;

		if (isset( $_POST[$input] ) && !empty($_POST[$input])) :

			return esc_attr($_POST[$input]);

		elseif (is_user_logged_in()) :

			if ($meta = get_user_meta( get_current_user_id(), $input, true )) return $meta;

			$current_user = wp_get_current_user();
			if ($input == "billing_email") :
				return $current_user->user_email;
			endif;

		else :

			$default_billing_country 	= apply_filters('default_checkout_country', ($woocommerce->customer->get_country()) ? $woocommerce->customer->get_country() : $woocommerce->countries->get_base_country());

			$default_shipping_country 	= apply_filters('default_checkout_country', ($woocommerce->customer->get_shipping_country()) ? $woocommerce->customer->get_shipping_country() : $woocommerce->countries->get_base_country());

			if ( $woocommerce->customer->has_calculated_shipping() ) {
				$default_billing_state 		= apply_filters('default_checkout_state', $woocommerce->customer->get_state());
				$default_shipping_state 	= apply_filters('default_checkout_state', $woocommerce->customer->get_shipping_state());
			} else {
				$default_billing_state 		= apply_filters('default_checkout_state', '');
				$default_shipping_state 	= apply_filters('default_checkout_state', '');
			}

			if ($input == "billing_country") return $default_billing_country;

			if ($input == "billing_state") return $default_billing_state;

			if ($input == "billing_postcode") return ($woocommerce->customer->get_postcode()) ? $woocommerce->customer->get_postcode() : '';

			if ($input == "shipping_country") return $default_shipping_country;

			if ($input == "shipping_state") return $default_shipping_state;

			if ($input == "shipping_postcode") return ($woocommerce->customer->get_shipping_postcode()) ? $woocommerce->customer->get_shipping_postcode() : '';

		endif;
	}
}

/**
 * woocommerce_checkout class.
 *
 * @extends		WC_Checkout
 * @deprecated 	1.4
 * @package		WooCommerce/Classes
 */
class woocommerce_checkout extends WC_Checkout {
	public function __construct() {
		_deprecated_function( 'woocommerce_checkout', '1.4', 'WC_Checkout()' );
		parent::__construct();
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
<user>
  <id>7505382</id>
  <name>Erik Michaels-Ober</name>
  <screen_name>sferik</screen_name>
  <location>San Francisco</location>
  <description>Adventures in hunger and foolishness.</description>
  <profile_image_url>http://a0.twimg.com/profile_images/323331048/me_normal.jpg</profile_image_url>
  <url></url>
  <protected>false</protected>
  <followers_count>898</followers_count>
  <profile_background_color>000000</profile_background_color>
  <profile_text_color>333333</profile_text_color>
  <profile_link_color>0084B4</profile_link_color>
  <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
  <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
  <friends_count>88</friends_count>
  <created_at>Mon Jul 16 12:59:01 +0000 2007</created_at>
  <favourites_count>727</favourites_count>
  <utc_offset>-28800</utc_offset>
  <time_zone>Pacific Time (US & Canada)</time_zone>
  <profile_background_image_url>http://a3.twimg.com/profile_background_images/162641967/we_concept_bg2.png</profile_background_image_url>
  <profile_background_tile>false</profile_background_tile>
  <profile_use_background_image>true</profile_use_background_image>
  <notifications>false</notifications>
  <geo_enabled>true</geo_enabled>
  <verified>false</verified>
  <following>false</following>
  <statuses_count>2962</statuses_count>
  <lang>en</lang>
  <contributors_enabled>false</contributors_enabled>
  <follow_request_sent>false</follow_request_sent>
  <listed_count>29</listed_count>
  <show_all_inline_media>true</show_all_inline_media>
  <status>
    <created_at>Fri Oct 22 21:56:04 +0000 2010</created_at>
    <id>28443146015</id>
    <text>RT @mojombo: A release three years and three months in the making. I give you...Chronic 0.3.0! http://rubygems.org/gems/chronic</text>
    <source>Echofon</source>
    <truncated>false</truncated>
    <favorited>false</favorited>
    <in_reply_to_status_id></in_reply_to_status_id>
    <in_reply_to_user_id></in_reply_to_user_id>
    <in_reply_to_screen_name></in_reply_to_screen_name>
    <retweet_count></retweet_count>
    <retweeted>false</retweeted>
    <retweeted_status>
      <created_at>Fri Oct 22 21:34:32 +0000 2010</created_at>
      <id>28441706055</id>
      <text>A release three years and three months in the making. I give you...Chronic 0.3.0! http://rubygems.org/gems/chronic</text>
      <source>web</source>
      <truncated>false</truncated>
      <favorited>false</favorited>
      <in_reply_to_status_id></in_reply_to_status_id>
      <in_reply_to_user_id></in_reply_to_user_id>
      <in_reply_to_screen_name></in_reply_to_screen_name>
      <retweet_count></retweet_count>
      <retweeted>false</retweeted>
      <geo/>
      <coordinates/>
      <place/>
      <contributors/>
    </retweeted_status>
    <geo/>
    <coordinates/>
    <place/>
    <contributors/>
  </status>
</user>
</users>


text:
<?xml version="1.0"?>
<!--

-->
<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_types.xsd">
    <type id="downloadable_customer_products" label="Customer My Account Downloadable Items"/>
</page_types>


text:
    <title>Pebble.Ink</title>
    <link href='http://fonts.googleapis.com/css?family=Ubuntu:300' rel='stylesheet' type='text/css'>
    <link href="main.css" rel="stylesheet" type="text/css">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <meta description="Pebble.ink is currently a small box with a webserver. All users enjoy the best that the 80s and 90s web had to offer.">
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@pebbleink" />
    <meta name="twitter:creator" content="@phildini" />
    <meta property="og:url" content="http://pebble.ink" />
    <meta property="og:title" content="Pebble.Ink" />
    <meta property="og:site_name" content="Pebble.Ink" />
    <meta property="og:locale" content="en_US" />
    <meta property="og:description" content="Pebble.ink is for now a small box with a webserver. All users enjoy the best that the 80s and 90s web had to offer." />
    <meta property="og:image" content="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3c/Japanese_-_Writing_Box_and_Implements_(suzuri_bako)_with_a_Pheasant_Beside_a_Stream_-_Walters_6775_-_Pieces_A_E_Front.jpg/710px-Japanese_-_Writing_Box_and_Implements_(suzuri_bako)_with_a_Pheasant_Beside_a_Stream_-_Walters_6775_-_Pieces_A_E_Front.jpg" />

Pebble.ink is for now a small box with a webserver. All users enjoy the best that the 80s and 90s web had to offer, including:

Shell access

Personal webspace

Email forwarding

        The best way to get a user account is know an existing user, or ask @phildini. You might also try the application form

There are currently eight users:

                phildini | elzilrac | clach04 | waste

                imt | jovan | ke7ofi | contolini


text:
(function () {
  'use strict';

  angular.module('stockViewer').value('Config', {
    mail: 'add your mail here'
  });
})();


text:
===============
_plugin_logputs
===============
This function prints a single line to the log window.

::

    void _plugin_logputs(
    const char* text //text to print
    );

----------
Parameters
----------

:text: Piece of text to put to the log window. This text can contain line breaks.

-------------
Return Values
-------------
This function does not return a value.