text:
configuration MSFT_xWebsite_Present_Started
{
    param(

        [Parameter(Mandatory = $true)]
        [String] $CertificateThumbprint

    )

    Import-DscResource -ModuleName xWebAdministration

    Node $AllNodes.NodeName
    {
        xWebsite Website
        {
            Name = $Node.Website
            Ensure = 'Present'
            ApplicationType = $Node.ApplicationType
            ApplicationPool = $Node.ApplicationPool
            AuthenticationInfo = `
                MSFT_xWebAuthenticationInformation
                {
                    Anonymous = $Node.AuthenticationInfoAnonymous
                    Basic     = $Node.AuthenticationInfoBasic
                    Digest    = $Node.AuthenticationInfoDigest
                    Windows   = $Node.AuthenticationInfoWindows
                }
            BindingInfo = @(MSFT_xWebBindingInformation
                {
                    Protocol              = $Node.HTTPProtocol
                    Port                  = $Node.HTTPPort
                    IPAddress             = '*'
                    Hostname              = $Node.HTTP1Hostname
                }
                MSFT_xWebBindingInformation
                {
                    Protocol              = $Node.HTTPProtocol
                    Port                  = $Node.HTTPPort
                    IPAddress             = '*'
                    Hostname              = $Node.HTTP2Hostname
                }
                MSFT_xWebBindingInformation
                {
                    Protocol              = $Node.HTTPSProtocol
                    Port                  = $Node.HTTPSPort
                    IPAddress             = '*'
                    Hostname              = $Node.HTTPSHostname
                    CertificateThumbprint = $CertificateThumbprint
                    CertificateStoreName  = $Node.CertificateStoreName
                    SslFlags              = $Node.SslFlags
                })
            DefaultPage = $Node.DefaultPage
            EnabledProtocols = $Node.EnabledProtocols
            PhysicalPath = $Node.PhysicalPath
            PreloadEnabled = $Node.PreloadEnabled
            ServiceAutoStartEnabled = $Node.ServiceAutoStartEnabled
            ServiceAutoStartProvider = $Node.ServiceAutoStartProvider
            State = 'Started'
        }
    }
}

configuration MSFT_xWebsite_Present_Stopped
{
    param(

        [Parameter(Mandatory = $true)]
        [String]$CertificateThumbprint

    )

    Import-DscResource -ModuleName xWebAdministration

    Node $AllNodes.NodeName
    {
        xWebsite Website
        {
            Name = $Node.Website
            Ensure = 'Present'
            ApplicationType = $Node.ApplicationType
            ApplicationPool = $Node.ApplicationPool
            AuthenticationInfo = `
                MSFT_xWebAuthenticationInformation
                {
                    Anonymous = $Node.AuthenticationInfoAnonymous
                    Basic     = $Node.AuthenticationInfoBasic
                    Digest    = $Node.AuthenticationInfoDigest
                    Windows   = $Node.AuthenticationInfoWindows
                }
            BindingInfo = @(
                MSFT_xWebBindingInformation
                {
                    Protocol              = $Node.HTTPProtocol
                    Port                  = $Node.HTTPPort
                    IPAddress             = '*'
                    Hostname              = $Node.HTTP1Hostname
                }
                MSFT_xWebBindingInformation
                {
                    Protocol              = $Node.HTTPProtocol
                    Port                  = $Node.HTTPPort
                    IPAddress             = '*'
                    Hostname              = $Node.HTTP2Hostname
                }
                MSFT_xWebBindingInformation
                {
                    Protocol              = $Node.HTTPSProtocol
                    Port                  = $Node.HTTPSPort
                    IPAddress             = '*'
                    Hostname              = $Node.HTTPSHostname
                    CertificateThumbprint = $CertificateThumbprint
                    CertificateStoreName  = $Node.CertificateStoreName
                    SslFlags              = $Node.SslFlags
            })
            DefaultPage = $Node.DefaultPage
            EnabledProtocols = $Node.EnabledProtocols
            PhysicalPath = $Node.PhysicalPath
            PreloadEnabled = $Node.PreloadEnabled
            ServiceAutoStartEnabled = $Node.ServiceAutoStartEnabled
            ServiceAutoStartProvider = $Node.ServiceAutoStartProvider
            State = 'Stopped'
        }
    }
}

configuration MSFT_xWebsite_Absent
{
    Import-DscResource -ModuleName xWebAdministration

    Node $AllNodes.NodeName
    {
        xWebsite Website
        {
            Name = $Node.Website
            Ensure = 'Absent'
        }
    }
}


text:
package de.li2b2.shrine.node.i2b2;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import org.aktin.broker.client.auth.ClientAuthenticator;

public class PlainHeaderAuthenticator implements ClientAuthenticator{
	public static final String X_SSL_CLIENT_ID = "X-SSL-Client-ID";
	public static final String X_SSL_CLIENT_DN = "X-SSL-Client-DN";
	public static final String X_SSL_CLIENT_VERIFY = "X-SSL-Client-Verify";

	private String clientId;
	private String clientDn;

	private PlainHeaderAuthenticator(String clientId, String clientDn) {
		this.clientDn = clientDn;
		this.clientId = clientId;
	}
	@Override
	public HttpURLConnection openAuthenticatedConnection(URL url) throws IOException {
		HttpURLConnection c = (HttpURLConnection)url.openConnection();
		c.setRequestProperty(X_SSL_CLIENT_VERIFY, "SUCCESS");
		c.setRequestProperty(X_SSL_CLIENT_ID, clientId);
		c.setRequestProperty(X_SSL_CLIENT_DN, clientDn);
		return c;
	}

}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

describe('Controller: UserCtrl', function () {

  // load the controller's module
  beforeEach(module('frontendApp'));

  var UserCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    UserCtrl = $controller('UserCtrl', {
      $scope: scope
      // place here mocked dependencies
    });
  }));

  it('should attach a list of awesomeThings to the scope', function () {
    expect(UserCtrl.awesomeThings.length).toBe(3);
  });
});


text:
package org.onosproject.codec.impl;

import java.time.Duration;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
import org.onlab.util.Bandwidth;
import org.onosproject.codec.JsonCodec;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.DefaultApplicationId;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.GridType;
import org.onosproject.net.HostId;
import org.onosproject.net.Lambda;
import org.onosproject.net.NetTestTools;
import org.onosproject.net.OchSignalType;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.Criteria;
import org.onosproject.net.intent.AbstractIntentTest;
import org.onosproject.net.intent.Constraint;
import org.onosproject.net.intent.HostToHostIntent;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.IntentServiceAdapter;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.net.intent.constraint.AnnotationConstraint;
import org.onosproject.net.intent.constraint.AsymmetricPathConstraint;
import org.onosproject.net.intent.constraint.BandwidthConstraint;
import org.onosproject.net.intent.constraint.LambdaConstraint;
import org.onosproject.net.intent.constraint.LatencyConstraint;
import org.onosproject.net.intent.constraint.ObstacleConstraint;
import org.onosproject.net.intent.constraint.WaypointConstraint;
import org.onosproject.net.resource.link.BandwidthResource;
import org.onosproject.net.resource.link.LambdaResource;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableList;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.onosproject.codec.impl.IntentJsonMatcher.matchesIntent;
import static org.onosproject.net.NetTestTools.did;
import static org.onosproject.net.NetTestTools.hid;

/**
 * Unit tests for the host to host intent class codec.
 */
public class IntentCodecTest extends AbstractIntentTest {

    private final HostId id1 = hid("12:34:56:78:91:ab/1");
    private final HostId id2 = hid("12:34:56:78:92:ab/1");
    private final ApplicationId appId = new DefaultApplicationId(3, "test");
    final TrafficSelector emptySelector =
            DefaultTrafficSelector.emptySelector();
    final TrafficTreatment emptyTreatment =
            DefaultTrafficTreatment.emptyTreatment();
    private final MockCodecContext context = new MockCodecContext();

    @Before
    public void setUpIntentService() {
        final IntentService mockIntentService = new IntentServiceAdapter();
        context.registerService(IntentService.class, mockIntentService);
    }

    /**
     * Tests the encoding of a host to host intent.
     */
    @Test
    public void hostToHostIntent() {
        final HostToHostIntent intent =
                HostToHostIntent.builder()
                        .appId(appId)
                        .one(id1)
                        .two(id2)
                        .build();

        final JsonCodec<HostToHostIntent> intentCodec =
                context.codec(HostToHostIntent.class);
        assertThat(intentCodec, notNullValue());

        final ObjectNode intentJson = intentCodec.encode(intent, context);
        assertThat(intentJson, matchesIntent(intent));
    }

    /**
     * Tests the encoding of a point to point intent.
     */
    @Test
    public void pointToPointIntent() {
        ConnectPoint ingress = NetTestTools.connectPoint("ingress", 1);
        ConnectPoint egress = NetTestTools.connectPoint("egress", 2);

        final PointToPointIntent intent =
                PointToPointIntent.builder()
                        .appId(appId)
                        .selector(emptySelector)
                        .treatment(emptyTreatment)
                        .ingressPoint(ingress)
                        .egressPoint(egress).build();

        final JsonCodec<PointToPointIntent> intentCodec =
                context.codec(PointToPointIntent.class);
        assertThat(intentCodec, notNullValue());

        final ObjectNode intentJson = intentCodec.encode(intent, context);
        assertThat(intentJson, matchesIntent(intent));
    }

