text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.storage.blob.specialized;

import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.RequestConditions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.storage.blob.BlobClient;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.implementation.util.ModelHelper;
import com.azure.storage.blob.options.BlobAcquireLeaseOptions;
import com.azure.storage.blob.options.BlobBreakLeaseOptions;
import com.azure.storage.blob.options.BlobChangeLeaseOptions;
import com.azure.storage.blob.options.BlobReleaseLeaseOptions;
import com.azure.storage.blob.options.BlobRenewLeaseOptions;
import com.azure.storage.common.implementation.StorageImplUtils;

import java.net.URL;
import java.time.Duration;

/**
 * This class provides a client that contains all the leasing operations for {@link BlobContainerClient containers} and
 * {@link BlobClient blobs}. This client acts as a supplement to those clients and only handles leasing operations.
 *
 *
Instantiating a BlobLeaseClient

 *
 * {@codesnippet com.azure.storage.blob.specialized.LeaseClientBuilder.syncInstantiationWithBlob}
 *
 * {@codesnippet com.azure.storage.blob.specialized.LeaseClientBuilder.syncInstantiationWithContainer}
 *
 *
View {@link BlobLeaseClientBuilder this} for additional ways to construct the client.

 *
 *
For more information about leasing see the
 * container leasing or
 * blob leasing documentation.

 *
 * @see BlobLeaseClientBuilder
 */
@ServiceClient(builder =  BlobLeaseClientBuilder.class)
public final class BlobLeaseClient {
    private final BlobLeaseAsyncClient client;

    BlobLeaseClient(BlobLeaseAsyncClient client) {
        this.client = client;
    }

    /**
     * Gets the {@link URL} of the lease client.
     *
     *
The lease will either be a container or blob URL depending on which the lease client is associated.

     *
     * @return URL of the lease client.
     */
    public String getResourceUrl() {
        return client.getResourceUrl();
    }

    /**
     * Get the lease ID for this lease.
     *
     * @return the lease ID.
     */
    public String getLeaseId() {
        return client.getLeaseId();
    }

    /**
     * Acquires a lease for write and delete operations. The lease duration must be between 15 to 60 seconds or
     * -1 for an infinite duration.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.acquireLease#int}
     *
     * @param duration The duration of the lease between 15 to 60 seconds or -1 for an infinite duration.
     * @return The lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public String acquireLease(int duration) {
        return acquireLeaseWithResponse(duration, null, null, Context.NONE).getValue();
    }

    /**
     * Acquires a lease for write and delete operations. The lease duration must be between 15 to 60 seconds or
     * -1 for an infinite duration.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.acquireLeaseWithResponse#int-RequestConditions-Duration-Context}
     *
     * @param duration The duration of the lease between 15 to 60 seconds or -1 for an infinite duration.
     * @param modifiedRequestConditions Standard HTTP Access conditions related to the modification of data. ETag and
     * LastModifiedTime are used to construct conditions related to when the resource was changed relative to the given
     * request. The request will fail if the specified condition is not satisfied.
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<String> acquireLeaseWithResponse(int duration, RequestConditions modifiedRequestConditions,
        Duration timeout, Context context) {
        return acquireLeaseWithResponse(new BlobAcquireLeaseOptions(duration)
        .setRequestConditions(ModelHelper.populateBlobLeaseRequestConditions(modifiedRequestConditions)), timeout,
            context);
    }

    /**
     * Acquires a lease for write and delete operations. The lease duration must be between 15 to 60 seconds or
     * -1 for an infinite duration.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.acquireLeaseWithResponse#BlobAcquireLeaseOptions-Duration-Context}
     *
     * @param options {@link BlobAcquireLeaseOptions}
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<String> acquireLeaseWithResponse(BlobAcquireLeaseOptions options, Duration timeout,
        Context context) {
        return StorageImplUtils.blockWithOptionalTimeout(this.client.acquireLeaseWithResponse(options, context),
            timeout);
    }

    /**
     * Renews the previously acquired lease.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.renewLease}
     *
     * @return The renewed lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public String renewLease() {
        return renewLeaseWithResponse((RequestConditions) null, null, Context.NONE).getValue();
    }

    /**
     * Renews the previously-acquired lease.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.renewLeaseWithResponse#RequestConditions-Duration-Context}
     *
     * @param modifiedRequestConditions Standard HTTP Access conditions related to the modification of data. ETag and
     * LastModifiedTime are used to construct conditions related to when the resource was changed relative to the given
     * request. The request will fail if the specified condition is not satisfied.
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The renewed lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<String> renewLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout,
        Context context) {
        return renewLeaseWithResponse(new BlobRenewLeaseOptions()
                .setRequestConditions(ModelHelper.populateBlobLeaseRequestConditions(modifiedRequestConditions)),
            timeout, context);
    }

    /**
     * Renews the previously-acquired lease.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.renewLeaseWithResponse#BlobRenewLeaseOptions-Duration-Context}
     *
     * @param options {@link BlobRenewLeaseOptions}
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The renewed lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<String> renewLeaseWithResponse(BlobRenewLeaseOptions options, Duration timeout,
        Context context) {
        return StorageImplUtils.blockWithOptionalTimeout(this.client.renewLeaseWithResponse(options, context), timeout);
    }

    /**
     * Releases the previously acquired lease.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.releaseLease}
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void releaseLease() {
        releaseLeaseWithResponse((RequestConditions) null, null, Context.NONE);
    }

    /**
     * Releases the previously acquired lease.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.releaseLeaseWithResponse#RequestConditions-Duration-Context}
     *
     * @param modifiedRequestConditions Standard HTTP Access conditions related to the modification of data. ETag and
     * LastModifiedTime are used to construct conditions related to when the resource was changed relative to the given
     * request. The request will fail if the specified condition is not satisfied.
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return A response containing status code and HTTP headers.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> releaseLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout,
        Context context) {
        return releaseLeaseWithResponse(new BlobReleaseLeaseOptions()
                .setRequestConditions(ModelHelper.populateBlobLeaseRequestConditions(modifiedRequestConditions)),
            timeout, context);
    }

    /**
     * Releases the previously acquired lease.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.releaseLeaseWithResponse#BlobReleaseLeaseOptions-Duration-Context}
     *
     * @param options {@link BlobReleaseLeaseOptions}
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return A response containing status code and HTTP headers.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> releaseLeaseWithResponse(BlobReleaseLeaseOptions options, Duration timeout,
        Context context) {
        return StorageImplUtils.blockWithOptionalTimeout(this.client.releaseLeaseWithResponse(options, context),
            timeout);
    }

    /**
     * Breaks the previously acquired lease, if it exists.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.breakLease}
     *
     * @return The remaining time in the broken lease in seconds.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Integer breakLease() {
        return breakLeaseWithResponse(null, null, null, Context.NONE).getValue();
    }

    /**
     * Breaks the previously acquired lease, if it exists.
     *
     *
If {@code null} is passed for {@code breakPeriodInSeconds} a fixed duration lease will break after the
     * remaining lease period elapses and an infinite lease will break immediately.

     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.breakLeaseWithResponse#Integer-RequestConditions-Duration-Context}
     *
     * @param breakPeriodInSeconds An optional duration, between 0 and 60 seconds, that the lease should continue before
     * it is broken. If the break period is longer than the time remaining on the lease the remaining time on the lease
     * is used. A new lease will not be available before the break period has expired, but the lease may be held for
     * longer than the break period.
     * @param modifiedRequestConditions Standard HTTP Access conditions related to the modification of data. ETag and
     * LastModifiedTime are used to construct conditions related to when the resource was changed relative to the given
     * request. The request will fail if the specified condition is not satisfied.
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The remaining time in the broken lease in seconds.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Integer> breakLeaseWithResponse(Integer breakPeriodInSeconds,
        RequestConditions modifiedRequestConditions, Duration timeout, Context context) {
        return breakLeaseWithResponse(new BlobBreakLeaseOptions()
                .setBreakPeriod(breakPeriodInSeconds == null ? null : Duration.ofSeconds(breakPeriodInSeconds))
                .setRequestConditions(ModelHelper.populateBlobLeaseRequestConditions(modifiedRequestConditions)),
            timeout, context);
    }

    /**
     * Breaks the previously acquired lease, if it exists.
     *
     *
If {@code null} is passed for {@code breakPeriodInSeconds} a fixed duration lease will break after the
     * remaining lease period elapses and an infinite lease will break immediately.

     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.breakLeaseWithResponse#BlobBreakLeaseOptions-Duration-Context}
     *
     * @param options {@link BlobBreakLeaseOptions}
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The remaining time in the broken lease in seconds.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Integer> breakLeaseWithResponse(BlobBreakLeaseOptions options, Duration timeout, Context context) {
        return StorageImplUtils.blockWithOptionalTimeout(this.client.breakLeaseWithResponse(options, context), timeout);
    }

    /**
     * Changes the lease ID.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.changeLease#String}
     *
     * @param proposedId A new lease ID in a valid GUID format.
     * @return The new lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public String changeLease(String proposedId) {
        return changeLeaseWithResponse(proposedId, null, null, Context.NONE).getValue();
    }

    /**
     * Changes the lease ID.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.changeLeaseWithResponse#String-RequestConditions-Duration-Context}
     *
     * @param proposedId A new lease ID in a valid GUID format.
     * @param modifiedRequestConditions Standard HTTP Access conditions related to the modification of data. ETag and
     * LastModifiedTime are used to construct conditions related to when the resource was changed relative to the given
     * request. The request will fail if the specified condition is not satisfied.
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The new lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<String> changeLeaseWithResponse(String proposedId,
        RequestConditions modifiedRequestConditions, Duration timeout, Context context) {
        return changeLeaseWithResponse(new BlobChangeLeaseOptions(proposedId)
            .setRequestConditions(ModelHelper.populateBlobLeaseRequestConditions(modifiedRequestConditions)), timeout,
            context);
    }

    /**
     * Changes the lease ID.
     *
     *
Code Samples

     *
     * {@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.changeLeaseWithResponse#BlobChangeLeaseOptions-Duration-Context}
     *
     * @param options {@link BlobChangeLeaseOptions}
     * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
     * @param context Additional context that is passed through the Http pipeline during the service call.
     * @return The new lease ID.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<String> changeLeaseWithResponse(BlobChangeLeaseOptions options, Duration timeout, Context context) {
        return StorageImplUtils.blockWithOptionalTimeout(this.client.changeLeaseWithResponse(options, context),
            timeout);
    }

    /**
     * Get associated account name.
     *
     * @return account name associated with this storage resource.
     */
    public String getAccountName() {
        return client.getAccountName();
    }

}


