text:
require 'json/ld'
require 'nokogiri'
require 'rdf/rdfa'

module Tess
  module Scrapers
    class RdfaExtractor
      #Given an RDF:RDFa::Reader and a schema.org Type
      # returns a hash containing all the available fields and values of the given schema (e.g. CreativeWork AggregateRating Person)
      #e.g. parse_rdfa(rdfa, 'CreativeWork')

      def self.parse_rdfa(rdfa, type='CreativeWork')

        json_graph = JSON.load(rdfa.dump(:jsonld, standard_prefixes: true))["@graph"]

        #  json_graph looks like this.
        #  {
        #      :@context => {<some stuff>},
        #      :@graph => [
        #      {
        #        "@id" => /audience-tags/beginner-bioinformaticians
        #        "@type" => "skos:Concept"
        #        "rdfs:label" => {
        #          "@value"=>"beginner bioinformaticians",
        #          "@language"=>"en"
        #        }
        #        skos:prefLabel" => {
        #          "@value"=>"beginner bioinformaticians",
        #          "@language"=>"en"
        #        }
        #      },
        #      {
        #        "@id"=>"/users/gabriella-rustici",
        #        "@type"=>["schema:Person", "sioc:UserAccount"],
        #        schema:name"=>"Gabriella Rustici"
        #      }
        #      ]
        #  }

        # The array item(s) in graph with the given type (e.g. "CreativeWork") is the root node.
        # This contains pointers to all of the properties the schema instance has.
        # Find this root node to start:
        if !json_graph.nil?
          objects = json_graph.select do |node|
            if node["@type"]
              node["@type"].include?("schema:#{type}") or node["@type"].include?("https://schema.org/#{type}") or node["@type"].include?("http://schema.org/#{type}")
            end
          end

          #root.keys gets the list of all the properties for this schema. For example a CreativeWork will return =>
          #["@id", "@type", "dc:created", "dc:date", "rss:modules/content/encoded", "schema:audience",
          # "schema:description", "schema:genre", "schema:hasPart", "schema:keywords", "schema:name", "schema:url",
          # "sioc:has_creator", "sioc:num_replies"]

          results_collection = []
          objects.each do |object|
            # Toss aside the @type and @id - we don't need them for now
            attributes = object.keys - ["@type"]
            # Go through the list of properties contained in the schema instance and extract each value to put into our return hash.
            # In most cases these contain an ID which we need to use the original json_graph object to lookup the value of.
            # (see ==Array and has_key?(@id) cases below)
            parsed_object = {}
            attributes.each do |attribute|
              parsed_object[attribute] = extract_attribute_value(object[attribute], json_graph)
            end
            results_collection << parsed_object
          end
          # res now contains a hash with all our property values.
          return results_collection
        else
          return []
        end
      end

      def self.extract_attribute_value(attribute, json_graph)
        if !attribute
          return nil
        elsif attribute.class == String
          return attribute
        elsif attribute.class == Array #e.g. root_node['schema:genre'] => [{"@id"=>"/edam-topic/bioinformatics"}, {"@id"=>"/edam-topic/data-analysis"}]
          properties = []
          attribute.each do |value|
            if value.class == Hash
              if value.has_key?("@id") #e.g. node => [{"@id"=>"/users/gabriella-rustici"}]
                properties << get_label_for_id(json_graph, value["@id"])
              else
                properties << value.values
              end
            else
              properties << value
            end
          end
          return properties.flatten
        elsif attribute.has_key?("@id") #e.g. root_node['sioc:has_creator'] => {"@id"=>"/users/gabriella-rustici"}
          return get_label_for_id(json_graph, attribute["@id"])
        elsif attribute.has_key?('@value') #e.g. root["schema:description"] => {"@value"=>"<p> This is a description </p>"}
          parsed_value = Nokogiri::HTML(attribute['@value'])
          return parsed_value.html? ? parsed_value.text : attribute['@value']
        end
      end

      def self.get_label_for_id(graph, id)
        node = graph.select{|node| node['@id'] == id}.first
        labels = []
        if node
          node.delete("@id") if node.has_key?('@id')
          node.delete("@type") if node.has_key?('@type')
          return node
        else
          return id
        end
        return labels
      end
    end
  end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<title>depot_tools_tutorial(7)</title>

depot_tools_tutorial(7) Manual Page

NAME

depot_tools_tutorial -
   A tutorial introduction to the Chromium depot_tools git extensions.

DESCRIPTION

The Chromium depot_tools(7) suite contains many git workflow-enhancing
tools which are designed to work together to enable anyone to wrangle the
Chromium codebase expertly. This tutorial explains how to do development on
Chromium using these tools. This will cover:

Setting up

Getting the code

TL;DR

Creating / Uploading a CL

Updating the code

Managing multiple CLs

Managing dependent CLs

Example Walkthrough

Please refer to the manpages (or --help output) for details about any of the
commands mentioned in this tutorial.

Note

If your platform does not support manpages (or you prefer something a bit more
expressive than plain text) you can find all documentation in html form in the
[DEPOT_TOOLS]/man/html folder.

PREREQUISITES

This tutorial assumes basic familiarity with git terminology and concepts. If you
need to brush up on these, the following are very good resources:

Think like (a) Git - A lighthearted
  overview of git. If you’re sorta-familiar with git, but not comfortable with
  it, then give this a look.

Git Immersion Tutorial - An in-depth git
  tutorial.

pcottle’s Visual Git
  Branching - An excellent interactive/graphical demo on how git handles
  commits, branches, and shows the operations git performs on them.

Pro Git book - “The” book for learning git
  from basics to advanced concepts. A bit dry, but very through.

If you’ve tried these out and are still having some trouble getting started,
there are many other resources online which should help. If you’re really
really stuck, then chat up one of the Chromium infrastructure team
members for some pointers.

Litmus Test

  If you know what git add, git status, git commit do and you know
  essentially what git rebase does, then you should know enough to follow
  along.

SETTING UP

GET DEPOT TOOLS

LINUX / MAC

Clone the depot_tools repository:

$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools

Add depot_tools to the end of your PATH (you will probably want to put this
in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools to
/path/to/depot_tools:

$ export PATH=$PATH:/path/to/depot_tools

WINDOWS

Download the depot_tools
bundle and
extract it somewhere.

Warning

DO NOT use drag-n-drop or copy-n-paste extract from Explorer, this will not
extract the hidden “.git” folder which is necessary for depot_tools to
autoupdate itself. You can use “Extract all…” from the context menu though.

Add depot_tools to the end of your PATH. Assuming you unzipped the
bundle to C:\workspace\depot_tools:

With Administrator access:

  Control Panel → System and Security → System → Advanced system settings

Modify the PATH system variable to include C:\workspace\depot_tools.

Without Administrator access:

  Control Panel → User Accounts → User Accounts → Change my environment variables

Add a PATH user variable: %PATH%;C:\workspace\depot_tools.

From a cmd.exe shell, run the command gclient (without arguments). On first
run, gclient will install all the Windows-specific bits needed to work with the
code, including msysgit and python.

Note

If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), it
  may appear to run properly, but msysgit, python, and other tools may not get
  installed correctly.

If you see strange errors with the file system on the first run of gclient,
  you may want to disable
  Windows Indexing.

If you are running Windows XP and see errors like “The system cannot execute
  the specified program”, try installing the
  “Microsoft
  Visual C++ 2008 Redistributable Package”.

BOOTSTRAPPING CONFIGURATION

If you have never used git before, you'll need to set some global git
configurations; substitute your name and email address in the following
commands:

$ git config --global user.name “John Doe”
$ git config --global user.email “jdoe@email.com”
$ git config --global core.autocrlf false
$ git config --global core.filemode false
$ # and for fun!
$ git config --global color.ui true

TL;DR

$ # get the code
$ # In an empty directory:
$ fetch {chromium,blink,...}

$ # Update third_party repos and run pre-compile hooks
$ gclient sync

$ # Make a new change and upload it for review
$ git new-branch <branch_name>
$ # repeat: [edit, git add, git commit]
$ git cl upload

$ # After change is reviewed, commit with the CQ
$ git cl set_commit
$ # Note that the committed hash which lands will /not/ match the
$ # commit hashes of your local branch.

GETTING THE CODE

Pick an empty directory and run one of the following:

$ fetch chromium  # Basic checkout for desktop Chromium
$ fetch blink     # Chromium code with Blink checked out to tip-of-tree
$ fetch android   # Chromium checkout for Android platform
$ fetch ios       # Chromium checkout for iOS platform