    /**
     * Tests the encoding of an intent with treatment, selector and constraints
     * specified.
     */
    @Test
    public void intentWithTreatmentSelectorAndConstraints() {
        ConnectPoint ingress = NetTestTools.connectPoint("ingress", 1);
        ConnectPoint egress = NetTestTools.connectPoint("egress", 2);
        DeviceId did1 = did("device1");
        DeviceId did2 = did("device2");
        DeviceId did3 = did("device3");
        Lambda ochSignal = Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8);
        final TrafficSelector selector = DefaultTrafficSelector.builder()
                .matchIPProtocol((byte) 3)
                .matchMplsLabel(MplsLabel.mplsLabel(4))
                .add(Criteria.matchOchSignalType(OchSignalType.FIXED_GRID))
                .add(Criteria.matchLambda(ochSignal))
                .matchEthDst(MacAddress.BROADCAST)
                .matchIPDst(IpPrefix.valueOf("1.2.3.4/24"))
                .build();
        final TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                .setLambda((short) 33)
                .setMpls(MplsLabel.mplsLabel(44))
                .setOutput(PortNumber.CONTROLLER)
                .setEthDst(MacAddress.BROADCAST)
                .build();

        final List<Constraint> constraints =
                ImmutableList.of(
                    new BandwidthConstraint(new BandwidthResource(Bandwidth.bps(1.0))),
                    new LambdaConstraint(LambdaResource.valueOf(3)),
                    new AnnotationConstraint("key", 33.0),
                    new AsymmetricPathConstraint(),
                    new LatencyConstraint(Duration.ofSeconds(2)),
                    new ObstacleConstraint(did1, did2),
                    new WaypointConstraint(did3));

        final PointToPointIntent intent =
                PointToPointIntent.builder()
                        .appId(appId)
                        .selector(selector)
                        .treatment(treatment)
                        .ingressPoint(ingress)
                        .egressPoint(egress)
                        .constraints(constraints)
                        .build();

        final JsonCodec<PointToPointIntent> intentCodec =
                context.codec(PointToPointIntent.class);
        assertThat(intentCodec, notNullValue());

        final ObjectNode intentJson = intentCodec.encode(intent, context);
        assertThat(intentJson, matchesIntent(intent));

    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Leaky wall — TimML 5.0.0 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="String of leaky wall segments" href="leakylinedoubletstring.html" />
    <link rel="prev" title="String of impermeable wall segments" href="implinedoubletstring.html" />

  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />

  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

Leaky wall¶

class timml.linedoublet.LeakyLineDoublet(model, x1=-1, y1=0, x2=1, y2=0, res=0, order=0, layers=0, label=None, addtomodel=True)[source]¶

Create a segment of a leaky wall, which is
simulated with a line-doublet. The specific discharge through
the wall is equal to the head difference across the wall
divided by the resistance of the wall.

<col class="field-name" />
<col class="field-body" />

Parameters:

model (Model object) – Model to which the element is added

x1 (scalar) – x-coordinate of fist point of line-doublet

y1 (scalar) – y-coordinate of fist point of line-doublet

x2 (scalar) – x-coordinate of second point of line-doublet

y2 (scalar) – y-coordinate of second point of line-doublet

res (scalar) – resistance of leaky wall

order (int (default is 0)) – polynomial order of potential jump along line-doublet
(head jump if transmissivity is equal on each side of wall)

layers (scalar, list or array) – layer(s) in which element is placed
if scalar: element is placed in this layer
if list or array: element is placed in all these layers

label (str or None) – label of element

See also

LeakyLineDoubletString

TimML

TimML is a multi-layer analytic element model

Navigation

Models

Inhomogeneities

Elements

Wells

Line-sinks

Line-doublets

ImpLineDoublet

ImpLineDoubletString

LeakyLineDoublet

LeakyLineDoubletString

Constant

Uniform flow

Area-sinks

Utilities

Xsection model

Related Topics

Documentation overview

Elements

Line-doublets

Previous: String of impermeable wall segments

Next: String of leaky wall segments

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

      ©2017, Mark Bakker.

      |
      Powered by Sphinx 1.7.9
      & Alabaster 0.7.11

      |
      Page source


text:
namespace agency
{

template<class T>
using is_bulk_executor = agency::detail::disjunction<
  is_bulk_synchronous_executor<T>,
  is_bulk_asynchronous_executor<T>,
  is_bulk_continuation_executor<T>
>;

namespace detail
{

// a fake Concept to use with __AGENCY_REQUIRES
template<class T>
constexpr bool BulkExecutor()
{
  return is_bulk_executor<T>();
}

} // end detail
} // end agency


text:
package systemtools;

public class Echo {

	public static int sayIt(String phrase) {
		System.out.println(phrase);

		return 0;
	}

}


text:
describe("Dashboard Trigger With Options Material Info Widget", () => {
  const m = require("mithril");

  const TriggerWithOptionsInfo = require('models/dashboard/trigger_with_options_info');
  const MaterialInfoWidget     = require("views/dashboard/trigger_with_options/material_info_widget");
  const TimeFormatter          = require('helpers/time_formatter');

  let $root, root;
  beforeEach(() => {
    [$root, root] = window.createDomElementForTest();
  });

  afterEach(() => {
    window.destroyDomElementForTest();
  });

  let triggerWithOptionsInfo;

  beforeEach(() => {
    triggerWithOptionsInfo = TriggerWithOptionsInfo.fromJSON(json);
  });

  afterEach(() => {
    m.mount(root, null);
    m.redraw();
  });

  function mount(material) {
    material.performSearch         = jasmine.createSpy('performSearch');
    material.searchText            = jasmine.createSpy('searchText');
    material.searchInProgress      = jasmine.createSpy('searchInProgress');
    material.materialSearchResults = jasmine.createSpy('materialSearchResult');
    material.isRevisionSelected    = jasmine.createSpy('isRevisionSelected');
    material.materialSearchResults.and.returnValue(searchResults);
    m.mount(root, {
      view() {
        return m(MaterialInfoWidget, {
          material
        });
      }
    });
    m.redraw(true);
  }

  it("it should render material info when revision is present", () => {
    mount(triggerWithOptionsInfo.materials[0]);
    const material = json.materials[0];

    expect($root.find('.name-value .meta')).toContainText(material.type);

    expect($root.find('.name-value .meta')).toContainText(material.name);

    expect($root.find('.name-value .destination')).toContainText(material.folder);

    expect($root.find('.name-value .date')).toContainText(TimeFormatter.format(material.revision.date));

    expect($root.find('.name-value .user')).toContainText(material.revision.user);

    expect($root.find('.name-value .comment')).toContainText(material.revision.comment);

    expect($root.find('.name-value .last-run-revision')).toContainText(material.revision.last_run_revision);
  });

  it("it should render material info when revision is not present", () => {
    mount(triggerWithOptionsInfo.materials[1]);
    const material = json.materials[1];

    expect($root.find('.name-value .meta')).toContainText(material.type);
    expect($root.find('.name-value .meta')).toContainText(material.name);

    expect($root.find('.name-value .destination')).toContainText('not specified');

    expect($root.find('.name-value .date')).toContainText('never ran');

    expect($root.find('.name-value .user')).toContainText('never ran');

    expect($root.find('.name-value .comment')).toContainText('never ran');

    expect($root.find('.name-value .last-run-revision')).toContainText('never ran');
  });

  it('should render searched material revision spinner', () => {
    mount(triggerWithOptionsInfo.materials[0]);
    expect($root.find('.commits')).toBeInDOM();
  });

  const json = {
    "variables": [],
    "materials": [
      {
        "type":        "Git",
        "name":        "material1",
        "folder":      "gocd",
        "fingerprint": "3dcc10e7943de637211a4742342fe456ffbe832577bb377173007499434fd819",
        "revision":    {
          "date":              "2018-02-08T04:32:11Z",
          "user":              "Ganesh S Patil <ganeshpl@thoughtworks.com>",
          "comment":           "Refactor Pipeline Widget (#4311)\n\n* Extract out PipelineHeaderWidget and PipelineOperationsWidget into seperate msx files",
          "last_run_revision": "a2d23c5505ac571d9512bdf08d6287e47dcb52d5"
        }
      },

      {
        "type":        "Git",
        "name":        "material2",
        "fingerprint": "3dcc10e7943de637211a4742342fe456ffbe832577bb377173007499434fd819",
        "revision":    {}
      },
      {
        "type":        "Git",
        "name":        "material2",
        "fingerprint": "3dcc10e7943de637211a4742342fe456ffbe832577bb377173007499434fd819",
        "revision":    {
          'some-junk': '123'
        }
      }
    ]
  };

  const searchResults = [
    {
      "revision": "2a4b782a3a7d2eb13868da75149e716b15f52e5d",
      "user":     "GaneshSPatil <ganeshpl@thoughtworks.com>",
      "date":     "2018-02-12T11:02:48Z",
      "comment":  "implemented feature boo"
    },
    {
      "revision": "7f7653464e14682c7c9ce6a8bf85989a9a52eb35",
      "user":     "GaneshSPatil <ganeshpl@thoughtworks.com>",
      "date":     "2018-02-12T11:01:53Z",
      "comment":  "implemented feature boo"
    },
    {
      "revision": "24d682d8b8a99e8862acac8cae092caeca3a51f3",
      "user":     "GaneshSPatil <ganeshpl@thoughtworks.com>",
      "date":     "2018-02-12T11:01:36Z",
      "comment":  "implemented feature baz"
    },
    {
      "revision": "e5b730abdf7954e7ff45a4c15b2333c550559b35",
      "user":     "GaneshSPatil <ganeshpl@thoughtworks.com>",
      "date":     "2018-02-12T11:01:12Z",
      "comment":  "implemented feature bar"
    },
    {
      "revision": "c30118c0a6e7e6042a50e2db1e191db081e915f0",
      "user":     "GaneshSPatil <ganeshpl@thoughtworks.com>",
      "date":     "2018-02-12T11:01:02Z",
      "comment":  "implemented feature foo"
    }
  ];

});


text:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-styles/typography.html">

<dom-module id="athlete-card">
	<template>
		<paper-card image="http://placehold.it/200x100/FFC107/000000" on-tap="_selectAthlete" >

[[athlete.name]]