text:
var env = require('./environment.js');

// This is the configuration file showing how a suite of tests might
// handle log-in using the onPrepare field.
exports.config = {
  seleniumAddress: env.seleniumAddress,

  framework: 'jasmine2',

  specs: [
    'login/login_spec.js'
  ],

  capabilities: env.capabilities,

  baseUrl: env.baseUrl,

  onPrepare: function() {
    browser.driver.get(env.baseUrl + '/login.html');

    browser.driver.findElement(by.id('username')).sendKeys('Jane');
    browser.driver.findElement(by.id('password')).sendKeys('1234');
    browser.driver.findElement(by.id('clickme')).click();

    // Login takes some time, so wait until it's done.
    // For the test app's login, we know it's done when it redirects to
    // index.html.
    browser.driver.wait(function() {
      return browser.driver.getCurrentUrl().then(function(url) {
        return /index/.test(url);
      });
    }, 10000);
  }
};

redpajama_set_name: RedPajamaGithub


text:
gcp_project_id = input('gcp_project_id')
gce_zones = input('gce_zones')
pci_version = input('pci_version')
pci_url = input('pci_url')
pci_section = '8.5'

gce_instances = GCECache(project: gcp_project_id, gce_zones: gce_zones).gce_instances_cache

title "[PCI-DSS-#{pci_version}][#{pci_section}] Do not use group, shared, or generic IDs, passwords, or other authentication methods"

# 8.5
pci_req = "#{pci_section}"
pci_req_title = "Do not use group, shared, or generic IDs, passwords, or other authentication methods"
pci_req_guidance = "If multiple users share the same authentication credentials (for example, user account and password), it becomes impossible to trace system access and activities to an individual. This in turn prevents an entity from assigning accountability for, or having effective logging of, an individual's actions, since a given action could have been performed by anyone in the group that has knowledge of the authentication credentials."
pci_req_coverage = 'partial'

control "pci-dss-#{pci_version}-#{pci_req}" do
  title "[PCI-DSS #{pci_version}][#{pci_req}] #{pci_req_title}"
  desc "#{pci_req_guidance}"
  impact 1.0

  tag project: "#{gcp_project_id}"
  tag standard: "pci-dss"
  tag pci_version: "#{pci_version}"
  tag pci_section: "#{pci_section}"
  tag pci_req: "#{pci_req}"
  tag coverage: "#{pci_req_coverage}"

  ref "PCI DSS #{pci_version}", url: "#{pci_url}"

  # Ensure the default compute service account is not attached to GCE/GKE instances
  gce_instances.each do |instance|
    describe "[#{pci_version}][#{pci_req}][#{gcp_project_id}] Instance: #{instance[:zone]}/#{instance[:name]}'s" do
      subject { google_compute_instance(project: gcp_project_id, zone: instance[:zone], name: instance[:name]) }
      it "service account should not be the Default Compute Service Account" do
        expect(subject.service_accounts[0].email).not_to match(/-compute@developer.gserviceaccount.com$/)
      end
    end
  end

  # Ensure the Default SA is not attached to Editor
  iam_cache = IAMBindingsCache(project: gcp_project_id)
  iam_editor_bindings = iam_cache.iam_bindings['roles/editor']
  unless iam_editor_bindings.nil?
    describe "[#{pci_version}][#{pci_req}][#{gcp_project_id}] The IAM Role 'roles/editor'" do
      subject { iam_editor_bindings }
      it "should not be bound to the default compute service account" do
        subject.members.should_not include(/-compute@developer.gserviceaccount.com/)
      end
    end
  end

  # Service Account User should not be bound at the project level
  describe "[#{pci_version}][#{pci_req}][#{gcp_project_id}] Ensure the role iam.serviceAccountUser is not bound at the project level" do
    subject { google_project_iam_bindings(project: gcp_project_id).where(iam_binding_role: 'roles/iam.serviceAccountUser') }
    its('count') { should be_zero }
  end
end


text:
var fs = require('fs')
var Canvas = require('canvas')
var should = require('should')
var Clipper = require('../lib/index')
var utils = require('../lib/utils')

var jpgImagePath = './example/house.jpg'
var pngImagePath = './example/building.png'
var exportDir = './example/'
var deleteTempFile = true

var x = 20
var y = 20
var width = 100
var height = 100

// return console.log(123, Canvas)

Clipper.configure({
  canvas: Canvas
})

describe('entrance method clipper()', function() {
  it('clipper(path, function() {...}) works', function(done) {
    Clipper(jpgImagePath, function() {
      var initialized = !!(this.canvas && this.options.imageFormat)
      initialized.should.equal(true)
      done()
    })
  })

  it('clipper(Image).crop(...) works', function(done) {
    var img = new Canvas.Image
    img.onload = function() {
      Clipper(img).crop(x, y, width, height).toDataURL(function(dataUrl) {
        should.exist(dataUrl)
        dataUrl.indexOf('data:image/png;base64,').should.equal(0)
        done()
      })
    }
    img.src = pngImagePath
  })

  it('clipper(path, {...}, function() {...}) works', function(done) {
    Clipper(jpgImagePath, {quality: 50}, function() {
      this.options.quality.should.equal(50)
      var initialized = !!(this.canvas && this.options.imageFormat)
      initialized.should.equal(true)
      done()
    })
  })

  it('clipper(Image, function() {...}) works and displays a warning message', function(done) {
    var img = new Canvas.Image
    img.onload = function() {
      Clipper(img, function() {
        var initialized = !!(this.canvas && this.options.imageFormat)
        initialized.should.equal(true)
        done()
      })
    }
    img.src = pngImagePath
  })

  it('clipper(Image, {...}, function() {...}) works and displays a warning message', function(done) {
    var img = new Canvas.Image
    img.onload = function() {
      Clipper(img, {quality: 50}, function() {
        this.options.quality.should.equal(50)
        var initialized = !!(this.canvas && this.options.imageFormat)
        initialized.should.equal(true)
        done()
      })
    }
    img.src = pngImagePath
  })

  it('clipper() works', function() {
    var clipper = Clipper()
    should(!!clipper.options.quality).equal(true)
  })

  it('clipper({quality: Number}) works', function() {
    var clipper = Clipper({
      quality: 66
    })
    clipper.options.quality.should.equal(66)
  })

  it('clipper({canvas: Canvas}) works', function(done) {
    Clipper.configure({
      canvas: null
    })

    var clipper = Clipper({
      canvas: Canvas
    })
    should(clipper.options.canvas).equal(Canvas)
    clipper.image(jpgImagePath, function() {
      var initialized = !!(this.canvas && this.options.imageFormat)
      initialized.should.equal(true)

      Clipper.configure({
        canvas: Canvas
      })

      done()
    })
  })

  it('clipper("path/to/image.jpg") throws since callback did not be provided', function(done) {
    try {
      Clipper(pngImagePath)
    } catch (e) {
      e.message.should.equal('callback must be specified when load from path')
      done()
    }
  })

})

describe('image', function() {
  it('image("path/to/image.jpg", function() {...}) works', function(done) {
    var clipper = Clipper()
    clipper.image(jpgImagePath, function() {
      var initialized = !!(this.canvas && this.options.imageFormat)
      initialized.should.equal(true)
      done()
    })
  })

  it('image(Image) works', function(done) {
    var img = new Canvas.Image
    var clipper = new Clipper()
    img.onload = function() {
      clipper.image(img).resize(200).quality(10).toFile(exportDir + 'output9.jpg', function() {
        deleteTempFile && deleteFile(exportDir + 'output9.jpg')
        this.canvas.width.should.equal(200)
        this.options.quality.should.equal(10)
        done()
      })
    }
    img.src = jpgImagePath
  })

  it('image(Image, function() {...}) works and displays a warning message', function(done) {
    var img = new Canvas.Image
    var clipper = new Clipper()
    img.onload = function() {
      clipper.image(img, function() {
        var initialized = !!(this.canvas && this.options.imageFormat)
        initialized.should.equal(true)
        done()
      })
    }
    img.src = pngImagePath
  })

  it('image("path/to/image.jpg") throws', function(done) {
    var clipper = Clipper()
    try {
      clipper.image(jpgImagePath)
    } catch (e) {
      e.message.should.equal('callback must be specified when load from path')
      done()
    }
  })
})

describe('crop', function() {
  it('crop(x, y, width, height) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.crop(x, y, width, height)
      this.canvas.width.should.equal(width)
      this.canvas.height.should.equal(height)
      done()
    })
  })

  it('crop(x, y, width, height).toDataURL(function(dataUrl) {...}) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.crop(x, y, width, height).toDataURL(function(dataUrl) {
        should.exist(dataUrl)
        dataUrl.indexOf('data:image/jpeg;base64,').should.equal(0)
        done()
      })
    })
  })

  it('crop(x, y, width, height).resize(width2, height2) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.crop(x, y, width, height).resize(50, 50)
      this.canvas.width.should.equal(50)
      this.canvas.height.should.equal(50)
      done()
    })
  })

  it('crop(x, y, width, height).toFile(...) works', function(done) {
    var clipper = Clipper({
      quality: 30
    })
    clipper.image(jpgImagePath, function() {
      this.crop(x, y, width, height).toFile(exportDir + 'output5.jpg', function() {
        deleteTempFile && deleteFile(exportDir + 'output5.jpg')
        done()
      })
    })
  })

  it('crop(x, y, width, height).resize(width2, height2).toFile(...) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.crop(x, y, width, height).resize(50, 50).toFile(exportDir + 'output5-1.jpg', function() {
        deleteTempFile && deleteFile(exportDir + 'output5-1.jpg')
        done()
      })
    })
  })
})