When the fetch tool completes you should have the following in your working
directory:

.gclient   # A configuration file for you source checkout
src/       # Top-level Chromium source checkout.

If you are on linux and fetching the code for the first time, then you’ll need
to run:

$ cd src && ./build/install-build-deps.sh

And finally:

$ gclient sync

This will pull all dependencies of the Chromium src checkout. You will need
to run this any time you update the main src checkout, including when you
switch branches.

CREATING / UPLOADING A CL

Note

The remainder of the tutorial assumes that your current working directory
is the src/ folder mentioned in Getting the code.

Each CL corresponds exactly with a single branch in git. Any time you want to
begin a new CL:

$ git new-branch <branch_name>

This will create and checkout a new branch named branch_name which will track
the default upstream branch (origin/master). See
git-new-branch(1) for more features.

Commit as many changes as you like to this branch. When you want to upload it
for review, run:

$ git cl upload

This will take the diff of your branch against its upstream branch (in that
case origin/master), and will post it to the
Chromium code review site.

UPDATING THE CODE

Inevitably, you’ll want to pull in changes from the main Chromium repo. This is
pretty easy with depot_tools:

$ git rebase-update

This command will update all of your CLs to contain the latest code from their
upstreams. It will also automatically clean up CLs which have been committed and
a couple other nice things. See git-rebase-update(1) for the full
scoop.

One thing to look out for are merge conflicts. These happen for exactly the
same as they do with SVN, but the experience is a little more controllable with
git. git rebase-update will try to rebase all your branches for you, but if it
encounters a merge conflict in one, it will halt and leave you in a rebase
conflict state (see git-rebase(1)). Resolving git rebase merge
conflicts is beyond the scope of this tutorial, but there are many good sources
online (see the Prerequisites for some).

Sometimes you’re pretty certain that you’ve committed a certain branch, but git
rebase-update isn’t able to tell that for sure. This is usually because your
branch doesn’t rebase cleanly. You could just delete the branch with git branch
-D <branch>, but you’d like to double check the diff of your branch against its
upstream before deleting it. If this is the case you can abort the rebase
started by git rebase-update, and then run git-squash-branch(1) to
flatten your branch into a single commit. When you run git rebase-update
again, you’ll get a (hopefully) much smaller / saner diff. If it turns out you
were wrong about your branch being fully committed, you can use
git-reflog(1) to reset your branch back to where it was before. If the
diff looks inconsequential, you can use git rebase --skip to ignore it, and
then git rebase-update will clean it up for you.

Once you’re done resolving all of the merge conflict, just run git
rebase-update, and it will pick up where it left off. Once the command has
finished updating all of your branches, it will return you back to the branch
you started on.

Note

Running git rebase-update will update all your branches, but it will not
automatically run gclient sync to update your dependencies.

MANAGING MULTIPLE CLS

Sometimes you want to work on more than one CL at once (say, you have a CL
posted for review and want to work on something else). For each CL that you
want to work on, just use git new-branch <branch_name>.

Once you start to have more than one CL at a time, it can be easy to lose your
bearings. Fortunately, depot_tools has two tools to help you out:

$ git map
* 7dcfe47        (frozen_changes) 2014-03-12 ~ FREEZE.unindexed
* 4b0c180        2014-03-12 ~ modfile
* 59a7cca        2014-03-12 ~ a deleted file
* 6bec695        (origin/master) 2014-03-11 ~ Add neat feature    <(frozen_changes)
* d15a38a        2014-03-11 ~ Epic README update
* d559894        (master) 2014-03-11 ~ Important upstream change
| * 9c311fd      (cool_feature) 2014-03-11 ~ Respond to CL comments
| | * 2a1eeb2    (subfeature) 2014-03-11 ~ integrate with CoolService
| | * d777af6    2014-03-11 ~ slick commenting action
| |/
| * 265803a      2014-03-11 ~ another improvement    <(subfeature)
| * 6d831ac      (spleen_tag) 2014-03-11 ~ Refactor spleen
| * 82e74ab      2014-03-11 ~ Add widget
|/
* d08c5b3        (bogus_noparent) 2014-03-11 ~ Wonderful beginnings    <(cool_feature)

Note that this example repo is in dire need of a git-rebase-update(1)!

$ git map-branches
origin/master
  cool_feature
    subfeature
  frozen_changes *
  master

git-map(1)

  This tool shows you the history of all of your branches in a pseudo-graphical
  format. In particular, it will show you which commits all of your branches
  are on, which commit you currently have checked out, and more. Check out the
  doc for the full details.

git-map-branches(1)

  This tool just shows you which branches you have in your repo, and their
  upstream relationship to each other (as well as which branch you have checked
  out at the moment).

Additionally, sometimes you need to switch between branches, but you’ve got work
in progress. You could use git-stash(1), but that can be tricky to
manage because you need to remember which branches you stashed what changes on.
Helpfully depot_tools includes two tools which can greatly assist in case:

git-freeze(1) allows you to put the current branch in 'suspended
animation' by committing your changes to a specially-named commit on the top of
your current branch. When you come back to your branch later, you can just run
git-thaw(1) to get your work-in-progress changes back to what they were.

Another useful tool is git-rename-branch(1). Unlike git branch -m <old>
<new>, this tool will correctly preserve the upstream relationships of your
branch compared to its downstreams.

Finally, take a look at git-upstream-diff(1). This will show you the
combined diff for all the commits on your branch against the upstream tracking
branch. This is exactly what git cl upload will push up to code review.
Additionally, consider trying the --wordwise argument to get a colorized
per-word diff (instead of a per-line diff).

MANAGING DEPENDENT CLS

Now that you know how to manage independent CLs, we’ll see how to manage
dependent CLs. Dependent CLs are useful when your second (or third or fourth
or …) CL depends on the changes in one of your other CLs (such as: CL 2 won’t
compile without CL 1, but you want to submit them as two separate reviews).

Like all of the other CLs we’ve created, we use git-new-branch(1), but
this time with an extra argument. First, git checkout the branch
you want to base the new one on (i.e. CL 1), and then run:

$ git new-branch --upstream_current <branch_name>

This will make a new branch which tracks the current branch as its upstream
(as opposed to origin/master). All changes you commit to this branch will be
in addition to the previous branch, but when you git cl upload, you will only
upload the diff for the dependent (child) branch. You may have as many branches
nested in this fashion as you like.

git-map(1) and git-map-branches(1) are particularly helpful when
you have dependent branches. In addition, there are two helper commands which
let you traverse your working copy up and down this tree of branches:
git-nav-upstream(1) and git-nav-downstream(1).

Sometimes when dealing with dependent CLs, it turns out that you accidentally
based a branch on the wrong upstream, but since then you’ve committed changes to
it, or even based another branch off of that one. Or you discover that you
have two independent CLs that would actually be much better off as dependent
CLs. In instances like these, you can check out the offending branch and use
git-reparent-branch(1) to move it to track a different parent. Note that
this can also be used to move a branch from tracking origin/master to lkgr
or vice versa.

EXAMPLE WALKTHROUGH

This section will demo what a typical workflow looks like when writing,
updating, and committing multiple CLs.

$ fetch chromium
... truncated output ...
$ cd src

 (only on linux)

$ ./build/install-build-deps.sh
... truncated output ...

 Pull in all dependencies for HEAD

$ gclient sync
... truncated output ...

 Let's fix something!

$ git new-branch fix_typo
$ echo -e '/Banana\ns/Banana/Kuun\nwq' | ed build/whitespace_file.txt
1503
1501
It was a Domo-Banana.
It was a Domo-Kuun.
$ git commit -am 'Fix terrible typo.'
[fix_typo 615ffa7] Fix terrible typo.
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git map
* 615ffa7	 (fix_typo) 2014-04-10 ~ Fix terrible typo.
* beec6f4	 (origin/master, origin/HEAD) 2014-04-10 ~ Make ReflectorImpl use mailboxes    <(fix_typo)
* 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
* a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
* 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
* 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
* 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
* 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr
$ git status
# On branch fix_typo
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
$ git cl upload -r domo@chromium.org --send-mail
... truncated output ...

 While we wait for feedback, let's do something else.

$ git new-branch chap2
$ git map-branches
origin/master
  chap2 *
  fix_typo
$ cat >> build/whitespace_file.txt <<EOF