		</paper-card>
	</template>

</dom-module>


text:
module Ground {

  export interface Query_Result {
    query_count:number
    return_sql?:boolean
    user
  }

  export interface IPager {
    limit?
    offset?
  }

  export interface Query_Filter_Source {
    property?:string
    path?:string
    value
    operator?:string
    type?:string
    filters?:Query_Filter_Source[]
  }

  export interface Query_Filter {
    path?:string
    property?:landscape.Property
    value?
    operator?:string
    type?:string
    filters?:Query_Filter[]
  }

  export interface Condition_Source {
    path?:string
    value?
    operator?:string

    type?:string
    filters?:Condition_Source[]
  }

  export interface Condition {
    path?:landscape.Property[]
    value?
    operator?:string

    type?:string
    filters?:Condition[]
  }

  export interface Query_Sort {
    property?
    path?
    dir?
  }

  function generate_operator_map() {
    var like = {
      "render": (result, filter, property, data)=> {
        if (data.value !== null)
          data.value = "'%" + data.value + "%'"
      }
    }

    var in_operator = {
      "render": (result, filter, property:landscape.Property, data)=> {
        var values = data.value.map((v)=> property.get_sql_value(v))
        data.value = "(" + values.join(', ') + ")"
      },
      "validate": (value, path, query)=> {
        return MetaHub.is_array(value)
      }
    }

    return {
      '=': null,
      'like': like,
      'LIKE': like,
      '!=': null,
      '<': null,
      '>': null,
      '<=': null,
      '>=': null,
      '=>': null,
      '=<': null,
      'in': in_operator,
      'IN': in_operator
    }
  }

//  export interface Filter_Operator {
//    symbol:string
//    action
//  }

  export interface Query_Transform {
    clause:string // A transitional hack.  This isn't something that could be used by a public service.
  }

  export class Query_Builder {
    ground:Core
    trellis:landscape.Trellis
    pager:IPager
    type:string = 'query'
    properties
    condition:Condition
    sorts:Query_Sort[] = []
    source:External_Query_Source
    include_links:boolean = false
    transforms:Query_Transform[] = []
    subqueries = {}
    map = {}
    queries:Query_Builder[] = undefined // used for Unions
    optimized_union:boolean = false
    public static operators = generate_operator_map()

    filters:Query_Filter[] = []

    constructor(trellis:landscape.Trellis) {
      this.trellis = trellis
      this.ground = trellis.ground
    }

    public static create(ground:Core, source = null):Query_Builder {
      var trellis = ground.sanitize_trellis_argument(source.trellis)
      var result = new Query_Builder(trellis)
      result.extend(source)
      return result
    }

    static add_operator(symbol:string, action) {
      Query_Builder.operators[symbol] = action
    }

    add_filter(path:string, value = null, operator:string = '=') {
      var operator_entry = Query_Builder.operators[operator]
      if (operator_entry === undefined)
        throw new Error("Invalid operator: '" + operator + "'.")

      if (operator_entry && typeof operator_entry.validate === 'function') {
        if (!operator_entry.validate(value, path, this))
          throw new Error('Invalid value for filtering ' + path + ' using operator "' + operator + '".')
      }
      else if (value === undefined) {
        throw new Error('Cannot add property filter where value is undefined; property = ' + this.trellis.name + '.' + path + '.')
      }

      var filter = <Query_Filter>{
        path: path,
        value: value,
        operator: operator
      }

      if (path.indexOf('.') === -1) {
        var properties = this.trellis.get_all_properties()
        filter.property = properties[path]
        if (!filter.property) {
          throw new Ground.InputError('Invalid filter path.  landscape.Trellis ' + this.trellis.name
          + ' does not have a property named "' + path + '.')
        }
      }

      this.filters.push(filter)
    }

    create_filter(source:Query_Filter_Source):Query_Filter {
      if (source.type == "or" || source.type == "and") {
        return {
          type: source.type,
          filters: source.filters.map((x) => this.create_filter(x))
        }
      }
      else {
        var operator = source.operator || '='
        if (Query_Builder.operators[operator] === undefined)
          throw new Error("Invalid operator: '" + operator + "'.")

        if (source.value === undefined) {
          throw new Error('Cannot add property filter where value is undefined; property = '
          + this.trellis.name + '.' + source.path + '.')
        }

        var filter = {
          path: source.path, // Query_Renderer.get_chain(source.path, this.trellis),
          value: source.value,
          operator: operator
        }

        return filter
      }
    }

    add_key_filter(value) {
      this.add_filter(this.trellis.primary_key, value)
    }

    add_sort(sort:Query_Sort) {
      this.sorts.push(sort)
    }

    add_map(target:string, source = null) {
      this.map[target] = source
    }

    add_query(source):Query_Builder {
      var trellis = this.ground.sanitize_trellis_argument(source.trellis)
      var query = new Query_Builder(trellis)
      this.queries = this.queries || []
      this.queries.push(query)
      query.extend(source)

      return query
    }

    add_subquery(property_name:string, source = null):Query_Builder {
      var properties = this.trellis.get_all_properties()
      var property = properties[property_name]
      if (!property)
        throw new Error('Cannot create subquery. '
        + this.trellis.name + ' does not have a property named ' + property_name + '.')

      if (!property.other_trellis)
        throw new Error('Cannot create a subquery from ' + property.fullname() + ' it does not reference another trellis.')

      var query = this.subqueries[property_name]
      if (!query) {
        query = new Query_Builder(property.other_trellis)
        query.include_links = false
        this.subqueries[property_name] = query
      }

      query.extend(source)
      return query
    }

    add_transform_clause(clause:string) {
      this.transforms.push({
        clause: clause
      })
    }

    create_runner():Query_Runner {
      return new Query_Runner(this)
    }

    static create_join_filter(property:landscape.Property, seed):Query_Filter {
      var value = property.parent.get_identity(seed)
      if (value === undefined || value === null)
        throw new Error(property.fullname() + ' could not get a valid identity from the provided seed.')

      var other_property = property.get_other_property(true)
      return {
        path: other_property.name,
        property: other_property,
        value: value,
        operator: '='
      }
    }

    extend(source) {
      if (!source) // I think it's okay to allow null to be passed to this method
        return

      if (typeof source.type === 'string')
        this.type = source.type

      var i
      this.source = source

      if (source.filters) {
        for (i = 0; i < source.filters.length; ++i) {
          var filter = source.filters[i]
          //this.add_filter(filter.path || filter.property, filter.value, filter.operator)
          this.filters.push(this.create_filter(filter))
        }
      }

      //if (source.condition) {
      //  this.condition = this.create_condition(source.condition)
      //}

      if (source.sorts) {
        for (i = 0; i < source.sorts.length; ++i) {
          this.add_sort(source.sorts[i])
        }
      }

      if (source.pager) {
        this.pager = source.pager
      }
      if (source.range) {
        this.pager = {
          offset: source.range.start,
          limit: source.range.length
        }
      }

      if (source.type === 'union') {
        for (i = 0; i < source.queries.length; ++i) {
          this.add_query(source.queries[i])
        }
      }
      else if (source.properties) {
        this.add_properties(source.properties)
      }

      if (typeof source.subqueries == 'object') {
        for (i in source.subqueries) {
          this.add_subquery(i, source.subqueries[i])
        }
      }

      if (typeof source.map == 'object') {
        for (i in source.map) {
          this.add_map(i, source.map[i])
        }
      }

      if (MetaHub.is_array(source.expansions)) {
        this.add_expansions(source.expansions)
      }
    }