describe('toDataURL', function() {
  it('toDataURL() throws', function(done) {
    Clipper(jpgImagePath, function() {
      try {
        this.toDataURL()
      } catch (e) {
        e.message.should.equal('toDataURL(): callback must be specified')
        done()
      }
    })
  })

  it('toDataURL(quality) throws', function(done) {
    Clipper(jpgImagePath, function() {
      try {
        this.toDataURL(30)
      } catch (e) {
        e.message.should.equal('toDataURL(): callback must be specified')
        done()
      }
    })
  })

  it('toDataURL(callback) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.toDataURL(function(dataUrl) {
        dataUrl.indexOf('data:image/jpeg;base64,').should.equal(0)
        done()
      })
    })
  })

  it('toDataURL(quality, callback) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.toDataURL(30, function(dataUrl) {
        dataUrl.indexOf('data:image/jpeg;base64,').should.equal(0)
        done()
      })
    })
  })

  it('toDataURL("quality", callback) works', function(done) {
    Clipper(jpgImagePath, function() {
      this.toDataURL('30', function(dataUrl) {
        dataUrl.indexOf('data:image/jpeg;base64,').should.equal(0)
        done()
      })
    })
  })
})

describe('resize', function() {
  it('resize(width, height) works', function(done) {
    Clipper(pngImagePath, function() {
      this.resize(100, 100)
      this.canvas.width.should.equal(100)
      this.canvas.height.should.equal(100)
      done()
    })
  })

  it('resize(width) works', function(done) {
    Clipper(pngImagePath, function() {
      this.resize(100)
      this.canvas.width.should.equal(100)
      this.canvas.height.should.equal(100)
      done()
    })
  })

  it('resize(null, height) works', function(done) {
    Clipper(pngImagePath, function() {
      this.resize(null, 200)
      this.canvas.width.should.equal(200)
      this.canvas.height.should.equal(200)
      done()
    })
  })

  it('resize() throws', function(done) {
    var clipper = Clipper()
    try {
      clipper.resize()
    } catch (e) {
      e.message.should.equal('resize() must be specified at least one parameter')
      done()
    }
  })

  it('resize(width, height).toFile(path, function() {...}) works', function(done) {
    Clipper(pngImagePath, function() {
      this.resize(100, 100).toFile(exportDir + 'output6.png', function() {
        deleteTempFile && deleteFile(exportDir + 'output6.png')
        done()
      })
    })
  })

  it('resize(width, height).crop(x, y, width, height).toFile(path, function() {...}) works', function(done) {
    Clipper(pngImagePath, function() {
      this.resize(100, 100).crop(0, 0, 50, 50).toFile(exportDir + 'output8.png', function() {
        deleteTempFile && deleteFile(exportDir + 'output8.png')
        done()
      })
    })
  })

  it('resize(width).toFile(path, function() {...}) works', function(done) {
    var clipper = Clipper({
      quality: 92
    })
    clipper.image(jpgImagePath, function() {
      this.resize(800).toFile(exportDir + 'output6-2.jpg', function() {
        deleteTempFile && deleteFile(exportDir + 'output6-2.jpg')
        done()
      })
    })
  })
})

describe('quality', function() {
  it('quality(level) works', function() {
    var clipper = Clipper()
    clipper.quality(68)
    clipper.options.quality.should.equal(68)

    clipper.quality(1)
    clipper.options.quality.should.equal(1)
    clipper.quality(92)
    clipper.options.quality.should.equal(92)
  })

  it('works when quality level > max quality level', function() {
    var clipper = Clipper({
      maxQuality: 92
    })
    clipper.quality(101)
    clipper.options.quality.should.equal(clipper.options.maxQuality)
    clipper.quality(92.2)
    clipper.options.quality.should.equal(clipper.options.maxQuality)
  })

  it('works when quality level < min quality level', function() {
    var clipper = Clipper({
      minQuality: 1
    })
    clipper.quality(0.1)
    clipper.options.quality.should.equal(clipper.options.minQuality)
    clipper.quality(-1)
    clipper.options.quality.should.equal(clipper.options.minQuality)
    clipper.quality(0)
    clipper.options.quality.should.equal(clipper.options.minQuality)
  })
})

describe('configure', function() {
  it('instance configure(name, value) works', function() {
    var clipper = Clipper()
    clipper.configure('quality', 90)
    clipper.options.quality.should.equal(90)
    clipper.configure('minQuality', 8)
    clipper.options.minQuality.should.equal(8)
    clipper.configure('maxQuality', 78)
    clipper.options.maxQuality.should.equal(78)
  })

  it('instance configure({...}) works', function() {
    var clipper = Clipper()
    clipper.configure({
      quality: 67,
      minQuality: 4,
      maxQuality: 97
    })
    clipper.options.quality.should.equal(67)
    clipper.options.minQuality.should.equal(4)
    clipper.options.maxQuality.should.equal(97)
  })

  it('global configure(name, value) works', function() {
    Clipper.configure('quality', 67)
    Clipper.configure('minQuality', 4)
    Clipper.configure('maxQuality', 97)
    var clipper = Clipper()
    clipper.options.quality.should.equal(67)
    clipper.options.minQuality.should.equal(4)
    clipper.options.maxQuality.should.equal(97)
  })

  it('global configure({...}) works', function() {
    Clipper.configure({
      quality: 68,
      minQuality: 7,
      maxQuality: 99
    })
    var clipper = Clipper()
    clipper.options.quality.should.equal(68)
    clipper.options.minQuality.should.equal(7)
    clipper.options.maxQuality.should.equal(99)
    clipper.configure('quality', 90)
    clipper.options.quality.should.equal(90)
    clipper.configure('minQuality', 8)
    clipper.options.minQuality.should.equal(8)
    clipper.configure('maxQuality', 78)
    clipper.options.maxQuality.should.equal(78)
  })
})

describe('other image-clipper tests', function() {
  it('destroy() works', function(done) {
    Clipper(pngImagePath, function() {
      this.destroy()
      should(this.canvas).equal(null)
      done()
    })
  })

  it('reset() works', function(done) {
    Clipper(pngImagePath, function() {
      this.destroy()
      should(this.canvas).equal(null)
      this.reset()
      should(this.canvas).not.eql(null)
      should(this.options.imageFormat).not.eql(null)
      done()
    })
  })

  it('clear(x, y, width, height) works', function(done) {
    Clipper(pngImagePath, function() {
      this.clear(50, 50, 100, 100)
          .crop(20, 20, 200, 200)
          .toFile(exportDir + 'output7.png', function() {
            deleteTempFile && deleteFile(exportDir + 'output7.png')
            done()
          })
    })
  })

  it('getCanvas() works', function(done) {
    Clipper(pngImagePath, function() {
      should.exist(this.canvas)
      done()
    })
  })

  it('injectNodeCanvas(Canvas) works', function(done) {
    var clipper = Clipper()
    clipper.injectNodeCanvas(null)
    should(clipper.options.canvas).equal(null)
    clipper.injectNodeCanvas(Canvas)
    clipper.image(jpgImagePath, function() {
      this.crop(x, y, width, height).toDataURL(function(dataUrl) {
        should.exist(dataUrl)
        dataUrl.indexOf('data:image/jpeg;base64,').should.equal(0)
        done()
      })
    })
  })

  it('should throws without node-canvas', function(done) {
    var clipper = Clipper()
    clipper.injectNodeCanvas(null)
    try {
      clipper.image(pngImagePath, function() {
        true.should.equal(false)
        done()
      })
    } catch (e) {
      e.message.should.equal('Require node-canvas on the server-side Node.js')
      done()
    }
  })

  it('should throws when the "canvas" option in clipper({...}) is not an instance of node-canvas', function(done) {
    var clipper = Clipper({
      canvas: 12
    })
    try {
      clipper.image(pngImagePath, function() {
        true.should.equal(false)
        done()
      })
    } catch (e) {
      e.message.should.equal('Require node-canvas on the server-side Node.js')
      done()
    }
  })

})

describe('utils', function() {
  it('isBrowser() works', function() {
    should(utils.isBrowser()).equal(false)
  })

  it('isNode() works', function() {
    should(utils.isNode()).equal(true)
  })

  it('isNW() works', function() {
    should(utils.isNW()).equal(false)
  })

  it('isElectron() works', function() {
    should(utils.isElectron()).equal(false)
  })

  it('type() works', function() {
    should(utils.type([])).equal('Array')
    should(utils.type({})).equal('Object')
    should(utils.type()).equal('Undefined')
    should(utils.type('hello')).equal('String')
    should(utils.type('')).equal('String')
    should(utils.type('1')).equal('String')
    should(utils.type('true')).equal('String')
    should(utils.type(1)).equal('Number')
    should(utils.type(true)).equal('Boolean')
    var Image = Canvas.Image
    should(utils.type(Canvas)).equal('Object')
    should(utils.type(new Image)).equal('Image')
  })

  it('rangeNumber(num, min, max) works', function() {
    utils.rangeNumber(10, 1, 92).should.equal(10)
    utils.rangeNumber(1, 1, 92).should.equal(1)
    utils.rangeNumber(-1, 1, 92).should.equal(1)
    utils.rangeNumber(0, 1, 92).should.equal(1)
    utils.rangeNumber(92, 1, 92).should.equal(92)
    utils.rangeNumber(100, 1, 92).should.equal(92)
    utils.rangeNumber(91, 1, 92).should.equal(91)
  })

  it('extend(target, obj1, obj2, ...) works', function() {
    var target = {a: 1}
    utils.extend(target, {b: 2})
    should(target).eql({a: 1, b: 2})

    target = {a: 1}
    utils.extend(target, {a: 11, b: 2}, {c: 3})
    should(target).eql({a: 11, b: 2, c: 3})
  })

  it('getImageFormat(str) works', function() {
    utils.getImageFormat(jpgImagePath).should.equal('image/jpeg')
    utils.getImageFormat(pngImagePath).should.equal('image/png')
  })

  it('upperCaseFirstLetter(str) works', function() {
    utils.upperCaseFirstLetter('apple').should.equal('Apple')
  })
})

function deleteFile(path) {
  fs.unlink(path, function(err) {
    if (err) {throw err}
  })
}


text:
from __future__ import division, unicode_literals
from scheme.environment import SyntaxEnvironment
import scheme.debug

__author__ = 'perkins'

O=[]