"You recall what happened on Mulholland drive?" The ceiling fan rotated slowly
overhead, barely disturbing the thick cigarette smoke. No doubt was left about
when the fan was last cleaned.
EOF
$ git status
# On branch chap2
# Your branch is up-to-date with 'origin/master'.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   build/whitespace_file.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

 Someone on the code review pointed out that our typo-fix has a typo :( We're still working on 'chap2' but we really want to land 'fix_typo', so let's switch over and fix it.

$ git freeze
$ git checkout fix_typo
Switched to branch 'fix_typo'
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
$ echo -e '/Kuun\ns/Kuun/Kun\nwq' | ed build/whitespace_file.txt
1501
1500
It was a Domo-Kuun.
It was a Domo-Kun.
$ git upstream-diff --wordwise
diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt
index 3eba355..57cdcee 100644
--- a/build/whitespace_file.txt
+++ b/build/whitespace_file.txt
@@ -17,7 +17,7 @@ swept up the streets (for it is in London that our scene lies), rattling along
the housetops, and fiercely agitating the scanty flame of the lamps that
struggled against the elements. A hooded figure emerged.

It was a Domo-BananaKun.

"What took you so long?", inquired his wife.

$ git commit -am 'Fix typo for good!'
[fix_typo 2c0ad9c] Fix typo for good!
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git cl upload
... truncated output ...

 Since we got lgtm, let the CQ land it.

$ git cl set_commit
$ git map
* 0e2e52e	 (chap2) 2014-04-10 ~ FREEZE.unindexed
| * 2c0ad9c	 (fix_typo) 2014-04-10 ~ Fix typo for good!
| * 615ffa7	 2014-04-10 ~ Fix terrible typo.
|/
* beec6f4	 (origin/master, origin/HEAD) 2014-04-10 ~ Make ReflectorImpl use mailboxes    <(chap2, fix_typo)
* 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
* a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
* 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
* 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
* 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
* 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr

 Switch back to where we were using the nav* commands (for fun... git checkout would work here too)

$ git map-branches
origin/master
  chap2
  fix_typo *
$ git nav-upstream
Note: checking out 'origin/master'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at beec6f4... Make ReflectorImpl use mailboxes
$ git nav-downstream
Please select a downstream branch
  0. chap2
  1. fix_typo
Selection (0-1)[0]: 0
Previous HEAD position was beec6f4... Make ReflectorImpl use mailboxes
Switched to branch 'chap2'
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
$ git map-branches
origin/master
  chap2 *
  fix_typo

 Now we can pick up on chapter2 where we left off.

$ git thaw
$ git diff
diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt
index 3eba355..9d08d9d 100644
--- a/build/whitespace_file.txt
+++ b/build/whitespace_file.txt
@@ -34,3 +34,7 @@ with his fork, watching the runny jelly spread and pool across his plate,
 like the blood of a dying fawn. \"It reminds me of that time --\" he started, as
 his wife cut in quickly: \"-- please. I can't bear to hear it.\". A flury of
 images coming from the past flowed through his mind.
+
+"You recall what happened on Mulholland drive?" The ceiling fan rotated slowly
+overhead, barely disturbing the thick cigarette smoke. No doubt was left about
+when the fan was last cleaned.
$ cat >> build/whitespace_file.txt <<EOF

There was an poignant pause.
EOF
$ git diff
diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt
index 3eba355..e3a55de 100644
--- a/build/whitespace_file.txt
+++ b/build/whitespace_file.txt
@@ -34,3 +34,9 @@ with his fork, watching the runny jelly spread and pool across his plate,
 like the blood of a dying fawn. \"It reminds me of that time --\" he started, as
 his wife cut in quickly: \"-- please. I can't bear to hear it.\". A flury of
 images coming from the past flowed through his mind.
+
+"You recall what happened on Mulholland drive?" The ceiling fan rotated slowly
+overhead, barely disturbing the thick cigarette smoke. No doubt was left about
+when the fan was last cleaned.
+
+There was an poignant pause.
$ git commit -am 'Finish chapter 2'
[chap2 ceef712] Finish chapter 2
 1 file changed, 6 insertions(+)
$ git map
* ceef712	 (chap2) 2014-04-10 ~ Finish chapter 2
| * 2c0ad9c	 (fix_typo) 2014-04-10 ~ Fix typo for good!
| * 615ffa7	 2014-04-10 ~ Fix terrible typo.
|/
* beec6f4	 (origin/master, origin/HEAD) 2014-04-10 ~ Make ReflectorImpl use mailboxes    <(chap2, fix_typo)
* 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
* a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
* 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
* 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
* 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
* 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr
$ git cl upload -r domo@chromium.org --send-mail
... truncated output ...

 We poke a committer until they lgtm :)

$ git cl set_commit

 While that runs through the CQ, let's get started on chapter 3. Since we know that chapter 3 depends on chapter 2, we'll track the current chapter2 branch.

$ git new-branch --upstream_current chap3
$ cat >> build/whitespace_file.txt <<EOF

CHAPTER 3:
Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he
began feeling sick.
EOF
$ git commit -am 'beginning of chapter 3'
[chap3 7d4238a] beginning of chapter 3
 1 file changed, 4 insertions(+)
$ git map
* 7d4238a	 (chap3) 2014-04-10 ~ beginning of chapter 3
* ceef712	 (chap2) 2014-04-10 ~ Finish chapter 2    <(chap3)
| * 2c0ad9c	 (fix_typo) 2014-04-10 ~ Fix typo for good!
| * 615ffa7	 2014-04-10 ~ Fix terrible typo.
|/
* beec6f4	 (origin/master, origin/HEAD) 2014-04-10 ~ Make ReflectorImpl use mailboxes    <(chap2, fix_typo)
* 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
* a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
* 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
* 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
* 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
* 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr

 We haven't updated the code in a while, so let's do that now.

$ git rebase-update
Fetching origin
From https://upstream
   beec6f4..59cdb73  master     -> origin/master
Rebasing: chap2
Rebasing: fix_typo
Failed! Attempting to squash fix_typo ... Success!
Rebasing: chap3
Deleted branch fix_typo (was 5d26fec).
Reparented chap3 to track origin/master (was tracking chap2)
Deleted branch chap2 (was 5d26fec).

 Well look at that. The CQ landed our typo and chapter2 branches  already and git rebase-update cleaned them up for us.

$ gclient sync
... truncated output ...
$ git map
* 93fe917	 (chap3) 2014-04-10 ~ beginning of chapter 3
* 5d26fec	 (origin/master, origin/HEAD) 2014-04-10 ~ Finish chapter 2    <(chap3)
* df7fefb	 2014-04-10 ~ Revert 255617, due to it not tracking use of the link doctor page properly.
* 4b39cda	 2014-04-10 ~ Fix terrible typo.
* 248c5b6	 2014-04-10 ~ Temporarily CHECK(trial) in ChromeRenderProcessObserver::OnSetFieldTrialGroup.
* 8171df8	 2014-04-10 ~ Remove AMD family check for the flapper crypto accelerator.
* d6a30d2	 2014-04-10 ~ Change the Pica load benchmark to listen for the polymer-ready event
* beec6f4	 2014-04-10 ~ Make ReflectorImpl use mailboxes
* 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
* a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
* 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
* 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
* 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
* 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr

 Someone on IRC mentions that they actually landed a chapter 3 already! We should pull their changes before continuing. Brace for a code conflict!

$ git rebase-update
Fetching origin
From https://upstream
   5d26fec..59cdb73  master     -> origin/master
Rebasing: chap2
... lots of output, it's a conflict alright :(...
$ git diff
diff --cc build/whitespace_file.txt
index 1293282,f903ea2..0000000
--- a/build/whitespace_file.txt
+++ b/build/whitespace_file.txt
@@@ -42,4 -42,5 +42,9 @@@ when the fan was last cleaned
  There was an poignant pause.

  CHAPTER 3:
++<<<<<<< HEAD
 +Hilariousness! This chapter is awesome!
++=======
+ Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he
+ began feeling sick.
++>>>>>>> beginning of chapter 3

 Oh, well, that's not too bad. In fact... that's a terrible chapter 3!

$ $EDITOR build/whitespace_file.txt
... /me deletes bad chapter 3 ...
$ git add build/whitespace_file.txt
$ git diff --cached
diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt
index 1293282..f903ea2 100644
--- a/build/whitespace_file.txt
+++ b/build/whitespace_file.txt
@@ -42,4 +42,5 @@ when the fan was last cleaned.
 There was an poignant pause.

 CHAPTER 3:
-Hilariousness! This chapter is awesome!
+Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he
+began feeling sick.

 Much better

$ git rebase --continue
Applying: beginning of chapter 3
$ git rebase-update
Fetching origin
chap3 up-to-date
$ gclient sync
... truncated output ...
$ git map
* 1cb4f5b	 (chap3) 2014-04-10 ~ beginning of chapter 3
* 59cdb73	 (origin/master, origin/HEAD) 2014-04-10 ~ Refactor data interchange format.    <(chap3)
* 34676a3	 2014-04-10 ~ Ensure FS is exited for all not-in-same-page navigations.
* 7d4784e	 2014-04-10 ~ Add best chapter2 ever!
* 5d26fec	 2014-04-10 ~ Finish chapter 2
* df7fefb	 2014-04-10 ~ Revert 255617, due to it not tracking use of the link doctor page properly.
* 4b39cda	 2014-04-10 ~ Fix terrible typo.
* 248c5b6	 2014-04-10 ~ Temporarily CHECK(trial) in ChromeRenderProcessObserver::OnSetFieldTrialGroup.
* 8171df8	 2014-04-10 ~ Remove AMD family check for the flapper crypto accelerator.
* d6a30d2	 2014-04-10 ~ Change the Pica load benchmark to listen for the polymer-ready event
* beec6f4	 2014-04-10 ~ Make ReflectorImpl use mailboxes
* 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
* a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
* 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
* 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
* 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
* 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr
$ git cl upload
... truncated output ...

So there you have the basic flow. Note that you don’t have to do chromium
development using these tools. Any git workflow is compatible, as long as
git cl upload is able to upload good patches.

CONCLUSION

Hopefully that gives you a good starting overview on Chromium development using
depot_tools. If you have questions which weren’t answered by this tutorial or
the man pages for the tools (see the index of all tools here:
depot_tools(7)), please feel free to ask.

GLOSSARY

CL

  A change-list. This is a diff which you would like to commit to the
  codebase.

DEPS

  A file in the chromium checkout which gclient sync uses to determine what
  dependencies to pull in. This file also contains hooks.

LKGR

  Last Known Good Revision. This is a git-tag(1) which tracks the last
  version of origin/master which has passed the full set of testing on the
  main Chromium waterfall.

CHROMIUM DEPOT_TOOLS

Part of the chromium depot_tools(7) suite. These tools are meant to
assist with the development of chromium and related projects. Download the tools
from here.

Last updated 2014-05-09 17:43:43 PDT

redpajama_set_name: RedPajamaGithub


text:
Simplifies extending classes and provides static inheritance. Classes that need to be extendable should extend Class
which will in turn give them the `extend` static function for their subclasses to use. In addition to a prototype,
mixins may be added as well.

One problem with many `Class.extend(prototype)` implementations is that you lose the name of the function, making it
harder during debug time to know what objects you're looking at in the logs since the function name for a class is used
in the display. By requiring the constructor to be defined outside of `extend` you get to keep the name and still
benefit from static inheritance and the increased code readability `extend` provides.

## Usage

This package is not on NPM. There are enough class systems out there and this is simple enough that you can clone or
simply copy-paste the code into your own project.

## Features

* Keeps the class name by requiring the constructor to be defined as a named function
* Makes prototype members non-enumerable so only instance data is enumerable, easier for debugging as well
* Static inheritance, methods defined statically on the super class are copied to the sub class
* Inline getters/setters supported in the prototype definitions
* Multiple inheritance (sort of, not the real deal), or mixins are supported

## Examples

Here are some examples of feature usage.

### Simple extension

```
var Class = require('class.extend');

function SuperClass(name) {
  this.name = name || '';
}

Class.extend(SuperClass, {
  output: function() {
    console.log(this.name);
  }
});

function MyClass(name, type) {
  SuperClass.call(this, name);
  this.type = type || '';
}

SuperClass.extend(MyClass, {
  output: function() {
    console.log(this.name, this.type);
  }
});
```

### Mixins, getters/setters

```
// ...

function MyClass() {
  SuperClass.call(this);
  EventEmitter.call(this);
  this._bar = 0;
}

SuperClass.extend(MyClass, EventEmitter, {
  foo: function() {
    this._bar++;
  },
  get bar() {
    return this._bar;
  }
});
```

### Statics

```
// ...

Class.extend(SuperClass, {
  foo: function() {
    // do something
  }
});

// Singleton support
SuperClass.getInstance = function() {
  if (!this._instance || this._instance.constructor !== this) {
    this._instance = new this();
  }
  return this._instance;
};

SuperClass.extend(MyClass);

var myclass = MyClass.getInstance();
```

```
var Class = require('class.extend');

function SuperClass() {

}

Class.extend(SuperClass, {
  static: {
    type: 'superclass'
  },

  get type() {
    return this.constructor.type;
  }
});

function MyClass() {

}

SuperClass.extend(MyClass, {
  static: {
    type: 'myclass'
  }
});

console.log(MyClass.type); // myclass
```


text:
#include <modules/spacecraftinstruments/rendering/renderableshadowcylinder.h>

#include <modules/spacecraftinstruments/spacecraftinstrumentsmodule.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/spicemanager.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem.h>

namespace {
    constexpr std::array<const char*, 3> UniformNames = {
        "modelViewProjectionTransform", "shadowColor", "opacity"
    };

    constexpr openspace::properties::Property::PropertyInfo NumberPointsInfo = {
        "AmountOfPoints",
        "Points",
        "This value determines the number of control points that is used to construct "
        "the shadow geometry. The higher this number, the more detailed the shadow is, "
        "but it will have a negative impact on the performance"
    };

    constexpr openspace::properties::Property::PropertyInfo ShadowLengthInfo = {
        "ShadowLength",
        "Shadow Length",
        "This value determines the length of the shadow that is cast by the target "
        "object. The total distance of the shadow is equal to the distance from the "
        "target to the Sun multiplied with this value"
    };

    constexpr openspace::properties::Property::PropertyInfo ShadowColorInfo = {
        "ShadowColor",
        "Shadow Color",
        "This value determines the color that is used for the shadow cylinder"
    };

    constexpr openspace::properties::Property::PropertyInfo TerminatorTypeInfo = {
        "TerminatorType",
        "Terminator Type",
        "This value determines the type of the terminator that is used to calculate the "
        "shadow eclipse"
    };

    constexpr openspace::properties::Property::PropertyInfo LightSourceInfo = {
        "LightSource",
        "Light Source",
        "This value determines the SPICE name of the object that is used as the "
        "illuminator for computing the shadow cylinder"
    };

    constexpr openspace::properties::Property::PropertyInfo ObserverInfo = {
        "Observer",
        "Observer",
        "This value specifies the SPICE name of the object that is the observer of the "
        "shadow cylinder"
    };

    constexpr openspace::properties::Property::PropertyInfo BodyInfo = {
        "Body",
        "Target Body",
        "This value is the SPICE name of target body that is used as the shadow caster "
        "for the shadow cylinder"
    };

    constexpr openspace::properties::Property::PropertyInfo BodyFrameInfo = {
        "BodyFrame",
        "Body Frame",
        "This value is the SPICE name of the reference frame in which the shadow "
        "cylinder is expressed"
    };

    constexpr openspace::properties::Property::PropertyInfo AberrationInfo = {
        "Aberration",
        "Aberration",
        "This value determines the aberration method that is used to compute the shadow "
        "cylinder"
    };

    struct [[codegen::Dictionary(RenderableShadowCylinder)]] Parameters {
        // [[codegen::verbatim(NumberPointsInfo.description)]]
        std::optional<int> numberOfPoints [[codegen::key("AmountOfPoints")]];

        // [[codegen::verbatim(ShadowLengthInfo.description)]]
        std::optional<float> shadowLength;

        // [[codegen::verbatim(ShadowColorInfo.description)]]
        std::optional<glm::vec3> shadowColor [[codegen::color()]];

        enum class [[codegen::map(openspace::SpiceManager::TerminatorType)]] Terminator {
            Umbral [[codegen::key("UMBRAL")]],
            Penumbral [[codegen::key("PENUMBRAL")]]
        };
        // [[codegen::verbatim(TerminatorTypeInfo.description)]]
        Terminator terminatorType;

        // [[codegen::verbatim(LightSourceInfo.description)]]
        std::string lightSource;

        // [[codegen::verbatim(ObserverInfo.description)]]
        std::string observer;