    add_properties(source_properties) {
      var properties = this.trellis.get_all_properties()
      this.properties = this.properties || {}
      for (var i in source_properties) {
        var property = source_properties[i]
        if (typeof property == 'string') {
          if (!properties[property])
            throw new Error('Error with overriding query properties: ' + this.trellis.name + ' does not have a property named ' + property + '.')

          this.properties[property] = {}
        }
        else {
          var name = property.name || i
          if (!properties[name])
            throw new Error('Error with overriding query properties: ' + this.trellis.name + ' does not have a property named ' + name + '.')

          if (property)
            this.properties[name] = property
        }
      }

      var identities = [this.trellis.properties[this.trellis.primary_key]]
      if (identities[0].composite_properties && identities[0].composite_properties.length > 0) {
        identities = identities.concat(identities[0].composite_properties)
      }

      for (var k in identities) {
        var identity = identities[k]
        if (!this.properties[identity.name])
          this.properties[identity.name] = {}
      }
    }

    add_expansions(expansions) {
      for (var i = 0; i < expansions.length; ++i) {
        var expansion = expansions[i]
        var tokens = expansion.split(/[\/\.]/g)
        var subquery = this
        for (var j = 0; j < tokens.length; ++j) {
          subquery = subquery.add_subquery(tokens[j], {})
        }
      }
    }

    get_primary_key_value() {
      var filters = this.filters.filter((filter)=>filter.path == this.trellis.primary_key)
      if (filters.length > 0)
        return filters[0].value

      return undefined
    }

    get_properties() {
      if (this.properties && Object.keys(this.properties).length > 0) {
        var properties = this.trellis.get_all_properties()
        return MetaHub.map(this.properties, (property, key)=> properties[key])
      }
      else {
        return this.trellis.get_all_properties()
      }
    }

    get_field_properties() {
      var result = {}
      var properties = this.get_properties()
      for (var i in properties) {
        var property = properties[i]
        if (property.type == 'list')
          continue

        if (property.is_virtual) {
          var field = property.get_field_override()
          if (!field || typeof field.sql != 'string')
            continue
        }

        result[property.name] = property
      }

      return result
    }

    get_field_properties2():landscape.Property[] {
      var result = []
      var properties = this.get_properties()
      for (var i in properties) {
        var property = properties[i]
        if (property.type == 'list')
          continue

        if (property.is_virtual) {
          var field = property.get_field_override()
          if (!field || typeof field.sql != 'string')
            continue
        }

        result.push(property)
      }

      return result
    }

    run(user, query_result:Query_Result = null):Promise {
      if (!query_result)
        query_result = {query_count: 0, user: user}
//console.log('query-count', this.trellis.name, query_result.query_count)
      ++query_result.query_count
      var runner = new Query_Runner(this)
//      console.log('filters', this.filters)
      return runner.run(query_result)
    }

    run_single(user, query_result:Query_Result = null):Promise {
      return this.run(user, query_result)
        .then((result)=> result.objects[0])
    }
  }
}


text:
import eossdk
import sys

class MyIntfHandler( eossdk.AgentHandler, eossdk.IntfHandler ):
   def __init__( self, intfMgr, agentMgr ):
      eossdk.AgentHandler.__init__( self, agentMgr )
      eossdk.IntfHandler.__init__( self, intfMgr )  # pylint: disable-msg=W0233
      self.intfMgr_ = intfMgr
      self.numIntfChanges_ = 0
      print "Constructed"

   # Callback provided by AgentHandler when all state is synchronized
   def on_initialized( self ):
      print "We are initialized!"
      self.watch_all_intfs( True )  # pylint: disable-msg=E1101

   # Callback provided by IntfHandler when an interface's configuration changes
   def on_oper_status( self, intfId, operState ):
      intfState = 'up' if operState == eossdk.INTF_OPER_UP else 'down'
      print "The state of", intfId.to_string(), "is now", intfState
      self.numIntfChanges_ += 1
      print "   We have seen", self.numIntfChanges_, "state changes"
      self.intfMgr_.description_is(intfId,
                                   "Changed state [%d]" % self.numIntfChanges_)

sdk = eossdk.Sdk()
mta = MyIntfHandler( sdk.get_intf_mgr(), sdk.get_agent_mgr() )
sdk.main_loop( sys.argv )


text:
RespoCSS
========
This framework is still experimental. Further improvements, examples and documents are already planned.

License
========
This Framework is available under the MIT License (MIT).


text:
class AccountActions {
	 static updateAccount (account) {
		 return {
			 type: 'updateAccount',
			 account: account
		 }
	 }
}


text:
var expect = require("chai").expect;

var autoprefixr = require('../../css/postcss/index');

describe('postcss', function () {
    describe('autoprefixr', function () {

        it('should prefix', function () {
            return autoprefixr('body {display: flex;}').then(function (data) {
                expect(data).to.exist;
            });
        });
    });

});


text:
package com.basho.riak.client.api.commands.mapreduce;

/**
 * MapReduce Input that provides the results of a Search query
 * as the input for a MapReduce job.
 */
public class SearchInput implements MapReduceInput
{
    private final String index;
    private final String search;

    /**
     * Construct a SearchInput using the provided index name and search query.
     * @param index The name of the index to query
     * @param search The search query to run on the index
     */
    public SearchInput(String index, String search)
    {
        this.index = index;
        this.search = search;
    }

    /**
     * Gets the index supplied for the search.
     * @return the name of the index to search
     */
    public String getIndex()
    {
        return index;
    }

    /**
     * Gets the search query supplied for the search.
     * @return the query to run on the index to search
     */
    public String getSearch()
    {
        return search;
    }
}


text:
package org.agmip.acmo.translators.dssat.core;

import java.io.BufferedReader;
import java.io.CharArrayReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import static org.agmip.util.MapUtil.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * DSSAT Output File Data I/O API Class
 *
 * @author Meng Zhang
 * @version 1.0
 */
public class AcmoDssatOutputFileInput extends AcmoCommonInput {

    private static final Logger log = LoggerFactory.getLogger(AcmoDssatOutputFileInput.class);
    public String outDataKey = "data";          // P.S. the key name might change

    /**
     * Constructor with no parameters Set jsonKey as "observed"
     *
     */
    public AcmoDssatOutputFileInput() {
        super();
        jsonKey = "out";
    }

    /**
     * DSSAT Output File Data input method for Controller using
     *
     * @param brMap The holder for BufferReader objects for all files
     * @return result data holder object
     */
    @Override
    protected HashMap readFile(HashMap brMap) throws IOException {

        HashMap ret = new HashMap();
        ret.put("meta", brMap.get("CSV"));
        ret.put("summary", readSummary(brMap));
//        ret.put("overview", readOverview(brMap));
//        ret.put("soilorg", readSoilOrg(brMap));
        return ret;
    }