class PatternMatcher(object):
    def __eq__(self, other):
        """

        :param other: One of ['.' sym] [sym '...'] [sym]
        :return: boolean
        """
        return self.pattern == other
    def setValue(self, val):
        self.value = val
        return self
    def __repr__(self):
        return '<pattern %s (%s) .=%r ...=%r>' % (self.pattern, self.literals, self.dot, self.ellipsis)
    def __init__(self, pattern, literals, dot=False, ellipsis=False):
        self.pattern = pattern
        self.literals = literals
        self.ellipsis = ellipsis
        self.dot = dot
        self.idx = 0
        self.value = None
    def __iter__(self):
        ei_pattern = enumerate(iter(self.pattern))
        for self.idx, i in ei_pattern:
            if isinstance(i, list):
                if len(self.pattern) > self.idx + 1 and self.pattern[self.idx + 1] == '...':
                    while True:
                        move_on = yield PatternMatcher(i, self.literals, False, True)
                        if move_on:
                            yield "OK"
                            self.idx, i = ei_pattern.next()
                            break
                else:
                    yield PatternMatcher(i, self.literals)
            elif i == '.':
                self.idx, i = ei_pattern.next()
                if isinstance(i, list):
                    raise SyntaxError(". must be followed by a name")
                yield PatternMatcher(i, self.literals, True)
            elif len(self.pattern) > self.idx + 1 and self.pattern[self.idx + 1] == '...':
                yield PatternMatcher(i, self.literals, False, True)
                self.idx, i = ei_pattern.next()
            else:
                yield PatternMatcher(i, self.literals)
    def match(self, params):
        try:
            return self.__match([params])
        except SyntaxError:
            pass
        except TypeError:
            pass
        except AttributeError:
            pass
        if scheme.debug.DEBUG > 1:
            import traceback
            traceback.print_exc()
    def __match(self, params):
        """
        Literals match literals
        Lists match lists (recursive invocation)
        Pattern tokens match lists or symbols
        ... makes the previous element match 0 or more times
        ... continues to consume elements from pattern until a non-matching param is encountered
        . makes the following element consume all following params
        :param params: [Symbol]
        :return: dictionary of pattern variables or False if not a matching pattern
        """
        o = SyntaxEnvironment()
        O.append(o)
        if not isinstance(self.pattern, list):  # we're a single element
            if self.dot:
                if not params:
                    o[self] = []
                else:
                    o[self] = [params[0]] + params[1]
                    params.pop()
                    params.pop()
                return o
            elif self.ellipsis:
                o[self] = [params[0]] + params[1]
                params.pop()
                params.pop()
                return o
            else:
                if not params:
                    '''
                    We need a symbol or a list
                    '''
                    raise SyntaxError()
                if self.pattern in self.literals:
                    if params[0] != self.pattern:
                        raise SyntaxError()
                    return SyntaxEnvironment()
                if isinstance(params, list):
                    r = SyntaxEnvironment({self: params[0]})
                    return r
                else:
                    return SyntaxEnvironment({self: params})
        else:
            if not params:
                raise SyntaxError()
            params = params[0][:]
            ipattern = iter(self)
            for patternElement in ipattern:
                if patternElement.ellipsis:
                    # This element needs to match 0+ sub-elements of params (non-greedy),
                    # so we work backward from the right till this is the last sub-pattern
                    reversed_pattern = self.pattern[self.idx + 2:]
                    rpm = PatternMatcher(reversed_pattern, self.literals)
                    reversed_pattern = list(rpm)
                    reversed_pattern.reverse()
                    for rpatternElement in reversed_pattern:
                        if rpatternElement.ellipsis:
                            raise SyntaxError()
                        if rpatternElement.dot:
                            o[rpatternElement] = []
                            continue
                        if params:
                            paramElement = [params.pop(-1)]
                        else:
                            paramElement = []
                        v = rpatternElement.__match(paramElement)
                        o.update(v)
                    # We've matched all the params to the right
                    # without error, whatever's left is given to this pattern
                    if not params:
                        o.update({patternElement: params})
                        try:
                            x = ipattern.send(1)
                        except StopIteration:
                            x = 'OK'
                        if x != 'OK':
                            raise SyntaxError(x)
                        break
                    if isinstance(patternElement.pattern, list):
                        matches = []
                        while True:
                            if params:
                                lastParam = False
                                paramElement = [params.pop(0)]
                            else:
                                lastParam = True
                                paramElement = []
                            try:
                                matches.append(patternElement.__match(paramElement))
                            except SyntaxError:
                                if not lastParam:
                                    params.insert(0, paramElement)
                                try:
                                    ipattern.send(True)
                                except StopIteration:
                                    break
                                break;

                        o.update({patternElement: matches})
                        break;
                    else:
                        l = [params.pop(0), params]
                        r = patternElement.__match(l)
                        if not l:
                            params = []
                        o.update(r)

                        break
                if params:
                    if isinstance(params, list):
                        paramElement = [params.pop(0), params]
                    else:
                        paramElement=[params]
                        params=[]
                else:
                    paramElement = []
                o.update(patternElement.__match(paramElement))
                if not paramElement:
                    params = []
            if params:
                raise SyntaxError()
            return o


text:
<!doctype html>

      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
      <title><?php  echo $this->session->userdata('name'); ?></title>
      <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
      <meta name="viewport" content="width=device-width" />

      <link href="<?php echo base_url(); ?>assets/css/bootstrap.min.css" rel="stylesheet" />

      <link href="<?php echo base_url(); ?>assets/css/light-bootstrap-dashboard.css" rel="stylesheet"/>

      <link href="<?php echo base_url(); ?>assets/css/demo.css" rel="stylesheet" />

      <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
      <link href='http://fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
      <link rel="stylesheet" href="<?php echo base_url(); ?>assets/stroke/css/pe-icon-7-stroke.css">

	    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/jquery.dataTables.min.css">
		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/buttons.dataTables.min.css">

               <button type="button" class="navbar-toggle" data-toggle="collapse">
               Toggle navigation

               </button>

                 <?php  echo $this->session->userdata('name'); ?>

                     Quick Links

<a href="<?php echo base_url(); ?>specialclass/home">Special Class

<a href="<?php echo base_url(); ?>event/home">Add Reminder