        // [[codegen::verbatim(BodyInfo.description)]]
        std::string body;

        // [[codegen::verbatim(BodyFrameInfo.description)]]
        std::string bodyFrame;

        // [[codegen::verbatim(AberrationInfo.description)]]
        std::string aberration [[codegen::inlist("NONE", "LT", "LT+S", "CN", "CN+S")]];
    };
#include "renderableshadowcylinder_codegen.cpp"
} // namespace

namespace openspace {

documentation::Documentation RenderableShadowCylinder::Documentation() {
    return codegen::doc<Parameters>("spacecraftinstruments_renderableshadowcylinder");
}

RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary)
    : Renderable(dictionary)
    , _numberOfPoints(NumberPointsInfo, 190, 1, 300)
    , _shadowLength(ShadowLengthInfo, 0.1f, 0.f, 0.5f)
    , _shadowColor(ShadowColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
    , _terminatorType(
        TerminatorTypeInfo,
        properties::OptionProperty::DisplayType::Dropdown
    )
    , _lightSource(LightSourceInfo)
    , _observer(ObserverInfo)
    , _body(BodyInfo)
    , _bodyFrame(BodyFrameInfo)
    , _aberration(AberrationInfo)
{
    const Parameters p = codegen::bake<Parameters>(dictionary);

    addProperty(_opacity);
    registerUpdateRenderBinFromOpacity();

    _numberOfPoints = p.numberOfPoints.value_or(_numberOfPoints);
    addProperty(_numberOfPoints);

    _shadowLength = p.shadowLength.value_or(_shadowLength);
    addProperty(_shadowLength);

    _shadowColor = p.shadowColor.value_or(_shadowColor);
    _shadowColor.setViewOption(properties::Property::ViewOptions::Color);
    addProperty(_shadowColor);

    _terminatorType.addOptions({
        { static_cast<int>(SpiceManager::TerminatorType::Umbral), "Umbral" },
        { static_cast<int>(SpiceManager::TerminatorType::Penumbral), "Penumbral" }
    });
    _terminatorType =
        static_cast<int>(codegen::map<SpiceManager::TerminatorType>(p.terminatorType));
    addProperty(_terminatorType);

    _lightSource = p.lightSource;
    _observer = p.observer;
    _body = p.body;
    _bodyFrame = p.bodyFrame;

    using T = SpiceManager::AberrationCorrection::Type;
    _aberration.addOptions({
        { static_cast<int>(T::None), "None" },
        { static_cast<int>(T::ConvergedNewtonian), "Converged Newtonian" },
        { static_cast<int>(T::ConvergedNewtonianStellar), "Converged Newtonian Stellar" },
        { static_cast<int>(T::LightTime), "Light Time" },
        { static_cast<int>(T::LightTimeStellar), "Light Time Stellar" },

    });
    SpiceManager::AberrationCorrection aberration = SpiceManager::AberrationCorrection(
        p.aberration
    );
    _aberration = static_cast<int>(aberration.type);
}

void RenderableShadowCylinder::initializeGL() {
    glGenVertexArrays(1, &_vao);
    glGenBuffers(1, &_vbo);

    _shader = SpacecraftInstrumentsModule::ProgramObjectManager.request(
        "ShadowCylinderProgram",
        []() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
            return global::renderEngine->buildRenderProgram(
                "ShadowCylinderProgram",
                absPath(
                    "${MODULE_SPACECRAFTINSTRUMENTS}/shaders/terminatorshadow_vs.glsl"
                ),
                absPath(
                    "${MODULE_SPACECRAFTINSTRUMENTS}/shaders/terminatorshadow_fs.glsl"
                )
            );
        }
    );

    ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames);
}

void RenderableShadowCylinder::deinitializeGL() {
    SpacecraftInstrumentsModule::ProgramObjectManager.release(
        "ShadowCylinderProgram",
        [](ghoul::opengl::ProgramObject* p) {
            global::renderEngine->removeRenderProgram(p);
        }
    );
    _shader = nullptr;

    glDeleteVertexArrays(1, &_vao);
    _vao = 0;
    glDeleteBuffers(1, &_vbo);
    _vbo = 0;
}

bool RenderableShadowCylinder::isReady() const {
    return true;
}

void RenderableShadowCylinder::render(const RenderData& data, RendererTasks&) {
    glDepthMask(false);
    glDisable(GL_CULL_FACE);

    _shader->activate();

    // Model transform and view transform needs to be in double precision
    const glm::dmat4 modelTransform =
        glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
        glm::dmat4(data.modelTransform.rotation) *
        glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
    glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;

    _shader->setUniform(
        _uniformCache.modelViewProjectionTransform,
        data.camera.projectionMatrix() * glm::mat4(modelViewTransform)
    );

    _shader->setUniform(_uniformCache.shadowColor, _shadowColor);
    _shader->setUniform(_uniformCache.opacity, opacity());

    glBindVertexArray(_vao);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, static_cast<GLsizei>(_vertices.size()));
    glBindVertexArray(0);

    _shader->deactivate();

    glDisable(GL_CULL_FACE);
    glDepthMask(true);
}

void RenderableShadowCylinder::update(const UpdateData& data) {
    _stateMatrix = SpiceManager::ref().positionTransformMatrix(
        _bodyFrame,
        "GALACTIC",
        data.time.j2000Seconds()
    );

    if (_shader->isDirty()) {
        _shader->rebuildFromFile();
        ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames);
    }
    createCylinder(data.time.j2000Seconds());
}

void RenderableShadowCylinder::createCylinder(double time) {
    SpiceManager::TerminatorEllipseResult res = SpiceManager::ref().terminatorEllipse(
        _body,
        _observer,
        _bodyFrame,
        _lightSource,
        static_cast<SpiceManager::TerminatorType>(_terminatorType.value()),
        {
            SpiceManager::AberrationCorrection::Type(_aberration.value()),
            SpiceManager::AberrationCorrection::Direction::Reception
        },
        time,
        _numberOfPoints
    );

    std::vector<glm::vec3> terminatorPoints;
    std::transform(
        res.terminatorPoints.begin(),
        res.terminatorPoints.end(),
        std::back_inserter(terminatorPoints),
        [](const glm::dvec3& p) { return p * 1000.0; }
    );

    double lt;
    glm::dvec3 vecLightSource = SpiceManager::ref().targetPosition(
        _body,
        _lightSource,
        "GALACTIC",
        {
            SpiceManager::AberrationCorrection::Type(_aberration.value()),
            SpiceManager::AberrationCorrection::Direction::Reception
        },
        time,
        lt
    );

    vecLightSource = glm::inverse(_stateMatrix) * vecLightSource;

    vecLightSource *= _shadowLength;
    _vertices.clear();

    for (const glm::vec3& v : terminatorPoints) {
        _vertices.push_back({ v[0], v[1], v[2], 0.f });
        glm::vec3 f = v + glm::vec3(vecLightSource);
        _vertices.push_back({ f[0], f[1], f[2], 0.f });
    }
    _vertices.push_back(_vertices[0]);
    _vertices.push_back(_vertices[1]);

    glBindVertexArray(_vao);
    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glBufferData(
        GL_ARRAY_BUFFER,
        _vertices.size() * sizeof(CylinderVBOLayout),
        nullptr,
        GL_DYNAMIC_DRAW
    );
    glBufferSubData(
        GL_ARRAY_BUFFER,
        0,
        _vertices.size() * sizeof(CylinderVBOLayout),
        _vertices.data()
    );

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, nullptr);
    glBindVertexArray(0);
}

} // namespace openspace


text:
var fs = require('fs');
var box = {
    id: 0,
    date: '',
    customer: '',
    address : '',
    items : []
};

var getDate = function(strDate) {
    var month = strDate.substring(0, 2);
    var day = strDate.substring(2, 4);
    var year = strDate.substring(4, 8);
    return new Date(year, month, day);
};

/**
* Load customer boxes from csv file
* example_data.csv ?( id, created at, customer name, address, items (separated by "/" ))    *
* @return {Array}
*/
var loadCSVData = function () {

    var fs = require('fs');
    var list = new Array();

    var lines = fs.readFileSync('example_data.csv', "utf8");

    var array = lines.split('\n');

    for (var i = 0; i < array.length; i++) {
        var cols = array[i].split(',');

        var currentBox = Object.create(box);
        currentBox.id = cols[0].trim();
        currentBox.date = getDate(cols[1].trim());
        currentBox.customer = cols[2].trim();
        currentBox.address = cols[3].trim();
        currentBox.items = cols[4].split('/');
        list.push(currentBox);
    }

    return list;
};