    /**
     * DSSAT Output File Data input method (Summary.out)
     *
     * @param brMap The holder for BufferReader objects for all files
     * @return result data holder object
     */
    protected HashMap readSummary(HashMap brMap) throws IOException {

        HashMap file = new HashMap();
        String line;
        BufferedReader brOut;
        Object buf;
        LinkedHashMap formats = new LinkedHashMap();
//        String[] titles = new String[0];
        ArrayList<HashMap> sumArr = new ArrayList();

        buf = brMap.get("SUMMARY.OUT");

        // If Output File is no been found
        if (buf == null) {
            return file;
        } else {
            if (buf instanceof char[]) {
                brOut = new BufferedReader(new CharArrayReader((char[]) buf));
            } else {
                brOut = (BufferedReader) buf;
            }
        }

        while ((line = brOut.readLine()) != null) {

            // Get content type of line
            judgeContentType(line);

            // Read summary data
            if (flg[2].equals("data")) {

                // Read meta info
                if (flg[0].equals("meta") && flg[1].equals("meta info")) {

                    // Set variables' formats
                    formats.clear();
                    formats.put("null_1", 11);
                    formats.put("exname", 10);
                    formats.put("local_name", 62);
                    formats.put("null_2", 28);
                    formats.put("version", 28);
                    formats.put("date", line.length());
                    // Read line and save into return holder
                    HashMap tmp = readLine(line, formats);
                    String date = getObjectOr(tmp, "date", "");
                    String version = getObjectOr(tmp, "version", "");
                    if (date.length() > 22) {
                        version += date.substring(0, date.length() - 22).trim();
                        tmp.put("version", version);
                    } else if (date.length() < 22) {
                        version = version.substring(0, version.length() - 22 + date.length()).trim();
                        tmp.put("version", version);
                    }
                    file.putAll(tmp);

                } // Read data info
                else {
                    // Set variables' formats
//                    formats.clear();
//                    formats.put("runno", 9);
//                    formats.put("trno", 7);
//                    formats.put("r#", 3);
//                    formats.put("o#", 3);
//                    formats.put("c#", 3);
//                    formats.put("cr", 3);
//                    formats.put("model", 9);
//                    formats.put("tnam", 26);
//                    formats.put("fnam", 9);
//                    formats.put("wsta", 9);
//                    formats.put("soil_id", 11);
//                    formats.put("sdat", 8);
//                    formats.put("pdat", 8);
//                    formats.put("edat", 8);
//                    formats.put("adat", 8);
//                    formats.put("mdat", 8);
//                    formats.put("hdat", 8);
//                    formats.put("dwap", 6);
//                    formats.put("cwam", 8);
//                    formats.put("hwam", 8);
//                    formats.put("hwah", 8);
//                    formats.put("bwah", 8);
//                    formats.put("pwam", 6);
//                    formats.put("hwum", 8);
//                    formats.put("h#am", 6);
//                    formats.put("h#um", 8);
//                    formats.put("hiam", 6);
//                    formats.put("laix", 6);
//                    formats.put("ir#m", 6);
//                    formats.put("ircm", 6);
//                    formats.put("prcm", 6);
//                    formats.put("etcm", 6);
//                    formats.put("epcm", 6);
//                    formats.put("escm", 6);
//                    formats.put("rocm", 6);
//                    formats.put("drcm", 6);
//                    formats.put("swxm", 6);
//                    formats.put("ni#m", 6);
//                    formats.put("nicm", 6);
//                    formats.put("nfxm", 6);
//                    formats.put("nucm", 6);
//                    formats.put("nlcm", 6);
//                    formats.put("niam", 6);
//                    formats.put("cnam", 6);
//                    formats.put("gnam", 6);
//                    formats.put("pi#m", 6);
//                    formats.put("picm", 6);
//                    formats.put("pupc", 6);
//                    formats.put("spam", 6);
//                    formats.put("ki#m", 6);
//                    formats.put("kicm", 6);
//                    formats.put("kupc", 6);
//                    formats.put("skam", 6);
//                    formats.put("recm", 6);
//                    formats.put("ontam", 7);
//                    formats.put("onam", 7);
//                    formats.put("optam", 7);
//                    formats.put("opam", 7);
//                    formats.put("octam", 8);
//                    formats.put("ocam", 8);
//                    formats.put("dmppm", 9);
//                    formats.put("dmpem", 9);
//                    formats.put("dmptm", 9);
//                    formats.put("dmpim", 9);
//                    formats.put("yppm", 9);
//                    formats.put("ypem", 9);
//                    formats.put("yptm", 9);
//                    formats.put("ypim", 9);
//                    formats.put("dpnam", 9);
//                    formats.put("dpnum", 9);
//                    formats.put("ypnam", 9);
//                    formats.put("ypnum", 9);
//                    formats.put("ndch", 6);
//                    formats.put("tmaxa", 6);
//                    formats.put("tmina", 6);
//                    formats.put("srada", 6);
//                    formats.put("dayla", 6);
//                    formats.put("co2a", 7);
//                    formats.put("prcp", 7);
//                    formats.put("etcp", 7);
                    // Read line and save into return holder
                    sumArr.add(readLine(line, formats));
                }

            } // Read Summary Info titles
            else if (flg[2].equals("title")) {

                // Set variables' formats based on title line
                formats.clear();
                formats.put("runno", 9);
                formats.put("trno", 7);
                formats.put("r#", 3);
                formats.put("o#", 3);
                formats.put("c#", 3);
                formats.put("cr", 3);
                formats.put("model", 9);
                formats.put("tnam", 26);
                formats.put("fnam", 9);
                formats.put("wsta", 9);
                formats.put("soil_id", 11);
//                line = line.replaceFirst("@", "").trim();
//                titles = line.split("\\.*\\s+");
//                for (String title : titles) {
//                    title = title.toLowerCase();
//                    if (defLength.containsKey(title)) {
//                        formats.put(title, defLength.get(title));
//                    } else {
//                        log.error("Unrecognized variable [{}] detected in title line of Summary.out file", title);
//                        return new HashMap();
//                    }
//                }

                if (line.length() < 93) {
                    log.warn("Detected unregconized format of title in Summary.out file: [{}]", line);
                    line = "";
                } else {
                    line = line.substring(92);
                }
                boolean isTitle = false;
                StringBuilder sb = new StringBuilder();
                int len = 0;
                for (char c : line.toCharArray()) {
                    if (c == ' ') {
                        if (isTitle) {
                            formats.put(sb.toString().toLowerCase(), len);
                            isTitle = false;
                            len = 1;
                        } else {
                            len++;
                        }
                    } else {
                        if (!isTitle) {
                            isTitle = true;
                            sb = new StringBuilder();
                        }
                        if (c != '.') {
                            sb.append(c);
                        }
                        len++;
                    }
                }
                if (isTitle) {
                    formats.put(sb.toString().toLowerCase(), len);
                }

            } else {
            }
        }

        file.put(outDataKey, sumArr);
        brOut.close();

        return file;
    }

    /**
     * DSSAT Output File Data input method (SoilOrg.out)
     *
     * @param brMap The holder for BufferReader objects for all files
     * @return the array of result data holder object
     */
    protected ArrayList<HashMap> readSoilOrg(HashMap brMap) throws IOException {

        ArrayList<HashMap> file = new ArrayList<HashMap>();
        HashMap data = new HashMap();
        ArrayList<HashMap> subArr = new ArrayList<HashMap>();
        String line;
        BufferedReader brOut;
        Object buf;
        LinkedHashMap formats = new LinkedHashMap();

        buf = brMap.get("SOILORG.OUT");

        // If Output File File is no been found
        if (buf == null) {
            return file;
        } else {
            if (buf instanceof char[]) {
                brOut = new BufferedReader(new CharArrayReader((char[]) buf));
            } else {
                brOut = (BufferedReader) buf;
            }
        }

        while ((line = brOut.readLine()) != null) {

            // Get content type of line
            judgeContentType(line);

            // Read soil organic data
            if (flg[2].equals("data")) {

                if (flg[1].equals("meta info")) {
                    if (line.trim().toUpperCase().startsWith("*RUN")) {
                        // Set new data object
                        data = new HashMap();
                        subArr = new ArrayList<HashMap>();
                        data.put(outDataKey, subArr);
                        file.add(data);
                        // Set variables' formats
                        formats.clear();
                        formats.put("null", 4);
                        formats.put("runno", 5);
                        // Get reading result
                        data.putAll(readLine(line, formats));
                    } else if (line.trim().toUpperCase().startsWith("EXPERIMENT")) {
                        // Set variables' formats
                        formats.clear();
                        formats.put("null", 17);
                        formats.put("exp_id", 9);
                        formats.put("cr", 3);
                        // Get reading result
                        data.putAll(readLine(line, formats));
                    } else if (line.trim().toUpperCase().startsWith("TREATMENT")) {
                        // Set variables' formats
                        formats.clear();
                        formats.put("null", 10);
                        formats.put("trno", 3);
                        // Get reading result
                        data.putAll(readLine(line, formats));
                    }
                } else {
                    // Set variables' formats
                    formats.clear();
                    formats.put("year", 5);
                    formats.put("doy", 4);
                    formats.put("das", 6);
                    formats.put("omac", 8);
                    formats.put("scdd", 8);
                    formats.put("socd", 8);
                    formats.put("sc0d", 8);
                    formats.put("sctd", 8);
                    formats.put("somct", 8);
                    formats.put("lctd", 8);
                    formats.put("onac", 8);
                    formats.put("sndd", 8);
                    formats.put("sond", 8);
                    formats.put("sn0d", 8);
                    formats.put("sntd", 8);
                    formats.put("somnt", 8);
                    formats.put("lntd", 8);
                    // Read line and save into return holder
                    subArr.add(readLine(line, formats));
                }
            }
        }

        // Set solic_final and surfc_final
        for (int i = 0; i < file.size(); i++) {
            data = file.get(i);
            subArr = getObjectOr(data, outDataKey, new ArrayList());
            if (!subArr.isEmpty()) {
                data.put("solic_init", getObjectOr(subArr.get(0), "sctd", ""));
                data.put("surfc_init", getObjectOr(subArr.get(0), "sc0d", ""));
                data.put("solic_final", getObjectOr(subArr.get(subArr.size() - 1), "sctd", ""));
                data.put("surfc_final", getObjectOr(subArr.get(subArr.size() - 1), "sc0d", ""));
            }

        }

        brOut.close();
        return file;
    }