<a href="<?php echo base_url(); ?>circular/create_circular_master">Circular Master

                           <?php
                              $user_id=$this->session->userdata('user_id');
                              $user_type=$this->session->userdata('user_type');
                              $query="SELECT user_pic FROM edu_users WHERE user_id='$user_id' AND user_type='$user_type'";
                              $objRs=$this->db->query($query);
                              $row=$objRs->result();
                              foreach ($row as $rows1)
                              {
                               $pic=$rows1->user_pic;
                               if($pic!='')
                               {?>
                           <img src="<?php echo base_url(); ?>assets/admin/profile/<?php echo $pic; ?>" class="img-circle img-responsive imgstyle"/>
                           <?php }else{
                              ?> <img src="<?php echo base_url(); ?>assets/noimg.png" class="img-circle img-responsive imgstyle" />
                           <?php }} ?>

                           <a href="<?php echo base_url(); ?>adminlogin/profilepic">
                           <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/profile.png"/> Profile

                           <a href="<?php echo base_url(); ?>adminlogin/profile">
                           <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/setting.png"/> Setting

                           <a href="<?php echo base_url(); ?>adminlogin/logout" class="text-danger">

                           Log out

                  <?php
                     $user_id=$this->session->userdata('user_id');
                     $user_type=$this->session->userdata('user_type');
                     $query="SELECT user_pic FROM edu_users WHERE user_id='$user_id' AND user_type='$user_type'";
                     $objRs=$this->db->query($query);
                     $row=$objRs->result();
                     foreach ($row as $rows1)
                     {
                      $pic=$rows1->user_pic;
                      if($pic!='')
                      {?>
                  <img class="img-responsive" style="height:75px;" src="<?php echo base_url(); ?>assets/admin/profile/<?php echo $pic; ?>" >
                  <?php }else{
                     ?> <img class="img-responsive" src="<?php echo base_url(); ?>assets/noimg.png"  />
                  <?php }} ?>

                  <?php  $user_type=$this->session->userdata('user_type');
                     if($user_type==1)
                     {echo "
 Welcome Admin
";}else { echo "Welcome";}?>

                  <a href="<?php echo base_url(); ?>adminlogin/dashboard">

Dashboard

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/masters.png"/>

Masters

<a href="<?php echo base_url();  ?>years/home">Academic Years

<a href="<?php echo base_url();  ?>years/terms">Academic Terms

<a href="<?php echo base_url(); ?>classadd/addclass">Class & Sections

<a href="<?php echo base_url(); ?>subjectadd/addsubject">Subjects

<a href="<?php echo base_url(); ?>classmanage/home">Class Management

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/admission.png"/>

Student's Admission

<a href="<?php echo base_url(); ?>admission/home">Student Detail

<a href="<?php echo base_url(); ?>admission/view">Student Search

<a href="<?php echo base_url(); ?>parents/view">Parents Search

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/extracurricular.png"/>

Extra-Co curricular

<a href="<?php echo base_url(); ?>extracurricular/home">Extra-Co curricular

<a href="<?php echo base_url(); ?>groups/home">House Groups

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/register.png"/>

Registration

<a href="<?php echo base_url(); ?>enrollment/home">Student Registration

<a href="<?php echo base_url(); ?>enrollment/view">List of Registration

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/teachers.png"/>

Staff

<a href="<?php echo base_url(); ?>teacher/home">Add Staff

<a href="<?php echo base_url(); ?>teacher/view">Staff Search

<a href="<?php echo base_url(); ?>communication/view_user_leaves">Teachers Leaves

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/fees.png"/>

Payment

<a href="<?php echo base_url(); ?>feesstructure/fees_master">Fees Structure

<a href="<?php echo base_url(); ?>feesstructure/view_term_fees_master">Fee Status

<a href="<?php echo base_url(); ?>quota/home">Quota

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/Attendance.png"/>

Attendance

<a href="<?php echo base_url(); ?>adminattendance/home">Day Wise View

<a href="<?php echo base_url(); ?>adminattendance/monthclass">Month view

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/calender.png"/>

Calendar

<a href="<?php echo base_url(); ?>event/create">Add / View Event

<a href="<?php echo base_url(); ?>event/home">Event Calendar

<a href="<?php echo base_url(); ?>leavemanage/home">Add/ View Leave

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/timetable.png"/>

TimeTable

<a href="<?php echo base_url(); ?>timetable/home">Add TimeTable

<a href="<?php echo base_url(); ?>timetable/manage">View TimeTable

Examination

<a href="<?php echo base_url(); ?>examination/add_exam">Add / View Exams

<a href="<?php echo base_url(); ?>examination/add_exam_detail">Examination Calendar

<a href="<?php echo base_url(); ?>examination/exam_name_status">Exam Result Details

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/circular.png"/>

Circular

<a href="<?php echo base_url(); ?>circular/add_circular">Add Circular

<a href="<?php echo base_url(); ?>circular/view_circular">View Circular

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/grp.png"/>

Grouping

<a href="<?php echo base_url(); ?>grouping/home">Create/ View Groups

<a href="<?php echo base_url(); ?>grouping/send">Send Message

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/promo.png"/>

Promotion

<a href="<?php echo base_url(); ?>promotion/home">Promotion

                     <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/on duty.png"/>

On Duty

<a href="<?php echo base_url(); ?>onduty/teachers">Teachers

<a href="<?php echo base_url(); ?>onduty/students">Students

Control Panel

<a href="<?php echo base_url(); ?>userrolemanage/teachers">Teachers

<a href="<?php echo base_url(); ?>userrolemanage/parents">Parents

<a href="<?php echo base_url(); ?>userrolemanage/students">Students

                  <a href="<?php echo base_url(); ?>rank/home">
                   <img class="menuimg" src="<?php echo base_url(); ?>assets/img/icons/homework&classtest.png"/>

Rank


text:
package com.gustavemichel.FIRST.cockroach;

/**
 * The RobotMap is a mapping from the ports sensors and actuators are wired into
 * to a variable name. This provides flexibility changing wiring, makes checking
 * the wiring easier and significantly reduces the number of magic numbers
 * floating around.
 */
public class RobotMap {
    // For example to map the left and right motors, you could define the
    // following variables to use with your drivetrain subsystem.
    // public static final int leftMotor = 1;
    // public static final int rightMotor = 2;

    // If you are using multiple modules, make sure to define both the port
    // number and the module. For example you with a rangefinder:
    // public static final int rangefinderPort = 1;
    // public static final int rangefinderModule = 1;

    public static final int leftTalon = 1;
    public static final int rightTalon = 2;
    public static final int joystickPort = 1;

}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
  Copyright (c) 2013 The Chromium Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.
-->
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
    id="org.chromium.polyfill.CustomEvent"
    version="1.0.0">
  <engines>
    <engine name="cordova" version=">=3.0.0" />
  </engines>

  <name>CustomEvent constuctor shim</name>

  <platform name="android">
    <js-module src="customEvent.js" name="customEvent">
      <merges target="window" />
    </js-module>
  </platform>
</plugin>


text:
name: srv_site
description: backend web.site

templates:
 - backend.backend

returns: TABLE
returns_columns:
 -
  name: domain
  type: dns.t_domain
 -
  name: port
  type: commons.t_port
 -
  name: user
  type: server_access.t_user
 -
  name: service_entity_name
  type: dns.t_domain
 -
  name: https
  type: commons.t_key
 -
  name: subservice
  type: commons.t_key
 -
  name: option
  type: jsonb
 -
  name: backend_status
  type: backend.t_status
---

RETURN QUERY
    WITH

    -- DELETE
    d AS (
        DELETE FROM web.site AS t
        WHERE
            backend._deleted(t.backend_status) AND
            backend._machine_priviledged(t.service, t.domain)
    ),

    -- UPDATE
    s AS (
        UPDATE web.site AS t
            SET backend_status = NULL
        WHERE
            backend._machine_priviledged(t.service, t.domain) AND
            backend._active(t.backend_status)
    )

    -- SELECT
    SELECT
        t.domain,
        t.port,
        t.user,
        t.service_entity_name,
        t.https,
        t.subservice,
        t.option,
        t.backend_status
    FROM web.site AS t

    WHERE
        backend._machine_priviledged(t.service, t.domain) AND
        (backend._active(t.backend_status) OR p_include_inactive);


text: Extract patterns from Javascript comments and export them to HTML/PDF


text:
//    nVLC
//
//    Author:  Roman Ginzburg
//
//    nVLC is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    nVLC is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//    GNU General Public License for more details.
//
// ========================================================================

using System;
using Declarations.Events;
using Implementation.Media;
using LibVlcWrapper;

namespace Implementation.Events
{
    internal class MediaListPlayerEventManager : EventManager, IMediaListPlayerEvents
    {
        public MediaListPlayerEventManager(IEventProvider eventProvider)
            : base(eventProvider)
        {

        }

        protected override void MediaPlayerEventOccured(ref libvlc_event_t libvlc_event, IntPtr userData)
        {
            switch (libvlc_event.type)
            {
                case libvlc_event_e.libvlc_MediaListPlayerPlayed:
                    if (m_mediaListPlayerPlayed != null)
                    {
                        m_mediaListPlayerPlayed(m_eventProvider, EventArgs.Empty);
                    }
                    break;
                case libvlc_event_e.libvlc_MediaListPlayerNextItemSet:
                    if (m_mediaListPlayerNextItemSet != null)
                    {
                        BasicMedia media = new BasicMedia(libvlc_event.MediaDescriptor.media_list_player_next_item_set.item, ReferenceCountAction.AddRef);
                        m_mediaListPlayerNextItemSet(m_eventProvider, new MediaListPlayerNextItemSet(media));
                        //media.Release();
                    }
                    break;
                case libvlc_event_e.libvlc_MediaListPlayerStopped:
                    if (m_mediaListPlayerStopped != null)
                    {
                        m_mediaListPlayerStopped(m_eventProvider, EventArgs.Empty);
                    }
                    break;
            }
        }

        #region IMediaListPlayerEvents Members

        event EventHandler m_mediaListPlayerPlayed;
        public event EventHandler MediaListPlayerPlayed
        {
            add
            {
                if (m_mediaListPlayerPlayed == null)
                {
                    Attach(libvlc_event_e.libvlc_MediaListPlayerPlayed);
                }
                m_mediaListPlayerPlayed += value;
            }
            remove
            {
                if (m_mediaListPlayerPlayed != null)
                {
                    m_mediaListPlayerPlayed -= value;
                    if (m_mediaListPlayerPlayed == null)
                    {
                        Dettach(libvlc_event_e.libvlc_MediaListPlayerPlayed);
                    }
                }
            }
        }

        event EventHandler<MediaListPlayerNextItemSet> m_mediaListPlayerNextItemSet;
        public event EventHandler<MediaListPlayerNextItemSet> MediaListPlayerNextItemSet
        {
            add
            {
                if (m_mediaListPlayerNextItemSet == null)
                {
                    Attach(libvlc_event_e.libvlc_MediaListPlayerNextItemSet);
                }
                m_mediaListPlayerNextItemSet += value;
            }
            remove
            {
                if (m_mediaListPlayerNextItemSet != null)
                {
                    m_mediaListPlayerNextItemSet -= value;
                    if (m_mediaListPlayerNextItemSet == null)
                    {
                        Dettach(libvlc_event_e.libvlc_MediaListPlayerNextItemSet);
                    }
                }
            }
        }

        event EventHandler m_mediaListPlayerStopped;
        public event EventHandler MediaListPlayerStopped
        {
            add
            {
                if (m_mediaListPlayerStopped == null)
                {
                    Attach(libvlc_event_e.libvlc_MediaListPlayerStopped);
                }
                m_mediaListPlayerStopped += value;
            }
            remove
            {
                if (m_mediaListPlayerStopped != null)
                {
                    m_mediaListPlayerStopped -= value;
                    if (m_mediaListPlayerStopped == null)
                    {
                        Dettach(libvlc_event_e.libvlc_MediaListPlayerStopped);
                    }
                }
            }
        }

        #endregion
    }
}


text:
Configuration
~~~~~~~~~~~~~

:Author:       Manuel Pichler
:Copyright:    All rights reserved
:Description:  This document describes the configuration component of
               PHP_Depend. The configuration system allows to customize
               several aspects of PHP_Depend through a simple xml file.
:Keywords:     Configuration, XML, XML-Schema, PHP_Depend, Command-Line

Newer versions of PHP_Depend provide a flexible and easy to use configuration
file. This file can be used to tune several aspects of PHP_Depend, that were
normally hard and complicated to configure with pure command line options.

The format has changed in version 2.0 and is now embedded into the Symfony
DependencyInjection Container configuration. Besides overwriting some settings,
you are now able to overwrite many of the internal PDepend services with your
own implementations and extend the parsing process with generators and
analyzers. You can find the old format in the History section below.

Base configuration file
=======================

The minimum configuration file consists of a root element with some namespaces
but without any child elements or attributes, because all settings are optional. ::

  <?xml version="1.0" ?>
  <symfony:container xmlns:symfony="http://symfony.com/schema/dic/services"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://pdepend.org/schema/dic/pdepend"
      xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" />

Rhe `XML schema`__ for the configuration
file is used in order to get automatic validation and auto-completion in your
development environment.

Elements
========

Image Convert
-------------

The ``<image-convert>`` element is a container for all configuration settings
available for the image convert component. It is used by PHP_Depend to render
the different graphical reports like the `Overview Pyramid`__ or the the
*Abstraction & Instabilit* chart. ::

  <?xml version="1.0" ?>
  <symfony:container xmlns:symfony="http://symfony.com/schema/dic/services"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://pdepend.org/schema/dic/pdepend"
      xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" />
      <config>
          <image-convert>
              <font-family>Luxi Sans</font-family>
              <font-size>42</font-size>
          </image-convert>
      </config>
  </symfony:container>

At the moment you can only customize the font-size and the font-family that
were used in the generated graphics.

fontFamily
``````````

The ``<font-family>`` element can be used to specify a custom font-family that
should be used for all text elements rendered by PHP_Depend. This element
accepts any valid font-family identifier, as they are used to specify a
font-family in a css- or svg-file. ::

  <image-convert>
      <font-family>Luxi Sans</font-family>
  </image-convert>

Or you can specify a list of font-families: ::

  <image-convert>
      <font-family>Luxi Sans, Verdana, sans-serif</font-family>
  </image-convert>

fontSize
````````

The ``<font-size>`` element can be used to specify a new base font-size for all
charts generated by PHP_Depend. This base font-size will be used by the image
convert component to recalculate all font sizes used within a chart. This
element only accepts data of type *int*. ::

  <image-convert>
      <font-size>42</font-size>
  </image-convert>

cache
-----

Within the ``<cache>`` container element you can configure the cache backend
that will be used by PHP_Depend. The used cache backend can have a great
impact on PHP_Depend's overall performance, memory consumption and diskspace
usage. While the file based cache promises a better performance on consecutive
calls, it can require a large amount of diskspace. In contrast, the memory
based cache doesn't allocate any diskspace, but it normally requires muc
more memory and it forces the PHP_Depend to parse the whole source on every
call. ::

  <?xml version="1.0" ?>
  <symfony:container xmlns:symfony="http://symfony.com/schema/dic/services"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://pdepend.org/schema/dic/pdepend"
      xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" />
      <config>
          <cache>
              <driver>file</driver>
              <location>/var/run/pdepend</location>
          </cache>
      </config>
  </symfony:container>

driver
``````

The ``<driver>`` element can be used to define the cache backend for
PHP_Depend. At the moment this element only accepts two predefined values
as content:

- ``file``
- ``memory``

The cache driver must be specified as cdata of the ``<driver>`` element. ::

  <cache>
      <driver>file</driver>
  </cache>

The default driver used by PHP_Depend is ``file``.

location
````````

The ``<location>`` element can be used to define a custom location for the
cache files generated by PHP_Depend. As this statement already implies, the
``<location>`` element is only used by the file system based cache and will
be ignored for the memory driver. ::

  <cache>
      <location>/tmp/pdepend/cache</location>
  </cache>

The default cache location under linux/unix systems is ``$HOME + "/.pdepend"``
and under windows ``$HOMEDRIVE + $HOMEPATH + "/.pdepend"``.

Using the configuration file
============================

There are two ways how the PHP_Depend configuration file can be specified.
The first style is to declare the configuration file explicit, by using the
command line option ``--configuration``.

.. class:: shell

::

  ~ $ pdepend --configuration=my.config.xml

The second style/concept to specify PHP_Depend's configuration file was
adapted from `PHPUnit`__, where you can put an xml file named after the
tool(so ``phpunit.xml`` in the case of PHPUnit and ``pdepend.xml`` in the
case of PHP_Depend) into the current working directory. This file will
then be read and parsed automatically by PHP_Depend.

.. class:: shell

::

  ~ $ ls -l
  drwxrwxr-x  8 4096 Nov 24 11:05 build
  drwxrwxr-x  8 4096 Nov 24 11:05 src
  -rwxr--r--  1  806 Oct 19 15:07 pdepend.xml
  ~ $ pdepend --jdepend-xml=build/logs/jdepend.xml src

In this case PHP_Depend parse the configuration settings defined in the
```pdepend.xml`` file, right before it starts to parse the source.

Beside this configuration file you can also put a second file named
``pdepend.xml.dist`` into the current working directory. The purpose of
the ``*.dist`` is to provide a project with factory settings for PHP_Depend,
while the ``*.xml`` is reserved for modifications in each checkout.

PHP_Depend reads both configuration files additive. This means it first
reads the ``pdepend.xml.dist`` and overwrites the default values with those
found in the xml file. Then it reads the ``pdepend.xml`` file and only
overwrites those settings that were defined in this file.
overwrites those settings that were defined in this file.

History
=======

The command line option to specify a xml configuration file already exists
for a long time in PHP_Depend, but the configuration file wasn't really in
use until version 0.10.0. Since this release we have started to provide an
`XML-Schema`__ for the configuration fike and we moved several command line
options or previously hard-coded-switches into the xml configuration file.

Starting with 2.0 the format was changed to allow integration in the
Symfony Dependency Injection Container. For legacy reasons the old
format is documented here ::

    <?xml version="1.0" ?>
    <configuration>
        <imageConvert>
            <fontFamily>Luxi Sans</fontFamily>
            <fontSize>42</fontFamily>
        </imageConvert>
        <cache>
            <driver>file</driver>
            <location>/tmp</location>
        </cache>
    </configuration>

__ http://pdepend.org/schema/1.0/configuration.xsd
__ /documentation/handbook/reports/overview-pyramid.html
__ http://www.phpunit.de/manual/3.5/en/index.html
__ http://pdepend.org/schema/1.0/configuration.xsd

.. class:: prev

`Command Line`__

.. class:: next

`Reports`__

__ /documentation/handbook/command-line.html
__ /documentation/handbook/reports.html


text:
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;

/// <summary>
/// Base class for all units in the game.
/// </summary>
public abstract class Unit : MonoBehaviour
{
    /// <summary>
    /// UnitClicked event is invoked when user clicks the unit. It requires a collider on the unit game object to work.
    /// </summary>
    public event EventHandler UnitClicked;
    /// <summary>
    /// UnitSelected event is invoked when user clicks on unit that belongs to him. It requires a collider on the unit game object to work.
    /// </summary>
    public event EventHandler UnitSelected;
    public event EventHandler UnitDeselected;
    /// <summary>
    /// UnitHighlighted event is invoked when user moves cursor over the unit. It requires a collider on the unit game object to work.
    /// </summary>
    public event EventHandler UnitHighlighted;
    public event EventHandler UnitDehighlighted;
    public event EventHandler<AttackEventArgs> UnitAttacked;
    public event EventHandler<AttackEventArgs> UnitDestroyed;
    public event EventHandler<MovementEventArgs> UnitMoved;

    public UnitState UnitState { get; set; }
    public void SetState(UnitState state)
    {
        UnitState.MakeTransition(state);
    }

    public List<Buff> Buffs { get; private set; }

    public int TotalHitPoints { get; private set; }
    protected int TotalMovementPoints;
    protected int TotalActionPoints;

    /// <summary>
    /// Cell that the unit is currently occupying.
    /// </summary>
    public Cell Cell { get; set; }

    public int HitPoints;
    public int AttackRange;
    public int AttackFactor;
    public int DefenceFactor;
    /// <summary>
    /// Determines how far on the grid the unit can move.
    /// </summary>
    public int MovementPoints;
    /// <summary>
    /// Determines speed of movement animation.
    /// </summary>
    public float MovementSpeed;
    /// <summary>
    /// Determines how many attacks unit can perform in one turn.
    /// </summary>
    public int ActionPoints;

    /// <summary>
    /// Indicates the player that the unit belongs to. Should correspoond with PlayerNumber variable on Player script.
    /// </summary>
    public int PlayerNumber;

    /// <summary>
    /// Indicates if movement animation is playing.
    /// </summary>
    public bool isMoving { get; set; }

    private static IPathfinding _pathfinder = new AStarPathfinding();

    /// <summary>
    /// Method called after object instantiation to initialize fields etc.
    /// </summary>
    public virtual void Initialize()
    {
        Buffs = new List<Buff>();

        UnitState = new UnitStateNormal(this);

        TotalHitPoints = HitPoints;
        TotalMovementPoints = MovementPoints;
        TotalActionPoints = ActionPoints;
    }

    protected virtual void OnMouseDown()
    {
        if (UnitClicked != null)
            UnitClicked.Invoke(this, new EventArgs());
    }
    protected virtual void OnMouseEnter()
    {
        if (UnitHighlighted != null)
            UnitHighlighted.Invoke(this, new EventArgs());
    }
    protected virtual void OnMouseExit()
    {
        if (UnitDehighlighted != null)
            UnitDehighlighted.Invoke(this, new EventArgs());
    }

    /// <summary>
    /// Method is called at the start of each turn.
    /// </summary>
    public virtual void OnTurnStart()
    {
        MovementPoints = TotalMovementPoints;
        ActionPoints = TotalActionPoints;

        SetState(new UnitStateMarkedAsFriendly(this));
    }
    /// <summary>
    /// Method is called at the end of each turn.
    /// </summary>
    public virtual void OnTurnEnd()
    {
        Buffs.FindAll(b => b.Duration == 0).ForEach(b => { b.Undo(this); });
        Buffs.RemoveAll(b => b.Duration == 0);
        Buffs.ForEach(b => { b.Duration--; });

        SetState(new UnitStateNormal(this));
    }
    /// <summary>
    /// Method is called when units HP drops below 1.
    /// </summary>
    protected virtual void OnDestroyed()
    {
        Cell.IsTaken = false;
        MarkAsDestroyed();
        Destroy(gameObject);
    }

    /// <summary>
    /// Method is called when unit is selected.
    /// </summary>
    public virtual void OnUnitSelected()
    {
        SetState(new UnitStateMarkedAsSelected(this));
        if (UnitSelected != null)
            UnitSelected.Invoke(this, new EventArgs());
    }
    /// <summary>
    /// Method is called when unit is deselected.
    /// </summary>
    public virtual void OnUnitDeselected()
    {
        SetState(new UnitStateMarkedAsFriendly(this));
        if (UnitDeselected != null)
            UnitDeselected.Invoke(this, new EventArgs());
    }

    /// <summary>
    /// Method indicates if it is possible to attack unit given as parameter, from cell given as second parameter.
    /// </summary>
    public virtual bool IsUnitAttackable(Unit other, Cell sourceCell)
    {
        if (sourceCell.GetDistance(other.Cell) <= AttackRange)
            return true;

        return false;
    }
    /// <summary>
    /// Method deals damage to unit given as parameter.
    /// </summary>
    public virtual void DealDamage(Unit other)
    {
        if (isMoving)
            return;
        if (ActionPoints == 0)
            return;
        if (!IsUnitAttackable(other, Cell))
            return;

        MarkAsAttacking(other);
        ActionPoints--;
        other.Defend(this, AttackFactor);

        if (ActionPoints == 0)
        {
            SetState(new UnitStateMarkedAsFinished(this));
            MovementPoints = 0;
        }
    }
    /// <summary>
    /// Attacking unit calls Defend method on defending unit.
    /// </summary>
    protected virtual void Defend(Unit other, int damage)
    {
        MarkAsDefending(other);
        HitPoints -= Mathf.Clamp(damage - DefenceFactor, 1, damage);  //Damage is calculated by subtracting attack factor of attacker and defence factor of defender. If result is below 1, it is set to 1.
                                                                      //This behaviour can be overridden in derived classes.
        if (UnitAttacked != null)
            UnitAttacked.Invoke(this, new AttackEventArgs(other, this, damage));

        if (HitPoints <= 0)
        {
            if (UnitDestroyed != null)
                UnitDestroyed.Invoke(this, new AttackEventArgs(other, this, damage));
            OnDestroyed();
        }
    }

    public virtual void Move(Cell destinationCell, List<Cell> path)
    {
        if (isMoving)
            return;

        var totalMovementCost = path.Sum(h => h.MovementCost);
        if (MovementPoints < totalMovementCost)
            return;

        MovementPoints -= totalMovementCost;

        Cell.IsTaken = false;
        Cell = destinationCell;
        destinationCell.IsTaken = true;

        if (MovementSpeed > 0)
            StartCoroutine(MovementAnimation(path));
        else
            transform.position = Cell.transform.position;

        if (UnitMoved != null)
            UnitMoved.Invoke(this, new MovementEventArgs(Cell, destinationCell, path));
    }
    protected virtual IEnumerator MovementAnimation(List<Cell> path)
    {
        isMoving = true;

        path.Reverse();
        foreach (var cell in path)
        {
            while (new Vector2(transform.position.x,transform.position.y) != new Vector2(cell.transform.position.x,cell.transform.position.y))
            {
                transform.position = Vector3.MoveTowards(transform.position, new Vector3(cell.transform.position.x,cell.transform.position.y,transform.position.z), Time.deltaTime * MovementSpeed);
                yield return 0;
            }
        }

        isMoving = false;
    }

    ///<summary>
    /// Method indicates if unit is capable of moving to cell given as parameter.
    /// </summary>
    public virtual bool IsCellMovableTo(Cell cell)
    {
        return !cell.IsTaken;
    }
    /// <summary>
    /// Method indicates if unit is capable of moving through cell given as parameter.
    /// </summary>
    public virtual bool IsCellTraversable(Cell cell)
    {
        return !cell.IsTaken;
    }
    /// <summary>
    /// Method returns all cells that the unit is capable of moving to.
    /// </summary>
    public List<Cell> GetAvailableDestinations(List<Cell> cells)
    {
        var ret = new List<Cell>();
        var cellsInMovementRange = cells.FindAll(c => IsCellMovableTo(c) && c.GetDistance(Cell) <= MovementPoints);

        var traversableCells = cells.FindAll(c => IsCellTraversable(c) && c.GetDistance(Cell) <= MovementPoints);
        traversableCells.Add(Cell);

        foreach (var cellInRange in cellsInMovementRange)
        {
            if (cellInRange.Equals(Cell)) continue;

            var path = FindPath(traversableCells, cellInRange);
            var pathCost = path.Sum(c => c.MovementCost);
            if (pathCost > 0 && pathCost <= MovementPoints)
                ret.AddRange(path);
        }
        return ret.FindAll(IsCellMovableTo).Distinct().ToList();
    }

    public List<Cell> FindPath(List<Cell> cells, Cell destination)
    {
        return _pathfinder.FindPath(GetGraphEdges(cells), Cell, destination);
    }
    /// <summary>
    /// Method returns graph representation of cell grid for pathfinding.
    /// </summary>
    protected virtual Dictionary<Cell, Dictionary<Cell, int>> GetGraphEdges(List<Cell> cells)
    {
        Dictionary<Cell, Dictionary<Cell, int>> ret = new Dictionary<Cell, Dictionary<Cell, int>>();
        foreach (var cell in cells)
        {
            if (IsCellTraversable(cell) || cell.Equals(Cell))
            {
                ret[cell] = new Dictionary<Cell, int>();
                foreach (var neighbour in cell.GetNeighbours(cells).FindAll(IsCellTraversable))
                {
                    ret[cell][neighbour] = neighbour.MovementCost;
                }
            }
        }
        return ret;
    }

    /// <summary>
    /// Gives visual indication that the unit is under attack.
    /// </summary>
    /// <param name="other"></param>
    public abstract void MarkAsDefending(Unit other);
    /// <summary>
    /// Gives visual indication that the unit is attacking.
    /// </summary>
    /// <param name="other"></param>
    public abstract void MarkAsAttacking(Unit other);
    /// <summary>
    /// Gives visual indication that the unit is destroyed. It gets called right before the unit game object is
    /// destroyed, so either instantiate some new object to indicate destruction or redesign Defend method.
    /// </summary>
    public abstract void MarkAsDestroyed();

    /// <summary>
    /// Method marks unit as current players unit.
    /// </summary>
    public abstract void MarkAsFriendly();
    /// <summary>
    /// Method mark units to indicate user that the unit is in range and can be attacked.
    /// </summary>
    public abstract void MarkAsReachableEnemy();
    /// <summary>
    /// Method marks unit as currently selected, to distinguish it from other units.
    /// </summary>
    public abstract void MarkAsSelected();
    /// <summary>
    /// Method marks unit to indicate user that he can't do anything more with it this turn.
    /// </summary>
    public abstract void MarkAsFinished();
    /// <summary>
    /// Method returns the unit to its base appearance
    /// </summary>
    public abstract void UnMark();
}

public class MovementEventArgs : EventArgs
{
    public Cell OriginCell;
    public Cell DestinationCell;
    public List<Cell> Path;

    public MovementEventArgs(Cell sourceCell, Cell destinationCell, List<Cell> path)
    {
        OriginCell = sourceCell;
        DestinationCell = destinationCell;
        Path = path;
    }
}
public class AttackEventArgs : EventArgs
{
    public Unit Attacker;
    public Unit Defender;

    public int Damage;

    public AttackEventArgs(Unit attacker, Unit defender, int damage)
    {
        Attacker = attacker;
        Defender = defender;

        Damage = damage;
    }
}


text:
import { Utils } from "../Utils/Utils";
import { HoverMode } from "../../Enums/Modes/HoverMode";
export class Mover {
    constructor(container, particle) {
        this.container = container;
        this.particle = particle;
    }
    move(delta) {
        const container = this.container;
        const options = container.options;
        const particle = this.particle;
        if (options.particles.move.enable) {
            const slowFactor = this.getProximitySpeedFactor();
            const deltaFactor = options.fpsLimit > 0 ? (60 * delta) / 1000 : 3.6;
            const moveSpeed = container.retina.moveSpeed / 2 * slowFactor * deltaFactor;
            particle.position.x += particle.velocity.horizontal * moveSpeed;
            particle.position.y += particle.velocity.vertical * moveSpeed;
        }
        this.moveParallax();
    }
    moveParallax() {
        const container = this.container;
        const options = container.options;
        if (!options.interactivity.events.onHover.parallax.enable) {
            return;
        }
        const particle = this.particle;
        const parallaxForce = options.interactivity.events.onHover.parallax.force;
        const mousePos = container.interactivity.mouse.position || { x: 0, y: 0 };
        const windowDimension = {
            height: window.innerHeight / 2,
            width: window.innerWidth / 2,
        };
        const parallaxSmooth = options.interactivity.events.onHover.parallax.smooth;
        const tmp = {
            x: (mousePos.x - windowDimension.width) * (particle.radius / parallaxForce),
            y: (mousePos.y - windowDimension.height) * (particle.radius / parallaxForce),
        };
        particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth;
        particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth;
    }
    getProximitySpeedFactor() {
        const container = this.container;
        const options = container.options;
        const particle = this.particle;
        const active = Utils.isInArray(HoverMode.slow, options.interactivity.events.onHover.mode);
        if (!active) {
            return 1;
        }
        const mousePos = this.container.interactivity.mouse.position;
        if (!mousePos) {
            return 1;
        }
        const particlePos = particle.position;
        const dist = Utils.getDistanceBetweenCoordinates(mousePos, particlePos);
        const radius = container.retina.slowModeRadius;
        if (dist > radius) {
            return 1;
        }
        const proximityFactor = (dist / radius) || 0;
        const slowFactor = options.interactivity.modes.slow.factor;
        return proximityFactor / slowFactor;
    }
}
//# sourceMappingURL=Mover.js.map


text:
import { Entity } from "../../../../src/decorator/entity/Entity"
import { PrimaryGeneratedColumn } from "../../../../src"

@Entity("bar", { schema: "foo" })
export class Bar {
    @PrimaryGeneratedColumn()
    id: string
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.github.leonardo-couto</groupId>
  <artifactId>example-nodejs-plugin</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Example Node.js plugin webapp</name>
  <url>http://github.com/leonardo-couto/example-nodejs-plugin</url>

  <properties>
    <node.target>${basedir}/generated</node.target>
    <node.path>${node.target}/node/bin</node.path>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <finalName>example</finalName>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <downloadSources>true</downloadSources>
          <downloadJavadocs>true</downloadJavadocs>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>add-javascript-source</id>
            <phase>generate-sources</phase>
            <goals><goal>add-source</goal></goals>
            <configuration>
              <sources>
                <source>src/main/javascript</source>
              </sources>
            </configuration>
          </execution>

          <execution>
            <id>add-javascript-test-source</id>
            <phase>generate-sources</phase>
            <goals><goal>add-test-source</goal></goals>
            <configuration>
              <sources>
                <source>src/test/javascript</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
          <execution>
            <id>npm-install</id>
            <phase>initialize</phase>
            <configuration>
              <executable>${node.path}/npm</executable>
              <arguments>
                <argument>install</argument>
              </arguments>
              <workingDirectory>${basedir}</workingDirectory>
              <environmentVariables>
                <PATH>${node.path}:${env.PATH}</PATH>
              </environmentVariables>
            </configuration>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>

          <execution>
            <id>grunt-default</id>
            <phase>test</phase>
            <configuration>
              <executable>${node.path}/grunt</executable>
              <workingDirectory>${basedir}</workingDirectory>
              <environmentVariables>
                <PATH>${node.path}:${env.PATH}</PATH>
              </environmentVariables>
            </configuration>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>

        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.leonardo-couto</groupId>
        <artifactId>nodejs-installer-plugin</artifactId>
        <version>0.12.5</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <npm>
            <install>grunt-cli</install>
          </npm>
          <target>${node.target}</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.2.1.v20140609</version>
      </plugin>

    </plugins>
  </build>

</project>


text:
{% extends "modal.html" %}

{% load i18n %}

{% block modal-id %}confirm-delete-dialog{% endblock modal-id %}

{% block modal-title %}
  {% trans "Confirm" %}
{% endblock modal-title %}

{% block modal-body %}
  {% trans "Are you sure that you want to delete this baseline term?" %}
{% endblock modal-body %}

{% block modal-footer %}
  <form id="delete-form" method="POST" class="form-inline"
        action="{% url 'baseline.baselineterm_delete' baselineterm.pk %}">
    {% csrf_token %}
    <button type="button" class="btn btn-default" data-dismiss="modal">
      {% trans "Cancel" %}
    </button>
    <button type="submit" class="btn btn-danger">
      {% trans "Delete" %}
    </button>
  </form>
{% endblock modal-footer %}


text:
"""
|Document| and closely related objects
"""

from __future__ import (
    absolute_import, division, print_function, unicode_literals
)

from .blkcntnr import BlockItemContainer
from .enum.section import WD_SECTION
from .enum.text import WD_BREAK
from .section import Section, Sections
from .shared import ElementProxy, Emu

class Document(ElementProxy):
    """
    WordprocessingML (WML) document. Not intended to be constructed directly.
    Use :func:`docx.Document` to open or create a document.
    """

    __slots__ = ('_part', '__body')

    def __init__(self, element, part):
        super(Document, self).__init__(element)
        self._part = part
        self.__body = None

    def add_heading(self, text='', level=1):
        """
        Return a heading paragraph newly added to the end of the document,
        containing *text* and having its paragraph style determined by
        *level*. If *level* is 0, the style is set to `Title`. If *level* is
        1 (or omitted), `Heading 1` is used. Otherwise the style is set to
        `Heading {level}`. Raises |ValueError| if *level* is outside the
        range 0-9.
        """
        if not 0 <= level <= 9:
            raise ValueError("level must be in range 0-9, got %d" % level)
        style = 'Title' if level == 0 else 'Heading %d' % level
        return self.add_paragraph(text, style)

    def add_page_break(self):
        """
        Return a paragraph newly added to the end of the document and
        containing only a page break.
        """
        paragraph = self.add_paragraph()
        paragraph.add_run().add_break(WD_BREAK.PAGE)
        return paragraph

    def add_paragraph(self, text='', style=None):
        """
        Return a paragraph newly added to the end of the document, populated
        with *text* and having paragraph style *style*. *text* can contain
        tab (``\\t``) characters, which are converted to the appropriate XML
        form for a tab. *text* can also include newline (``\\n``) or carriage
        return (``\\r``) characters, each of which is converted to a line
        break.
        """
        return self._body.add_paragraph(text, style)

    def add_picture(self, image_path_or_stream, width=None, height=None):
        """
        Return a new picture shape added in its own paragraph at the end of
        the document. The picture contains the image at
        *image_path_or_stream*, scaled based on *width* and *height*. If
        neither width nor height is specified, the picture appears at its
        native size. If only one is specified, it is used to compute
        a scaling factor that is then applied to the unspecified dimension,
        preserving the aspect ratio of the image. The native size of the
        picture is calculated using the dots-per-inch (dpi) value specified
        in the image file, defaulting to 72 dpi if no value is specified, as
        is often the case.
        """
        run = self.add_paragraph().add_run()
        return run.add_picture(image_path_or_stream, width, height)

    def add_section(self, start_type=WD_SECTION.NEW_PAGE):
        """
        Return a |Section| object representing a new section added at the end
        of the document. The optional *start_type* argument must be a member
        of the :ref:`WdSectionStart` enumeration, and defaults to
        ``WD_SECTION.NEW_PAGE`` if not provided.
        """
        new_sectPr = self._element.body.add_section_break()
        new_sectPr.start_type = start_type
        return Section(new_sectPr)

    def add_table(self, rows, cols, style=None):
        """
        Add a table having row and column counts of *rows* and *cols*
        respectively and table style of *style*. *style* may be a paragraph
        style object or a paragraph style name. If *style* is |None|, the
        table inherits the default table style of the document.
        """
        table = self._body.add_table(rows, cols, self._block_width)
        table.style = style
        return table

    @property
    def core_properties(self):
        """
        A |CoreProperties| object providing read/write access to the core
        properties of this document.
        """
        return self._part.core_properties

    @property
    def inline_shapes(self):
        """
        An |InlineShapes| object providing access to the inline shapes in
        this document. An inline shape is a graphical object, such as
        a picture, contained in a run of text and behaving like a character
        glyph, being flowed like other text in a paragraph.
        """
        return self._part.inline_shapes

    @property
    def paragraphs(self):
        """
        A list of |Paragraph| instances corresponding to the paragraphs in
        the document, in document order. Note that paragraphs within revision
        marks such as ``<w:ins>`` or ``<w:del>`` do not appear in this list.
        """
        return self._body.paragraphs

    @property
    def part(self):
        """
        The |DocumentPart| object of this document.
        """
        return self._part

    def save(self, path_or_stream):
        """
        Save this document to *path_or_stream*, which can be either a path to
        a filesystem location (a string) or a file-like object.
        """
        self._part.save(path_or_stream)

    @property
    def sections(self):
        """
        A |Sections| object providing access to each section in this
        document.
        """
        return Sections(self._element)

    @property
    def settings(self):
        """
        A |Settings| object providing access to the document-level settings
        for this document.
        """
        return self._part.settings

    @property
    def styles(self):
        """
        A |Styles| object providing access to the styles in this document.
        """
        return self._part.styles

    @property
    def tables(self):
        """
        A list of |Table| instances corresponding to the tables in the
        document, in document order. Note that only tables appearing at the
        top level of the document appear in this list; a table nested inside
        a table cell does not appear. A table within revision marks such as
        ``<w:ins>`` or ``<w:del>`` will also not appear in the list.
        """
        return self._body.tables

    @property
    def _block_width(self):
        """
        Return a |Length| object specifying the width of available "writing"
        space between the margins of the last section of this document.
        """
        section = self.sections[-1]
        return Emu(
            section.page_width - section.left_margin - section.right_margin
        )

    @property
    def _body(self):
        """
        The |_Body| instance containing the content for this document.
        """
        if self.__body is None:
            self.__body = _Body(self._element.body, self)
        return self.__body

class _Body(BlockItemContainer):
    """
    Proxy for ``<w:body>`` element in this document, having primarily a
    container role.
    """
    def __init__(self, body_elm, parent):
        super(_Body, self).__init__(body_elm, parent)
        self._body = body_elm

    def clear_content(self):
        """
        Return this |_Body| instance after clearing it of all content.
        Section properties for the main document story, if present, are
        preserved.
        """
        self._body.clear_content()
        return self


text:
package main

import (
	"net/http"
	"sync"
	"time"

	"github.com/1lann/airlift/airlift"
	humanize "github.com/dustin/go-humanize"
	"github.com/gin-gonic/contrib/renders/multitemplate"
	"github.com/gin-gonic/contrib/sessions"
	"github.com/gin-gonic/gin"
)

func formatBasicTime(t time.Time) string {
	return getDay(t) + " " + t.Format("January 2006 at 3:04 PM")
}

func init() {
	registers = append(registers, func(r *gin.RouterGroup, t multitemplate.Render) {
		t.AddFromFiles("notes", viewsPath+"/notes.tmpl",
			viewsPath+"/components/base.tmpl")
		r.GET("/notes", viewUserNotes)

		t.AddFromFiles("view-note", viewsPath+"/view-note.tmpl",
			viewsPath+"/components/base.tmpl")
		r.GET("/notes/:id", viewNote)

		r.POST("/notes/:id/star", func(c *gin.Context) {
			starred := c.PostForm("starred") == "true"
			username := c.MustGet("user").(airlift.User).Username

			err := airlift.SetNoteStar(c.Param("id"), username, starred)
			if err != nil {
				panic(err)
			}

			c.JSON(http.StatusOK, gin.H{"status": "ok"})
		})
	})
}

func viewNote(c *gin.Context) {
	id := c.Param("id")
	user := c.MustGet("user").(airlift.User)

	note, err := airlift.GetFullNote(id, user.Username)
	if err != nil {
		panic(err)
	}

	if note.Title == "" {
		c.HTML(http.StatusNotFound, "not-found", nil)
		return
	}

	files := []fileCard{
		{
			Name: "Notes",
			Size: humanize.Bytes(note.Size),
			URL:  "/download/notes/" + note.ID,
		},
	}

	session := sessions.Default(c)
	uploadFlashes := session.Flashes("upload")
	uploadSuccess := ""
	if len(uploadFlashes) > 0 {
		uploadSuccess = uploadFlashes[0].(string)
	}
	session.Save()

	htmlOK(c, "view-note", gin.H{
		"ActiveMenu":    "notes",
		"Note":          note,
		"Files":         files,
		"IsUploader":    note.Uploader == user.Username,
		"UploadTime":    formatBasicTime(note.UploadTime),
		"UpdatedTime":   formatBasicTime(note.UpdatedTime),
		"UploadSuccess": uploadSuccess,
	})
}

func viewUserNotes(c *gin.Context) {
	user := c.MustGet("user").(airlift.User)

	wg := new(sync.WaitGroup)
	wg.Add(2)

	var starred []airlift.Note
	go func() {
		defer func() {
			wg.Done()
		}()
		var err error
		starred, err = airlift.GetStarredNotes(user.Username)
		if err != nil {
			panic(err)
		}
	}()

	var uploaded []airlift.Note
	go func() {
		defer func() {
			wg.Done()
		}()
		var err error
		uploaded, err = airlift.GetUploadedNotes(user.Username)
		if err != nil {
			panic(err)
		}
	}()

	deleted := false
	session := sessions.Default(c)
	uploadFlashes := session.Flashes("upload")
	if len(uploadFlashes) > 0 && uploadFlashes[0] == "delete" {
		deleted = true
	}
	session.Save()

	wg.Wait()

	htmlOK(c, "notes", gin.H{
		"ActiveMenu": "notes",
		"Starred":    starred,
		"Uploaded":   uploaded,
		"Deleted":    deleted,
	})
}


text:
require 'test_helper'

class LevelSourceHintsControllerTest < ActionController::TestCase
end