/**
* Write boxes into a json file -> storage.json *
*/
var writeStorage = function (jsonData) {
    fs.writeFileSync("storage.json", JSON.stringify(jsonData));
};

var readStorage = function () {
    var data = fs.readFileSync('storage.json', "utf8");
    return JSON.parse(data);
};

var deleteBox = function (id) {
    var boxes = readStorage();
    for (var i = 0; i < boxes.length; ++i) {
        if (boxes[i].id === id) {
            boxes.splice(i, 1);
            writeStorage(boxes);
        }
    }
}

var insertBox = function (box) {
    var boxes = readStorage();

    var len = boxes.length, max = -Infinity;
    while (len--) {
        if (boxes[len].id > max) {
            max = boxes[len].id;
        }
    }
    box.id = parseInt(max) + 1;

    boxes.push(box);
    writeStorage(boxes);

    return box;
};

module.exports = {
    loadCSVData: loadCSVData,
    readStorage : readStorage,
    writeStorage : writeStorage,
    deleteBox : deleteBox,
    insertBox : insertBox
};


text:
;(function() {

  /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  var undefined;

  /** Used as the semantic version number. */
  var VERSION = '3.10.0';

  /** Used to compose bitmasks for wrapper metadata. */
  var BIND_FLAG = 1,
      BIND_KEY_FLAG = 2,
      CURRY_BOUND_FLAG = 4,
      CURRY_FLAG = 8,
      CURRY_RIGHT_FLAG = 16,
      PARTIAL_FLAG = 32,
      PARTIAL_RIGHT_FLAG = 64,
      ARY_FLAG = 128,
      REARG_FLAG = 256;

  /** Used as default options for `_.trunc`. */
  var DEFAULT_TRUNC_LENGTH = 30,
      DEFAULT_TRUNC_OMISSION = '...';

  /** Used to detect when a function becomes hot. */
  var HOT_COUNT = 150,
      HOT_SPAN = 16;

  /** Used as the size to enable large array optimizations. */
  var LARGE_ARRAY_SIZE = 200;

  /** Used to indicate the type of lazy iteratees. */
  var LAZY_FILTER_FLAG = 1,
      LAZY_MAP_FLAG = 2;

  /** Used as the `TypeError` message for "Functions" methods. */
  var FUNC_ERROR_TEXT = 'Expected a function';

  /** Used as the internal argument placeholder. */
  var PLACEHOLDER = '__lodash_placeholder__';

  /** `Object#toString` result references. */
  var argsTag = '[object Arguments]',
      arrayTag = '[object Array]',
      boolTag = '[object Boolean]',
      dateTag = '[object Date]',
      errorTag = '[object Error]',
      funcTag = '[object Function]',
      mapTag = '[object Map]',
      numberTag = '[object Number]',
      objectTag = '[object Object]',
      regexpTag = '[object RegExp]',
      setTag = '[object Set]',
      stringTag = '[object String]',
      weakMapTag = '[object WeakMap]';

  var arrayBufferTag = '[object ArrayBuffer]',
      float32Tag = '[object Float32Array]',
      float64Tag = '[object Float64Array]',
      int8Tag = '[object Int8Array]',
      int16Tag = '[object Int16Array]',
      int32Tag = '[object Int32Array]',
      uint8Tag = '[object Uint8Array]',
      uint8ClampedTag = '[object Uint8ClampedArray]',
      uint16Tag = '[object Uint16Array]',
      uint32Tag = '[object Uint32Array]';

  /** Used to match empty string literals in compiled template source. */
  var reEmptyStringLeading = /\b__p \+= '';/g,
      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;

  /** Used to match HTML entities and HTML characters. */
  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
      reUnescapedHtml = /[&<>"'`]/g,
      reHasEscapedHtml = RegExp(reEscapedHtml.source),
      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);

  /** Used to match template delimiters. */
  var reEscape = /<%-([\s\S]+?)%>/g,
      reEvaluate = /<%([\s\S]+?)%>/g,
      reInterpolate = /<%=([\s\S]+?)%>/g;

  /** Used to match property names within property paths. */
  var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
      reIsPlainProp = /^\w*$/,
      rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;

  /**
   * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
   * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
   */
  var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
      reHasRegExpChars = RegExp(reRegExpChars.source);

  /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
  var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;

  /** Used to match backslashes in property paths. */
  var reEscapeChar = /\\(\\)?/g;

  /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;

  /** Used to match `RegExp` flags from their coerced string values. */
  var reFlags = /\w*$/;

  /** Used to detect hexadecimal string values. */
  var reHasHexPrefix = /^0[xX]/;

  /** Used to detect host constructors (Safari > 5). */
  var reIsHostCtor = /^\[object .+?Constructor\]$/;

  /** Used to detect unsigned integer values. */
  var reIsUint = /^\d+$/;

  /** Used to match latin-1 supplementary letters (excluding mathematical operators). */
  var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;

  /** Used to ensure capturing order of template delimiters. */
  var reNoMatch = /($^)/;

  /** Used to match unescaped characters in compiled string literals. */
  var reUnescapedString = /['\n\r\u2028\u2029\\]/g;

  /** Used to match words to create compound words. */
  var reWords = (function() {
    var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
        lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';

    return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
  }());

  /** Used to assign default `context` object properties. */
  var contextProps = [
    'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
    'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
    'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
    'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
  ];

  /** Used to make template sourceURLs easier to identify. */
  var templateCounter = -1;

  /** Used to identify `toStringTag` values of typed arrays. */
  var typedArrayTags = {};
  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  typedArrayTags[uint32Tag] = true;
  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  typedArrayTags[dateTag] = typedArrayTags[errorTag] =
  typedArrayTags[funcTag] = typedArrayTags[mapTag] =
  typedArrayTags[numberTag] = typedArrayTags[objectTag] =
  typedArrayTags[regexpTag] = typedArrayTags[setTag] =
  typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;

  /** Used to identify `toStringTag` values supported by `_.clone`. */
  var cloneableTags = {};
  cloneableTags[argsTag] = cloneableTags[arrayTag] =
  cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
  cloneableTags[dateTag] = cloneableTags[float32Tag] =
  cloneableTags[float64Tag] = cloneableTags[int8Tag] =
  cloneableTags[int16Tag] = cloneableTags[int32Tag] =
  cloneableTags[numberTag] = cloneableTags[objectTag] =
  cloneableTags[regexpTag] = cloneableTags[stringTag] =
  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  cloneableTags[errorTag] = cloneableTags[funcTag] =
  cloneableTags[mapTag] = cloneableTags[setTag] =
  cloneableTags[weakMapTag] = false;

  /** Used to map latin-1 supplementary letters to basic latin letters. */
  var deburredLetters = {
    '\xc0': 'A',  '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
    '\xe0': 'a',  '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
    '\xc7': 'C',  '\xe7': 'c',
    '\xd0': 'D',  '\xf0': 'd',
    '\xc8': 'E',  '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
    '\xe8': 'e',  '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
    '\xcC': 'I',  '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
    '\xeC': 'i',  '\xed': 'i', '\xee': 'i', '\xef': 'i',
    '\xd1': 'N',  '\xf1': 'n',
    '\xd2': 'O',  '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
    '\xf2': 'o',  '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
    '\xd9': 'U',  '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
    '\xf9': 'u',  '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
    '\xdd': 'Y',  '\xfd': 'y', '\xff': 'y',
    '\xc6': 'Ae', '\xe6': 'ae',
    '\xde': 'Th', '\xfe': 'th',
    '\xdf': 'ss'
  };

  /** Used to map characters to HTML entities. */
  var htmlEscapes = {
    '&': '&',
    '<': '<',
    '>': '>',
    '"': '"',
    "'": ''',
    '`': '`'
  };

  /** Used to map HTML entities to characters. */
  var htmlUnescapes = {
    '&': '&',
    '<': '<',
    '>': '>',
    '"': '"',
    ''': "'",
    '`': '`'
  };

  /** Used to determine if values are of the language type `Object`. */
  var objectTypes = {
    'function': true,
    'object': true
  };

  /** Used to escape characters for inclusion in compiled regexes. */
  var regexpEscapes = {
    '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',
    '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',
    'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',
    'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',
    'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'
  };

  /** Used to escape characters for inclusion in compiled string literals. */
  var stringEscapes = {
    '\\': '\\',
    "'": "'",
    '\n': 'n',
    '\r': 'r',
    '\u2028': 'u2028',
    '\u2029': 'u2029'
  };

  /** Detect free variable `exports`. */
  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;

  /** Detect free variable `module`. */
  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;

  /** Detect free variable `global` from Node.js. */
  var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;

  /** Detect free variable `self`. */
  var freeSelf = objectTypes[typeof self] && self && self.Object && self;

  /** Detect free variable `window`. */
  var freeWindow = objectTypes[typeof window] && window && window.Object && window;

  /** Detect the popular CommonJS extension `module.exports`. */
  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;

  /**
   * Used as a reference to the global object.
   *
   * The `this` value is used if it's the global object to avoid Greasemonkey's
   * restricted `window` object, otherwise the `window` object is used.
   */
  var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;

  /*--------------------------------------------------------------------------*/

  /**
   * The base implementation of `compareAscending` which compares values and
   * sorts them in ascending order without guaranteeing a stable sort.
   *
   * @private
   * @param {*} value The value to compare.
   * @param {*} other The other value to compare.
   * @returns {number} Returns the sort order indicator for `value`.
   */
  function baseCompareAscending(value, other) {
    if (value !== other) {
      var valIsNull = value === null,
          valIsUndef = value === undefined,
          valIsReflexive = value === value;

      var othIsNull = other === null,
          othIsUndef = other === undefined,
          othIsReflexive = other === other;

      if ((value > other && !othIsNull) || !valIsReflexive ||
          (valIsNull && !othIsUndef && othIsReflexive) ||
          (valIsUndef && othIsReflexive)) {
        return 1;
      }
      if ((value < other && !valIsNull) || !othIsReflexive ||
          (othIsNull && !valIsUndef && valIsReflexive) ||
          (othIsUndef && valIsReflexive)) {
        return -1;
      }
    }
    return 0;
  }

  /**
   * The base implementation of `_.findIndex` and `_.findLastIndex` without
   * support for callback shorthands and `this` binding.
   *
   * @private
   * @param {Array} array The array to search.
   * @param {Function} predicate The function invoked per iteration.
   * @param {boolean} [fromRight] Specify iterating from right to left.
   * @returns {number} Returns the index of the matched value, else `-1`.
   */
  function baseFindIndex(array, predicate, fromRight) {
    var length = array.length,
        index = fromRight ? length : -1;

    while ((fromRight ? index-- : ++index < length)) {
      if (predicate(array[index], index, array)) {
        return index;
      }
    }
    return -1;
  }

  /**
   * The base implementation of `_.indexOf` without support for binary searches.
   *
   * @private
   * @param {Array} array The array to search.
   * @param {*} value The value to search for.
   * @param {number} fromIndex The index to search from.
   * @returns {number} Returns the index of the matched value, else `-1`.
   */
  function baseIndexOf(array, value, fromIndex) {
    if (value !== value) {
      return indexOfNaN(array, fromIndex);
    }
    var index = fromIndex - 1,
        length = array.length;

    while (++index < length) {
      if (array[index] === value) {
        return index;
      }
    }
    return -1;
  }

  /**
   * The base implementation of `_.isFunction` without support for environments
   * with incorrect `typeof` results.
   *
   * @private
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
   */
  function baseIsFunction(value) {
    // Avoid a Chakra JIT bug in compatibility modes of IE 11.
    // See https://github.com/jashkenas/underscore/issues/1621 for more details.
    return typeof value == 'function' || false;
  }

  /**
   * Converts `value` to a string if it's not one. An empty string is returned
   * for `null` or `undefined` values.
   *
   * @private
   * @param {*} value The value to process.
   * @returns {string} Returns the string.
   */
  function baseToString(value) {
    return value == null ? '' : (value + '');
  }

  /**
   * Used by `_.trim` and `_.trimLeft` to get the index of the first character
   * of `string` that is not found in `chars`.
   *
   * @private
   * @param {string} string The string to inspect.
   * @param {string} chars The characters to find.
   * @returns {number} Returns the index of the first character not found in `chars`.
   */
  function charsLeftIndex(string, chars) {
    var index = -1,
        length = string.length;

    while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
    return index;
  }

  /**
   * Used by `_.trim` and `_.trimRight` to get the index of the last character
   * of `string` that is not found in `chars`.
   *
   * @private
   * @param {string} string The string to inspect.
   * @param {string} chars The characters to find.
   * @returns {number} Returns the index of the last character not found in `chars`.
   */
  function charsRightIndex(string, chars) {
    var index = string.length;

    while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
    return index;
  }

  /**
   * Used by `_.sortBy` to compare transformed elements of a collection and stable
   * sort them in ascending order.
   *
   * @private
   * @param {Object} object The object to compare.
   * @param {Object} other The other object to compare.
   * @returns {number} Returns the sort order indicator for `object`.
   */
  function compareAscending(object, other) {
    return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
  }

  /**
   * Used by `_.sortByOrder` to compare multiple properties of a value to another
   * and stable sort them.
   *
   * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,
   * a value is sorted in ascending order if its corresponding order is "asc", and
   * descending if "desc".
   *
   * @private
   * @param {Object} object The object to compare.
   * @param {Object} other The other object to compare.
   * @param {boolean[]} orders The order to sort by for each property.
   * @returns {number} Returns the sort order indicator for `object`.
   */
  function compareMultiple(object, other, orders) {
    var index = -1,
        objCriteria = object.criteria,
        othCriteria = other.criteria,
        length = objCriteria.length,
        ordersLength = orders.length;

    while (++index < length) {
      var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
      if (result) {
        if (index >= ordersLength) {
          return result;
        }
        var order = orders[index];
        return result * ((order === 'asc' || order === true) ? 1 : -1);
      }
    }
    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
    // that causes it, under certain circumstances, to provide the same value for
    // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
    // for more details.
    //
    // This also ensures a stable sort in V8 and other engines.
    // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
    return object.index - other.index;
  }

  /**
   * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
   *
   * @private
   * @param {string} letter The matched letter to deburr.
   * @returns {string} Returns the deburred letter.
   */
  function deburrLetter(letter) {
    return deburredLetters[letter];
  }

  /**
   * Used by `_.escape` to convert characters to HTML entities.
   *
   * @private
   * @param {string} chr The matched character to escape.
   * @returns {string} Returns the escaped character.
   */
  function escapeHtmlChar(chr) {
    return htmlEscapes[chr];
  }

  /**
   * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.
   *
   * @private
   * @param {string} chr The matched character to escape.
   * @param {string} leadingChar The capture group for a leading character.
   * @param {string} whitespaceChar The capture group for a whitespace character.
   * @returns {string} Returns the escaped character.
   */
  function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
    if (leadingChar) {
      chr = regexpEscapes[chr];
    } else if (whitespaceChar) {
      chr = stringEscapes[chr];
    }
    return '\\' + chr;
  }

  /**
   * Used by `_.template` to escape characters for inclusion in compiled string literals.
   *
   * @private
   * @param {string} chr The matched character to escape.
   * @returns {string} Returns the escaped character.
   */
  function escapeStringChar(chr) {
    return '\\' + stringEscapes[chr];
  }

  /**
   * Gets the index at which the first occurrence of `NaN` is found in `array`.
   *
   * @private
   * @param {Array} array The array to search.
   * @param {number} fromIndex The index to search from.
   * @param {boolean} [fromRight] Specify iterating from right to left.
   * @returns {number} Returns the index of the matched `NaN`, else `-1`.
   */
  function indexOfNaN(array, fromIndex, fromRight) {
    var length = array.length,
        index = fromIndex + (fromRight ? 0 : -1);

    while ((fromRight ? index-- : ++index < length)) {
      var other = array[index];
      if (other !== other) {
        return index;
      }
    }
    return -1;
  }

  /**
   * Checks if `value` is object-like.
   *
   * @private
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
   */
  function isObjectLike(value) {
    return !!value && typeof value == 'object';
  }

  /**
   * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
   * character code is whitespace.
   *
   * @private
   * @param {number} charCode The character code to inspect.
   * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
   */
  function isSpace(charCode) {
    return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
      (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
  }

  /**
   * Replaces all `placeholder` elements in `array` with an internal placeholder
   * and returns an array of their indexes.
   *
   * @private
   * @param {Array} array The array to modify.
   * @param {*} placeholder The placeholder to replace.
   * @returns {Array} Returns the new array of placeholder indexes.
   */
  function replaceHolders(array, placeholder) {
    var index = -1,
        length = array.length,
        resIndex = -1,
        result = [];

    while (++index < length) {
      if (array[index] === placeholder) {
        array[index] = PLACEHOLDER;
        result[++resIndex] = index;
      }
    }
    return result;
  }

  /**
   * An implementation of `_.uniq` optimized for sorted arrays without support
   * for callback shorthands and `this` binding.
   *
   * @private
   * @param {Array} array The array to inspect.
   * @param {Function} [iteratee] The function invoked per iteration.
   * @returns {Array} Returns the new duplicate-value-free array.
   */
  function sortedUniq(array, iteratee) {
    var seen,
        index = -1,
        length = array.length,
        resIndex = -1,
        result = [];

    while (++index < length) {
      var value = array[index],
          computed = iteratee ? iteratee(value, index, array) : value;

      if (!index || seen !== computed) {
        seen = computed;
        result[++resIndex] = value;
      }
    }
    return result;
  }

  /**
   * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
   * character of `string`.
   *
   * @private
   * @param {string} string The string to inspect.
   * @returns {number} Returns the index of the first non-whitespace character.
   */
  function trimmedLeftIndex(string) {
    var index = -1,
        length = string.length;

    while (++index < length && isSpace(string.charCodeAt(index))) {}
    return index;
  }

  /**
   * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
   * character of `string`.
   *
   * @private
   * @param {string} string The string to inspect.
   * @returns {number} Returns the index of the last non-whitespace character.
   */
  function trimmedRightIndex(string) {
    var index = string.length;

    while (index-- && isSpace(string.charCodeAt(index))) {}
    return index;
  }

  /**
   * Used by `_.unescape` to convert HTML entities to characters.
   *
   * @private
   * @param {string} chr The matched character to unescape.
   * @returns {string} Returns the unescaped character.
   */
  function unescapeHtmlChar(chr) {
    return htmlUnescapes[chr];
  }

  /*--------------------------------------------------------------------------*/

  /**
   * Create a new pristine `lodash` function using the given `context` object.
   *
   * @static
   * @memberOf _
   * @category Utility
   * @param {Object} [context=root] The context object.
   * @returns {Function} Returns a new `lodash` function.
   * @example
   *
   * _.mixin({ 'foo': _.constant('foo') });
   *
   * var lodash = _.runInContext();
   * lodash.mixin({ 'bar': lodash.constant('bar') });
   *
   * _.isFunction(_.foo);
   * // => true
   * _.isFunction(_.bar);
   * // => false
   *
   * lodash.isFunction(lodash.foo);
   * // => false
   * lodash.isFunction(lodash.bar);
   * // => true
   *
   * // using `context` to mock `Date#getTime` use in `_.now`
   * var mock = _.runInContext({
   *   'Date': function() {
   *     return { 'getTime': getTimeMock };
   *   }
   * });
   *
   * // or creating a suped-up `defer` in Node.js
   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
   */
  function runInContext(context) {
    // Avoid issues with some ES3 environments that attempt to use values, named
    // after built-in constructors like `Object`, for the creation of literals.
    // ES5 clears this up by stating that literals must use built-in constructors.
    // See https://es5.github.io/#x11.1.5 for more details.
    context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;

    /** Native constructor references. */
    var Array = context.Array,
        Date = context.Date,
        Error = context.Error,
        Function = context.Function,
        Math = context.Math,
        Number = context.Number,
        Object = context.Object,
        RegExp = context.RegExp,
        String = context.String,
        TypeError = context.TypeError;

    /** Used for native method references. */
    var arrayProto = Array.prototype,
        objectProto = Object.prototype,
        stringProto = String.prototype;

    /** Used to resolve the decompiled source of functions. */
    var fnToString = Function.prototype.toString;

    /** Used to check objects for own properties. */
    var hasOwnProperty = objectProto.hasOwnProperty;

    /** Used to generate unique IDs. */
    var idCounter = 0;

    /**
     * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
     * of values.
     */
    var objToString = objectProto.toString;

    /** Used to restore the original `_` reference in `_.noConflict`. */
    var oldDash = root._;

    /** Used to detect if a method is native. */
    var reIsNative = RegExp('^' +
      fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
      .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
    );

    /** Native method references. */
    var ArrayBuffer = context.ArrayBuffer,
        clearTimeout = context.clearTimeout,
        parseFloat = context.parseFloat,
        pow = Math.pow,
        propertyIsEnumerable = objectProto.propertyIsEnumerable,
        Set = getNative(context, 'Set'),
        setTimeout = context.setTimeout,
        splice = arrayProto.splice,
        Uint8Array = context.Uint8Array,
        WeakMap = getNative(context, 'WeakMap');

    /* Native method references for those with the same name as other `lodash` methods. */
    var nativeCeil = Math.ceil,
        nativeCreate = getNative(Object, 'create'),
        nativeFloor = Math.floor,
        nativeIsArray = getNative(Array, 'isArray'),
        nativeIsFinite = context.isFinite,
        nativeKeys = getNative(Object, 'keys'),
        nativeMax = Math.max,
        nativeMin = Math.min,
        nativeNow = getNative(Date, 'now'),
        nativeParseInt = context.parseInt,
        nativeRandom = Math.random;

    /** Used as references for `-Infinity` and `Infinity`. */
    var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
        POSITIVE_INFINITY = Number.POSITIVE_INFINITY;

    /** Used as references for the maximum length and index of an array. */
    var MAX_ARRAY_LENGTH = 4294967295,
        MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
        HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;

    /**
     * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
     * of an array-like value.
     */
    var MAX_SAFE_INTEGER = 9007199254740991;

    /** Used to store function metadata. */
    var metaMap = WeakMap && new WeakMap;

    /** Used to lookup unminified function names. */
    var realNames = {};

    /*------------------------------------------------------------------------*/

    /**
     * Creates a `lodash` object which wraps `value` to enable implicit chaining.
     * Methods that operate on and return arrays, collections, and functions can
     * be chained together. Methods


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Medical mycology. Fungous diseases of men and other mammals (1935)

#### Original name
null

### Remarks
null


text:
[![Build Status](https://img.shields.io/travis/contributte/nextras-orm-query-object.svg?style=flat-square)](https://travis-ci.org/contributte/nextras-orm-query-object)
[![Code coverage](https://img.shields.io/coveralls/contributte/nextras-orm-query-object.svg?style=flat-square)](https://coveralls.io/r/contributte/nextras-orm-query-object)
[![Licence](https://img.shields.io/packagist/l/contributte/nextras-orm-query-object.svg?style=flat-square)](https://packagist.org/packages/contributte/nextras-orm-query-object)
[![Downloads this Month](https://img.shields.io/packagist/dm/contributte/nextras-orm-query-object.svg?style=flat-square)](https://packagist.org/packages/contributte/nextras-orm-query-object)
[![Downloads total](https://img.shields.io/packagist/dt/contributte/nextras-orm-query-object.svg?style=flat-square)](https://packagist.org/packages/contributte/nextras-orm-query-object)
[![Latest stable](https://img.shields.io/packagist/v/contributte/nextras-orm-query-object.svg?style=flat-square)](https://packagist.org/packages/contributte/nextras-orm-query-object)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)

## Discussion / Help

[![Join the chat](https://img.shields.io/gitter/room/contributte/contributte.svg?style=flat-square)](http://bit.ly/ctteg)

## Install

```
composer require contributte/nextras-orm-query-object
```

## Versions

| State       | Version | Branch   | PHP      |
|-------------|---------|----------|----------|
| dev         | `^0.3`  | `master` | `>= 7.1` |
| stable      | `^0.2`  | `master` | `>= 7.1` |

## Overview

- [Usage - how to use it](https://github.com/contributte/nextras-orm-query-object/blob/master/.docs/README.md#usage)

## Maintainers

        Milan Felix Šulc

        Marek Bartoš

-----

Thank you for testing, reporting and contributing.


text:
class AddUserIdToAccountLinkRequest < ActiveRecord::Migration
  def self.up
    add_column :account_link_requests, :user_id, :integer
    for id, user_id in execute("select account_link_requests.id, accounts.user_id from account_link_requests inner join accounts on account_link_requests.account_id = accounts.id")
      execute("update account_link_requests set user_id = #{user_id} where id = #{id}")
    end
  end

  def self.down
    remove_column :account_link_requests, :user_id
  end
end