    /**
     * DSSAT Output File Data input method (Overview.out)
     *
     * @param brMap The holder for BufferReader objects for all files
     * @return the array of result data holder object
     */
    protected ArrayList<HashMap> readOverview(HashMap brMap) throws IOException {

        ArrayList<HashMap> file = new ArrayList<HashMap>();
        HashMap data = new HashMap();
        ArrayList<HashMap> subArr;
        String line;
        BufferedReader brOut;
        Object buf;
        LinkedHashMap formats = new LinkedHashMap();

        buf = brMap.get("OVERVIEW.OUT");

        // If Output File File is no been found
        if (buf == null) {
            return file;
        } else {
            if (buf instanceof char[]) {
                brOut = new BufferedReader(new CharArrayReader((char[]) buf));
            } else {
                brOut = (BufferedReader) buf;
            }
        }

        while ((line = brOut.readLine()) != null) {

            // Get content type of line
            judgeContentType(line);

            // Read soil organic data
            if (flg[2].equals("data")) {

                if (flg[1].equals("meta info")) {
                    if (line.trim().toUpperCase().startsWith("*RUN")) {
                        // Set new data object
                        data = new HashMap();
                        subArr = new ArrayList<HashMap>();
                        data.put(outDataKey, subArr);
                        file.add(data);
                        // Set variables' formats
                        formats.clear();
                        formats.put("null", 4);
                        formats.put("runno", 5);
                        // Get reading result
                        data.putAll(readLine(line, formats));
                    } else if (line.trim().toUpperCase().startsWith("EXPERIMENT")) {
                        // Set variables' formats
                        formats.clear();
                        formats.put("null", 17);
                        formats.put("exp_id", 9);
                        formats.put("cr", 3);
                        // Get reading result
                        data.putAll(readLine(line, formats));
                    } else if (line.trim().toUpperCase().startsWith("TREATMENT")) {
                        // Set variables' formats
                        formats.clear();
                        formats.put("null", 10);
                        formats.put("trno", 3);
                        // Get reading result
                        data.putAll(readLine(line, formats));
                    }
                }
            }
        }

        brOut.close();
        return file;
    }

    /**
     * Set reading flags for title lines (marked with *)
     *
     * @param line the string of reading line
     */
    @Override
    protected void setTitleFlgs(String line) {
        flg[0] = "meta";
        flg[1] = "meta info";
        flg[2] = "data";
    }
}


text:
/* global jQuery:true utilities:true */

/*
 * Fuel UX Pillbox
 * https://github.com/ExactTarget/fuelux
 *
 * Copyright (c) 2014 ExactTarget
 * Licensed under the BSD New license.
 */

// -- BEGIN UMD WRAPPER PREFACE --

// WARNING: Anything placed inside of the UMD Wrapper may be stripped out by dist task

// For more information on UMD visit:
// https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
(function umdWrapper (factory) {
	if (typeof define === 'function' && define.amd) {
		// if AMD loader is available, register as an anonymous module.
		define(['jquery', 'fuelux/utilities', 'fuelux/dropdown-autoflip'], factory);
	} else if (typeof exports === 'object') {
		// Node/CommonJS
		module.exports = factory(require('jquery'), require('./utilities'), require('./dropdown-autoflip'));
	} else {
		// OR use browser globals if AMD is not present
		factory(jQuery);
	}
}(function pillboxWrapper ($) {
	if (!$.fn.dropdownautoflip) {
		throw new Error('Fuel UX pillbox control requires dropdown-autoflip.');
	}

	if (!$.fn.utilities) {
		throw new Error('Fuel UX pillbox control requires FuelUX utilities.');
	}
	// -- END UMD WRAPPER PREFACE --

	// -- BEGIN MODULE CODE HERE --
	var old = $.fn.pillbox;

	var utilities = $.fn.utilities;
	var CONST = $.fn.utilities.CONST;
	var COMMA_KEYCODE = CONST.COMMA_KEYCODE;
	var ENTER_KEYCODE = CONST.ENTER_KEYCODE;
	var isBackspaceKey = utilities.isBackspaceKey;
	var isDeleteKey = utilities.isDeleteKey;
	var isTabKey = utilities.isTabKey;
	var isUpArrow = utilities.isUpArrow;
	var isDownArrow = utilities.isDownArrow;
	var cleanInput = utilities.cleanInput;
	var isShiftHeld = utilities.isShiftHeld;

	// PILLBOX CONSTRUCTOR AND PROTOTYPE
	var Pillbox = function Pillbox (element, options) {
		this.$element = $(element);
		this.$moreCount = this.$element.find('.pillbox-more-count');
		this.$pillGroup = this.$element.find('.pill-group');
		this.$addItem = this.$element.find('.pillbox-add-item');
		this.$addItemWrap = this.$addItem.parent();
		this.$suggest = this.$element.find('.suggest');
		this.$pillHTML = '
' +
		'	' +
		'	' +
		'		Remove' +
		'	' +
		'
';

		this.options = $.extend({}, $.fn.pillbox.defaults, options);

		if (this.options.readonly === -1) {
			if (this.$element.attr('data-readonly') !== undefined) {
				this.readonly(true);
			}
		} else if (this.options.readonly) {
			this.readonly(true);
		}

		// EVENTS
		this.acceptKeyCodes = this._generateObject(this.options.acceptKeyCodes);
		// Create an object out of the key code array, so we don't have to loop through it on every key stroke

		this.$element.on('click.fu.pillbox', '.pill-group > .pill', $.proxy(this.itemClicked, this));
		this.$element.on('click.fu.pillbox', $.proxy(this.inputFocus, this));
		this.$element.on('keydown.fu.pillbox', '.pillbox-add-item', $.proxy(this.inputEvent, this));
		if (this.options.onKeyDown) {
			this.$element.on('mousedown.fu.pillbox', '.suggest > li', $.proxy(this.suggestionClick, this));
		}

		if (this.options.edit) {
			this.$element.addClass('pills-editable');
			this.$element.on('blur.fu.pillbox', '.pillbox-add-item', $.proxy(this.cancelEdit, this));
		}
		this.$element.on('blur.fu.pillbox', '.pillbox-add-item', $.proxy(this.inputEvent, this));
	};

	Pillbox.prototype = {
		constructor: Pillbox,

		destroy: function destroy () {
			this.$element.remove();
			// any external bindings
			// [none]
			// empty elements to return to original markup
			// [none]
			// returns string of markup
			return this.$element[0].outerHTML;
		},

		items: function items () {
			var self = this;

			return this.$pillGroup.children('.pill').map(function getItemsData () {
				return self.getItemData($(this));
			}).get();
		},

		itemClicked: function itemClicked (e) {
			var $target = $(e.target);
			var $item;

			e.preventDefault();
			e.stopPropagation();
			this._closeSuggestions();

			if (!$target.hasClass('pill')) {
				$item = $target.parent();
				if (this.$element.attr('data-readonly') === undefined) {
					if ($target.hasClass('glyphicon-close')) {
						if (this.options.onRemove) {
							this.options.onRemove(this.getItemData($item, {
								el: $item
							}), $.proxy(this._removeElement, this));
						} else {
							this._removeElement(this.getItemData($item, {
								el: $item
							}));
						}

						return false;
					} else if (this.options.edit) {
						if ($item.find('.pillbox-list-edit').length) {
							return false;
						}

						this.openEdit($item);
					}
				}
			} else {
				$item = $target;
			}

			this.$element.trigger('clicked.fu.pillbox', this.getItemData($item));

			return true;
		},

		readonly: function readonly (enable) {
			if (enable) {
				this.$element.attr('data-readonly', 'readonly');
			} else {
				this.$element.removeAttr('data-readonly');
			}

			if (this.options.truncate) {
				this.truncate(enable);
			}
		},

		suggestionClick: function suggestionClick (e) {
			var $item = $(e.currentTarget);
			var item = {
				text: $item.html(),
				value: $item.data('value')
			};

			e.preventDefault();
			this.$addItem.val('');

			if ($item.data('attr')) {
				item.attr = JSON.parse($item.data('attr'));
			}

			item.data = $item.data('data');

			this.addItems(item, true);

			// needs to be after addItems for IE
			this._closeSuggestions();
		},

		itemCount: function itemCount () {
			return this.$pillGroup.children('.pill').length;
		},

		// First parameter is 1 based index (optional, if index is not passed all new items will be appended)
		// Second parameter can be array of objects [{ ... }, { ... }] or you can pass n additional objects as args
		// object structure is as follows (attr and value are optional): { text: '', value: '', attr: {}, data: {} }
		addItems: function addItems () {
			var self = this;
			var items;
			var index;
			var isInternal;

			if (isFinite(String(arguments[0])) && !(arguments[0] instanceof Array)) {
				items = [].slice.call(arguments).slice(1);
				index = arguments[0];
			} else {
				items = [].slice.call(arguments).slice(0);
				isInternal = items[1] && !items[1].text;
			}

			// If first argument is an array, use that, otherwise they probably passed each thing through as a separate arg, so use items as-is
			if (items[0] instanceof Array) {
				items = items[0];
			}

			if (items.length) {
				$.each(items, function normalizeItemsObject (i, value) {
					var data = {
						text: value.text,
						value: (value.value ? value.value : value.text),
						el: self.$pillHTML
					};

					if (value.attr) {
						data.attr = value.attr;
					}

					if (value.data) {
						data.data = value.data;
					}

					items[i] = data;
				});

				if (this.options.edit && this.currentEdit) {
					items[0].el = this.currentEdit.wrap('

').parent().html();
				}

				if (isInternal) {
					items.pop(1);
				}

				if (self.options.onAdd && isInternal) {
					if (this.options.edit && this.currentEdit) {
						self.options.onAdd(items[0], $.proxy(self.saveEdit, this));
					} else {
						self.options.onAdd(items[0], $.proxy(self.placeItems, this));
					}
				} else if (this.options.edit && this.currentEdit) {
					self.saveEdit(items);
				} else if (index) {
					self.placeItems(index, items);
				} else {
					self.placeItems(items, isInternal);
				}
			}
		},

		// First parameter is the index (1 based) to start removing items
		// Second parameter is the number of items to be removed
		removeItems: function removeItems (index, howMany) {
			var self = this;

			if (!index) {
				this.$pillGroup.find('.pill').remove();
				this._removePillTrigger({
					method: 'removeAll'
				});
			} else {
				var itemsToRemove = howMany ? howMany : 1;

				for (var item = 0; item < itemsToRemove; item++) {
					var $currentItem = self.$pillGroup.find('> .pill:nth-child(' + index + ')');

					if ($currentItem) {
						$currentItem.remove();
					} else {
						break;
					}
				}
			}
		},

		// First parameter is index (optional)
		// Second parameter is new arguments
		placeItems: function placeItems () {
			var items;
			var index;
			var $neighbor;
			var isInternal;

			if (isFinite(String(arguments[0])) && !(arguments[0] instanceof Array)) {
				items = [].slice.call(arguments).slice(1);
				index = arguments[0];
			} else {
				items = [].slice.call(arguments).slice(0);
				isInternal = items[1] && !items[1].text;
			}

			if (items[0] instanceof Array) {
				items = items[0];
			}

			if (items.length) {
				var newItems = [];
				$.each(items, function prepareItemForAdd (i, item) {
					var $item = $(item.el);

					$item.attr('data-value', item.value);
					$item.find('span:first').html(item.text);

					// DOM attributes
					if (item.attr) {
						$.each(item.attr, function handleDOMAttributes (key, value) {
							if (key === 'cssClass' || key === 'class') {
								$item.addClass(value);
							} else {
								$item.attr(key, value);
							}
						});
					}

					if (item.data) {
						$item.data('data', item.data);
					}

					newItems.push($item);
				});

				if (this.$pillGroup.children('.pill').length > 0) {
					if (index) {
						$neighbor = this.$pillGroup.find('.pill:nth-child(' + index + ')');

						if ($neighbor.length) {
							$neighbor.before(newItems);
						} else {
							this.$pillGroup.children('.pill:last').after(newItems);
						}
					} else {
						this.$pillGroup.children('.pill:last').after(newItems);
					}
				} else {
					this.$pillGroup.prepend(newItems);
				}

				if (isInternal) {
					this.$element.trigger('added.fu.pillbox', {
						text: items[0].text,
						value: items[0].value
					});
				}
			}
		},

		inputEvent: function inputEvent (e) {
			var self = this;
			var text = self.options.cleanInput(this.$addItem.val());
			var isFocusOutEvent = e.type === 'focusout';
			var blurredAfterInput = (isFocusOutEvent && text.length > 0);
			// If we test for keycode only, it will match for `<` & `,` instead of just `,`
			// This way users can type `<3` and `1 < 3`, etc...
			var acceptKeyPressed = (this.acceptKeyCodes[e.keyCode] && !isShiftHeld(e));

			if (acceptKeyPressed || blurredAfterInput) {
				var attr;
				var value;

				if (this.options.onKeyDown && this._isSuggestionsOpen()) {
					var $selection = this.$suggest.find('.pillbox-suggest-sel');

					if ($selection.length) {
						text = self.options.cleanInput($selection.html());
						value = self.options.cleanInput($selection.data('value'));
						attr = $selection.data('attr');
					}
				}

				// ignore comma and make sure text that has been entered (protects against " ,". https://github.com/ExactTarget/fuelux/issues/593), unless allowEmptyPills is true.
				if (text.replace(/[ ]*\,[ ]*/, '').match(/\S/) || (this.options.allowEmptyPills && text.length)) {
					this._closeSuggestions();
					this.$addItem.hide().val('');

					if (attr) {
						this.addItems({
							text: text,
							value: value,
							attr: JSON.parse(attr)
						}, true);
					} else {
						this.addItems({
							text: text,
							value: value
						}, true);
					}

					setTimeout(function clearAddItemInput () {
						self.$addItem.show().attr({
							size: 10
						}).focus();
					}, 0);
				}

				e.preventDefault();
				return true;
			} else if (isBackspaceKey(e) || isDeleteKey(e)) {
				if (!text.length) {
					e.preventDefault();

					if (this.options.edit && this.currentEdit) {
						this.cancelEdit();
						return true;
					}

					this._closeSuggestions();
					var $lastItem = this.$pillGroup.children('.pill:last');

					if ($lastItem.hasClass('pillbox-highlight')) {
						this._removeElement(this.getItemData($lastItem, {
							el: $lastItem
						}));
					} else {
						$lastItem.addClass('pillbox-highlight');
					}

					return true;
				}
			} else if (text.length > 10) {
				if (this.$addItem.width() < (this.$pillGroup.width() - 6)) {
					this.$addItem.attr({
						size: text.length + 3
					});
				}
			}

			this.$pillGroup.find('.pill').removeClass('pillbox-highlight');

			if (this.options.onKeyDown && !isFocusOutEvent) {
				if (
					isTabKey(e) ||
					isUpArrow(e) ||
					isDownArrow(e)
				) {
					if (this._isSuggestionsOpen()) {
						this._keySuggestions(e);
					}

					return true;
				}

				// only allowing most recent event callback to register
				this.callbackId = e.timeStamp;
				this.options.onKeyDown({
					event: e,
					value: text
				}, function callOpenSuggestions (data) {
					self._openSuggestions(e, data);
				});
			}

			return true;
		},

		openEdit: function openEdit (el) {
			var targetChildIndex = el.index() + 1;
			var $addItemWrap = this.$addItemWrap.detach().hide();

			this.$pillGroup.find('.pill:nth-child(' + targetChildIndex + ')').before($addItemWrap);
			this.currentEdit = el.detach();

			$addItemWrap.addClass('editing');
			this.$addItem.val(el.find('span:first').html());
			$addItemWrap.show();
			this.$addItem.focus().select();
		},

		cancelEdit: function cancelEdit (e) {
			var $addItemWrap;
			if (!this.currentEdit) {
				return false;
			}

			this._closeSuggestions();
			if (e) {
				this.$addItemWrap.before(this.currentEdit);
			}

			this.currentEdit = false;

			$addItemWrap = this.$addItemWrap.detach();
			$addItemWrap.removeClass('editing');
			this.$addItem.val('');
			this.$pillGroup.append($addItemWrap);

			return true;
		},

		// Must match syntax of placeItem so addItem callback is called when an item is edited
		// expecting to receive an array back from the callback containing edited items
		saveEdit: function saveEdit () {
			var item = arguments[0][0] ? arguments[0][0] : arguments[0];

			this.currentEdit = $(item.el);
			this.currentEdit.data('value', item.value);
			this.currentEdit.find('span:first').html(item.text);

			this.$addItemWrap.hide();
			this.$addItemWrap.before(this.currentEdit);
			this.currentEdit = false;

			this.$addItem.val('');
			this.$addItemWrap.removeClass('editing');
			this.$pillGroup.append(this.$addItemWrap.detach().show());
			this.$element.trigger('edited.fu.pillbox', {
				value: item.value,
				text: item.text
			});
		},

		removeBySelector: function removeBySelector () {
			var selectors = [].slice.call(arguments).slice(0);
			var self = this;

			$.each(selectors, function doRemove (i, sel) {
				self.$pillGroup.find(sel).remove();
			});

			this._removePillTrigger({
				method: 'removeBySelector',
				removedSelectors: selectors
			});
		},

		removeByValue: function removeByValue () {
			var values = [].slice.call(arguments).slice(0);
			var self = this;

			$.each(values, function doRemove (i, val) {
				self.$pillGroup.find('> .pill[data-value="' + val + '"]').remove();
			});

			this._removePillTrigger({
				method: 'removeByValue',
				removedValues: values
			});
		},

		removeByText: function removeByText () {
			var text = [].slice.call(arguments).slice(0);
			var self = this;

			$.each(text, function doRemove (i, matchingText) {
				self.$pillGroup.find('> .pill:contains("' + matchingText + '")').remove();
			});

			this._removePillTrigger({
				method: 'removeByText',
				removedText: text
			});
		},

		truncate: function truncate (enable) {
			var self = this;

			this.$element.removeClass('truncate');
			this.$addItemWrap.removeClass('truncated');
			this.$pillGroup.find('.pill').removeClass('truncated');

			if (enable) {
				this.$element.addClass('truncate');

				var availableWidth = this.$element.width();
				var containerFull = false;
				var processedPills = 0;
				var totalPills = this.$pillGroup.find('.pill').length;
				var widthUsed = 0;

				this.$pillGroup.find('.pill').each(function processPills () {
					var pill = $(this);
					if (!containerFull) {
						processedPills++;
						self.$moreCount.text(totalPills - processedPills);
						if ((widthUsed + pill.outerWidth(true) + self.$addItemWrap.outerWidth(true)) <= availableWidth) {
							widthUsed += pill.outerWidth(true);
						} else {
							self.$moreCount.text((totalPills - processedPills) + 1);
							pill.addClass('truncated');
							containerFull = true;
						}
					} else {
						pill.addClass('truncated');
					}
				});
				if (processedPills === totalPills) {
					this.$addItemWrap.addClass('truncated');
				}
			}
		},

		inputFocus: function inputFocus () {
			this.$element.find('.pillbox-add-item').focus();
		},

		getItemData: function getItemData (el, data) {
			return $.extend({
				text: el.find('span:first').html()
			}, el.data(), data);
		},

		_removeElement: function _removeElement (data) {
			data.el.remove();
			delete data.el;
			this.$element.trigger('removed.fu.pillbox', data);
		},

		_removePillTrigger: function _removePillTrigger (removedBy) {
			this.$element.trigger('removed.fu.pillbox', removedBy);
		},

		_generateObject: function _generateObject (data) {
			var obj = {};

			$.each(data, function setObjectValue (index, value) {
				obj[value] = true;
			});

			return obj;
		},

		_openSuggestions: function _openSuggestions (e, data) {
			var $suggestionList = $('
');

			if (this.callbackId !== e.timeStamp) {
				return false;
			}

			if (data.data && data.data.length) {
				$.each(data.data, function appendSuggestions (index, value) {
					var val = value.value ? value.value : value.text;

					// markup concatentation is 10x faster, but does not allow data store
					var $suggestion = $('
' + value.text + '
');

					if (value.attr) {
						$suggestion.data('attr', JSON.stringify(value.attr));
					}

					if (value.data) {
						$suggestion.data('data', value.data);
					}

					$suggestionList.append($suggestion);
				});

				// suggestion dropdown
				this.$suggest.html('').append($suggestionList.children());
				$(document).trigger('suggested.fu.pillbox', this.$suggest);
			}

			return true;
		},

		_closeSuggestions: function _closeSuggestions () {
			this.$suggest.html('').parent().removeClass('open');
		},

		_isSuggestionsOpen: function _isSuggestionsOpen () {
			return this.$suggest.parent().hasClass('open');
		},

		_keySuggestions: function _keySuggestions (e) {
			var $first = this.$suggest.find('li.pillbox-suggest-sel');
			var dir = isUpArrow(e);

			e.preventDefault();

			if (!$first.length) {
				$first = this.$suggest.find('li:first');
				$first.addClass('pillbox-suggest-sel');
			} else {
				var $next = dir ? $first.prev() : $first.next();

				if (!$next.length) {
					$next = dir ? this.$suggest.find('li:last') : this.$suggest.find('li:first');
				}

				if ($next) {
					$next.addClass('pillbox-suggest-sel');
					$first.removeClass('pillbox-suggest-sel');
				}
			}
		}
	};

	Pillbox.prototype.getValue = Pillbox.prototype.items;

	// PILLBOX PLUGIN DEFINITION

	$.fn.pillbox = function pillbox (option) {
		var args = Array.prototype.slice.call(arguments, 1);
		var methodReturn;

		var $set = this.each(function set () {
			var $this = $(this);
			var data = $this.data('fu.pillbox');
			var options = typeof option === 'object' && option;

			if (!data) {
				$this.data('fu.pillbox', (data = new Pillbox(this, options)));
			}

			if (typeof option === 'string') {
				methodReturn = data[option].apply(data, args);
			}
		});

		return (methodReturn === undefined) ? $set : methodReturn;
	};

	$.fn.pillbox.defaults = {
		edit: false,
		readonly: -1, // can be true or false. -1 means it will check for data-readonly="readonly"
		truncate: false,
		acceptKeyCodes: [
			ENTER_KEYCODE,
			COMMA_KEYCODE
		],
		allowEmptyPills: false,
		cleanInput: cleanInput

		// example on remove
		/* onRemove: function(data,callback){
			console.log('onRemove');
			callback(data);
		} */

		// example on key down
		/* onKeyDown: function(event, data, callback ){
			callback({data:[
				{text: Math.random(),value:'sdfsdfsdf'},
				{text: Math.random(),value:'sdfsdfsdf'}
			]});
		}
		*/
		// example onAdd
		/* onAdd: function( data, callback ){
			console.log(data, callback);
			callback(data);
		} */
	};

	$.fn.pillbox.Constructor = Pillbox;

	$.fn.pillbox.noConflict = function noConflict () {
		$.fn.pillbox = old;
		return this;
	};

	// DATA-API

	$(document).on('mousedown.fu.pillbox.data-api', '[data-initialize=pillbox]', function dataAPI (e) {
		var $control = $(e.target).closest('.pillbox');
		if (!$control.data('fu.pillbox')) {
			$control.pillbox($control.data());
		}
	});

	// Must be domReady for AMD compatibility
	$(function DOMReady () {
		$('[data-initialize=pillbox]').each(function init () {
			var $this = $(this);
			if ($this.data('fu.pillbox')) return;
			$this.pillbox($this.data());
		});
	});

	// -- BEGIN UMD WRAPPER AFTERWORD --
}));
// -- END UMD WRAPPER AFTERWORD --


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="rustdoc">
    <meta name="description" content="API documentation for the Rust `Builder` struct in crate `rustc_serialize`.">
    <meta name="keywords" content="rust, rustlang, rust-lang, Builder">

    <title>rustc_serialize::json::Builder - Rust</title>

    <link rel="stylesheet" type="text/css" href="../../normalize.css">
    <link rel="stylesheet" type="text/css" href="../../rustdoc.css">
    <link rel="stylesheet" type="text/css" href="../../main.css">

    <link rel="shortcut icon" href="https://www.rust-lang.org/favicon.ico">

rustc_serialize::<wbr>json

        <form class="search-form js-only">

                <input class="search-input" name="search"
                       autocomplete="off"
                       placeholder="Click or press 'S' to search, '?' for more options…"
                       type="search">

        </form>

Struct rustc_serialize::<wbr>json::<wbr>Builder

                       [−]

               [src]

pub struct Builder<T> { /* fields omitted */ }

A Builder consumes a json::Parser to create a generic Json structure.

Methods

impl<T: Iterator<Item = char>> Builder<T>

[src]

fn new(src: T) -> Builder<T>

Create a JSON Builder.

fn build(&mut self) -> Result<Json, BuilderError>

Help

Keyboard Shortcuts

?

Show this help dialog

S

Focus the search field

⇤

Move up in search results

⇥

Move down in search results

⏎

Go to active search result

+

Collapse/expand all sections

Search Tricks

                    Prefix searches with a type followed by a colon (e.g.
                    fn:) to restrict the search to a given type.

                    Accepted types are: fn, mod,
                    struct, enum,
                    trait, type, macro,
                    and const.

                    Search functions by type signature (e.g.
                    vec -> usize or * -> vec)


text:
@interface ViewController ()

@property (strong, nonatomic) CIFilter* bump;
@property (strong, nonatomic) CIContext *context;
@property (strong, nonatomic) CIImage *baseImage;
@property (strong, nonatomic) NSOperationQueue* workQueue;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //set up a filter instance and context
    //we want to do only once for perfomance reasons
    self.bump = [CIFilter filterWithName:@"CIHoleDistortion"];
    [self.bump setValue:[CIVector vectorWithCGPoint:CGPointMake(187, 282)] forKey:kCIInputCenterKey];
    [self.bump setValue:@100 forKey:kCIInputRadiusKey];
    self.context = [CIContext contextWithOptions:nil];

    //set up a background queue to do CI work
    self.workQueue = [NSOperationQueue new];

}

- (void)viewDidAppear:(BOOL)animated {
    //load the base image to apply filters to
    //we're loading it in x1 to simplify this code
    UIImage* uiimage = [UIImage imageWithData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tvtest" ofType:@"png"]] scale:1.0f];
    CGImageRef cgimage = [uiimage CGImage];
    self.baseImage = [[CIImage alloc] initWithCGImage:cgimage];
    [self.bump setValue:self.baseImage forKey:kCIInputImageKey];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat dY = scrollView.contentOffset.y;
    if (dY < 0) { //if pulling down
        if (self.workQueue.operationCount < 5) { //we'll keep a number of operations to a minimum to reduce lag
            [self.workQueue addOperationWithBlock:^{
                //find where the user's finger is
                CGPoint touchPoint = [scrollView.panGestureRecognizer locationInView:scrollView];
                //center the distortion above the finger
                [self.bump setValue:[CIVector vectorWithCGPoint:CGPointMake(touchPoint.x, self.imageView.frame.size.height)] forKey:kCIInputCenterKey];
                //increase the radius of the distortion the more the user pulls the scroll view
                [self.bump setValue:[NSNumber numberWithFloat:-dY] forKey:kCIInputRadiusKey];
                //get the filtered image
                CIImage *result = [self.bump valueForKey:kCIOutputImageKey];
                //transform it into something we can use
                CGImageRef cgImage = [self.context createCGImage:result fromRect:result.extent];
                UIImage* filteredImage = [UIImage imageWithCGImage:cgImage];
                CGImageRelease(cgImage);
                dispatch_async(dispatch_get_main_queue(), ^{
                    //update the imageView
                    self.imageView.image = filteredImage;
                });
            }];
        }
    }
}

@end