content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
attempt #2 to fix format
12f31f3d871db074038b819df3f75bbf83d2ea43
<ide><path>test/lang/ms-my.js <ide> exports["lang:ms-my"] = { <ide> test.expect(22); <ide> <ide> var a = [ <del> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Ahad, Februari 14 2010, 3:25:50 petang'], <del> ['ddd, hA', 'Ahd, 3 petang'], <add> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Ahad, Februari 14 2010, 3:25:50 pm'], <add> ['ddd, hA', 'Ahd, 3PM'], <ide> ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], <ide> ['YYYY YY', '2010 10'], <ide> ['D Do DD', '14 14 14'], <ide> exports["lang:ms-my"] = { <ide> ['H HH', '15 15'], <ide> ['m mm', '25 25'], <ide> ['s ss', '50 50'], <del> ['a A', 'petang Petang'], <add> ['a A', 'pm PM'], <ide> ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'hari ke 45 tahun ini'], <ide> ['L', '02/14/2010'], <ide> ['LL', 'Februari 14 2010'], <del> ['LLL', 'Februari 14 2010 3:25 Petang'], <del> ['LLLL', 'Ahad, Februari 14 2010 3:25 Petang'], <add> ['LLL', 'Februari 14 2010 3:25 PM'], <add> ['LLLL', 'Ahad, Februari 14 2010 3:25 PM'], <ide> ['l', '2/14/2010'], <ide> ['ll', 'Feb 14 2010'], <del> ['lll', 'Feb 14 2010 3:25 Petang'], <del> ['llll', 'Ahd, Feb 14 2010 3:25 Petang'] <add> ['lll', 'Feb 14 2010 3:25 PM'], <add> ['llll', 'Ahd, Feb 14 2010 3:25 PM'] <ide> ], <ide> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), <ide> i;
1
Javascript
Javascript
remove unneeded escaping of /
0f4c7b8c371caae4cd4a2cb1fa03d2079f75663d
<ide><path>lib/url.js <ide> const protocolPattern = /^([a-z0-9.+-]+:)/i; <ide> const portPattern = /:[0-9]*$/; <ide> <ide> // Special case for a simple path URL <del>const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/; <add>const simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/; <ide> <ide> const hostnameMaxLen = 255; <ide> // protocols that can allow "unsafe" and "unwise" chars. <ide><path>tools/doc/html.js <ide> function loadGtoc(cb) { <ide> function toID(filename) { <ide> return filename <ide> .replace('.html', '') <del> .replace(/[^\w\-]/g, '-') <add> .replace(/[^\w-]/g, '-') <ide> .replace(/-+/g, '-'); <ide> } <ide> <ide> function linkJsTypeDocs(text) { <ide> // Handle types, for example the source Markdown might say <ide> // "This argument should be a {Number} or {String}" <ide> for (i = 0; i < parts.length; i += 2) { <del> typeMatches = parts[i].match(/\{([^\}]+)\}/g); <add> typeMatches = parts[i].match(/\{([^}]+)\}/g); <ide> if (typeMatches) { <ide> typeMatches.forEach(function(typeMatch) { <ide> parts[i] = parts[i].replace(typeMatch, typeParser.toLink(typeMatch)); <ide><path>tools/doc/json.js <ide> function doJSON(input, filename, cb) { <ide> // <!-- type = module --> <ide> // This is for cases where the markdown semantic structure is lacking. <ide> if (type === 'paragraph' || type === 'html') { <del> var metaExpr = /<!--([^=]+)=([^\-]+)-->\n*/g; <add> var metaExpr = /<!--([^=]+)=([^-]+)-->\n*/g; <ide> text = text.replace(metaExpr, function(_0, k, v) { <ide> current[k.trim()] = v.trim(); <ide> return ''; <ide> function parseListItem(item) { <ide> item.name = 'return'; <ide> text = text.replace(retExpr, ''); <ide> } else { <del> var nameExpr = /^['`"]?([^'`": \{]+)['`"]?\s*:?\s*/; <add> var nameExpr = /^['`"]?([^'`": {]+)['`"]?\s*:?\s*/; <ide> var name = text.match(nameExpr); <ide> if (name) { <ide> item.name = name[1]; <ide> function parseListItem(item) { <ide> } <ide> <ide> text = text.trim(); <del> var typeExpr = /^\{([^\}]+)\}/; <add> var typeExpr = /^\{([^}]+)\}/; <ide> var type = text.match(typeExpr); <ide> if (type) { <ide> item.type = type[1]; <ide> var classMethExpr = <ide> /^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i; <ide> var methExpr = <ide> /^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i; <del>var newExpr = /^new ([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/; <add>var newExpr = /^new ([A-Z][a-zA-Z]+)\([^)]*\)\s*?$/; <ide> var paramExpr = /\((.*)\);?$/; <ide> <ide> function newSection(tok) { <ide><path>tools/license2rtf.js <ide> function ParagraphParser() { <ide> <ide> // Detect separator "lines" within a block. These mark a paragraph break <ide> // and are stripped from the output. <del> if (/^\s*[=*\-]{5,}\s*$/.test(line)) { <add> if (/^\s*[=*-]{5,}\s*$/.test(line)) { <ide> flushParagraph(); <ide> return; <ide> } <ide> function RtfGenerator() { <ide> <ide> function rtfEscape(string) { <ide> return string <del> .replace(/[\\\{\}]/g, function(m) { <add> .replace(/[\\{}]/g, function(m) { <ide> return '\\' + m; <ide> }) <ide> .replace(/\t/g, function() {
4
Go
Go
add setsubenv and getsubenv
7b7f7e443637d8303f03316ee437012b71936c12
<ide><path>api.go <ide> func postCommit(srv *Server, version float64, w http.ResponseWriter, r *http.Req <ide> return err <ide> } <ide> var ( <del> config = &Config{} <add> config engine.Env <ide> env engine.Env <ide> job = srv.Eng.Job("commit", r.Form.Get("container")) <ide> ) <del> if err := json.NewDecoder(r.Body).Decode(config); err != nil && err != io.EOF { <add> if err := config.Import(r.Body); err != nil { <ide> utils.Errorf("%s", err) <ide> } <ide> <ide> job.Setenv("repo", r.Form.Get("repo")) <ide> job.Setenv("tag", r.Form.Get("tag")) <ide> job.Setenv("author", r.Form.Get("author")) <ide> job.Setenv("comment", r.Form.Get("comment")) <del> job.SetenvJson("config", config) <add> job.SetenvSubEnv("config", &config) <ide> <ide> var id string <ide> job.Stdout.AddString(&id) <ide> func postContainersAttach(srv *Server, version float64, w http.ResponseWriter, r <ide> return fmt.Errorf("Missing parameter") <ide> } <ide> <del> // TODO: replace the buffer by job.AddEnv() <ide> var ( <ide> job = srv.Eng.Job("inspect", vars["name"], "container") <del> buffer = bytes.NewBuffer(nil) <del> c Container <add> c, err = job.Stdout.AddEnv() <ide> ) <del> job.Stdout.Add(buffer) <del> if err := job.Run(); err != nil { <add> if err != nil { <ide> return err <ide> } <del> <del> if err := json.Unmarshal(buffer.Bytes(), &c); err != nil { <add> if err = job.Run(); err != nil { <ide> return err <ide> } <ide> <ide> func postContainersAttach(srv *Server, version float64, w http.ResponseWriter, r <ide> <ide> fmt.Fprintf(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n\r\n") <ide> <del> if !c.Config.Tty && version >= 1.6 { <add> if c.GetSubEnv("Config") != nil && !c.GetSubEnv("Config").GetBool("Tty") && version >= 1.6 { <ide> errStream = utils.NewStdWriter(outStream, utils.Stderr) <ide> outStream = utils.NewStdWriter(outStream, utils.Stdout) <ide> } else { <ide><path>engine/env.go <ide> func (env *Env) GetList(key string) []string { <ide> return l <ide> } <ide> <add>func (env *Env) GetSubEnv(key string) *Env { <add> sval := env.Get(key) <add> if sval == "" { <add> return nil <add> } <add> buf := bytes.NewBufferString(sval) <add> var sub Env <add> if err := sub.Decode(buf); err != nil { <add> return nil <add> } <add> return &sub <add>} <add> <add>func (env *Env) SetSubEnv(key string, sub *Env) error { <add> var buf bytes.Buffer <add> if err := sub.Encode(&buf); err != nil { <add> return err <add> } <add> env.Set(key, string(buf.Bytes())) <add> return nil <add>} <add> <ide> func (env *Env) GetJson(key string, iface interface{}) error { <ide> sval := env.Get(key) <ide> if sval == "" { <ide><path>engine/job.go <ide> func (job *Job) SetenvBool(key string, value bool) { <ide> job.env.SetBool(key, value) <ide> } <ide> <add>func (job *Job) GetenvSubEnv(key string) *Env { <add> return job.env.GetSubEnv(key) <add>} <add> <add>func (job *Job) SetenvSubEnv(key string, value *Env) error { <add> return job.env.SetSubEnv(key, value) <add>} <add> <ide> func (job *Job) GetenvInt64(key string) int64 { <ide> return job.env.GetInt64(key) <ide> } <ide><path>server.go <ide> func (srv *Server) ContainerCreate(job *engine.Job) engine.Status { <ide> } <ide> resolvConf, err := utils.GetResolvConf() <ide> if err != nil { <del> job.Error(err) <del> return engine.StatusErr <add> return job.Error(err) <ide> } <ide> if !config.NetworkDisabled && len(config.Dns) == 0 && len(srv.runtime.config.Dns) == 0 && utils.CheckLocalDns(resolvConf) { <ide> job.Errorf("WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: %v\n", defaultDns)
4
Python
Python
replace doctest traceback with `...`
393b9605259fe19e03bdaac2b0866151e1a2afc2
<ide><path>conversions/pressure_conversions.py <ide> def pressure_conversion(value: float, from_type: str, to_type: str) -> float: <ide> 0.019336718261000002 <ide> >>> pressure_conversion(4, "wrongUnit", "atm") <ide> Traceback (most recent call last): <del> File "/usr/lib/python3.8/doctest.py", line 1336, in __run <del> exec(compile(example.source, filename, "single", <del> File "<doctest __main__.pressure_conversion[8]>", line 1, in <module> <del> pressure_conversion(4, "wrongUnit", "atm") <del> File "<string>", line 67, in pressure_conversion <add> ... <ide> ValueError: Invalid 'from_type' value: 'wrongUnit' Supported values are: <ide> atm, pascal, bar, kilopascal, megapascal, psi, inHg, torr <ide> """ <ide><path>electronics/carrier_concentration.py <ide> def carrier_concentration( <ide> ('hole_conc', 1440.0) <ide> >>> carrier_concentration(electron_conc=1000, hole_conc=400, intrinsic_conc=1200) <ide> Traceback (most recent call last): <del> File "<stdin>", line 37, in <module> <add> ... <ide> ValueError: You cannot supply more or less than 2 values <ide> >>> carrier_concentration(electron_conc=-1000, hole_conc=0, intrinsic_conc=1200) <ide> Traceback (most recent call last): <del> File "<stdin>", line 40, in <module> <add> ... <ide> ValueError: Electron concentration cannot be negative in a semiconductor <ide> >>> carrier_concentration(electron_conc=0, hole_conc=-400, intrinsic_conc=1200) <ide> Traceback (most recent call last): <del> File "<stdin>", line 44, in <module> <add> ... <ide> ValueError: Hole concentration cannot be negative in a semiconductor <ide> >>> carrier_concentration(electron_conc=0, hole_conc=400, intrinsic_conc=-1200) <ide> Traceback (most recent call last): <del> File "<stdin>", line 48, in <module> <add> ... <ide> ValueError: Intrinsic concentration cannot be negative in a semiconductor <ide> """ <ide> if (electron_conc, hole_conc, intrinsic_conc).count(0) != 1: <ide><path>electronics/electric_power.py <ide> def electric_power(voltage: float, current: float, power: float) -> tuple: <ide> result(name='power', value=6.0) <ide> >>> electric_power(voltage=2, current=4, power=2) <ide> Traceback (most recent call last): <del> File "<stdin>", line 15, in <module> <add> ... <ide> ValueError: Only one argument must be 0 <ide> >>> electric_power(voltage=0, current=0, power=2) <ide> Traceback (most recent call last): <del> File "<stdin>", line 19, in <module> <add> ... <ide> ValueError: Only one argument must be 0 <ide> >>> electric_power(voltage=0, current=2, power=-4) <ide> Traceback (most recent call last): <del> File "<stdin>", line 23, in <modulei <add> ... <ide> ValueError: Power cannot be negative in any electrical/electronics system <ide> >>> electric_power(voltage=2.2, current=2.2, power=0) <ide> result(name='power', value=4.84) <ide><path>maths/nevilles_method.py <ide> def neville_interpolate(x_points: list, y_points: list, x0: int) -> list: <ide> 104.0 <ide> >>> neville_interpolate((1,2,3,4,6), (6,7,8,9,11), '') <ide> Traceback (most recent call last): <del> File "<stdin>", line 1, in <module> <del> ... <add> ... <ide> TypeError: unsupported operand type(s) for -: 'str' and 'int' <ide> """ <ide> n = len(x_points)
4
Ruby
Ruby
add signatures for `cmd/--cache`
1baf98ea69c0a33dea17174ddc0ea0e321771a6b
<ide><path>Library/Homebrew/cmd/--cache.rb <ide> def __cache_args <ide> end <ide> end <ide> <add> sig { void } <ide> def __cache <ide> args = __cache_args.parse <ide> <ide> def __cache <ide> end <ide> end <ide> <add> sig { params(formula: Formula, args: CLI::Args).void } <ide> def print_formula_cache(formula, args:) <ide> if fetch_bottle?(formula, args: args) <ide> puts formula.bottle.cached_download <ide> def print_formula_cache(formula, args:) <ide> end <ide> end <ide> <add> sig { params(cask: Cask::Cask).void } <ide> def print_cask_cache(cask) <ide> puts Cask::Download.new(cask).downloader.cached_location <ide> end
1
Javascript
Javascript
fix flakey next/link react streaming test
55d8a14e8a0adfd2ae4e09113076ef33615564ba
<ide><path>test/integration/react-streaming-and-server-components/test/index.test.js <ide> async function runBasicTests(context, env) { <ide> await browser.elementByCss('#next_id').click() <ide> await browser.elementByCss('#next_id').click() <ide> await check(() => browser.waitForElementByCss('#query').text(), /query:2/) <del> expect(await browser.eval('window.beforeNav')).toBe(1) <add> <add> if (!isDev) { <add> // this might do a hard navigation in development <add> // so only require this check in production <add> expect(await browser.eval('window.beforeNav')).toBe(1) <add> } <ide> }) <ide> <ide> it('should suspense next/image on server side', async () => {
1
Ruby
Ruby
extract insert test case from
d2542882b20f6205e1c40ab34ff075eefc2d589c
<ide><path>activerecord/test/cases/insert_all_test.rb <ide> class InsertAllTest < ActiveRecord::TestCase <ide> fixtures :books <ide> <ide> def test_insert <add> skip unless supports_insert_on_duplicate_skip? <add> <add> id = 1_000_000 <add> <add> assert_difference "Book.count", +1 do <add> Book.insert(id: id, name: "Rework", author_id: 1) <add> end <add> <add> Book.upsert(id: id, name: "Remote", author_id: 1) <add> <add> assert_equal "Remote", Book.find(id).name <add> end <add> <add> def test_insert! <ide> assert_difference "Book.count", +1 do <ide> Book.insert! name: "Rework", author_id: 1 <ide> end
1
Text
Text
add benchmarks to issue templates
8efc0ec91a398f051dfdbff9c64a042d4836ae2b
<ide><path>.github/ISSUE_TEMPLATE/---new-benchmark.md <add>--- <add>name: "\U0001F5A5 New Benchmark" <add>about: You benchmark a part of this library and would like to share your results <add>title: "[Benchmark]" <add>labels: '' <add>assignees: '' <add> <add>--- <add> <add># Benchmarking Transformers <add> <add>## Benchmark <add> <add>Which part of Transformers did you benchmark? <add> <add>## Set-up <add> <add>What did you run your benchmarks on? Please include details, such as: CPU, GPU? If using multiple GPUs, which parallelization did you use? <add> <add>## Results <add> <add>Put your results here!
1
Ruby
Ruby
add tab, runtime_dependencies methods
a7727b66b30bdb3c0280a006b763787e9077cc6f
<ide><path>Library/Homebrew/keg.rb <ide> def remove_oldname_opt_record <ide> @oldname_opt_record = nil <ide> end <ide> <add> def tab <add> Tab.for_keg(self) <add> end <add> <add> def runtime_dependencies <add> tab.runtime_dependencies <add> end <add> <ide> def aliases <del> Tab.for_keg(self).aliases || [] <add> tab.aliases || [] <ide> end <ide> <ide> def optlink(mode = OpenStruct.new)
1
Ruby
Ruby
simplify some taggedlogging methods
ffb0c5185c649f3ef132c9f308384e60a01de9b0
<ide><path>activesupport/lib/active_support/tagged_logging.rb <ide> def tagged(*new_tags) <ide> tags.concat new_tags <ide> yield <ide> ensure <del> new_tags.size.times { tags.pop } <add> tags.pop(new_tags.size) <ide> end <ide> <ide> def add(severity, message = nil, progname = nil, &block) <ide> def method_missing(method, *args) <ide> def tags_text <ide> tags = current_tags <ide> if tags.any? <del> tags.collect { |tag| "[#{tag}]" }.join(" ") + " " <add> tags.collect { |tag| "[#{tag}] " }.join <ide> end <ide> end <ide>
1
PHP
PHP
remove unused imports
87f0fab78b63d17def5f79cd28220119b5995709
<ide><path>src/Illuminate/Routing/RoutingServiceProvider.php <ide> <ide> use Illuminate\Support\ServiceProvider; <ide> use Zend\Diactoros\Response as PsrResponse; <del>use Symfony\Component\HttpFoundation\Request; <del>use Symfony\Component\HttpFoundation\Response; <ide> use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; <ide> <ide> class RoutingServiceProvider extends ServiceProvider
1
Ruby
Ruby
add audit for env.x11
26f887d4ab02c9e1e061cb3537238fc5d6e81508
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_text <ide> problem "xcodebuild should be passed an explicit \"SYMROOT\"" <ide> end <ide> <add> if text =~ /ENV\.x11/ <add> problem "Use \"depends_on :x11\" instead of \"ENV.x11\"" <add> end <add> <ide> # Avoid hard-coding compilers <ide> if text =~ %r[(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]] <ide> problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
1
Go
Go
move the attach prevention from server to client
c106ed32ea7613573a2081d47ad2498429ac86f2
<ide><path>commands.go <ide> func (cli *DockerCli) CmdAttach(args ...string) error { <ide> return err <ide> } <ide> <add> if !container.State.Running { <add> return fmt.Errorf("Impossible to attach to a stopped container, start it first") <add> } <add> <ide> splitStderr := container.Config.Tty <ide> <ide> connections := 1 <ide><path>server.go <ide> func (srv *Server) ContainerAttach(name string, logs, stream, stdin, stdout, std <ide> if container.State.Ghost { <ide> return fmt.Errorf("Impossible to attach to a ghost container") <ide> } <del> if !container.State.Running { <del> return fmt.Errorf("Impossible to attach to a stopped container, start it first") <del> } <ide> <ide> var ( <ide> cStdin io.ReadCloser
2
Javascript
Javascript
fix quotes in comment
e377621eaf85915b8459632cf2565e40e54d6c19
<ide><path>src/effects.js <ide> jQuery.fn.extend({ <ide> } <ide> <ide> return this[ optall.queue === false ? "each" : "queue" ](function() { <del> // XXX ‘this’ does not always have a nodeName when running the <add> // XXX 'this' does not always have a nodeName when running the <ide> // test suite <ide> <ide> var opt = jQuery.extend({}, optall), p,
1
Text
Text
add image of current travis ci build status
ffef82e6d94faa3e10133c7cca32e0f5698ca811
<ide><path>README.md <del># Ember.js <add># Ember.js [![Build Status](https://secure.travis-ci.org/emberjs/ember.js.png?branch=master)](http://travis-ci.org/emberjs/ember.js) <ide> <ide> Ember.js (formerly SproutCore 2.0) is a JavaScript framework that does all of the heavy lifting that you'd normally have to do by hand. There are tasks that are common to every web app; Ember.js does those things for you, so you can focus on building killer features and UI. <ide>
1
Text
Text
remove gemnasium batch from readme. [ci skip]
1df4dcf7dd9ec5cf8fed3c04d9427ad925f2b83b
<ide><path>README.md <ide> We encourage you to contribute to Ruby on Rails! Please check out the <ide> ## Code Status <ide> <ide> * [![Build Status](https://api.travis-ci.org/rails/rails.png)](https://travis-ci.org/rails/rails) <del>* [![Dependencies](https://gemnasium.com/rails/rails.png?travis)](https://gemnasium.com/rails/rails) <ide> <ide> ## License <ide>
1
PHP
PHP
add test case for
33186dcb5bc17df4413a60915d3fc57edd405fcf
<ide><path>tests/TestCase/ORM/TableTest.php <ide> public function testAddAssociations() <ide> 'hasOne' => ['profiles'], <ide> 'hasMany' => ['authors'], <ide> 'belongsToMany' => [ <del> 'tags' => ['joinTable' => 'things_tags'] <add> 'tags' => [ <add> 'joinTable' => 'things_tags', <add> 'conditions' => [ <add> 'Tags.starred' => true <add> ] <add> ] <ide> ] <ide> ]; <ide> <ide> public function testAddAssociations() <ide> $this->assertInstanceOf('Cake\ORM\Association\BelongsToMany', $belongsToMany); <ide> $this->assertEquals('tags', $belongsToMany->name()); <ide> $this->assertSame('things_tags', $belongsToMany->junction()->table()); <add> $this->assertSame(['Tags.starred' => true], $belongsToMany->conditions()); <ide> } <ide> <ide> /**
1
Java
Java
fix numberformatexception with x-forwarded-host
ea5ff87f8ec8d34871aaf3bcc49a165e2db076e5
<ide><path>spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java <ide> * @author Rossen Stoyanchev <ide> * @author Phillip Webb <ide> * @author Oliver Gierke <add> * @author Brian Clozel <ide> * @since 3.1 <ide> * @see #newInstance() <ide> * @see #fromPath(String) <ide> UriComponentsBuilder adaptFromForwardedHeaders(HttpHeaders headers) { <ide> String hostHeader = headers.getFirst("X-Forwarded-Host"); <ide> if (StringUtils.hasText(hostHeader)) { <ide> String hostToUse = StringUtils.tokenizeToStringArray(hostHeader, ",")[0]; <del> String[] hostAndPort = StringUtils.split(hostToUse, ":"); <del> if (hostAndPort != null) { <del> host(hostAndPort[0]); <del> port(Integer.parseInt(hostAndPort[1])); <add> int portSeparatorIdx = hostToUse.lastIndexOf(":"); <add> if (portSeparatorIdx > hostToUse.lastIndexOf("]")) { <add> host(hostToUse.substring(0, portSeparatorIdx)); <add> port(Integer.parseInt(hostToUse.substring(portSeparatorIdx + 1))); <ide> } <ide> else { <ide> host(hostToUse); <ide><path>spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java <ide> public void fromOpaqueUri() throws URISyntaxException { <ide> assertEquals("Invalid result URI", uri, result.toUri()); <ide> } <ide> <del> // SPR-9317 <del> <del> @Test <add> @Test // SPR-9317 <ide> public void fromUriEncodedQuery() throws URISyntaxException { <ide> URI uri = new URI("http://www.example.org/?param=aGVsbG9Xb3JsZA%3D%3D"); <ide> String fromUri = UriComponentsBuilder.fromUri(uri).build().getQueryParams().get("param").get(0); <ide> public void fromUriString() { <ide> assertEquals("28", result.getFragment()); <ide> } <ide> <del> // SPR-9832 <del> <del> @Test <add> @Test // SPR-9832 <ide> public void fromUriStringQueryParamWithReservedCharInValue() throws URISyntaxException { <ide> String uri = "http://www.google.com/ig/calculator?q=1USD=?EUR"; <ide> UriComponents result = UriComponentsBuilder.fromUriString(uri).build(); <ide> public void fromUriStringQueryParamWithReservedCharInValue() throws URISyntaxExc <ide> assertEquals("1USD=?EUR", result.getQueryParams().getFirst("q")); <ide> } <ide> <del> // SPR-10779 <del> <del> @Test <add> @Test // SPR-10779 <ide> public void fromHttpUrlStringCaseInsesitiveScheme() { <ide> assertEquals("http", UriComponentsBuilder.fromHttpUrl("HTTP://www.google.com").build().getScheme()); <ide> assertEquals("https", UriComponentsBuilder.fromHttpUrl("HTTPS://www.google.com").build().getScheme()); <ide> } <ide> <del> // SPR-10539 <ide> <del> @Test(expected = IllegalArgumentException.class) <add> <add> @Test(expected = IllegalArgumentException.class) // SPR-10539 <ide> public void fromHttpUrlStringInvalidIPv6Host() throws URISyntaxException { <ide> UriComponentsBuilder.fromHttpUrl("http://[1abc:2abc:3abc::5ABC:6abc:8080/resource").build().encode(); <ide> } <ide> <del> // SPR-10539 <del> <del> @Test <add> @Test // SPR-10539 <ide> public void fromUriStringIPv6Host() throws URISyntaxException { <del> UriComponents result = UriComponentsBuilder <del> .fromUriString("http://[1abc:2abc:3abc::5ABC:6abc]:8080/resource").build().encode(); <del> assertEquals("[1abc:2abc:3abc::5ABC:6abc]", result.getHost()); <add> UriComponents result = UriComponentsBuilder <add> .fromUriString("http://[1abc:2abc:3abc::5ABC:6abc]:8080/resource").build().encode(); <add> assertEquals("[1abc:2abc:3abc::5ABC:6abc]", result.getHost()); <ide> <del> UriComponents resultWithScopeId = UriComponentsBuilder <del> .fromUriString("http://[1abc:2abc:3abc::5ABC:6abc%eth0]:8080/resource").build().encode(); <add> UriComponents resultWithScopeId = UriComponentsBuilder <add> .fromUriString("http://[1abc:2abc:3abc::5ABC:6abc%eth0]:8080/resource").build().encode(); <ide> assertEquals("[1abc:2abc:3abc::5ABC:6abc%25eth0]", resultWithScopeId.getHost()); <ide> <del> UriComponents resultIPv4compatible = UriComponentsBuilder <del> .fromUriString("http://[::192.168.1.1]:8080/resource").build().encode(); <add> UriComponents resultIPv4compatible = UriComponentsBuilder <add> .fromUriString("http://[::192.168.1.1]:8080/resource").build().encode(); <ide> assertEquals("[::192.168.1.1]", resultIPv4compatible.getHost()); <ide> } <ide> <del> // SPR-11970 <del> <del> @Test <add> @Test // SPR-11970 <ide> public void fromUriStringNoPathWithReservedCharInQuery() { <ide> UriComponents result = UriComponentsBuilder.fromUriString("http://example.com?foo=bar@baz").build(); <ide> assertTrue(StringUtils.isEmpty(result.getUserInfo())); <ide> public void fromHttpRequest() throws URISyntaxException { <ide> assertEquals("a=1", result.getQuery()); <ide> } <ide> <del> // SPR-12771 <del> <del> @Test <add> @Test // SPR-12771 <ide> public void fromHttpRequestResetsPortBeforeSettingIt() throws Exception { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.addHeader("X-Forwarded-Proto", "https"); <ide> public void fromHttpRequestResetsPortBeforeSettingIt() throws Exception { <ide> assertEquals("/rest/mobile/users/1", result.getPath()); <ide> } <ide> <add> @Test //SPR-14761 <add> public void fromHttpRequestWithForwardedIPv4Host() { <add> MockHttpServletRequest request = new MockHttpServletRequest(); <add> request.setScheme("http"); <add> request.setServerName("localhost"); <add> request.setServerPort(-1); <add> request.setRequestURI("/mvc-showcase"); <add> request.addHeader("Forwarded", "host=192.168.0.1"); <add> <add> HttpRequest httpRequest = new ServletServerHttpRequest(request); <add> UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); <add> <add> assertEquals("http://192.168.0.1/mvc-showcase", result.toString()); <add> } <add> <add> @Test //SPR-14761 <add> public void fromHttpRequestWithForwardedIPv6() { <add> MockHttpServletRequest request = new MockHttpServletRequest(); <add> request.setScheme("http"); <add> request.setServerName("localhost"); <add> request.setServerPort(-1); <add> request.setRequestURI("/mvc-showcase"); <add> request.addHeader("Forwarded", "host=[1abc:2abc:3abc::5ABC:6abc]"); <add> <add> HttpRequest httpRequest = new ServletServerHttpRequest(request); <add> UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); <add> <add> assertEquals("http://[1abc:2abc:3abc::5ABC:6abc]/mvc-showcase", result.toString()); <add> } <add> <add> @Test //SPR-14761 <add> public void fromHttpRequestWithForwardedIPv6Host() { <add> MockHttpServletRequest request = new MockHttpServletRequest(); <add> request.setScheme("http"); <add> request.setServerName("localhost"); <add> request.setServerPort(-1); <add> request.setRequestURI("/mvc-showcase"); <add> request.addHeader("X-Forwarded-Host", "[1abc:2abc:3abc::5ABC:6abc]"); <add> <add> HttpRequest httpRequest = new ServletServerHttpRequest(request); <add> UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); <add> <add> assertEquals("http://[1abc:2abc:3abc::5ABC:6abc]/mvc-showcase", result.toString()); <add> } <add> <add> @Test //SPR-14761 <add> public void fromHttpRequestWithForwardedIPv6HostAndPort() { <add> MockHttpServletRequest request = new MockHttpServletRequest(); <add> request.setScheme("http"); <add> request.setServerName("localhost"); <add> request.setServerPort(-1); <add> request.setRequestURI("/mvc-showcase"); <add> request.addHeader("X-Forwarded-Host", "[1abc:2abc:3abc::5ABC:6abc]:8080"); <add> <add> HttpRequest httpRequest = new ServletServerHttpRequest(request); <add> UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); <add> <add> assertEquals("http://[1abc:2abc:3abc::5ABC:6abc]:8080/mvc-showcase", result.toString()); <add> } <add> <add> <ide> @Test <ide> public void fromHttpRequestWithForwardedHost() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> public void fromHttpRequestWithForwardedHost() { <ide> assertEquals("http://anotherHost/mvc-showcase", result.toString()); <ide> } <ide> <del> // SPR-10701 <del> <del> @Test <add> @Test // SPR-10701 <ide> public void fromHttpRequestWithForwardedHostIncludingPort() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedHostIncludingPort() { <ide> assertEquals(443, result.getPort()); <ide> } <ide> <del> // SPR-11140 <del> <del> @Test <add> @Test // SPR-11140 <ide> public void fromHttpRequestWithForwardedHostMultiValuedHeader() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedHostMultiValuedHeader() { <ide> assertEquals(-1, result.getPort()); <ide> } <ide> <del> // SPR-11855 <del> <del> @Test <add> @Test // SPR-11855 <ide> public void fromHttpRequestWithForwardedHostAndPort() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedHostAndPort() { <ide> assertEquals(9090, result.getPort()); <ide> } <ide> <del> // SPR-11872 <del> <del> @Test <add> @Test // SPR-11872 <ide> public void fromHttpRequestWithForwardedHostWithDefaultPort() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedHostWithForwardedScheme() { <ide> assertEquals(-1, result.getPort()); <ide> } <ide> <del> // SPR-12771 <del> <del> @Test <add> @Test // SPR-12771 <ide> public void fromHttpRequestWithForwardedProtoAndDefaultPort() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedProtoAndDefaultPort() { <ide> assertEquals("https://84.198.58.199/mvc-showcase", result.toString()); <ide> } <ide> <del> // SPR-12813 <del> <del> @Test <add> @Test // SPR-12813 <ide> public void fromHttpRequestWithForwardedPortMultiValueHeader() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedPortMultiValueHeader() { <ide> assertEquals("http://a.example.org/mvc-showcase", result.toString()); <ide> } <ide> <del> // SPR-12816 <del> <del> @Test <add> @Test // SPR-12816 <ide> public void fromHttpRequestWithForwardedProtoMultiValueHeader() { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.setScheme("http"); <ide> public void fromHttpRequestWithForwardedProtoMultiValueHeader() { <ide> assertEquals("https://a.example.org/mvc-showcase", result.toString()); <ide> } <ide> <del> // SPR-12742 <del> <del> @Test <add> @Test // SPR-12742 <ide> public void fromHttpRequestWithTrailingSlash() throws Exception { <ide> UriComponents before = UriComponentsBuilder.fromPath("/foo/").build(); <ide> UriComponents after = UriComponentsBuilder.newInstance().uriComponents(before).build(); <ide> public void pathSegmentsSomeEmpty() { <ide> assertEquals(Arrays.asList("foo", "bar"), result.getPathSegments()); <ide> } <ide> <del> // SPR-12398 <del> <del> @Test <add> @Test // SPR-12398 <ide> public void pathWithDuplicateSlashes() throws URISyntaxException { <ide> UriComponents uriComponents = UriComponentsBuilder.fromPath("/foo/////////bar").build(); <ide> assertEquals("/foo/bar", uriComponents.getPath()); <ide> public void relativeUrls() throws Exception { <ide> @Test <ide> public void emptySegments() throws Exception { <ide> assertThat(UriComponentsBuilder.fromUriString("http://example.com/abc/").path("/x/y/z").build().toString(), equalTo("http://example.com/abc/x/y/z")); <del> assertThat(UriComponentsBuilder.fromUriString("http://example.com/abc/").pathSegment("x", "y", "z").build().toString(), equalTo("http://example.com/abc/x/y/z")); <add> assertThat(UriComponentsBuilder.fromUriString("http://example.com/abc/").pathSegment("x", "y", "z").build().toString(), equalTo("http://example.com/abc/x/y/z")); <ide> assertThat(UriComponentsBuilder.fromUriString("http://example.com/abc/").path("/x/").path("/y/z").build().toString(), equalTo("http://example.com/abc/x/y/z")); <ide> assertThat(UriComponentsBuilder.fromUriString("http://example.com/abc/").pathSegment("x").path("y").build().toString(), equalTo("http://example.com/abc/x/y")); <ide> } <ide> public void testClone() throws URISyntaxException { <ide> assertEquals("f2", result2.getFragment()); <ide> } <ide> <del> // SPR-11856 <del> <del> @Test <add> @Test // SPR-11856 <ide> public void fromHttpRequestForwardedHeader() throws Exception { <ide> MockHttpServletRequest request = new MockHttpServletRequest(); <ide> request.addHeader("Forwarded", "proto=https; host=84.198.58.199");
2
PHP
PHP
simplify code per josephsilber's suggestion
e3a8001a13fb3ff0edd4a1c851d30e4fc9f654f3
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function syncOriginalAttribute($attribute) <ide> /** <ide> * Determine if the model or given attribute(s) have been modified. <ide> * <del> * @param string|array|null $attribute <add> * @param string|array|null $attributes <ide> * @return bool <ide> */ <del> public function isDirty($attribute = null) <add> public function isDirty($attributes = null) <ide> { <ide> $dirty = $this->getDirty(); <ide> <del> if (func_num_args() > 1) $attribute = func_get_args(); <add> if (is_null($attributes)) return count($dirty) > 0; <ide> <del> if (is_null($attribute)) <add> if ( ! is_array($attributes)) $attributes = func_get_args(); <add> <add> foreach ($attributes as $attr) <ide> { <del> return count($dirty) > 0; <add> if (array_key_exists($attr, $dirty)) return true; <ide> } <del> elseif (is_array($attribute)) <del> { <del> foreach ($attribute as $attr) <del> { <del> if (array_key_exists($attr, $dirty)) return true; <del> } <ide> <del> return false; <del> } <del> else <del> { <del> return array_key_exists($attribute, $dirty); <del> } <add> return false; <ide> } <ide> <ide> /**
1
PHP
PHP
throw deprecation warning
b099e40d432b505a89f4f1aa6a9af0b0ea5bd9bd
<ide><path>src/TestSuite/TestCase.php <ide> public function assertTextNotContains($needle, $haystack, $message = '', $ignore <ide> $this->assertNotContains($needle, $haystack, $message, $ignoreCase); <ide> } <ide> <add> /** <add> * Asserts HTML tags. <add> * <add> * @param string $string An HTML/XHTML/XML string <add> * @param array $expected An array, see above <add> * @param bool $fullDebug Whether or not more verbose output should be used. <add> * @return void <add> * @deprecated 3.0. Use assertHtml() instead. <add> */ <add> public function assertTags($string, $expected, $fullDebug = false) <add> { <add> trigger_error( <add> 'assertTags() is deprecated, use assertHtml() instead.', <add> E_USER_DEPRECATED <add> ); <add> static::assertHtml($expected, $string, $fullDebug); <add> } <add> <ide> /** <ide> * Asserts HTML tags. <ide> *
1
Python
Python
fix flake8 error
2d1864ab76a4e4683a945faa47923a14b65a824f
<ide><path>libcloud/compute/drivers/packet.py <ide> def ex_delete_bgp_session(self, session_uuid): <ide> res = self.connection.request(path, method='DELETE') <ide> return res.status == httplib.OK # or res.status == httplib.NO_CONTENT <ide> <del> def ex_list_events_for_node(self, node, include=None, page=1, per_page=10): <add> def ex_list_events_for_node(self, node, include=None, <add> page=1, per_page=10): <ide> path = '/devices/%s/events' % node.id <ide> params = { <ide> 'include': include, <ide> def ex_list_events_for_project(self, project, include=None, page=1, <ide> } <ide> return self.connection.request(path, params=params).object <ide> <add> <ide> class Project(object): <ide> def __init__(self, project): <ide> self.id = project.get('id')
1
Javascript
Javascript
capture stderr from child processes
448b0c0afcd87f93aab8b863dcaf463827814ad5
<ide><path>test/parallel/test-child-process-pipe-dataflow.js <ide> const MB = KB * KB; <ide> grep = spawn('grep', ['x'], { stdio: [cat.stdout, 'pipe', 'pipe'] }); <ide> wc = spawn('wc', ['-c'], { stdio: [grep.stdout, 'pipe', 'pipe'] }); <ide> <add> [cat, grep, wc].forEach((child, index) => { <add> child.stderr.on('data', (d) => { <add> // Don't want to assert here, as we might miss error code info. <add> console.error(`got unexpected data from child #${index}:\n${d}`); <add> }); <add> child.on('exit', common.mustCall(function(code) { <add> assert.strictEqual(code, 0); <add> })); <add> }); <add> <ide> wc.stdout.on('data', common.mustCall(function(data) { <ide> assert.strictEqual(data.toString().trim(), MB.toString()); <ide> })); <del> <del> cat.on('exit', common.mustCall(function(code) { <del> assert.strictEqual(code, 0); <del> })); <del> <del> grep.on('exit', common.mustCall(function(code) { <del> assert.strictEqual(code, 0); <del> })); <del> <del> wc.on('exit', common.mustCall(function(code) { <del> assert.strictEqual(code, 0); <del> })); <ide> }
1
Javascript
Javascript
fix typo in ember-api documentation
b4c0fa766fbb07dfb936a2d53892747deb8c4f06
<ide><path>packages/ember-routing/lib/system/route.js <ide> var Route = EmberObject.extend(ActionHandler, Evented, { <ide> // <ide> this.render('post', { // the template name associated with 'post' Route <ide> into: 'application', // the parent route to 'post' Route <del> outlet: 'main', // {{outlet}} and {{outlet 'main' are synonymous}}, <add> outlet: 'main', // {{outlet}} and {{outlet 'main'}} are synonymous, <ide> view: 'post', // the view associated with the 'post' Route <ide> controller: 'post', // the controller associated with the 'post' Route <ide> })
1
PHP
PHP
fix failing tests
06cf62aefe43e4aef2247a06af8b5e9f47d91276
<ide><path>lib/Cake/Test/Case/BasicsTest.php <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> 'this-is-a-test' <ide> ########################### <add> <ide> EXPECTED; <del> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8); <add> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <ide> <ide> $this->assertEquals($expected, $result); <ide> <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> '<div>this-is-a-test</div>' <ide> ########################### <add> <ide> EXPECTED; <ide> if (php_sapi_name() === 'cli') { <del> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 17); <add> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 18); <ide> } else { <ide> $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 19); <ide> } <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> '<div>this-is-a-test</div>' <ide> ########################### <add> <ide> EXPECTED; <ide> if (php_sapi_name() === 'cli') { <del> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 17); <add> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 18); <ide> } else { <ide> $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 19); <ide> } <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> '<div>this-is-a-test</div>' <ide> ########################### <add> <ide> EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8); <add> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <ide> $this->assertEquals($expected, $result); <ide> <ide> ob_start(); <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> '<div>this-is-a-test</div>' <ide> ########################### <add> <ide> EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8); <add> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <ide> $this->assertEquals($expected, $result); <ide> <ide> ob_start(); <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> '<div>this-is-a-test</div>' <ide> ########################### <add> <ide> EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8); <add> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <ide> $this->assertEquals($expected, $result); <ide> <ide> ob_start(); <ide> public function testDebug() { <ide> ########## DEBUG ########## <ide> false <ide> ########################### <add> <ide> EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8); <add> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <ide> $this->assertEquals($expected, $result); <ide> } <ide>
1
Javascript
Javascript
simplify vendor prefixes handling in tests
ac2d06b19d8118cf482075f39088f41dfa318acf
<ide><path>test/ngAnimate/animateSpec.js <ide> describe("ngAnimate", function() { <ide> ss = createMockStyleSheet($document, $window); <ide> try { <ide> $timeout.flush(); <del> } catch(e) {}; <add> } catch(e) {} <ide> $animate.enabled(true); <ide> }; <ide> })); <ide> describe("ngAnimate", function() { <ide> var child, after; <ide> <ide> beforeEach(function() { <del> module(function($animateProvider, $provide) { <add> module(function($animateProvider) { <ide> $animateProvider.register('.custom', function() { <ide> return { <ide> start: function(element, done) { <ide> describe("ngAnimate", function() { <ide> } <ide> } <ide> }); <del> return function($animate, $compile, $rootScope, $rootElement, $sniffer) { <add> return function($animate, $compile, $rootScope, $rootElement) { <ide> element = $compile('<div></div>')($rootScope); <del> child = $compile('<div></div>')($rootScope); <ide> <ide> angular.forEach(['.ng-hide-add', '.ng-hide-remove', '.ng-enter', '.ng-leave', '.ng-move'], function(selector) { <del> ss.addRule(selector, 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <add> ss.addRule(selector, '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <ide> }); <ide> <ide> child = $compile('<div>...</div>')($rootScope); <ide> describe("ngAnimate", function() { <ide> }) <ide> <ide> it("should animate the enter animation event", <del> inject(function($animate, $rootScope, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $sniffer) { <ide> element[0].removeChild(child[0]); <ide> <ide> expect(element.contents().length).toBe(0); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should animate the leave animation event", <del> inject(function($animate, $rootScope, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $sniffer) { <ide> <ide> expect(element.contents().length).toBe(1); <ide> $animate.leave(child); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should animate the move animation event", <del> inject(function($animate, $compile, $rootScope, $sniffer, $timeout) { <add> inject(function($animate, $compile, $rootScope) { <ide> <ide> $rootScope.$digest(); <ide> element.html(''); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should animate the show animation event", <del> inject(function($animate, $rootScope, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $sniffer) { <ide> <ide> $rootScope.$digest(); <ide> child.addClass('ng-hide'); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should animate the hide animation event", <del> inject(function($animate, $rootScope, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $sniffer) { <ide> <ide> $rootScope.$digest(); <ide> expect(child).toBeShown(); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should assign the ng-event className to all animation events when transitions/keyframes are used", <del> inject(function($animate, $sniffer, $rootScope, $timeout, $browser, $compile, $rootElement, $document) { <add> inject(function($animate, $sniffer, $rootScope) { <ide> <ide> if (!$sniffer.transitions) return; <ide> <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should not run if animations are disabled", <del> inject(function($animate, $rootScope, $sniffer, $timeout) { <add> inject(function($animate, $rootScope) { <ide> <ide> $animate.enabled(false); <ide> <ide> describe("ngAnimate", function() { <ide> <ide> <ide> it("should NOT clobber all data on an element when animation is finished", <del> inject(function($animate, $rootScope, $sniffer, $timeout) { <add> inject(function($animate) { <ide> <ide> child.css('display','none'); <ide> element.data('foo', 'bar'); <ide> describe("ngAnimate", function() { <ide> inject(function($animate, $rootScope, $compile, $sniffer, $timeout, _$rootElement_) { <ide> $rootElement = _$rootElement_; <ide> <del> ss.addRule('.ng-hide-add', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <del> ss.addRule('.ng-hide-remove', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <add> ss.addRule('.ng-hide-add', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <add> ss.addRule('.ng-hide-remove', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <ide> <ide> element = $compile(html('<div>1</div>'))($rootScope); <ide> element.addClass('custom-delay custom-long-delay'); <ide> describe("ngAnimate", function() { <ide> }); <ide> <ide> describe("with CSS3", function() { <del> var prefix, vendorPrefix; <del> <ide> beforeEach(function() { <del> module(function($animateProvider, $provide) { <del> return function($sniffer, _$rootElement_, $animate) { <del> vendorPrefix = '-' + $sniffer.vendorPrefix.toLowerCase() + '-'; <add> module(function() { <add> return function(_$rootElement_) { <ide> $rootElement = _$rootElement_; <ide> }; <ide> }) <ide> }); <ide> <ide> describe("Animations", function() { <ide> it("should properly detect and make use of CSS Animations", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $compile, $sniffer) { <ide> <del> ss.addRule('.ng-hide-add', 'animation: some_animation 4s linear 0s 1 alternate;' + <del> vendorPrefix + 'animation: some_animation 4s linear 0s 1 alternate'); <del> ss.addRule('.ng-hide-remove', 'animation: some_animation 4s linear 0s 1 alternate;' + <del> vendorPrefix + 'animation: some_animation 4s linear 0s 1 alternate'); <add> ss.addRule('.ng-hide-add', <add> '-webkit-animation: some_animation 4s linear 0s 1 alternate;' + <add> 'animation: some_animation 4s linear 0s 1 alternate;'); <add> ss.addRule('.ng-hide-remove', <add> '-webkit-animation: some_animation 4s linear 0s 1 alternate;' + <add> 'animation: some_animation 4s linear 0s 1 alternate;'); <ide> <ide> element = $compile(html('<div>1</div>'))($rootScope); <ide> <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should properly detect and make use of CSS Animations with multiple iterations", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $compile, $sniffer) { <ide> <del> var style = 'animation-duration: 2s;' + <del> 'animation-iteration-count: 3;' + <del> vendorPrefix + 'animation-duration: 2s;' + <del> vendorPrefix + 'animation-iteration-count: 3;'; <add> var style = '-webkit-animation-duration: 2s;' + <add> '-webkit-animation-iteration-count: 3;' + <add> 'animation-duration: 2s;' + <add> 'animation-iteration-count: 3;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should fallback to the animation duration if an infinite iteration is provided", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $compile, $sniffer) { <ide> <del> var style = 'animation-duration: 2s;' + <del> 'animation-iteration-count: infinite;' + <del> vendorPrefix + 'animation-duration: 2s;' + <del> vendorPrefix + 'animation-iteration-count: infinite;'; <add> var style = '-webkit-animation-duration: 2s;' + <add> '-webkit-animation-iteration-count: infinite;' + <add> 'animation-duration: 2s;' + <add> 'animation-iteration-count: infinite;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should not consider the animation delay is provided", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $compile, $sniffer) { <ide> <del> var style = 'animation-duration: 2s;' + <del> 'animation-delay: 10s;' + <del> 'animation-iteration-count: 5;' + <del> vendorPrefix + 'animation-duration: 2s;' + <del> vendorPrefix + 'animation-delay: 10s;' + <del> vendorPrefix + 'animation-iteration-count: 5;'; <add> var style = '-webkit-animation-duration: 2s;' + <add> '-webkit-animation-delay: 10s;' + <add> '-webkit-animation-iteration-count: 5;' + <add> 'animation-duration: 2s;' + <add> 'animation-delay: 10s;' + <add> 'animation-iteration-count: 5;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> it("should skip animations if disabled and run when enabled", <ide> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <ide> $animate.enabled(false); <del> var style = 'animation: some_animation 2s linear 0s 1 alternate;' + <del> vendorPrefix + 'animation: some_animation 2s linear 0s 1 alternate;' <add> var style = '-webkit-animation: some_animation 2s linear 0s 1 alternate;' + <add> 'animation: some_animation 2s linear 0s 1 alternate;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should finish the previous animation when a new animation is started", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <del> var style = 'animation: some_animation 2s linear 0s 1 alternate;' + <del> vendorPrefix + 'animation: some_animation 2s linear 0s 1 alternate;' <add> inject(function($animate, $rootScope, $compile, $sniffer) { <add> var style = '-webkit-animation: some_animation 2s linear 0s 1 alternate;' + <add> 'animation: some_animation 2s linear 0s 1 alternate;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> it("should skip transitions if disabled and run when enabled", <ide> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <ide> <del> var style = 'transition: 1s linear all;' + <del> vendorPrefix + 'transition: 1s linear all'; <add> var style = '-webkit-transition: 1s linear all;' + <add> 'transition: 1s linear all;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should skip animations if disabled and run when enabled picking the longest specified duration", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <add> inject(function($animate, $rootScope, $compile, $sniffer) { <ide> <del> var style = 'transition-duration: 1s, 2000ms, 1s;' + <del> 'transition-property: height, left, opacity;' + <del> vendorPrefix + 'transition-duration: 1s, 2000ms, 1s;' + <del> vendorPrefix + 'transition-property: height, left, opacity'; <add> var style = '-webkit-transition-duration: 1s, 2000ms, 1s;' + <add> '-webkit-transition-property: height, left, opacity;' + <add> 'transition-duration: 1s, 2000ms, 1s;' + <add> 'transition-property: height, left, opacity;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> it("should skip animations if disabled and run when enabled picking the longest specified duration/delay combination", <ide> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <ide> $animate.enabled(false); <del> var style = 'transition-duration: 1s, 0s, 1s; ' + <del> 'transition-delay: 2s, 1000ms, 2s; ' + <del> 'transition-property: height, left, opacity;' + <del> vendorPrefix + 'transition-duration: 1s, 0s, 1s; ' + <del> vendorPrefix + 'transition-delay: 2s, 1000ms, 2s; ' + <del> vendorPrefix + 'transition-property: height, left, opacity'; <add> var style = '-webkit-transition-duration: 1s, 0s, 1s; ' + <add> '-webkit-transition-delay: 2s, 1000ms, 2s; ' + <add> '-webkit-transition-property: height, left, opacity;' + <add> 'transition-duration: 1s, 0s, 1s; ' + <add> 'transition-delay: 2s, 1000ms, 2s; ' + <add> 'transition-property: height, left, opacity;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should animate for the highest duration", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <del> var style = 'transition:1s linear all 2s;' + <del> vendorPrefix + 'transition:1s linear all 2s;' + <del> 'animation:my_ani 10s 1s;' + <del> vendorPrefix + 'animation:my_ani 10s 1s;'; <add> inject(function($animate, $rootScope, $compile, $sniffer) { <add> var style = '-webkit-transition:1s linear all 2s;' + <add> 'transition:1s linear all 2s;' + <add> '-webkit-animation:my_ani 10s 1s;' + <add> 'animation:my_ani 10s 1s;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should finish the previous transition when a new animation is started", <del> inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { <del> var style = 'transition: 1s linear all;' + <del> vendorPrefix + 'transition: 1s linear all;' <add> inject(function($animate, $rootScope, $compile, $sniffer) { <add> var style = '-webkit-transition: 1s linear all;' + <add> 'transition: 1s linear all;'; <ide> <ide> ss.addRule('.ng-hide-add', style); <ide> ss.addRule('.ng-hide-remove', style); <ide> describe("ngAnimate", function() { <ide> it('should re-evaluate the CSS classes for an animation each time', <ide> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout, $compile) { <ide> <del> ss.addRule('.abc', 'transition:22s linear all;' + <del> vendorPrefix + 'transition:22s linear all'); <del> ss.addRule('.xyz', 'transition:11s linear all;' + <del> vendorPrefix + 'transition:11s linear all'); <add> ss.addRule('.abc', '-webkit-transition:22s linear all;' + <add> 'transition:22s linear all;'); <add> ss.addRule('.xyz', '-webkit-transition:11s linear all;' + <add> 'transition:11s linear all;'); <ide> <ide> var parent = $compile('<div><span ng-class="klass"></span></div>')($rootScope); <ide> var element = parent.find('span'); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it('should only append active to the newly append CSS className values', <del> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout) { <add> inject(function($animate, $rootScope, $sniffer, $rootElement) { <ide> <del> ss.addRule('.ng-enter', 'transition:9s linear all;' + <del> vendorPrefix + 'transition:9s linear all'); <del> ss.addRule('.ng-enter', 'transition:9s linear all;' + <del> vendorPrefix + 'transition:9s linear all'); <add> ss.addRule('.ng-enter', '-webkit-transition:9s linear all;' + <add> 'transition:9s linear all;'); <add> ss.addRule('.ng-enter', '-webkit-transition:9s linear all;' + <add> 'transition:9s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> var element = parent.find('span'); <ide> describe("ngAnimate", function() { <ide> }); <ide> <ide> describe("Callbacks", function() { <del> <del> var vendorPrefix; <ide> beforeEach(function() { <del> module(function($animateProvider, $provide) { <add> module(function($animateProvider) { <ide> $animateProvider.register('.custom', function($timeout) { <ide> return { <ide> removeClass : function(element, className, done) { <ide> describe("ngAnimate", function() { <ide> } <ide> }); <ide> }) <del> inject(function($sniffer, $animate) { <del> vendorPrefix = '-' + $sniffer.vendorPrefix.toLowerCase() + '-'; <del> }); <ide> }); <ide> <ide> it("should fire the enter callback", <ide> describe("ngAnimate", function() { <ide> it("should fire a done callback when provided with a css animation/transition", <ide> inject(function($animate, $rootScope, $compile, $sniffer, $rootElement, $timeout) { <ide> <del> ss.addRule('.ng-hide-add', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <del> ss.addRule('.ng-hide-remove', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <add> ss.addRule('.ng-hide-add', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <add> ss.addRule('.ng-hide-remove', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> it("should fire the callback right away if another animation is called right after", <ide> inject(function($animate, $rootScope, $compile, $sniffer, $rootElement, $timeout) { <ide> <del> ss.addRule('.ng-hide-add', 'transition:9s linear all;' + <del> vendorPrefix + 'transition:9s linear all'); <del> ss.addRule('.ng-hide-remove', 'transition:9s linear all;' + <del> vendorPrefix + 'transition:9s linear all'); <add> ss.addRule('.ng-hide-add', '-webkit-transition:9s linear all;' + <add> 'transition:9s linear all;'); <add> ss.addRule('.ng-hide-remove', '-webkit-transition:9s linear all;' + <add> 'transition:9s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> }); <ide> <ide> describe("addClass / removeClass", function() { <del> <del> var vendorPrefix; <ide> beforeEach(function() { <ide> module(function($animateProvider, $provide) { <ide> $animateProvider.register('.klassy', function($timeout) { <ide> describe("ngAnimate", function() { <ide> } <ide> } <ide> }); <del> }) <del> inject(function($sniffer, $animate) { <del> vendorPrefix = '-' + $sniffer.vendorPrefix.toLowerCase() + '-'; <ide> }); <ide> }); <ide> <ide> it("should add and remove CSS classes after an animation even if no animation is present", <del> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout) { <add> inject(function($animate, $rootScope, $sniffer, $rootElement) { <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> it("should end the current addClass animation, add the CSS class and then run the removeClass animation", <ide> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout) { <ide> <del> ss.addRule('.klass-add', 'transition:3s linear all;' + <del> vendorPrefix + 'transition:3s linear all'); <del> ss.addRule('.klass-remove', 'transition:3s linear all;' + <del> vendorPrefix + 'transition:3s linear all'); <add> ss.addRule('.klass-add', '-webkit-transition:3s linear all;' + <add> 'transition:3s linear all;'); <add> ss.addRule('.klass-remove', '-webkit-transition:3s linear all;' + <add> 'transition:3s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> it("should properly execute CSS animations/transitions and use callbacks when using addClass / removeClass", <ide> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout) { <ide> <del> ss.addRule('.klass-add', 'transition:11s linear all;' + <del> vendorPrefix + 'transition:11s linear all'); <del> ss.addRule('.klass-remove', 'transition:11s linear all;' + <del> vendorPrefix + 'transition:11s linear all'); <add> ss.addRule('.klass-add', '-webkit-transition:11s linear all;' + <add> 'transition:11s linear all;'); <add> ss.addRule('.klass-remove', '-webkit-transition:11s linear all;' + <add> 'transition:11s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> it("should allow for multiple css classes to be animated plus a callback when added", <ide> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout) { <ide> <del> ss.addRule('.one-add', 'transition:7s linear all;' + <del> vendorPrefix + 'transition:7s linear all'); <del> ss.addRule('.two-add', 'transition:7s linear all;' + <del> vendorPrefix + 'transition:7s linear all'); <add> ss.addRule('.one-add', '-webkit-transition:7s linear all;' + <add> 'transition:7s linear all;'); <add> ss.addRule('.two-add', '-webkit-transition:7s linear all;' + <add> 'transition:7s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should allow for multiple css classes to be animated plus a callback when removed", <del> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout, filterFilter) { <add> inject(function($animate, $rootScope, $sniffer, $rootElement, $timeout) { <ide> <del> ss.addRule('.one-remove', 'transition:9s linear all;' + <del> vendorPrefix + 'transition:9s linear all'); <del> ss.addRule('.two-remove', 'transition:9s linear all;' + <del> vendorPrefix + 'transition:9s linear all'); <add> ss.addRule('.one-remove', '-webkit-transition:9s linear all;' + <add> 'transition:9s linear all;'); <add> ss.addRule('.two-remove', '-webkit-transition:9s linear all;' + <add> 'transition:9s linear all;'); <ide> <ide> var parent = jqLite('<div><span></span></div>'); <ide> $rootElement.append(parent); <ide> describe("ngAnimate", function() { <ide> }); <ide> }); <ide> <del> var $rootElement, $document, vendorPrefix; <del> beforeEach(module(function($provide) { <del> return function(_$rootElement_, _$document_, $animate, $sniffer) { <del> vendorPrefix = '-' + $sniffer.vendorPrefix.toLowerCase() + '-'; <add> var $rootElement, $document; <add> beforeEach(module(function() { <add> return function(_$rootElement_, _$document_, $animate) { <ide> $rootElement = _$rootElement_; <ide> $document = _$document_; <ide> $animate.enabled(true); <ide> describe("ngAnimate", function() { <ide> } <ide> <ide> it("should properly animate and parse CSS3 transitions", <del> inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { <add> inject(function($compile, $rootScope, $animate, $sniffer) { <ide> <del> ss.addRule('.ng-enter', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <add> ss.addRule('.ng-enter', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <ide> <ide> var element = html($compile('<div>...</div>')($rootScope)); <ide> var child = $compile('<div>...</div>')($rootScope); <ide> describe("ngAnimate", function() { <ide> })); <ide> <ide> it("should properly animate and parse CSS3 animations", <del> inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { <add> inject(function($compile, $rootScope, $animate, $sniffer) { <ide> <del> ss.addRule('.ng-enter', 'some_animation 4s linear 1s 2 alternate;' + <del> vendorPrefix + 'animation: some_animation 4s linear 1s 2 alternate'); <add> ss.addRule('.ng-enter', '-webkit-animation: some_animation 4s linear 1s 2 alternate;' + <add> 'animation: some_animation 4s linear 1s 2 alternate;'); <ide> <ide> var element = html($compile('<div>...</div>')($rootScope)); <ide> var child = $compile('<div>...</div>')($rootScope); <ide> describe("ngAnimate", function() { <ide> <ide> if (!$sniffer.animations) return; <ide> <del> ss.addRule('.ani.ng-enter', 'my_animation 2s linear;' + <del> vendorPrefix + 'animation: my_animation 2s linear'); <add> ss.addRule('.ani.ng-enter', '-webkit-animation: my_animation 2s linear;' + <add> 'animation: my_animation 2s linear'); <add> <add> ss.addRule('.trans.ng-enter', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all'); <ide> <del> ss.addRule('.trans.ng-enter', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <add> var propertyKey = ($sniffer.vendorPrefix == 'Webkit' ? '-webkit-' : '') + 'transition-property'; <ide> <ide> var element = html($compile('<div>...</div>')($rootScope)); <ide> var child = $compile('<div class="ani">...</div>')($rootScope); <del> child.css('transition-property','background-color'); <add> child.css(propertyKey,'background-color'); <ide> <ide> $animate.enter(child, element); <ide> $rootScope.$digest(); <ide> <ide> browserTrigger(child,'transitionend', { timeStamp: Date.now() + 2000 }); <ide> <del> expect(child.css('transition-property')).toBe('background-color'); <add> expect(child.css(propertyKey)).toBe('background-color'); <ide> child.remove(); <ide> <ide> child.attr('class','trans'); <ide> $animate.enter(child, element); <ide> $rootScope.$digest(); <ide> <del> expect(child.css('transition-property')).not.toBe('background-color'); <add> expect(child.css(propertyKey)).not.toBe('background-color'); <ide> })); <ide> <ide> it("should skip animations if the browser does not support CSS3 transitions and CSS3 animations", <ide> describe("ngAnimate", function() { <ide> $sniffer.animations = false; <ide> $sniffer.transitions = false; <ide> <del> ss.addRule('.ng-enter', 'some_animation 4s linear 1s 2 alternate;' + <del> vendorPrefix + 'animation: some_animation 4s linear 1s 2 alternate'); <add> ss.addRule('.ng-enter', '-webkit-animation: some_animation 4s linear 1s 2 alternate;' + <add> 'animation: some_animation 4s linear 1s 2 alternate;'); <ide> <ide> var element = html($compile('<div>...</div>')($rootScope)); <ide> var child = $compile('<div>...</div>')($rootScope); <ide> describe("ngAnimate", function() { <ide> }) <ide> inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { <ide> <del> ss.addRule('.ng-enter', 'transition: 1s linear all;' + <del> vendorPrefix + 'transition: 1s linear all'); <add> ss.addRule('.ng-enter', '-webkit-transition: 1s linear all;' + <add> 'transition: 1s linear all;'); <ide> <ide> var element = html($compile('<div>...</div>')($rootScope)); <ide> var child = $compile('<div>...</div>')($rootScope); <ide> describe("ngAnimate", function() { <ide> }); <ide> }); <ide> inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { <del> ss.addRule('.ng-enter', 'transition: 2s linear all;' + <del> vendorPrefix + 'transition: 2s linear all'); <del> ss.addRule('.ng-leave', 'transition: 2s linear all;' + <del> vendorPrefix + 'transition: 2s linear all'); <add> ss.addRule('.ng-enter', '-webkit-transition: 2s linear all;' + <add> 'transition: 2s linear all;'); <add> ss.addRule('.ng-leave', '-webkit-transition: 2s linear all;' + <add> 'transition: 2s linear all;'); <ide> <ide> var element = html($compile('<div>...</div>')($rootScope)); <ide> var child = $compile('<div>...</div>')($rootScope); <ide> describe("ngAnimate", function() { <ide> // it("should add and remove CSS classes and perform CSS animations during the process", <ide> // inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { <ide> // <del>// ss.addRule('.on-add', 'transition: 10s linear all; ' + <del>// vendorPrefix + 'transition: 10s linear all'); <del>// ss.addRule('.on-remove', 'transition: 10s linear all; ' + <del>// vendorPrefix + 'transition: 10s linear all'); <add>// ss.addRule('.on-add', '-webkit-transition: 10s linear all; ' + <add>// 'transition: 10s linear all;'); <add>// ss.addRule('.on-remove', '-webkit-transition: 10s linear all; ' + <add>// 'transition: 10s linear all;'); <ide> // <ide> // var element = html($compile('<div></div>')($rootScope)); <ide> // <ide> describe("ngAnimate", function() { <ide> // }) <ide> // inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { <ide> // <del>// ss.addRule('.ng-hide-add', 'transition: 5s linear all;' + <del>// vendorPrefix + 'transition: 5s linear all'); <del>// ss.addRule('.ng-hide-remove', 'transition: 5s linear all;' + <del>// vendorPrefix + 'transition: 5s linear all'); <add>// ss.addRule('.ng-hide-add', '-webkit-transition: 5s linear all;' + <add>// 'transition: 5s linear all;'); <add>// ss.addRule('.ng-hide-remove', '-webkit-transition: 5s linear all;' + <add>// 'transition: 5s linear all;'); <ide> // <ide> // var element = html($compile('<div></div>')($rootScope)); <ide> // <ide> describe("ngAnimate", function() { <ide> <ide> it("should provide the correct CSS class to the addClass and removeClass callbacks within a JS animation", function() { <ide> module(function($animateProvider) { <del> $animateProvider.register('.classify', function($timeout) { <add> $animateProvider.register('.classify', function() { <ide> return { <ide> removeClass : function(element, className, done) { <ide> element.data('classify','remove-' + className); <ide> describe("ngAnimate", function() { <ide> } <ide> }); <ide> }) <del> inject(function($compile, $rootScope, $animate, $timeout) { <add> inject(function($compile, $rootScope, $animate) { <ide> var element = html($compile('<div class="classify"></div>')($rootScope)); <ide> <ide> $animate.addClass(element, 'super'); <ide> describe("ngAnimate", function() { <ide> var element = html($compile('<div class="animated parent"></div>')($rootScope)); <ide> var child = html($compile('<div class="animated child"></div>')($rootScope)); <ide> <del> ss.addRule('.animated', 'transition:1s linear all;' + <del> vendorPrefix + 'transition:1s linear all'); <del> ss.addRule('.super-add', 'transition:2s linear all;' + <del> vendorPrefix + 'transition:2s linear all'); <add> ss.addRule('.animated', '-webkit-transition:1s linear all;' + <add> 'transition:1s linear all;'); <add> ss.addRule('.super-add', '-webkit-transition:2s linear all;' + <add> 'transition:2s linear all;'); <ide> <ide> $rootElement.append(element); <ide> jqLite(document.body).append($rootElement); <ide> describe("ngAnimate", function() { <ide> var element = html($compile('<div class="animated parent"></div>')($rootScope)); <ide> var child = html($compile('<div class="animated child"></div>')($rootScope)); <ide> <del> ss.addRule('.animated.ng-enter', 'transition: width 1s, background 1s 1s;' + <del> vendorPrefix + 'transition: width 1s, background 1s 1s;'); <add> ss.addRule('.animated.ng-enter', '-webkit-transition: width 1s, background 1s 1s;' + <add> 'transition: width 1s, background 1s 1s;'); <ide> <ide> $rootElement.append(element); <ide> jqLite(document.body).append($rootElement);
1
Text
Text
fix typo error
d9e5321c4ebecb725e25340e4e010b049cdf458f
<ide><path>guide/english/cplusplus/index.md <ide> title: C++ <ide> ## What is C++? <ide> <ide> * C++ is a general purpose programming language which has been used since the 1990's <del>* It was designed by Bjarne Stroustrup under with the name "C with classes". <add>* It was designed by Bjarne Stroustrup under the name "C with classes". <ide> * It is a version of C that includes Object-Oriented elements, including classes and functions. <ide> <ide> * It is considered one of the biggest programming languages, as you can see in the following image:
1
PHP
PHP
turn redis clustering off by default
0103a698d7e1de6a9c49f9c55c769fcd90fe0d4c
<ide><path>app/config/database.php <ide> <ide> 'redis' => array( <ide> <del> 'cluster' => true, <add> 'cluster' => false, <ide> <ide> 'default' => array( <ide> 'host' => '127.0.0.1',
1
Text
Text
enable python curriculum
decf1ece992556d19da5f9d0c2a948a182c0db55
<ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/american-british-translator.english.md <ide> id: 5e601c0d5ac9d0ecd8b94afe <ide> title: American British Translator <ide> challengeType: 4 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/sudoku-solver.english.md <ide> id: 5e601bf95ac9d0ecd8b94afd <ide> title: Sudoku Solver <ide> challengeType: 4 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide> Start this project on Glitch using <a href='https://glitch.com/edit/#!/remix/clo <ide> <ide> ```yml <ide> tests: <del> - text: I can enter a sudoku puzzle by filling in the text area with either a number or period (.) to represent an empty cell. <add> - text: I can enter a sudoku puzzle by filling in the text area with either a number or period (.) to represent an empty cell. <ide> testString: '' <ide> - text: When a valid number is entered in the text area, the same number is applied to the correct cell of the sudoku grid. <ide> testString: '' <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/build-your-own-functions.english.md <ide> id: 5e7b9f060b6c005b0e76f05b <ide> title: Build your own Functions <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: nLDychdBwUg <ide> --- <ide> question: <ide> answers: <ide> - | <ide> Zap <del> <add> <ide> ABC <del> <add> <ide> jane <del> <add> <ide> fred <del> <add> <ide> jane <ide> - | <ide> Zap <del> <add> <ide> ABC <del> <add> <ide> Zap <ide> - | <ide> ABC <del> <add> <ide> Zap <del> <add> <ide> jane <ide> - | <ide> ABC <del> <add> <ide> Zap <del> <add> <ide> ABC <ide> - | <ide> Zap <del> <add> <ide> Zap <del> <add> <ide> Zap <ide> solution: 4 <ide> ``` <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/comparing-and-sorting-tuples.english.md <ide> id: 5e7b9f0b0b6c005b0e76f06d <ide> title: Comparing and Sorting Tuples <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: dZXzBXUxxCs <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/conditional-execution.english.md <ide> id: 5e7b9f050b6c005b0e76f058 <ide> title: Conditional Execution <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: gz_IfIsZQtc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/data-visualization-mailing-lists.english.md <ide> id: 5e7b9f6a0b6c005b0e76f097 <ide> title: 'Data Visualization: Mailing Lists' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: RYdW660KkaQ <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/data-visualization-page-rank.english.md <ide> id: 5e7b9f6a0b6c005b0e76f096 <ide> title: 'Data Visualization: Page Rank' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 6-w_qIUwaxU <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/dictionaries-and-loops.english.md <ide> id: 5e7b9f0a0b6c005b0e76f069 <ide> title: Dictionaries and Loops <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: EEmekKiKG70 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/dictionaries-common-applications.english.md <ide> id: 5e7b9f090b6c005b0e76f068 <ide> title: "Dictionaries: Common Applications" <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: f17xPfIXct0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.english.md <ide> id: 5e7b9f080b6c005b0e76f063 <ide> title: Files as a Sequence <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: cIA0EokbaHE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.english.md <ide> id: 5e7b9f050b6c005b0e76f057 <ide> title: Intermediate Expressions <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: dKgUaIa5ATg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/intermediate-strings.english.md <ide> id: 5e7b9f070b6c005b0e76f061 <ide> title: Intermediate Strings <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: KgT_fYLXnyk <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-elements-of-python.md <ide> id: 5e6a54c358d3af90110a60a3 <ide> title: 'Introduction: Elements of Python' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: aRY_xjL35v0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-hardware-achitecture.english.md <ide> id: 5e6a54af58d3af90110a60a1 <ide> title: 'Introduction: Hardware Architecture' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: H6qtjRTfSog <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-python-as-a-language.english.md <ide> id: 5e6a54ba58d3af90110a60a2 <ide> title: 'Introduction: Python as a Language' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 0QeGbZNS_bY <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.english.md <ide> id: 5e6a54a558d3af90110a60a0 <ide> title: 'Introduction: Why Program?' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 3muQV-Im3Z0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/iterations-definite-loops.english.md <ide> id: 5e7b9f070b6c005b0e76f05d <ide> title: 'Iterations: Definite Loops' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: hiRTRAqNlpE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/iterations-loop-idioms.english.md <ide> id: 5e7b9f070b6c005b0e76f05e <ide> title: 'Iterations: Loop Idioms' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: AelGAcoMXbI <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.english.md <ide> id: 5e7b9f070b6c005b0e76f05f <ide> title: 'Iterations: More Patterns' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 9Wtqo6vha1M <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/loops-and-iterations.english.md <ide> id: 5e7b9f060b6c005b0e76f05c <ide> title: Loops and Iterations <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: dLA-szNRnUY <ide> --- <ide> question: <ide> answers: <ide> - | <ide> 0 <del> <add> <ide> 1 <del> <add> <ide> 2 <ide> - | <ide> 0 <del> <add> <ide> 1 <del> <add> <ide> 2 <del> <add> <ide> 3 <ide> - | <ide> 1 <del> <add> <ide> 2 <ide> - | <ide> 1 <del> <add> <ide> 2 <del> <add> <ide> 3 <ide> solution: 1 <ide> ``` <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/make-a-relational-database.english.md <ide> id: 5e7b9f170b6c005b0e76f08b <ide> title: Make a Relational Database <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: MQ5z4bdF92U <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/more-conditional-structures.english.md <ide> id: 5e7b9f060b6c005b0e76f059 <ide> title: More Conditional Structures <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: HdL82tAZR20 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-protocol.english.md <ide> id: 5e7b9f0c0b6c005b0e76f072 <ide> title: Networking Protocol <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: c6vZGescaSc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-text-processing.english.md <ide> id: 5e7b9f0c0b6c005b0e76f074 <ide> title: 'Networking: Text Processing' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: Pv_pJgVu8WI <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-using-urllib-in-python.md <ide> id: 5e7b9f0d0b6c005b0e76f075 <ide> title: 'Networking: Using urllib in Python' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 7lFM1T_CxBs <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.english.md <ide> id: 5e7b9f0d0b6c005b0e76f076 <ide> title: 'Networking: Web Scraping with Python' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: Uyioq2q4cEg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-with-python.english.md <ide> id: 5e7b9f0c0b6c005b0e76f071 <ide> title: Networking with Python <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: _kJvneKVdNM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-write-a-web-browser.english.md <ide> id: 5e7b9f0c0b6c005b0e76f073 <ide> title: 'Networking: Write a Web Browser' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: zjyT9DaAjx4 <ide> --- <ide> question: <ide> <ide> ```py <ide> import socket <del> <add> <ide> mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <ide> mysock.connect(('data.pr4e.org', 80)) <ide> cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\r\n\r\n'.encode() <ide> mysock.send(cmd) <del> <add> <ide> while True: <ide> data = mysock.recv(512) <ide> if len(data) < 1: <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/object-lifecycle.english.md <ide> id: 5e7b9f170b6c005b0e76f087 <ide> title: Object Lifecycle <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: p1r3h_AMMIM <ide> --- <ide> question: <ide> answers: <ide> - | <ide> Quincy constructed <del> <add> <ide> Miya constructed <ide> <ide> Quincy party count 1 <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/objects-a-sample-class.english.md <ide> id: 5e7b9f160b6c005b0e76f086 <ide> title: 'Objects: A Sample Class' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: FiABKEuaSJ8 <ide> --- <ide> question: <ide> answers: <ide> - | <ide> So far 1 <del> <add> <ide> So far 2 <ide> - | <ide> 0 <ide> question: <ide> 2 <ide> - | <ide> 2 <del> <add> <ide> 4 <ide> solution: 4 <ide> ``` <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/objects-inheritance.english.md <ide> id: 5e7b9f170b6c005b0e76f088 <ide> title: 'Objects: Inheritance' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: FBL3alYrxRM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-dictionaries.english.md <ide> id: 5e7b9f090b6c005b0e76f067 <ide> title: Python Dictionaries <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: dnzvfimrRMg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-functions.english.md <ide> id: 5e7b9f060b6c005b0e76f05a <ide> title: Python Functions <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 3JGF-n3tDPU <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-lists.english.md <ide> id: 5e7b9f080b6c005b0e76f064 <ide> title: Python Lists <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: Y0cvfDpYC_c <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-objects.english.md <ide> id: 5e7b9f160b6c005b0e76f085 <ide> title: Python Objects <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: uJxGeTYy0us <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/reading-files.english.md <ide> id: 5e7b9f080b6c005b0e76f062 <ide> title: Reading Files <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: Fo1tW09KIwo <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/regular-expressions-matching-and-extracting-data.english.md <ide> id: 5e7b9f0b0b6c005b0e76f06f <ide> title: 'Regular Expressions: Matching and Extracting Data' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: LaCZnTbQGkE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/regular-expressions-practical-applications.english.md <ide> id: 5e7b9f0b0b6c005b0e76f070 <ide> title: 'Regular Expressions: Practical Applications' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: xCjFU9G6x48 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/regular-expressions.english.md <ide> id: 5e7b9f0b0b6c005b0e76f06e <ide> title: Regular Expressions <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: Yud_COr6pZo <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-database-design.english.md <ide> id: 5e7b9f180b6c005b0e76f08c <ide> title: Relational Database Design <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: AqdfbrpkbHk <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-and-sqlite.english.md <ide> id: 5e7b9f170b6c005b0e76f08a <ide> title: 'Relational Databases and SQLite' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: QlNod5-kFpA <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-join-operation.english.md <ide> id: 5e7b9f180b6c005b0e76f08f <ide> title: 'Relational Databases: Join Operation' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: jvDw3D9GKac <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-many-to-many-relationships.english.md <ide> id: 5e7b9f190b6c005b0e76f090 <ide> title: 'Relational Databases: Many-to-many Relationships' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: z-SBYcvEQOc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-relationship-building.english.md <ide> id: 5e7b9f180b6c005b0e76f08e <ide> title: 'Relational Databases: Relationship Building' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: CSbqczsHVnc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/representing-relationships-in-a-relational-database.english.md <ide> id: 5e7b9f180b6c005b0e76f08d <ide> title: Representing Relationships in a Relational Database <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: -orenCNdC2Q <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/strings-and-lists.english.md <ide> id: 5e7b9f090b6c005b0e76f066 <ide> title: Strings and Lists <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: lxcFa7ldCi0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/strings-in-python.english.md <ide> id: 5e7b9f070b6c005b0e76f060 <ide> title: Strings in Python <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: LYZj207fKpQ <ide> --- <ide> question: <ide> answers: <ide> - | <ide> n <del> <add> <ide> n <ide> - | <ide> 0 <del> <add> <ide> 1 <ide> - | <ide> 0 <del> <add> <ide> 1 <del> <add> <ide> 2 <del> <add> <ide> 3 <del> <add> <ide> 4 <del> <add> <ide> 5 <ide> - | <ide> b <del> <add> <ide> a <del> <add> <ide> n <del> <add> <ide> a <del> <add> <ide> n <del> <add> <ide> a <ide> solution: 4 <ide> ``` <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/the-tuples-collection.english.md <ide> id: 5e7b9f0a0b6c005b0e76f06c <ide> title: The Tuples Collection <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: 3Lxpladfh2k <ide> --- <ide> question: <ide> answers: <ide> - | <ide> k i <del> <add> <ide> k i <del> <add> <ide> k i <ide> - | <ide> quincy 0 <del> <add> <ide> beau 1 <del> <add> <ide> kris 2 <ide> - | <ide> quincy 1 <del> <add> <ide> beau 5 <del> <add> <ide> kris 9 <ide> - | <ide> 1 quincy <del> <add> <ide> 5 beau <del> <add> <ide> 9 kris <ide> solution: 3 <ide> ``` <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/using-web-services.english.md <ide> id: 5e7b9f0e0b6c005b0e76f07a <ide> title: Using Web Services <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: oNl1OVDPGKE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/variables-expressions-and-statements.english.md <ide> id: 5e7b9f050b6c005b0e76f056 <ide> title: Variables, Expressions, and Statements <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: nELR-uyyrok <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/visualizing-data-with-python.english.md <ide> id: 5e7b9f690b6c005b0e76f095 <ide> title: Visualizing Data with Python <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: e3lydkH0prw <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-api-rate-limiting-and-security.english.md <ide> id: 5e7b9f150b6c005b0e76f080 <ide> title: 'Web Services: API Rate Limiting and Security' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: pI-g0lI8ngs <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-apis.english.md <ide> id: 5e7b9f150b6c005b0e76f07f <ide> title: 'Web Services: APIs' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: oUNn1psfBJg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-json.english.md <ide> id: 5e7b9f140b6c005b0e76f07d <ide> title: 'Web Services: JSON' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: ZJE-U56BppM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-service-oriented-approach.english.md <ide> id: 5e7b9f140b6c005b0e76f07e <ide> title: 'Web Services: Service Oriented Approach' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: muerlsCHExI <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-xml-schema.english.md <ide> id: 5e7b9f0e0b6c005b0e76f07c <ide> title: 'Web Services: XML Schema' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: yWU9kTxW-nc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-xml.english.md <ide> id: 5e7b9f0e0b6c005b0e76f07b <ide> title: 'Web Services: XML' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: _pZ0srbg7So <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/working-with-lists.english.md <ide> id: 5e7b9f090b6c005b0e76f065 <ide> title: Working with Lists <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> videoId: lCnHfTHkhbE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.english.md <ide> id: 5e44412c903586ffb414c94c <ide> title: Arithmetic Formatter <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/budget-app.english.md <ide> id: 5e44413e903586ffb414c94e <ide> title: Budget App <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/polygon-area-calculator.english.md <ide> id: 5e444147903586ffb414c94f <ide> title: Polygon Area Calculator <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.english.md <ide> id: 5e44414f903586ffb414c950 <ide> title: Probability Calculator <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator.english.md <ide> id: 5e444136903586ffb414c94d <ide> title: Time Calculator <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-a.english.md <ide> id: 5e9a093a74c4063ca6f7c14d <ide> title: Data Analysis Example A <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: nVAaxZ34khk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-b.english.md <ide> id: 5e9a093a74c4063ca6f7c14e <ide> title: Data Analysis Example B <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 0kJz0q0pvgQ <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-and-visualizations.english.md <ide> id: 5e9a093a74c4063ca6f7c160 <ide> title: Data Cleaning and Visualizations <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: mHjxzFS5_Z0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-duplicates.english.md <ide> id: 5e9a093a74c4063ca6f7c15f <ide> title: Data Cleaning Duplicates <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: kj7QqjXhH6A <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c15d <ide> title: Data Cleaning Introduction <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: ovYNhnltVxY <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-with-dataframes.english.md <ide> id: 5e9a093a74c4063ca6f7c15e <ide> title: Data Cleaning with DataFrames <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: sTMN_pdI6S0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/how-to-use-jupyter-notebooks-intro.english.md <ide> id: 5e9a093a74c4063ca6f7c14f <ide> title: How to use Jupyter Notebooks Intro <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: h8caJq2Bb9w <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/introduction-to-data-analysis.english.md <ide> id: 5e9a093a74c4063ca6f7c14c <ide> title: Introduction to Data Analysis <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: VJrP2FUzKP0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-cells.english.md <ide> id: 5e9a093a74c4063ca6f7c150 <ide> title: Jupyter Notebooks Cells <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 5PPegAs9aLA <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-importing-and-exporting-data.english.md <ide> id: 5e9a093a74c4063ca6f7c151 <ide> title: Jupyter Notebooks Importing and Exporting Data <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: k1msxD3JIxE <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-algebra-and-size.english.md <ide> id: 5e9a093a74c4063ca6f7c157 <ide> title: Numpy Algebra and Size <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: XAT97YLOKD8 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-arrays.english.md <ide> id: 5e9a093a74c4063ca6f7c154 <ide> title: Numpy Arrays <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: VDYVFHBL1AM <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-boolean-arrays.english.md <ide> id: 5e9a093a74c4063ca6f7c156 <ide> title: Numpy Boolean Arrays <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: N1ttsMmcVMM <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-a.english.md <ide> id: 5e9a093a74c4063ca6f7c152 <ide> title: Numpy Introduction A <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: P-JjV6GBCmk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-b.english.md <ide> id: 5e9a093a74c4063ca6f7c153 <ide> title: Numpy Introduction B <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: YIqgrNLAZkA <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-operations.english.md <ide> id: 5e9a093a74c4063ca6f7c155 <ide> title: Numpy Operations <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: eqSVcJbaPdk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-condtitional-selection-and-modifying-dataframes.english.md <ide> id: 5e9a093a74c4063ca6f7c15b <ide> title: Pandas Condtitional Selection and Modifying DataFrames <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: BFlH0fN5xRQ <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-creating-columns.english.md <ide> id: 5e9a093a74c4063ca6f7c15c <ide> title: Pandas Creating Columns <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: _sSo2XZoB3E <ide> --- <ide> <ide> question: <ide> - | <ide> ```py <ide> certificates_earned['Certificates per month'] = round( <del> certificates_earned['Certificates'] / <add> certificates_earned['Certificates'] / <ide> certificates_earned['Time (in months)'] <ide> ) <ide> ``` <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-dataframes.english.md <ide> id: 5e9a093a74c4063ca6f7c15a <ide> title: Pandas DataFrames <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 7SgFBYXaiH0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-indexing-and-conditional-selection.english.md <ide> id: 5e9a093a74c4063ca6f7c159 <ide> title: Pandas Indexing and Conditional Selection <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: -ZOrgV_aA9A <ide> --- <ide> <ide> question: <ide> import pandas as pd <ide> <ide> certificates_earned = pd.Series( <del> [8, 2, 5, 6], <add> [8, 2, 5, 6], <ide> index=['Tom', 'Kris', 'Ahmad', 'Beau'] <ide> ) <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c158 <ide> title: Pandas Introduction <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 0xACW-8cZU0 <ide> --- <ide> <ide> question: <ide> import pandas as pd <ide> <ide> certificates_earned = pd.Series( <del> [8, 2, 5, 6], <add> [8, 2, 5, 6], <ide> index=['Tom', 'Kris', 'Ahmad', 'Beau'] <ide> ) <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.english.md <ide> id: 5e9a093a74c4063ca6f7c164 <ide> title: Parsing HTML and Saving Data <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: bJaqnTWQmb0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/python-functions-and-collections.english.md <ide> id: 5e9a093a74c4063ca6f7c166 <ide> title: Python Functions and Collections <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: NzpU17ZVlUw <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/python-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c165 <ide> title: Python Introduction <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: PrQV9JkLhb4 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/python-iteration-and-modules.english.md <ide> id: 5e9a093a74c4063ca6f7c167 <ide> title: Python Iteration and Modules <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: XzosGWLafrY <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.english.md <ide> id: 5e9a093a74c4063ca6f7c162 <ide> title: Reading Data CSV and TXT <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: ViGEv0zOzUk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.english.md <ide> id: 5e9a093a74c4063ca6f7c163 <ide> title: Reading Data from Databases <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: MtgXS1MofRw <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c161 <ide> title: Reading Data Introduction <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: cDnt02BcHng <ide> --- <ide> <ide> question: <ide> name, certs_num, months_num = values <ide> print(f"{name} earned {__C__} certificates in {months_num} months") <ide> ``` <del> <add> <ide> answers: <ide> - | <ide> A: `'certificates.csv'` <del> <del> B: `'-'` <del> <add> <add> B: `'-'` <add> <ide> C: `values` <ide> - | <ide> A: `'certificates.csv'` <del> <add> <ide> B: `'$'` <del> <add> <ide> C: `certs_num` <ide> - | <del> <add> <ide> A: `'certificates'` <del> <add> <ide> B: `'$'` <del> <add> <ide> C: `certs_num` <ide> solution: 2 <ide> ``` <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.english.md <ide> id: 5e46f7e5ac417301a38fb929 <ide> title: Demographic Data Analyzer <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/mean-variance-standard-deviation-calculator.english.md <ide> id: 5e46f7e5ac417301a38fb928 <ide> title: Mean-Variance-Standard Deviation Calculator <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.english.md <ide> id: 5e46f7f8ac417301a38fb92a <ide> title: Medical Data Visualizer <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.english.md <ide> id: 5e46f802ac417301a38fb92b <ide> title: Page View Time Series Visualizer <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.english.md <ide> id: 5e4f5c4b570f7e3a4949899f <ide> title: Sea Level Predictor <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/accessing-and-changing-elements,-rows,-columns.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed4 <ide> title: Accessing and Changing Elements, Rows, Columns <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: v-7Y7koJ_N0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/basics-of-numpy.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed3 <ide> title: Basics of Numpy <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: f9QrZrKQMLI <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/copying-arrays-warning.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed7 <ide> title: Copying Arrays Warning <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: iIoQ0_L0GvA <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/initialize-array-problem.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed6 <ide> title: Initialize Array Problem <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 0jGfH8BPfOk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/initializing-different-arrays.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed5 <ide> title: Initializing Different Arrays <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: CEykdsKT4U4 <ide> --- <ide> <ide> videoId: CEykdsKT4U4 <ide> question: <ide> text: | <ide> What will the following code print?: <del> <add> <ide> ```py <ide> a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/loading-data-and-advanced-indexing.english.md <ide> id: 5e9a0a8e09c5df3cc3600eda <ide> title: Loading Data and Advanced Indexing <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: tUdBZ7pF8Jg <ide> --- <ide> <ide> question: <ide> ```py <ide> [29. 32. 45. 15. 5. 22.] <ide> ``` <del> <add> <ide> answers: <ide> - | <ide> ``` <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/mathematics.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed8 <ide> title: Mathematics <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 7txegvyhtVk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/reorganizing-arrays.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed9 <ide> title: Reorganizing Arrays <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: VNWAQbEM-C8 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/what-is-numpy.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed2 <ide> title: What is NumPy <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 5Nwfs5Ej85Q <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/port-scanner.english.md <ide> id: 5e46f979ac417301a38fb932 <ide> title: Port Scanner <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/secure-real-time-multiplayer-game.english.md <ide> id: 5e601c775ac9d0ecd8b94aff <ide> title: Secure Real Time Multiplayer Game <ide> challengeType: 4 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/sha-1-password-cracker.english.md <ide> id: 5e46f983ac417301a38fb933 <ide> title: SHA-1 Password Cracker <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/creating-a-tcp-client.english.md <ide> id: 5ea9997bbec2e9bc47e94db0 <ide> title: Creating a TCP Client <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: ugYfJNTawks <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-a-banner-grabber.english.md <ide> id: 5ea9997bbec2e9bc47e94db3 <ide> title: Developing a Banner Grabber <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: CeGW761BIsA <ide> --- <ide> <ide> question: <ide> answers: <ide> - | <ide> A: `connect` <del> <add> <ide> B: `port` <ide> - | <ide> A: `getsockname` <del> <add> <ide> B: `'1-1024'` <ide> - | <ide> A: `connect` <del> <add> <ide> B: `int(port)` <ide> solution: 3 <ide> ``` <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-a-port-scanner.english.md <ide> id: 5ea9997bbec2e9bc47e94db4 <ide> title: Developing a Port Scanner <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: z_qkqZS7KZ4 <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-an-nmap-scanner-part-1.english.md <ide> id: 5ea9997bbec2e9bc47e94db1 <ide> title: Developing an Nmap Scanner part 1 <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: jYk9XaGoAnk <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-an-nmap-scanner-part-2.english.md <ide> id: 5ea9997bbec2e9bc47e94db2 <ide> title: Developing an Nmap Scanner part 2 <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: a98PscnUsTg <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/introduction-and-setup.english.md <ide> id: 5ea9997bbec2e9bc47e94dae <ide> title: Introduction and Setup <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: XeQ7ZKtb998 <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/understanding-sockets-and-creating-a-tcp-server.english.md <ide> id: 5ea9997bbec2e9bc47e94daf <ide> title: Understanding Sockets and Creating a TCP Server <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: F1QI9tNuDQg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/deep-learning-demystified.english.md <ide> id: 5e9a0e9ef99a403d019610cc <ide> title: Deep Learning Demystified <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: bejQ-W9BGJg <ide> --- <ide> <ide> videoId: bejQ-W9BGJg <ide> ```yml <ide> question: <ide> text: How should you assign weights to input neurons before training your network for the first time? <del> <add> <ide> answers: <ide> - From smallest to largest. <ide> - Completely randomly. <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/how-convolutional-neural-networks-work.english.md <ide> id: 5e9a0e9ef99a403d019610cd <ide> title: How Convolutional Neural Networks work <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: Y5M7KH4A4n4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/how-deep-neural-networks-work.english.md <ide> id: 5e9a0e9ef99a403d019610ca <ide> title: How Deep Neural Networks Work <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: zvalnHWGtx4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/recurrent-neural-networks-rnn-and-long-short-term-memory-lstm.english.md <ide> id: 5e9a0e9ef99a403d019610cb <ide> title: Recurrent Neural Networks RNN and Long Short Term Memory LSTM <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: UVimlsy9eW0 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.english.md <ide> id: 5e46f8e3ac417301a38fb92f <ide> title: Book Recommendation Engine using KNN <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.english.md <ide> id: 5e46f8dcac417301a38fb92e <ide> title: Cat and Dog Image Classifier <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.english.md <ide> id: 5e46f8edac417301a38fb930 <ide> title: Linear Regression Health Costs Calculator <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md <ide> id: 5e46f8edac417301a38fb931 <ide> title: Neural Network SMS Text Classifier <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.english.md <ide> id: 5e46f8d6ac417301a38fb92d <ide> title: Rock Paper Scissors <ide> challengeType: 10 <del>isHidden: true <add>isHidden: false <ide> isRequired: true <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/conclusion.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da6 <ide> title: Conclusion <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: LMNub5frQi4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks-evaluating-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d99 <ide> title: 'Convolutional Neural Networks: Evaluating the Model' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: eCATNvwraXg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks-picking-a-pretrained-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9a <ide> title: 'Convolutional Neural Networks: Picking a Pretrained Model' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: h1XUt1AgIOI <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks-the-convolutional-layer.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d97 <ide> title: 'Convolutional Neural Networks: The Convolutional Layer' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: LrdmcQpTyLw <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d96 <ide> title: Convolutional Neural Networks <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: _1kTP7uoU9E <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-building-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8e <ide> title: 'Core Learning Algorithms: Building the Model' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 5wHw8BTd2ZQ <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-classification.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8d <ide> title: 'Core Learning Algorithms: Classification' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: qFF7ZQNvK9E <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-clustering.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8f <ide> title: 'Core Learning Algorithms: Clustering' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 8sqIaHc9Cz4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-hidden-markov-models.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d90 <ide> title: 'Core Learning Algorithms: Hidden Markov Models' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: IZg24y4wEPY <ide> --- <ide> <ide> question: <ide> answers: <ide> - It uses probability distributions to predict future events or states. <ide> - It analyzes the relationship between independent and dependent variables to make predictions. <del> - It separates data points into separate categories. <add> - It separates data points into separate categories. <ide> solution: 1 <ide> ``` <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-the-training-process.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8c <ide> title: 'Core Learning Algorithms: The Training Process' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: _cEwvqVoBhI <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-training-and-testing-data.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8b <ide> title: 'Core Learning Algorithms: Training and Testing Data' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: wz9J1slsi7I <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-using-probabilities-to-make-predictions.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d91 <ide> title: 'Core Learning Algorithms: Using Probabilities to make Predictions' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: fYAYvLUawnc <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-working-with-data.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8a <ide> title: 'Core Learning Algorithms: Working with Data' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: u85IOSsJsPI <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d89 <ide> title: Core Learning Algorithms <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: u5lZURgcWnU <ide> --- <ide> <ide> videoId: u5lZURgcWnU <ide> ```yml <ide> question: <ide> text: | <del> Which type of analysis would be best suited for the following problem?: <del> <add> Which type of analysis would be best suited for the following problem?: <add> <ide> You have the average temperature in the month of March for the last 100 years. Using this data, you want to predict the average temperature in the month of March 5 years from now. <ide> answers: <ide> - Multiple regression <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/creating-a-convolutional-neural-network.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d98 <ide> title: Creating a Convolutional Neural Network <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: kfv0K8MtkIc <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/introduction-machine-learning-fundamentals.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d87 <ide> title: "Introduction: Machine Learning Fundamentals" <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: KwL1qTR5MT8 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/introduction-to-tensorflow.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d88 <ide> title: Introduction to TensorFlow <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: r9hRyGGjOgQ <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-building-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da1 <ide> title: 'Natural Language Processing With RNNs: Building the Model' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: 32WBFS7lfsw <ide> --- <ide> <ide> question: <ide> def build_mode(vocab_size, embedding_dim, rnn_units, batch_size): <ide> model = tf.keras.Sequential([ <ide> tf.keras.layers.Embedding(vocab_size, <del> embedding_dim, <add> embedding_dim, <ide> batch_input_shape=[batch_size, None]), <ide> tf.keras.layers.__A__(rnn_units, <ide> return_sequences=__B__, <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-create-a-play-generator.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da0 <ide> title: 'Natural Language Processing With RNNs: Create a Play Generator' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: j5xsxjq_Xk8 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-making-predictions.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9f <ide> title: 'Natural Language Processing With RNNs: Making Predictions' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: WO1hINnBj20 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-part-2.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9c <ide> title: 'Natural Language Processing With RNNs: Part 2' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: mUU9YXOFbZg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-recurring-neural-networks.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9d <ide> title: 'Natural Language Processing With RNNs: Recurring Neural Networks' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: bX5681NPOcA <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-sentimental-analysis.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9e <ide> title: 'Natural Language Processing With RNNs: Sentiment Analysis' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: lYeLtu8Nq7c <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-training-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da2 <ide> title: 'Natural Language Processing With RNNs: Training the Model' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: hEUiK7j9UI8 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9b <ide> title: Natural Language Processing With RNNs <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: ZyCaF5S-lKg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d93 <ide> title: 'Neural Networks: Activation Functions' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: S45tqW6BqRs <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-creating-a-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d95 <ide> title: 'Neural Networks: Creating a Model' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: K8bz1bmOCTw <ide> --- <ide> <ide> question: <ide> answers: <ide> - | <ide> A: `keras` <del> <add> <ide> B: `Sequential` <del> <add> <ide> C: `Dense` <ide> - | <ide> A: `tf` <del> <add> <ide> B: `Sequential` <del> <add> <ide> C: `Categorical` <ide> - | <ide> A: `keras` <del> <add> <ide> B: `sequential` <del> <add> <ide> C: `dense` <ide> solution: 1 <ide> ``` <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-optimizers.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d94 <ide> title: 'Neural Networks: Optimizers' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: hdOtRPQe1o4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-with-tensorflow.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d92 <ide> title: Neural Networks with TensorFlow <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: uisdfrNrZW4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/reinforcement-learning-with-q-learning-example.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da5 <ide> title: 'Reinforcement Learning With Q-Learning: Example' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: RBBSNta234s <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/reinforcement-learning-with-q-learning-part-2.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da4 <ide> title: 'Reinforcement Learning With Q-Learning: Part 2' <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: DX7hJuaUZ7o <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/reinforcement-learning-with-q-learning.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da3 <ide> title: Reinforcement Learning With Q-Learning <ide> challengeType: 11 <del>isHidden: true <add>isHidden: false <ide> videoId: Cf7DSU0gVb4 <ide> --- <ide> <ide><path>curriculum/challenges/english/12-certificates/data-analysis-with-python-certificate/data-analysis-with-python-certificate.english.md <ide> id: 5e46fc95ac417301a38fb934 <ide> title: Data Analysis with Python Certificate <ide> challengeType: 7 <del>isHidden: true <add>isHidden: false <ide> isPrivate: true <ide> --- <ide> <ide><path>curriculum/challenges/english/12-certificates/information-security-certificate/information-security-certificate.english.md <ide> id: 5e6021435ac9d0ecd8b94b00 <ide> title: Information Security Certificate <ide> challengeType: 7 <del>isHidden: true <add>isHidden: false <ide> isPrivate: true <ide> --- <ide> <ide><path>curriculum/challenges/english/12-certificates/machine-learning-with-python-certificate/machine-learning-with-python-certificate.english.md <ide> id: 5e46fc95ac417301a38fb935 <ide> title: Machine Learning with Python Certificate <ide> challengeType: 7 <del>isHidden: true <add>isHidden: false <ide> isPrivate: true <ide> --- <ide> <ide><path>curriculum/challenges/english/12-certificates/quality-assurance-certificate/quality-assurance-certificate.english.md <ide> id: 5e611829481575a52dc59c0e <ide> title: Quality Assurance Certificate <ide> challengeType: 7 <del>isHidden: true <add>isHidden: false <ide> isPrivate: true <ide> --- <ide> <ide><path>curriculum/challenges/english/12-certificates/scientific-computing-with-python-certificate/scientific-computing-with-python-certificate.english.md <ide> id: 5e44431b903586ffb414c951 <ide> title: Scientific Computing with Python Certificate <ide> challengeType: 7 <del>isHidden: true <add>isHidden: false <ide> isPrivate: true <ide> --- <ide>
161
Javascript
Javascript
add replacement utils for lodash modules + tests
3aef46935f63175f9e79d84fce343fa8fe1963f9
<ide><path>src/utils/identity.js <add>export default function identity(value) { <add> return value; <add>} <ide><path>src/utils/isPlainObject.js <add>export default function isPlainObject(obj) { <add> return typeof obj == 'object' && Object.getPrototypeOf(obj) === Object.prototype; <add>} <ide><path>src/utils/pick.js <add>export default function pick(obj, fn) { <add> return Object.keys(obj).reduce((result, key) => { <add> if (fn(obj[key])) { <add> result[key] = obj[key]; <add> } <add> return result; <add> }, {}); <add>} <ide><path>test/utils/identity.spec.js <add>import expect from 'expect'; <add>import identity from '../../src/utils/identity'; <add> <add>describe('Utils', () => { <add> describe('identity', () => { <add> it('should return first argument passed to it', () => { <add> var test = { 'a': 1 }; <add> expect(identity(test, 'test')).toEqual(test); <add> }); <add> }); <add>}); <ide><path>test/utils/isPlainObject.spec.js <add>import expect from 'expect'; <add>import isPlainObject from '../../src/utils/isPlainObject'; <add> <add>describe('Utils', () => { <add> describe('isPlainObject', () => { <add> it('should return true only if plain object', () => { <add> function Test() { <add> this.prop = 1; <add> } <add> <add> expect(isPlainObject(new Test())).toBe(false); <add> expect(isPlainObject(new Date())).toBe(false); <add> expect(isPlainObject([1, 2, 3])).toBe(false); <add> expect(isPlainObject({ 'x': 1, 'y': 2 })).toBe(true); <add> }); <add> }); <add>}); <ide><path>test/utils/pick.spec.js <add>import expect from 'expect'; <add>import pick from '../../src/utils/pick'; <add> <add>describe('Utils', () => { <add> describe('pick', () => { <add> it('should return object with picked values', () => { <add> const test = { 'name': 'lily', 'age': 20 }; <add> expect(pick(test, x => typeof x === 'string')).toEqual({ 'name': 'lily' }); <add> }); <add> }); <add>});
6
Ruby
Ruby
fix spelling in `controller/filters_test.rb`
2bb445d25fa2befef9f37b994c36cc65a47c36ae
<ide><path>actionpack/test/controller/filters_test.rb <ide> class ExceptConditionClassController < ConditionalFilterController <ide> before_action ConditionalClassFilter, except: :show_without_action <ide> end <ide> <del> class AnomolousYetValidConditionController < ConditionalFilterController <add> class AnomalousYetValidConditionController < ConditionalFilterController <ide> before_action(ConditionalClassFilter, :ensure_login, Proc.new { |c| c.instance_variable_set(:"@ran_proc_action1", true) }, except: :show_without_action) { |c| c.instance_variable_set(:"@ran_proc_action2", true) } <ide> end <ide> <ide> def test_running_actions_with_class <ide> end <ide> <ide> def test_running_anomalous_yet_valid_condition_actions <del> test_process(AnomolousYetValidConditionController) <add> test_process(AnomalousYetValidConditionController) <ide> assert_equal %w( ensure_login ), @controller.instance_variable_get(:@ran_filter) <ide> assert @controller.instance_variable_get(:@ran_class_action) <ide> assert @controller.instance_variable_get(:@ran_proc_action1) <ide> assert @controller.instance_variable_get(:@ran_proc_action2) <ide> <del> test_process(AnomolousYetValidConditionController, "show_without_action") <add> test_process(AnomalousYetValidConditionController, "show_without_action") <ide> assert_not @controller.instance_variable_defined?(:@ran_filter) <ide> assert_not @controller.instance_variable_defined?(:@ran_class_action) <ide> assert_not @controller.instance_variable_defined?(:@ran_proc_action1)
1
Text
Text
correct raw github urls
6f3fbc696955f249b6a46a50353ec10b242494fd
<ide><path>guides/source/performance_testing.md <ide> $ cd <ruby-version> <ide> ##### Apply the Patch <ide> <ide> ```bash <del>$ curl http://github.com/wayneeseguin/rvm/raw/master/patches/ruby/1.9.2/p180/gcdata.patch | patch -p0 # if you're on 1.9.2! <del>$ curl http://github.com/wayneeseguin/rvm/raw/master/patches/ruby/1.8.7/ruby187gc.patch | patch -p0 # if you're on 1.8.7! <add>$ curl https://raw.github.com/wayneeseguin/rvm/master/patches/ruby/1.9.2/p180/gcdata.patch | patch -p0 # if you're on 1.9.2! <add>$ curl https://raw.github.com/wayneeseguin/rvm/master/patches/ruby/1.8.7/ruby187gc.patch | patch -p0 # if you're on 1.8.7! <ide> ``` <ide> <ide> ##### Configure and Install
1
PHP
PHP
add missing assertion
5926ae57eb512fbe35de638debeeb570b12f31c0
<ide><path>tests/TestCase/View/Helper/PaginatorHelperTest.php <ide> public function testRoutePlaceholder() <ide> 'Title', <ide> '/a', <ide> ]; <add> $this->assertHtml($expected, $result); <ide> } <ide> <ide> /**
1
Text
Text
include test env in default env vars
56d62a52fd706613de4800eeb7f6d4fff1b3af94
<ide><path>docs/basic-features/environment-variables.md <ide> If you've configured [Development Environment Variables](https://vercel.com/docs <ide> ```bash <ide> vercel env pull .env.local <ide> ``` <add> <add>## Test Environment Variables <add> <add>Apart from `development` and `production` environments, there is a 3rd option available: `test`. In the same way you can set defaults for development or production environments, you can do the same with `.env.test` file for testing environment (though this one is not so common as the previous two). <add> <add>This one is useful when running tests with tools like `jest` or `cypress` where you need to set specific environment vars only for testing purposes. Test default values will be loaded if `NODE_ENV` is set to `test`, though you usually don't need to do this manually as testing tools will address it for you. <add> <add>There is a small difference between `test` environment, and both `development` and `production` that you need to bear in mind: `.env.local` won't be loaded, as you expect tests to produce the same results for everyone. This way every test execution will use same env defaults across different executions by ignoring your `.env.local` (which is intended to override the default set). <add> <add>> **Note**: similar to Default Environment Variables, `.env.test` file should be included in your repository, but `.env.test.local` shouldn't, as `.env*.local` are intended to be ignored through `.gitignore`.
1
Text
Text
fix markdown indentation in lists
931abc085e772d3ad35de2d45b22aa4e677b702d
<ide><path>doc/api/esm.md <ide> CommonJS modules loaded. <ide> * `defaultResolve` {Function} The Node.js default resolver. <ide> * Returns: {Object} <ide> * `format` {string|null|undefined} <del> `'builtin' | 'commonjs' | 'json' | 'module' | 'wasm'` <add> `'builtin' | 'commonjs' | 'json' | 'module' | 'wasm'` <ide> * `url` {string} The absolute url to the import target (such as `file://…`) <ide> <ide> The `resolve` hook returns the resolved file URL for a given module specifier <ide> export async function resolve(specifier, context, defaultResolve) { <ide> * `url` {string} <ide> * `context` {Object} <ide> * `format` {string|null|undefined} The format optionally supplied by the <del> `resolve` hook. <add> `resolve` hook. <ide> * `defaultLoad` {Function} <ide> * Returns: {Object} <ide> * `format` {string} <ide><path>doc/api/process.md <ide> tarball. <ide> that are no longer supported). <ide> * `'Dubnium'` for the 10.x LTS line beginning with 10.13.0. <ide> * `'Erbium'` for the 12.x LTS line beginning with 12.13.0. <del> For other LTS Release code names, see [Node.js Changelog Archive](https://github.com/nodejs/node/blob/HEAD/doc/changelogs/CHANGELOG_ARCHIVE.md) <add> For other LTS Release code names, see [Node.js Changelog Archive](https://github.com/nodejs/node/blob/HEAD/doc/changelogs/CHANGELOG_ARCHIVE.md) <ide> <ide> <!-- eslint-skip --> <ide> ```js <ide><path>doc/api/tls.md <ide> changes: <ide> or `null` to stop the negotiation process. `psk` must be <ide> compatible with the selected cipher's digest. <ide> `identity` must use UTF-8 encoding. <add> <ide> When negotiating TLS-PSK (pre-shared keys), this function is called <ide> with optional identity `hint` provided by the server or `null` <ide> in case of TLS 1.3 where `hint` was removed. <ide> changes: <ide> * Returns: {Buffer|TypedArray|DataView} pre-shared key that must either be <ide> a buffer or `null` to stop the negotiation process. Returned PSK must be <ide> compatible with the selected cipher's digest. <add> <ide> When negotiating TLS-PSK (pre-shared keys), this function is called <ide> with the identity provided by the client. <ide> If the return value is `null` the negotiation process will stop and an <ide><path>doc/api/tty.md <ide> Returns: <ide> * `1` for 2, <ide> * `4` for 16, <ide> * `8` for 256, <del>* `24` for 16,777,216 <del>colors supported. <add>* `24` for 16,777,216 colors supported. <ide> <ide> Use this to determine what colors the terminal supports. Due to the nature of <ide> colors in terminals it is possible to either have false positives or false <ide><path>doc/api/vm.md <ide> added: <ide> * `evaluateCallback` {Function} Called when the module is evaluated. <ide> * `options` <ide> * `identifier` {string} String used in stack traces. <del> **Default:** `'vm:module(i)'` where `i` is a context-specific ascending <add> **Default:** `'vm:module(i)'` where `i` is a context-specific ascending <ide> index. <ide> * `context` {Object} The [contextified][] object as returned by the <ide> `vm.createContext()` method, to compile and evaluate this `Module` in.
5
Javascript
Javascript
remove flowfixme in virtualizedsectionlist
224757e830f65cf8b00de461f390848bb25c1c71
<ide><path>Libraries/Lists/VirtualizedSectionList.js <ide> class ItemWithSeparator extends React.Component< <ide> section, <ide> separators: this._separators, <ide> }); <del> const leadingSeparator = LeadingSeparatorComponent && ( <add> const leadingSeparator = LeadingSeparatorComponent != null && ( <ide> <LeadingSeparatorComponent {...this.state.leadingSeparatorProps} /> <ide> ); <del> const separator = SeparatorComponent && ( <add> const separator = SeparatorComponent != null && ( <ide> <SeparatorComponent {...this.state.separatorProps} /> <ide> ); <ide> return leadingSeparator || separator ? ( <del> /* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an <del> * error found when Flow v0.89 was deployed. To see the error, delete <del> * this comment and run Flow. */ <ide> <View> <del> {!inverted ? leadingSeparator : separator} <add> {inverted === false ? leadingSeparator : separator} <ide> {element} <del> {!inverted ? separator : leadingSeparator} <add> {inverted === false ? separator : leadingSeparator} <ide> </View> <ide> ) : ( <ide> element
1
Text
Text
add release note for [ci skip]
1faf222b934d61844d8b8bd4f40e1ef1d2b49433
<ide><path>guides/source/4_2_release_notes.md <ide> Please refer to the [Changelog][action-pack] for detailed changes. <ide> <ide> ([Commit](https://github.com/rails/rails/commit/cc26b6b7bccf0eea2e2c1a9ebdcc9d30ca7390d9)) <ide> <add>* Deprecated support for String keys in URL helpers: <add> <add> ```ruby <add> # bad <add> Rails.application.routes.url_helpers.root_path('controller' => 'posts', 'action' => 'index') <add> # good <add> Rails.application.routes.url_helpers.root_path(:controller => 'posts', :action => 'index') <add> # better :trollface: <add> Rails.application.routes.url_helpers.root_path(controller: 'posts', action: 'index') <add> ``` <add> <add> ([Pull Request](https://github.com/rails/rails/pull/17743)) <add> <ide> ### Notable changes <ide> <ide> * Rails will now automatically include the template's digest in ETags.
1
Ruby
Ruby
adjust ast tests to respect bind values
034762a760eeb3c6fca4bdc31fb927d36b6cd6db
<ide><path>activerecord/test/cases/relation/where_chain_test.rb <ide> def setup <ide> end <ide> <ide> def test_not_eq <del> expected = Arel::Nodes::NotEqual.new(Post.arel_table[@name], 'hello') <ide> relation = Post.where.not(title: 'hello') <del> assert_equal([expected], relation.where_values) <add> <add> assert_equal 1, relation.where_values.length <add> <add> value = relation.where_values.first <add> bind = relation.bind_values.first <add> <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::NotEqual <add> assert_equal 'hello', bind.last <ide> end <ide> <ide> def test_not_null <ide> def test_association_not_eq <ide> def test_not_eq_with_preceding_where <ide> relation = Post.where(title: 'hello').where.not(title: 'world') <ide> <del> expected = Arel::Nodes::Equality.new(Post.arel_table[@name], 'hello') <del> assert_equal(expected, relation.where_values.first) <add> value = relation.where_values.first <add> bind = relation.bind_values.first <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::Equality <add> assert_equal 'hello', bind.last <ide> <del> expected = Arel::Nodes::NotEqual.new(Post.arel_table[@name], 'world') <del> assert_equal(expected, relation.where_values.last) <add> value = relation.where_values.last <add> bind = relation.bind_values.last <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::NotEqual <add> assert_equal 'world', bind.last <ide> end <ide> <ide> def test_not_eq_with_succeeding_where <ide> relation = Post.where.not(title: 'hello').where(title: 'world') <ide> <del> expected = Arel::Nodes::NotEqual.new(Post.arel_table[@name], 'hello') <del> assert_equal(expected, relation.where_values.first) <add> value = relation.where_values.first <add> bind = relation.bind_values.first <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::NotEqual <add> assert_equal 'hello', bind.last <ide> <del> expected = Arel::Nodes::Equality.new(Post.arel_table[@name], 'world') <del> assert_equal(expected, relation.where_values.last) <add> value = relation.where_values.last <add> bind = relation.bind_values.last <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::Equality <add> assert_equal 'world', bind.last <ide> end <ide> <ide> def test_not_eq_with_string_parameter <ide> def test_chaining_multiple <ide> expected = Arel::Nodes::NotIn.new(Post.arel_table['author_id'], [1, 2]) <ide> assert_equal(expected, relation.where_values[0]) <ide> <del> expected = Arel::Nodes::NotEqual.new(Post.arel_table[@name], 'ruby on rails') <del> assert_equal(expected, relation.where_values[1]) <add> value = relation.where_values[1] <add> bind = relation.bind_values.first <add> <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::NotEqual <add> assert_equal 'ruby on rails', bind.last <ide> end <ide> <ide> def test_rewhere_with_one_condition <ide> relation = Post.where(title: 'hello').where(title: 'world').rewhere(title: 'alone') <ide> <del> expected = Arel::Nodes::Equality.new(Post.arel_table[@name], 'alone') <ide> assert_equal 1, relation.where_values.size <del> assert_equal expected, relation.where_values.first <add> value = relation.where_values.first <add> bind = relation.bind_values.first <add> assert_bound_ast value, Post.arel_table[@name], Arel::Nodes::Equality <add> assert_equal 'alone', bind.last <ide> end <ide> <ide> def test_rewhere_with_multiple_overwriting_conditions <ide> def test_rewhere_with_multiple_overwriting_conditions <ide> body_expected = Arel::Nodes::Equality.new(Post.arel_table['body'], 'again') <ide> <ide> assert_equal 2, relation.where_values.size <del> assert_equal title_expected, relation.where_values.first <del> assert_equal body_expected, relation.where_values.second <add> <add> value = relation.where_values.first <add> bind = relation.bind_values.first <add> assert_bound_ast value, Post.arel_table['title'], Arel::Nodes::Equality <add> assert_equal 'alone', bind.last <add> <add> value = relation.where_values[1] <add> bind = relation.bind_values[1] <add> assert_bound_ast value, Post.arel_table['body'], Arel::Nodes::Equality <add> assert_equal 'again', bind.last <add> end <add> <add> def assert_bound_ast value, table, type <add> assert_equal table, value.left <add> assert_kind_of type, value <add> assert_kind_of Arel::Nodes::BindParam, value.right <ide> end <ide> <ide> def test_rewhere_with_one_overwriting_condition_and_one_unrelated <ide> relation = Post.where(title: 'hello').where(body: 'world').rewhere(title: 'alone') <ide> <del> title_expected = Arel::Nodes::Equality.new(Post.arel_table['title'], 'alone') <del> body_expected = Arel::Nodes::Equality.new(Post.arel_table['body'], 'world') <del> <ide> assert_equal 2, relation.where_values.size <del> assert_equal body_expected, relation.where_values.first <del> assert_equal title_expected, relation.where_values.second <add> <add> value = relation.where_values.first <add> bind = relation.bind_values.first <add> <add> assert_bound_ast value, Post.arel_table['body'], Arel::Nodes::Equality <add> assert_equal 'world', bind.last <add> <add> value = relation.where_values.second <add> bind = relation.bind_values.second <add> <add> assert_bound_ast value, Post.arel_table['title'], Arel::Nodes::Equality <add> assert_equal 'alone', bind.last <ide> end <ide> end <ide> end
1
Javascript
Javascript
fix typo in `test/parallel/test-fs-rm.js`
84044df70b247c8fa6a321ac62836160a77c3ef2
<ide><path>test/parallel/test-fs-rm.js <ide> if (isGitPresent) { <ide> }); <ide> } catch (err) { <ide> // Only fail the test if the folder was not deleted. <del> // as in some cases rmSync succesfully deletes read-only folders. <add> // as in some cases rmSync successfully deletes read-only folders. <ide> if (fs.existsSync(root)) { <ide> throw err; <ide> }
1
Ruby
Ruby
replace kwarg for displaying all configurations
9da8fef16211ff0b696068da146e9372d7d87c98
<ide><path>activerecord/lib/active_record/database_configurations.rb <ide> def initialize(configurations = {}) <ide> end <ide> <ide> # Collects the configs for the environment and optionally the specification <del> # name passed in. To include replica configurations pass <tt>include_replicas: true</tt>. <add> # name passed in. To include replica configurations pass <tt>include_hidden: true</tt>. <ide> # <ide> # If a name is provided a single DatabaseConfig object will be <ide> # returned, otherwise an array of DatabaseConfig objects will be <ide> def initialize(configurations = {}) <ide> # * <tt>name:</tt> The db config name (i.e. primary, animals, etc.). Defaults <ide> # to +nil+. If no +env_name+ is specified the config for the default env and the <ide> # passed +name+ will be returned. <del> # * <tt>include_replicas:</tt> Determines whether to include replicas in <add> # * <tt>include_replicas:</tt> Deprecated. Determines whether to include replicas in <ide> # the returned list. Most of the time we're only iterating over the write <ide> # connection (i.e. migrations don't need to run for the write and read connection). <ide> # Defaults to +false+. <del> def configs_for(env_name: nil, spec_name: nil, name: nil, include_replicas: false) <add> # * <tt>include_hidden:</tte Determines whether to include replicas and configurations <add> # hidden by +database_tasks: false+ in the returned list. Most of the time we're only <add> # iterating over the primary connections (i.e. migrations don't need to run for the <add> # write and read connection). Defaults to +false+. <add> def configs_for(env_name: nil, spec_name: nil, name: nil, include_replicas: false, include_hidden: false) <ide> if spec_name <ide> name = spec_name <ide> ActiveSupport::Deprecation.warn("The kwarg `spec_name` is deprecated in favor of `name`. `spec_name` will be removed in Rails 7.0") <ide> end <ide> <add> if include_replicas <add> include_hidden = include_replicas <add> ActiveSupport::Deprecation.warn("The kwarg `include_replicas` is deprecated in favor of `include_hidden`. When `include_hidden` is passed, configurations with `replica: true` or `database_tasks: false` will be returned. `include_replicas` will be removed in Rails 7.1.") <add> end <add> <ide> env_name ||= default_env if name <ide> configs = env_with_configs(env_name) <ide> <del> unless include_replicas <add> unless include_hidden <ide> configs = configs.select do |db_config| <ide> db_config.database_tasks? <ide> end <ide> def resolve_symbol_connection(name) <ide> end <ide> <ide> def build_configuration_sentence <del> configs = configs_for(include_replicas: true) <add> configs = configs_for(include_hidden: true) <ide> <ide> configs.group_by(&:env_name).map do |env, config| <ide> names = config.map(&:name) <ide><path>activerecord/test/cases/database_configurations_test.rb <ide> def test_spec_name_getter_is_deprecated <ide> assert_equal "primary", db_config.spec_name <ide> end <ide> end <add> <add> def test_hidden_returns_replicas <add> config = { <add> "default_env" => { <add> "readonly" => { "adapter" => "sqlite3", "database" => "test/db/readonly.sqlite3", "replica" => true }, <add> "hidden" => { "adapter" => "sqlite3", "database" => "test/db/hidden.sqlite3", "database_tasks" => false }, <add> "default" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" } <add> } <add> } <add> prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config <add> <add> assert_equal 1, ActiveRecord::Base.configurations.configs_for(env_name: "default_env").count <add> assert_equal 3, ActiveRecord::Base.configurations.configs_for(env_name: "default_env", include_hidden: true).count <add> ensure <add> ActiveRecord::Base.configurations = prev_configs <add> end <add> <add> def test_include_replicas_is_deprecated <add> assert_deprecated do <add> db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary", include_replicas: true) <add> <add> assert_equal "primary", db_config.name <add> end <add> end <ide> end <ide><path>railties/lib/rails/commands/dbconsole/dbconsole_command.rb <ide> def db_config <ide> # first time around to show a consistent error message to people <ide> # relying on 2-level database configuration. <ide> <del> @db_config = configurations.configs_for(env_name: environment, name: database, include_replicas: true) <add> @db_config = configurations.configs_for(env_name: environment, name: database, include_hidden: true) <ide> <ide> unless @db_config <ide> raise ActiveRecord::AdapterNotSpecified,
3
PHP
PHP
move http\client into http package
5d866f0dce93978748d2efeb76de9a34ab930c3b
<ide><path>config/bootstrap.php <ide> class_alias('Cake\Mailer\Email', 'Cake\Network\Email\Email'); <ide> class_alias('Cake\Mailer\Transport\MailTransport', 'Cake\Network\Email\MailTransport'); <ide> class_alias('Cake\Mailer\Transport\SmtpTransport', 'Cake\Network\Email\SmtpTransport'); <ide> <add>// @deprecated Backwards compatibility with earler 3.x versions. <add>class_alias('Cake\Http\Client', 'Cake\Network\Http\Client'); <add>class_alias('Cake\Http\Client\CookieCollection', 'Cake\Network\Http\CookieCollection'); <add>class_alias('Cake\Http\Client\FormData', 'Cake\Network\Http\FormData'); <add>class_alias('Cake\Http\Client\Message', 'Cake\Network\Http\Message'); <add>class_alias('Cake\Http\Client\Request', 'Cake\Network\Http\Request'); <add>class_alias('Cake\Http\Client\Response', 'Cake\Network\Http\Response'); <add>class_alias('Cake\Http\Client\Adapter\Stream', 'Cake\Network\Http\Adapter\Stream'); <add>class_alias('Cake\Http\Client\Auth\Basic', 'Cake\Network\Http\Auth\Basic'); <add>class_alias('Cake\Http\Client\Auth\Digest', 'Cake\Network\Http\Auth\Digest'); <add>class_alias('Cake\Http\Client\Auth\Oauth', 'Cake\Network\Http\Auth\Oauth'); <add>class_alias('Cake\Http\Client\FormDataPart', 'Cake\Network\Http\FormData\Part'); <add> <ide> require CAKE . 'basics.php'; <ide> <ide> // Sets the initial router state so future reloads work. <add><path>src/Http/Client.php <del><path>src/Network/Http/Client.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http; <add>namespace Cake\Http; <ide> <ide> use Cake\Core\App; <ide> use Cake\Core\Exception\Exception; <ide> use Cake\Core\InstanceConfigTrait; <add>use Cake\Http\Client\CookieCollection; <add>use Cake\Http\Client\Request; <ide> use Cake\Utility\Hash; <ide> <ide> /** <ide> class Client <ide> * @var array <ide> */ <ide> protected $_defaultConfig = [ <del> 'adapter' => 'Cake\Network\Http\Adapter\Stream', <add> 'adapter' => 'Cake\Http\Client\Adapter\Stream', <ide> 'host' => null, <ide> 'port' => null, <ide> 'scheme' => 'http', <ide> class Client <ide> * Cookies are indexed by the cookie's domain or <ide> * request host name. <ide> * <del> * @var \Cake\Network\Http\CookieCollection <add> * @var \Cake\Http\Client\CookieCollection <ide> */ <ide> protected $_cookies; <ide> <ide> /** <ide> * Adapter for sending requests. Defaults to <ide> * Cake\Network\Http\Adapter\Stream <ide> * <del> * @var \Cake\Network\Http\Adapter\Stream <add> * @var \Cake\Http\Client\Adapter\Stream <ide> */ <ide> protected $_adapter; <ide> <ide> public function __construct($config = []) <ide> * <ide> * Returns an array of cookie data arrays. <ide> * <del> * @return \Cake\Network\Http\CookieCollection <add> * @return \Cake\Http\Client\CookieCollection <ide> */ <ide> public function cookies() <ide> { <ide> public function cookies() <ide> * @param string $url The url or path you want to request. <ide> * @param array $data The query data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function get($url, $data = [], array $options = []) <ide> { <ide> public function get($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param mixed $data The post data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function post($url, $data = [], array $options = []) <ide> { <ide> public function post($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param mixed $data The request data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function put($url, $data = [], array $options = []) <ide> { <ide> public function put($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param mixed $data The request data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function patch($url, $data = [], array $options = []) <ide> { <ide> public function patch($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param mixed $data The request data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function options($url, $data = [], array $options = []) <ide> { <ide> public function options($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param mixed $data The request data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function trace($url, $data = [], array $options = []) <ide> { <ide> public function trace($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param mixed $data The request data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function delete($url, $data = [], array $options = []) <ide> { <ide> public function delete($url, $data = [], array $options = []) <ide> * @param string $url The url or path you want to request. <ide> * @param array $data The query string data you want to send. <ide> * @param array $options Additional options for the request. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function head($url, array $data = [], array $options = []) <ide> { <ide> public function head($url, array $data = [], array $options = []) <ide> * @param string $url URL to request. <ide> * @param mixed $data The request body. <ide> * @param array $options The options to use. Contains auth, proxy etc. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> protected function _doRequest($method, $url, $data, $options) <ide> { <ide> protected function _mergeOptions($options) <ide> * Used internally by other methods, but can also be used to send <ide> * handcrafted Request objects. <ide> * <del> * @param \Cake\Network\Http\Request $request The request to send. <add> * @param \Cake\Http\Client\Request $request The request to send. <ide> * @param array $options Additional options to use. <del> * @return \Cake\Network\Http\Response <add> * @return \Cake\Http\Client\Response <ide> */ <ide> public function send(Request $request, $options = []) <ide> { <ide> public function buildUrl($url, $query = [], $options = []) <ide> * @param string $url The url including query string. <ide> * @param mixed $data The request body. <ide> * @param array $options The options to use. Contains auth, proxy etc. <del> * @return \Cake\Network\Http\Request <add> * @return \Cake\Http\Client\Request <ide> */ <ide> protected function _createRequest($method, $url, $data, $options) <ide> { <ide> protected function _typeHeaders($type) <ide> * Uses the authentication type to choose the correct strategy <ide> * and use its methods to add headers. <ide> * <del> * @param \Cake\Network\Http\Request $request The request to modify. <add> * @param \Cake\Http\Client\Request $request The request to modify. <ide> * @param array $options Array of options containing the 'auth' key. <ide> * @return void <ide> */ <ide> protected function _addAuthentication(Request $request, $options) <ide> * Uses the authentication type to choose the correct strategy <ide> * and use its methods to add headers. <ide> * <del> * @param \Cake\Network\Http\Request $request The request to modify. <add> * @param \Cake\Http\Client\Request $request The request to modify. <ide> * @param array $options Array of options containing the 'proxy' key. <ide> * @return void <ide> */ <ide> protected function _createAuth($auth, $options) <ide> $auth['type'] = 'basic'; <ide> } <ide> $name = ucfirst($auth['type']); <del> $class = App::className($name, 'Network/Http/Auth'); <add> $class = App::className($name, 'Http/Client/Auth'); <ide> if (!$class) { <ide> throw new Exception( <ide> sprintf('Invalid authentication type %s', $name) <add><path>src/Http/Client/Adapter/Stream.php <del><path>src/Network/Http/Adapter/Stream.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http\Adapter; <add>namespace Cake\Http\Client\Adapter; <ide> <ide> use Cake\Core\Exception\Exception; <del>use Cake\Network\Http\FormData; <del>use Cake\Network\Http\Request; <del>use Cake\Network\Http\Response; <add>use Cake\Http\Client\FormData; <add>use Cake\Http\Client\Request; <add>use Cake\Http\Client\Response; <ide> <ide> /** <ide> * Implements sending Cake\Network\Http\Request <ide> class Stream <ide> /** <ide> * Send a request and get a response back. <ide> * <del> * @param \Cake\Network\Http\Request $request The request object to send. <add> * @param \Cake\Http\Client\Request $request The request object to send. <ide> * @param array $options Array of options for the stream. <ide> * @return array Array of populated Response objects <ide> */ <add><path>src/Http/Client/Auth/Basic.php <del><path>src/Network/Http/Auth/Basic.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http\Auth; <add>namespace Cake\Http\Client\Auth; <ide> <ide> use Cake\Network\Http\Request; <ide> <add><path>src/Http/Client/Auth/Digest.php <del><path>src/Network/Http/Auth/Digest.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http\Auth; <add>namespace Cake\Http\Client\Auth; <ide> <del>use Cake\Network\Http\Client; <del>use Cake\Network\Http\Request; <add>use Cake\Http\Client; <add>use Cake\Http\Client\Request; <ide> <ide> /** <ide> * Digest authentication adapter for Cake\Network\Http\Client <add><path>src/Http/Client/Auth/Oauth.php <del><path>src/Network/Http/Auth/Oauth.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http\Auth; <add>namespace Cake\Http\Client\Auth; <ide> <ide> use Cake\Core\Exception\Exception; <del>use Cake\Network\Http\Request; <add>use Cake\Http\Client\Request; <ide> <ide> /** <ide> * Oauth 1 authentication strategy for Cake\Network\Http\Client <add><path>src/Http/Client/CookieCollection.php <del><path>src/Network/Http/CookieCollection.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http; <add>namespace Cake\Http\Client; <add> <add>use Cake\Http\Client\Response; <ide> <ide> /** <ide> * Container class for cookies used in Http\Client. <add><path>src/Http/Client/FormData.php <del><path>src/Network/Http/FormData.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http; <add>namespace Cake\Http\Client; <ide> <del>use Cake\Network\Http\FormData\Part; <add>use Cake\Http\Client\FormDataPart; <ide> use Countable; <ide> use finfo; <ide> <ide> * <ide> * Used by Http\Client to upload POST/PUT data <ide> * and files. <del> * <ide> */ <ide> class FormData implements Countable <ide> { <ide> public function boundary() <ide> * <ide> * @param string $name The name of the part. <ide> * @param string $value The value to add. <del> * @return \Cake\Network\Http\FormData\Part <add> * @return \Cake\Network\Http\FormDataPart <ide> */ <ide> public function newPart($name, $value) <ide> { <del> return new Part($name, $value); <add> return new FormDataPart($name, $value); <ide> } <ide> <ide> /** <ide> public function add($name, $value = null) <ide> E_USER_DEPRECATED <ide> ); <ide> $this->_parts[] = $this->addFile($name, $value); <del> } elseif ($name instanceof Part && $value === null) { <add> } elseif ($name instanceof FormDataPart && $value === null) { <ide> $this->_hasComplexPart = true; <ide> $this->_parts[] = $name; <ide> } else { <ide> public function addMany(array $data) <ide> * <ide> * @param string $name The name to use. <ide> * @param mixed $value Either a string filename, or a filehandle. <del> * @return \Cake\Network\Http\FormData\Part <add> * @return \Cake\Network\Http\FormDataPart <ide> */ <ide> public function addFile($name, $value) <ide> { <add><path>src/Http/Client/FormDataPart.php <del><path>src/Network/Http/FormData/Part.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http\FormData; <add>namespace Cake\Http\Client; <ide> <ide> /** <ide> * Contains the data and behavior for a single <ide> * part in a Multipart FormData request body. <ide> * <ide> * Added to Cake\Network\Http\FormData when sending <ide> * data to a remote server. <add> * <add> * @internal <ide> */ <del>class Part <add>class FormDataPart <ide> { <ide> <ide> /** <add><path>src/Http/Client/Message.php <del><path>src/Network/Http/Message.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http; <add>namespace Cake\Http\Client; <ide> <ide> /** <ide> * Base class for other HTTP requests/responses <add><path>src/Http/Client/Request.php <del><path>src/Network/Http/Request.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http; <add>namespace Cake\Http\Client; <ide> <ide> use Cake\Core\Exception\Exception; <ide> <ide> * <ide> * Used by Cake\Network\Http\Client to contain request information <ide> * for making requests. <add> * <ide> */ <ide> class Request extends Message <ide> { <add><path>src/Http/Client/Response.php <del><path>src/Network/Http/Response.php <ide> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Network\Http; <add>namespace Cake\Http\Client; <ide> <ide> use RuntimeException; <ide>
12
Ruby
Ruby
use native ruby
82c57566904147393065d06ff30ecdb899470c6e
<ide><path>Library/Homebrew/dev-cmd/bottle.rb <ide> def bottle_formula(f, args:) <ide> # Set the times for reproducible bottles. <ide> if file.symlink? <ide> # Need to make symlink permissions consistent on macOS and Linux <del> system "chmod", "-h", "0777", file if OS.mac? <add> File.lchmod 0777, file if OS.mac? <ide> File.lutime(tab.source_modified_time, tab.source_modified_time, file) <ide> else <ide> file.utime(tab.source_modified_time, tab.source_modified_time)
1
Javascript
Javascript
add test for layout service weight ordering
b50eac366dbde8c376f9fddc104726936a720628
<ide><path>test/core.layoutService.tests.js <ide> describe('Test the layout service', function() { <ide> expect(chart.chartArea.top).toBeCloseToPixel(0); <ide> }); <ide> }); <add> <add> describe('ordering by weight', function() { <add> it('should keep higher weights outside', function() { <add> var chart = window.acquireChart({ <add> type: 'bar', <add> data: { <add> datasets: [ <add> { <add> data: [10, 5, 0, 25, 78, -10] <add> } <add> ], <add> labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5', 'tick6'] <add> }, <add> options: { <add> legend: { <add> display: true, <add> position: 'left', <add> }, <add> title: { <add> display: true, <add> position: 'bottom', <add> }, <add> }, <add> }, { <add> canvas: { <add> height: 150, <add> width: 250 <add> } <add> }); <add> <add> var xAxis = chart.scales['x-axis-0']; <add> var yAxis = chart.scales['y-axis-0']; <add> var legend = chart.legend; <add> var title = chart.titleBlock; <add> <add> expect(yAxis.left).toBe(legend.right); <add> expect(xAxis.bottom).toBe(title.top); <add> }); <add> }); <ide> });
1
Javascript
Javascript
remove bind helper
e34dd12f1921cba438c2f5d16cc249f1f832b612
<ide><path>packages/ember-htmlbars/lib/helpers/binding.js <del>/** <del>@module ember <del>@submodule ember-htmlbars <del>*/ <del> <del>import isNone from 'ember-metal/is_none'; <del>import run from "ember-metal/run_loop"; <del>import { get } from "ember-metal/property_get"; <del>import SimpleStream from "ember-metal/streams/simple"; <del>import BoundView from "ember-views/views/bound_view"; <del>import { isStream } from "ember-metal/streams/utils"; <del> <del>function exists(value) { <del> return !isNone(value); <del>} <del> <del>// Binds a property into the DOM. This will create a hook in DOM that the <del>// KVO system will look for and update if the property changes. <del>function bind(property, hash, options, env, preserveContext, shouldDisplay, valueNormalizer, childProperties, _viewClass) { <del> var valueStream = isStream(property) ? property : this.getStream(property); <del> var lazyValue; <del> <del> if (childProperties) { <del> lazyValue = new SimpleStream(valueStream); <del> <del> var subscriber = function(childStream) { <del> childStream.value(); <del> lazyValue.notify(); <del> }; <del> <del> for (var i = 0; i < childProperties.length; i++) { <del> var childStream = valueStream.get(childProperties[i]); <del> childStream.value(); <del> childStream.subscribe(subscriber); <del> } <del> } else { <del> lazyValue = valueStream; <del> } <del> <del> // Set up observers for observable objects <del> var viewClass = _viewClass || BoundView; <del> var viewOptions = { <del> _morph: options.morph, <del> preserveContext: preserveContext, <del> shouldDisplayFunc: shouldDisplay, <del> valueNormalizerFunc: valueNormalizer, <del> displayTemplate: options.template, <del> inverseTemplate: options.inverse, <del> lazyValue: lazyValue, <del> previousContext: get(this, 'context'), <del> templateHash: hash, <del> helperName: options.helperName <del> }; <del> <del> if (options.keywords) { <del> viewOptions._keywords = options.keywords; <del> } <del> <del> // Create the view that will wrap the output of this template/property <del> // and add it to the nearest view's childViews array. <del> // See the documentation of Ember._BoundView for more. <del> var bindView = this.createChildView(viewClass, viewOptions); <del> <del> this.appendChild(bindView); <del> <del> lazyValue.subscribe(this._wrapAsScheduled(function() { <del> run.scheduleOnce('render', bindView, 'rerenderIfNeeded'); <del> })); <del>} <del> <del>/** <del> `bind` can be used to display a value, then update that value if it <del> changes. For example, if you wanted to print the `title` property of <del> `content`: <del> <del> ```handlebars <del> {{bind "content.title"}} <del> ``` <del> <del> This will return the `title` property as a string, then create a new observer <del> at the specified path. If it changes, it will update the value in DOM. Note <del> that if you need to support IE7 and IE8 you must modify the model objects <del> properties using `Ember.get()` and `Ember.set()` for this to work as it <del> relies on Ember's KVO system. For all other browsers this will be handled for <del> you automatically. <del> <del> @private <del> @method bind <del> @for Ember.Handlebars.helpers <del> @param {String} property Property to bind <del> @param {Function} render Context to provide for rendering <del> @return {String} HTML string <del>*/ <del>function bindHelper(params, hash, options, env) { <del> Ember.assert("You must pass exactly one argument to the bind helper", params.length === 1); <del> <del> var property = params[0]; <del> <del> if (typeof property === 'string') { <del> property = this.getStream(property); <del> } <del> <del> if (options.template) { <del> options.helperName = 'bind'; <del> Ember.deprecate("The block form of bind, {{#bind foo}}{{/bind}}, has been deprecated and will be removed."); <del> bind.call(this, property, hash, options, env, false, exists); <del> } else { <del> return property; <del> } <del>} <del> <del>export { <del> bind, <del> bindHelper <del>}; <ide><path>packages/ember-htmlbars/lib/main.js <ide> import { <ide> helper, <ide> default as helpers <ide> } from "ember-htmlbars/helpers"; <del>import { bindHelper } from "ember-htmlbars/helpers/binding"; <ide> import { viewHelper } from "ember-htmlbars/helpers/view"; <ide> import { yieldHelper } from "ember-htmlbars/helpers/yield"; <ide> import { withHelper } from "ember-htmlbars/helpers/with"; <ide> import "ember-htmlbars/system/bootstrap"; <ide> // Ember.Handlebars global if htmlbars is enabled <ide> import "ember-htmlbars/compat"; <ide> <del>registerHelper('bindHelper', bindHelper); <del>registerHelper('bind', bindHelper); <ide> registerHelper('view', viewHelper); <ide> registerHelper('yield', yieldHelper); <ide> registerHelper('with', withHelper); <ide><path>packages/ember-htmlbars/tests/helpers/bind_test.js <del>import EmberView from "ember-views/views/view"; <del>import EmberObject from "ember-runtime/system/object"; <del>import run from "ember-metal/run_loop"; <del>import _MetamorphView from 'ember-views/views/metamorph_view'; <del>import compile from "ember-htmlbars/system/compile"; <del>import { Registry } from "ember-runtime/system/container"; <del>import ObjectController from "ember-runtime/controllers/object_controller"; <del> <del>import { get } from "ember-metal/property_get"; <del>import { set } from "ember-metal/property_set"; <del>import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <del> <del>var view, registry, container; <del> <del>QUnit.module("ember-htmlbars: {{bind}} helper", { <del> setup: function() { <del> registry = new Registry(); <del> container = registry.container(); <del> registry.optionsForType('template', { instantiate: false }); <del> registry.register('view:default', _MetamorphView); <del> registry.register('view:toplevel', EmberView.extend()); <del> }, <del> teardown: function() { <del> runDestroy(container); <del> runDestroy(view); <del> registry = container = view = null; <del> } <del>}); <del> <del>test("it should render the current value of a property on the context", function() { <del> view = EmberView.create({ <del> template: compile('{{bind foo}}'), <del> context: EmberObject.create({ <del> foo: "BORK" <del> }) <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$().text(), "BORK", "initial value is rendered"); <del> <del> run(view, view.set, 'context.foo', 'MWEEER'); <del> <del> equal(view.$().text(), "MWEEER", "value can be updated"); <del>}); <del> <del>test("it should render the current value of a path on the context", function() { <del> view = EmberView.create({ <del> template: compile('{{bind foo.bar}}'), <del> context: EmberObject.create({ <del> foo: { <del> bar: "BORK" <del> } <del> }) <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$().text(), "BORK", "initial value is rendered"); <del> <del> run(view, view.set, 'context.foo.bar', 'MWEEER'); <del> <del> equal(view.$().text(), "MWEEER", "value can be updated"); <del>}); <del> <del>test("it should render the current value of a string path on the context", function() { <del> view = EmberView.create({ <del> template: compile('{{bind "foo.bar"}}'), <del> context: EmberObject.create({ <del> foo: { <del> bar: "BORK" <del> } <del> }) <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$().text(), "BORK", "initial value is rendered"); <del> <del> run(view, view.set, 'context.foo.bar', 'MWEEER'); <del> <del> equal(view.$().text(), "MWEEER", "value can be updated"); <del>}); <del> <del>QUnit.module("ember-htmlbars: {{bind}} with a container, block forms", { <del> setup: function() { <del> registry = new Registry(); <del> container = registry.container(); <del> registry.optionsForType('template', { instantiate: false }); <del> }, <del> teardown: function() { <del> runDestroy(container); <del> runDestroy(view); <del> registry = container = view = null; <del> } <del>}); <del> <del>test("should not update when a property is removed from the view", function() { <del> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <del> expectDeprecation(/block form of bind.*has been deprecated/); <del> } <del> var template = compile( <del> '<h1 id="first">{{#bind view.content}}{{#bind foo}}{{bind baz}}{{/bind}}{{/bind}}</h1>' ); <del> registry.register('template:foo', template); <del> <del> view = EmberView.create({ <del> container: container, <del> templateName: 'foo', <del> <del> content: EmberObject.create({ <del> foo: EmberObject.create({ <del> baz: "unicorns" <del> }) <del> }) <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$('#first').text(), "unicorns", "precond - renders the bound value"); <del> <del> var oldContent = get(view, 'content'); <del> <del> run(function() { <del> set(view, 'content', EmberObject.create({ <del> foo: EmberObject.create({ <del> baz: "ninjas" <del> }) <del> })); <del> }); <del> <del> equal(view.$('#first').text(), 'ninjas', "updates to new content value"); <del> <del> run(function() { <del> set(oldContent, 'foo.baz', 'rockstars'); <del> }); <del> <del> run(function() { <del> set(oldContent, 'foo.baz', 'ewoks'); <del> }); <del> <del> equal(view.$('#first').text(), "ninjas", "does not update removed object"); <del>}); <del> <del>test("Handlebars templates update properties if a content object changes", function() { <del> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <del> expectDeprecation(/block form of bind.*has been deprecated/); <del> } <del> var template = compile( <del> '<h1>Today\'s Menu</h1>{{#bind view.coffee}}<h2>{{color}} coffee</h2><span id="price">{{bind price}}</span>{{/bind}}'); <del> registry.register('template:menu', template); <del> <del> run(function() { <del> view = EmberView.create({ <del> container: container, <del> templateName: 'menu', <del> <del> coffee: EmberObject.create({ <del> color: 'brown', <del> price: '$4' <del> }) <del> }); <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$('h2').text(), "brown coffee", "precond - renders color correctly"); <del> equal(view.$('#price').text(), '$4', "precond - renders price correctly"); <del> <del> run(function() { <del> set(view, 'coffee', EmberObject.create({ <del> color: "mauve", <del> price: "$4.50" <del> })); <del> }); <del> <del> equal(view.$('h2').text(), "mauve coffee", "should update name field when content changes"); <del> equal(view.$('#price').text(), "$4.50", "should update price field when content changes"); <del> <del> run(function() { <del> set(view, 'coffee', EmberObject.create({ <del> color: "mauve", <del> price: "$5.50" <del> })); <del> }); <del> <del> equal(view.$('h2').text(), "mauve coffee", "should update name field when content changes"); <del> equal(view.$('#price').text(), "$5.50", "should update price field when content changes"); <del> <del> run(function() { <del> set(view, 'coffee.price', "$5"); <del> }); <del> <del> equal(view.$('#price').text(), "$5", "should update price field when price property is changed"); <del> <del> runDestroy(view); <del>}); <del> <del>test("Template updates correctly if a path is passed to the bind helper", function() { <del> var template = compile('<h1>{{bind view.coffee.price}}</h1>'); <del> registry.register('template:menu', template); <del> <del> view = EmberView.create({ <del> container: container, <del> templateName: 'menu', <del> <del> coffee: EmberObject.create({ <del> price: '$4' <del> }) <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$('h1').text(), "$4", "precond - renders price"); <del> <del> run(function() { <del> set(view, 'coffee.price', "$5"); <del> }); <del> <del> equal(view.$('h1').text(), "$5", "updates when property changes"); <del> <del> run(function() { <del> set(view, 'coffee', { price: "$6" }); <del> }); <del> <del> equal(view.$('h1').text(), "$6", "updates when parent property changes"); <del>}); <del> <del>test("Template updates correctly if a path is passed to the bind helper and the context object is an ObjectController", function() { <del> var template = compile('<h1>{{bind view.coffee.price}}</h1>'); <del> registry.register('template:menu', template); <del> <del> var controller = ObjectController.create(); <del> <del> var realObject = EmberObject.create({ <del> price: "$4" <del> }); <del> <del> set(controller, 'model', realObject); <del> <del> view = EmberView.create({ <del> container: container, <del> templateName: 'menu', <del> <del> coffee: controller <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$('h1').text(), "$4", "precond - renders price"); <del> <del> run(function() { <del> set(realObject, 'price', "$5"); <del> }); <del> <del> equal(view.$('h1').text(), "$5", "updates when property is set on real object"); <del> <del> run(function() { <del> set(controller, 'price', "$6" ); <del> }); <del> <del> equal(view.$('h1').text(), "$6", "updates when property is set on object controller"); <del>}); <del> <del>test('View should update when a property changes and the bind helper is used', function() { <del> registry.register('template:foo', compile('<h1 id="first">{{#with view.content as thing}}{{bind "thing.wham"}}{{/with}}</h1>')); <del> <del> view = EmberView.create({ <del> container: container, <del> templateName: 'foo', <del> <del> content: EmberObject.create({ <del> wham: 'bam', <del> thankYou: "ma'am" <del> }) <del> }); <del> <del> runAppend(view); <del> <del> equal(view.$('#first').text(), 'bam', 'precond - view renders Handlebars template'); <del> <del> run(function() { <del> set(get(view, 'content'), 'wham', 'bazam'); <del> }); <del> <del> equal(view.$('#first').text(), 'bazam', 'view updates when a bound property changes'); <del>}); <ide><path>packages/ember-views/lib/main.js <ide> import TextSupport from "ember-views/mixins/text_support"; <ide> import TextField from "ember-views/views/text_field"; <ide> import TextArea from "ember-views/views/text_area"; <ide> <del>import BoundView from "ember-views/views/bound_view"; <ide> import SimpleBoundView from "ember-views/views/simple_bound_view"; <ide> import _MetamorphView from "ember-views/views/metamorph_view"; <ide> import { _Metamorph } from "ember-views/views/metamorph_view"; <ide> Ember.TextField = TextField; <ide> Ember.TextArea = TextArea; <ide> <ide> Ember._SimpleBoundView = SimpleBoundView; <del>Ember._BoundView = BoundView; <ide> Ember._MetamorphView = _MetamorphView; <ide> Ember._Metamorph = _Metamorph; <ide> Ember.Select = Select; <ide><path>packages/ember-views/lib/views/bound_view.js <del>/** <del>@module ember <del>@submodule ember-views <del>*/ <del> <del>import { get } from "ember-metal/property_get"; <del>import { set } from "ember-metal/property_set"; <del>import _MetamorphView from "ember-views/views/metamorph_view"; <del>import NormalizedRerenderIfNeededSupport from "ember-views/mixins/normalized_rerender_if_needed"; <del> <del>/** <del> `Ember._BoundView` is a private view created by the Handlebars <del> `{{bind}}` helpers that is used to keep track of bound properties. <del> <del> Every time a property is bound using a `{{mustache}}`, an anonymous subclass <del> of `Ember._BoundView` is created with the appropriate sub-template <del> and context set up. When the associated property changes, just the template <del> for this view will re-render. <del> <del> @class _BoundView <del> @namespace Ember <del> @extends Ember._MetamorphView <del> @private <del>*/ <del>export default _MetamorphView.extend(NormalizedRerenderIfNeededSupport, { <del> instrumentName: 'bound', <del> <del> /** <del> The function used to determine if the `displayTemplate` or <del> `inverseTemplate` should be rendered. This should be a function that takes <del> a value and returns a Boolean. <del> <del> @property shouldDisplayFunc <del> @type Function <del> @default null <del> */ <del> shouldDisplayFunc: null, <del> <del> /** <del> Whether the template rendered by this view gets passed the context object <del> of its parent template, or gets passed the value of retrieving `path` <del> from the `pathRoot`. <del> <del> For example, this is true when using the `{{#if}}` helper, because the <del> template inside the helper should look up properties relative to the same <del> object as outside the block. This would be `false` when used with `{{#with <del> foo}}` because the template should receive the object found by evaluating <del> `foo`. <del> <del> @property preserveContext <del> @type Boolean <del> @default false <del> */ <del> preserveContext: false, <del> <del> /** <del> If `preserveContext` is true, this is the object that will be used <del> to render the template. <del> <del> @property previousContext <del> @type Object <del> */ <del> previousContext: null, <del> <del> /** <del> The template to render when `shouldDisplayFunc` evaluates to `true`. <del> <del> @property displayTemplate <del> @type Function <del> @default null <del> */ <del> displayTemplate: null, <del> <del> /** <del> The template to render when `shouldDisplayFunc` evaluates to `false`. <del> <del> @property inverseTemplate <del> @type Function <del> @default null <del> */ <del> inverseTemplate: null, <del> <del> lazyValue: null, <del> <del> /** <del> Determines which template to invoke, sets up the correct state based on <del> that logic, then invokes the default `Ember.View` `render` implementation. <del> <del> This method will first look up the `path` key on `pathRoot`, <del> then pass that value to the `shouldDisplayFunc` function. If that returns <del> `true,` the `displayTemplate` function will be rendered to DOM. Otherwise, <del> `inverseTemplate`, if specified, will be rendered. <del> <del> For example, if this `Ember._BoundView` represented the `{{#with <del> foo}}` helper, it would look up the `foo` property of its context, and <del> `shouldDisplayFunc` would always return true. The object found by looking <del> up `foo` would be passed to `displayTemplate`. <del> <del> @method render <del> @param {Ember.RenderBuffer} buffer <del> */ <del> render: function(buffer) { <del> var shouldDisplay = get(this, 'shouldDisplayFunc'); <del> var preserveContext = get(this, 'preserveContext'); <del> var context = get(this, 'previousContext'); <del> <del> var inverseTemplate = get(this, 'inverseTemplate'); <del> var displayTemplate = get(this, 'displayTemplate'); <del> <del> var result = this.normalizedValue(); <del> <del> this._lastNormalizedValue = result; <del> <del> // First, test the conditional to see if we should <del> // render the template or not. <del> if (shouldDisplay(result)) { <del> set(this, 'template', displayTemplate); <del> <del> // If we are preserving the context (for example, if this <del> // is an #if block, call the template with the same object. <del> if (preserveContext) { <del> set(this, '_context', context); <del> } else { <del> // Otherwise, determine if this is a block bind or not. <del> // If so, pass the specified object to the template <del> if (displayTemplate) { <del> set(this, '_context', result); <del> } else { <del> // This is not a bind block, just push the result of the <del> // expression to the render context and return. <del> if (result === null || result === undefined) { <del> result = ""; <del> } <del> <del> buffer.push(result); <del> return; <del> } <del> } <del> } else if (inverseTemplate) { <del> set(this, 'template', inverseTemplate); <del> <del> if (preserveContext) { <del> set(this, '_context', context); <del> } else { <del> set(this, '_context', result); <del> } <del> } else { <del> set(this, 'template', function() { return ''; }); <del> } <del> <del> return this._super(buffer); <del> } <del>});
5
Javascript
Javascript
remove a typo
7b63b225a50f7e38300b898ec63ac8af434c009b
<ide><path>Libraries/Animated/src/AnimatedImplementation.js <ide> class AnimatedValue extends AnimatedWithChildren { <ide> <ide> /** <ide> * Adds an asynchronous listener to the value so you can observe updates from <del> * animations or whathaveyou. This is useful because there is no way to <add> * animations. This is useful because there is no way to <ide> * synchronously read the value because it might be driven natively. <ide> */ <ide> addListener(callback: ValueListenerCallback): string {
1
Javascript
Javascript
update dat.gui
272607c803e635558fc02e42ca298473a415540f
<ide><path>examples/js/libs/dat.gui.min.js <ide> * <ide> * http://www.apache.org/licenses/LICENSE-2.0 <ide> */ <del>var dat=dat||{};dat.gui=dat.gui||{};dat.utils=dat.utils||{};dat.controllers=dat.controllers||{};dat.dom=dat.dom||{};dat.color=dat.color||{};dat.utils.css=function(){return{load:function(e,a){var a=a||document,c=a.createElement("link");c.type="text/css";c.rel="stylesheet";c.href=e;a.getElementsByTagName("head")[0].appendChild(c)},inject:function(e,a){var a=a||document,c=document.createElement("style");c.type="text/css";c.innerHTML=e;a.getElementsByTagName("head")[0].appendChild(c)}}}(); <del>dat.utils.common=function(){var e=Array.prototype.forEach,a=Array.prototype.slice;return{BREAK:{},extend:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(a[f])||(c[f]=a[f])},this);return c},defaults:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(c[f])&&(c[f]=a[f])},this);return c},compose:function(){var c=a.call(arguments);return function(){for(var d=a.call(arguments),f=c.length-1;f>=0;f--)d=[c[f].apply(this,d)];return d[0]}}, <del>each:function(a,d,f){if(e&&a.forEach===e)a.forEach(d,f);else if(a.length===a.length+0)for(var b=0,n=a.length;b<n;b++){if(b in a&&d.call(f,a[b],b)===this.BREAK)break}else for(b in a)if(d.call(f,a[b],b)===this.BREAK)break},defer:function(a){setTimeout(a,0)},toArray:function(c){return c.toArray?c.toArray():a.call(c)},isUndefined:function(a){return a===void 0},isNull:function(a){return a===null},isNaN:function(a){return a!==a},isArray:Array.isArray||function(a){return a.constructor===Array},isObject:function(a){return a=== <del>Object(a)},isNumber:function(a){return a===a+0},isString:function(a){return a===a+""},isBoolean:function(a){return a===false||a===true},isFunction:function(a){return Object.prototype.toString.call(a)==="[object Function]"}}}(); <del>dat.controllers.Controller=function(e){var a=function(a,d){this.initialValue=a[d];this.domElement=document.createElement("div");this.object=a;this.property=d;this.__onFinishChange=this.__onChange=void 0};e.extend(a.prototype,{onChange:function(a){this.__onChange=a;return this},onFinishChange:function(a){this.__onFinishChange=a;return this},setValue:function(a){this.object[this.property]=a;this.__onChange&&this.__onChange.call(this,a);this.updateDisplay();return this},getValue:function(){return this.object[this.property]}, <del>updateDisplay:function(){return this},isModified:function(){return this.initialValue!==this.getValue()}});return a}(dat.utils.common); <del>dat.dom.dom=function(e){function a(b){if(b==="0"||e.isUndefined(b))return 0;b=b.match(d);return!e.isNull(b)?parseFloat(b[1]):0}var c={};e.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(b,a){e.each(b,function(b){c[b]=a})});var d=/(\d+(\.\d+)?)px/,f={makeSelectable:function(b,a){if(!(b===void 0||b.style===void 0))b.onselectstart=a?function(){return false}:function(){},b.style.MozUserSelect=a?"auto":"none",b.style.KhtmlUserSelect= <del>a?"auto":"none",b.unselectable=a?"on":"off"},makeFullscreen:function(b,a,d){e.isUndefined(a)&&(a=true);e.isUndefined(d)&&(d=true);b.style.position="absolute";if(a)b.style.left=0,b.style.right=0;if(d)b.style.top=0,b.style.bottom=0},fakeEvent:function(b,a,d,f){var d=d||{},m=c[a];if(!m)throw Error("Event type "+a+" not supported.");var l=document.createEvent(m);switch(m){case "MouseEvents":l.initMouseEvent(a,d.bubbles||false,d.cancelable||true,window,d.clickCount||1,0,0,d.x||d.clientX||0,d.y||d.clientY|| <del>0,false,false,false,false,0,null);break;case "KeyboardEvents":m=l.initKeyboardEvent||l.initKeyEvent;e.defaults(d,{cancelable:true,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,keyCode:void 0,charCode:void 0});m(a,d.bubbles||false,d.cancelable,window,d.ctrlKey,d.altKey,d.shiftKey,d.metaKey,d.keyCode,d.charCode);break;default:l.initEvent(a,d.bubbles||false,d.cancelable||true)}e.defaults(l,f);b.dispatchEvent(l)},bind:function(b,a,d,c){b.addEventListener?b.addEventListener(a,d,c||false):b.attachEvent&& <del>b.attachEvent("on"+a,d);return f},unbind:function(b,a,d,c){b.removeEventListener?b.removeEventListener(a,d,c||false):b.detachEvent&&b.detachEvent("on"+a,d);return f},addClass:function(b,a){if(b.className===void 0)b.className=a;else if(b.className!==a){var d=b.className.split(/ +/);if(d.indexOf(a)==-1)d.push(a),b.className=d.join(" ").replace(/^\s+/,"").replace(/\s+$/,"")}return f},removeClass:function(b,a){if(a){if(b.className!==void 0)if(b.className===a)b.removeAttribute("class");else{var d=b.className.split(/ +/), <del>c=d.indexOf(a);if(c!=-1)d.splice(c,1),b.className=d.join(" ")}}else b.className=void 0;return f},hasClass:function(a,d){return RegExp("(?:^|\\s+)"+d+"(?:\\s+|$)").test(a.className)||false},getWidth:function(b){b=getComputedStyle(b);return a(b["border-left-width"])+a(b["border-right-width"])+a(b["padding-left"])+a(b["padding-right"])+a(b.width)},getHeight:function(b){b=getComputedStyle(b);return a(b["border-top-width"])+a(b["border-bottom-width"])+a(b["padding-top"])+a(b["padding-bottom"])+a(b.height)}, <del>getOffset:function(a){var d={left:0,top:0};if(a.offsetParent){do d.left+=a.offsetLeft,d.top+=a.offsetTop;while(a=a.offsetParent)}return d},isActive:function(a){return a===document.activeElement&&(a.type||a.href)}};return f}(dat.utils.common); <del>dat.controllers.OptionController=function(e,a,c){var d=function(f,b,e){d.superclass.call(this,f,b);var h=this;this.__select=document.createElement("select");if(c.isArray(e)){var j={};c.each(e,function(a){j[a]=a});e=j}c.each(e,function(a,b){var d=document.createElement("option");d.innerHTML=b;d.setAttribute("value",a);h.__select.appendChild(d)});this.updateDisplay();a.bind(this.__select,"change",function(){h.setValue(this.options[this.selectedIndex].value)});this.domElement.appendChild(this.__select)}; <del>d.superclass=e;c.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue());return a},updateDisplay:function(){this.__select.value=this.getValue();return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); <del>dat.controllers.NumberController=function(e,a){var c=function(d,f,b){c.superclass.call(this,d,f);b=b||{};this.__min=b.min;this.__max=b.max;this.__step=b.step;d=this.__impliedStep=a.isUndefined(this.__step)?this.initialValue==0?1:Math.pow(10,Math.floor(Math.log(this.initialValue)/Math.LN10))/10:this.__step;d=d.toString();this.__precision=d.indexOf(".")>-1?d.length-d.indexOf(".")-1:0};c.superclass=e;a.extend(c.prototype,e.prototype,{setValue:function(a){if(this.__min!==void 0&&a<this.__min)a=this.__min; <del>else if(this.__max!==void 0&&a>this.__max)a=this.__max;this.__step!==void 0&&a%this.__step!=0&&(a=Math.round(a/this.__step)*this.__step);return c.superclass.prototype.setValue.call(this,a)},min:function(a){this.__min=a;return this},max:function(a){this.__max=a;return this},step:function(a){this.__step=a;return this}});return c}(dat.controllers.Controller,dat.utils.common); <del>dat.controllers.NumberControllerBox=function(e,a,c){var d=function(f,b,e){function h(){var a=parseFloat(l.__input.value);c.isNaN(a)||l.setValue(a)}function j(a){var b=o-a.clientY;l.setValue(l.getValue()+b*l.__impliedStep);o=a.clientY}function m(){a.unbind(window,"mousemove",j);a.unbind(window,"mouseup",m)}this.__truncationSuspended=false;d.superclass.call(this,f,b,e);var l=this,o;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"change",h); <del>a.bind(this.__input,"blur",function(){h();l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())});a.bind(this.__input,"mousedown",function(b){a.bind(window,"mousemove",j);a.bind(window,"mouseup",m);o=b.clientY});a.bind(this.__input,"keydown",function(a){if(a.keyCode===13)l.__truncationSuspended=true,this.blur(),l.__truncationSuspended=false});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;c.extend(d.prototype,e.prototype,{updateDisplay:function(){var a=this.__input, <del>b;if(this.__truncationSuspended)b=this.getValue();else{b=this.getValue();var c=Math.pow(10,this.__precision);b=Math.round(b*c)/c}a.value=b;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common); <del>dat.controllers.NumberControllerSlider=function(e,a,c,d,f){var b=function(d,c,f,e,l){function o(b){b.preventDefault();var d=a.getOffset(g.__background),c=a.getWidth(g.__background);g.setValue(g.__min+(g.__max-g.__min)*((b.clientX-d.left)/(d.left+c-d.left)));return false}function y(){a.unbind(window,"mousemove",o);a.unbind(window,"mouseup",y);g.__onFinishChange&&g.__onFinishChange.call(g,g.getValue())}b.superclass.call(this,d,c,{min:f,max:e,step:l});var g=this;this.__background=document.createElement("div"); <del>this.__foreground=document.createElement("div");a.bind(this.__background,"mousedown",function(b){a.bind(window,"mousemove",o);a.bind(window,"mouseup",y);o(b)});a.addClass(this.__background,"slider");a.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background)};b.superclass=e;b.useDefaultStyles=function(){c.inject(f)};d.extend(b.prototype,e.prototype,{updateDisplay:function(){this.__foreground.style.width= <del>(this.getValue()-this.__min)/(this.__max-this.__min)*100+"%";return b.superclass.prototype.updateDisplay.call(this)}});return b}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,".slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}"); <del>dat.controllers.FunctionController=function(e,a,c){var d=function(c,b,e){d.superclass.call(this,c,b);var h=this;this.__button=document.createElement("div");this.__button.innerHTML=e===void 0?"Fire":e;a.bind(this.__button,"click",function(a){a.preventDefault();h.fire();return false});a.addClass(this.__button,"button");this.domElement.appendChild(this.__button)};d.superclass=e;c.extend(d.prototype,e.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.__onFinishChange&&this.__onFinishChange.call(this, <del>this.getValue());this.getValue().call(this.object)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); <del>dat.controllers.BooleanController=function(e,a,c){var d=function(c,b){d.superclass.call(this,c,b);var e=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");a.bind(this.__checkbox,"change",function(){e.setValue(!e.__prev)},false);this.domElement.appendChild(this.__checkbox);this.updateDisplay()};d.superclass=e;c.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&& <del>this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a},updateDisplay:function(){this.getValue()===true?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=true):this.__checkbox.checked=false;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common); <del>dat.color.toString=function(e){return function(a){if(a.a==1||e.isUndefined(a.a)){for(a=a.hex.toString(16);a.length<6;)a="0"+a;return"#"+a}else return"rgba("+Math.round(a.r)+","+Math.round(a.g)+","+Math.round(a.b)+","+a.a+")"}}(dat.utils.common); <del>dat.color.interpret=function(e,a){var c,d,f=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return a===null?false:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return a===null?false:{space:"HEX",hex:parseInt("0x"+a[1].toString())}},write:e},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/); <del>return a===null?false:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])}},write:e},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return a===null?false:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])}},write:e}}},{litmus:a.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"}},write:function(a){return a.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(a){return a.length!= <del>3?false:{space:"RGB",r:a[0],g:a[1],b:a[2]}},write:function(a){return[a.r,a.g,a.b]}},RGBA_ARRAY:{read:function(a){return a.length!=4?false:{space:"RGB",r:a[0],g:a[1],b:a[2],a:a[3]}},write:function(a){return[a.r,a.g,a.b,a.a]}}}},{litmus:a.isObject,conversions:{RGBA_OBJ:{read:function(b){return a.isNumber(b.r)&&a.isNumber(b.g)&&a.isNumber(b.b)&&a.isNumber(b.a)?{space:"RGB",r:b.r,g:b.g,b:b.b,a:b.a}:false},write:function(a){return{r:a.r,g:a.g,b:a.b,a:a.a}}},RGB_OBJ:{read:function(b){return a.isNumber(b.r)&& <del>a.isNumber(b.g)&&a.isNumber(b.b)?{space:"RGB",r:b.r,g:b.g,b:b.b}:false},write:function(a){return{r:a.r,g:a.g,b:a.b}}},HSVA_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)&&a.isNumber(b.a)?{space:"HSV",h:b.h,s:b.s,v:b.v,a:b.a}:false},write:function(a){return{h:a.h,s:a.s,v:a.v,a:a.a}}},HSV_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)?{space:"HSV",h:b.h,s:b.s,v:b.v}:false},write:function(a){return{h:a.h,s:a.s,v:a.v}}}}}];return function(){d= <del>false;var b=arguments.length>1?a.toArray(arguments):arguments[0];a.each(f,function(e){if(e.litmus(b))return a.each(e.conversions,function(e,f){c=e.read(b);if(d===false&&c!==false)return d=c,c.conversionName=f,c.conversion=e,a.BREAK}),a.BREAK});return d}}(dat.color.toString,dat.utils.common); <del>dat.GUI=dat.gui.GUI=function(e,a,c,d,f,b,n,h,j,m,l,o,y,g,i){function q(a,b,r,c){if(b[r]===void 0)throw Error("Object "+b+' has no property "'+r+'"');c.color?b=new l(b,r):(b=[b,r].concat(c.factoryArgs),b=d.apply(a,b));if(c.before instanceof f)c.before=c.before.__li;t(a,b);g.addClass(b.domElement,"c");r=document.createElement("span");g.addClass(r,"property-name");r.innerHTML=b.property;var e=document.createElement("div");e.appendChild(r);e.appendChild(b.domElement);c=s(a,e,c.before);g.addClass(c,k.CLASS_CONTROLLER_ROW); <del>g.addClass(c,typeof b.getValue());p(a,c,b);a.__controllers.push(b);return b}function s(a,b,d){var c=document.createElement("li");b&&c.appendChild(b);d?a.__ul.insertBefore(c,params.before):a.__ul.appendChild(c);a.onResize();return c}function p(a,d,c){c.__li=d;c.__gui=a;i.extend(c,{options:function(b){if(arguments.length>1)return c.remove(),q(a,c.object,c.property,{before:c.__li.nextElementSibling,factoryArgs:[i.toArray(arguments)]});if(i.isArray(b)||i.isObject(b))return c.remove(),q(a,c.object,c.property, <del>{before:c.__li.nextElementSibling,factoryArgs:[b]})},name:function(a){c.__li.firstElementChild.firstElementChild.innerHTML=a;return c},listen:function(){c.__gui.listen(c);return c},remove:function(){c.__gui.remove(c);return c}});if(c instanceof j){var e=new h(c.object,c.property,{min:c.__min,max:c.__max,step:c.__step});i.each(["updateDisplay","onChange","onFinishChange"],function(a){var b=c[a],H=e[a];c[a]=e[a]=function(){var a=Array.prototype.slice.call(arguments);b.apply(c,a);return H.apply(e,a)}}); <del>g.addClass(d,"has-slider");c.domElement.insertBefore(e.domElement,c.domElement.firstElementChild)}else if(c instanceof h){var f=function(b){return i.isNumber(c.__min)&&i.isNumber(c.__max)?(c.remove(),q(a,c.object,c.property,{before:c.__li.nextElementSibling,factoryArgs:[c.__min,c.__max,c.__step]})):b};c.min=i.compose(f,c.min);c.max=i.compose(f,c.max)}else if(c instanceof b)g.bind(d,"click",function(){g.fakeEvent(c.__checkbox,"click")}),g.bind(c.__checkbox,"click",function(a){a.stopPropagation()}); <del>else if(c instanceof n)g.bind(d,"click",function(){g.fakeEvent(c.__button,"click")}),g.bind(d,"mouseover",function(){g.addClass(c.__button,"hover")}),g.bind(d,"mouseout",function(){g.removeClass(c.__button,"hover")});else if(c instanceof l)g.addClass(d,"color"),c.updateDisplay=i.compose(function(a){d.style.borderLeftColor=c.__color.toString();return a},c.updateDisplay),c.updateDisplay();c.setValue=i.compose(function(b){a.getRoot().__preset_select&&c.isModified()&&B(a.getRoot(),true);return b},c.setValue)} <del>function t(a,b){var c=a.getRoot(),d=c.__rememberedObjects.indexOf(b.object);if(d!=-1){var e=c.__rememberedObjectIndecesToControllers[d];e===void 0&&(e={},c.__rememberedObjectIndecesToControllers[d]=e);e[b.property]=b;if(c.load&&c.load.remembered){c=c.load.remembered;if(c[a.preset])c=c[a.preset];else if(c[w])c=c[w];else return;if(c[d]&&c[d][b.property]!==void 0)d=c[d][b.property],b.initialValue=d,b.setValue(d)}}}function I(a){var b=a.__save_row=document.createElement("li");g.addClass(a.domElement, <del>"has-save");a.__ul.insertBefore(b,a.__ul.firstChild);g.addClass(b,"save-row");var c=document.createElement("span");c.innerHTML="&nbsp;";g.addClass(c,"button gears");var d=document.createElement("span");d.innerHTML="Save";g.addClass(d,"button");g.addClass(d,"save");var e=document.createElement("span");e.innerHTML="New";g.addClass(e,"button");g.addClass(e,"save-as");var f=document.createElement("span");f.innerHTML="Revert";g.addClass(f,"button");g.addClass(f,"revert");var m=a.__preset_select=document.createElement("select"); <del>a.load&&a.load.remembered?i.each(a.load.remembered,function(b,c){C(a,c,c==a.preset)}):C(a,w,false);g.bind(m,"change",function(){for(var b=0;b<a.__preset_select.length;b++)a.__preset_select[b].innerHTML=a.__preset_select[b].value;a.preset=this.value});b.appendChild(m);b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);if(u){var b=document.getElementById("dg-save-locally"),l=document.getElementById("dg-local-explain");b.style.display="block";b=document.getElementById("dg-local-storage"); <del>localStorage.getItem(document.location.href+".isLocal")==="true"&&b.setAttribute("checked","checked");var o=function(){l.style.display=a.useLocalStorage?"block":"none"};o();g.bind(b,"change",function(){a.useLocalStorage=!a.useLocalStorage;o()})}var h=document.getElementById("dg-new-constructor");g.bind(h,"keydown",function(a){a.metaKey&&(a.which===67||a.keyCode==67)&&x.hide()});g.bind(c,"click",function(){h.innerHTML=JSON.stringify(a.getSaveObject(),void 0,2);x.show();h.focus();h.select()});g.bind(d, <del>"click",function(){a.save()});g.bind(e,"click",function(){var b=prompt("Enter a new preset name.");b&&a.saveAs(b)});g.bind(f,"click",function(){a.revert()})}function J(a){function b(f){f.preventDefault();e=f.clientX;g.addClass(a.__closeButton,k.CLASS_DRAG);g.bind(window,"mousemove",c);g.bind(window,"mouseup",d);return false}function c(b){b.preventDefault();a.width+=e-b.clientX;a.onResize();e=b.clientX;return false}function d(){g.removeClass(a.__closeButton,k.CLASS_DRAG);g.unbind(window,"mousemove", <del>c);g.unbind(window,"mouseup",d)}a.__resize_handle=document.createElement("div");i.extend(a.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});var e;g.bind(a.__resize_handle,"mousedown",b);g.bind(a.__closeButton,"mousedown",b);a.domElement.insertBefore(a.__resize_handle,a.domElement.firstElementChild)}function D(a,b){a.domElement.style.width=b+"px";if(a.__save_row&&a.autoPlace)a.__save_row.style.width=b+"px";if(a.__closeButton)a.__closeButton.style.width= <del>b+"px"}function z(a,b){var c={};i.each(a.__rememberedObjects,function(d,e){var f={};i.each(a.__rememberedObjectIndecesToControllers[e],function(a,c){f[c]=b?a.initialValue:a.getValue()});c[e]=f});return c}function C(a,b,c){var d=document.createElement("option");d.innerHTML=b;d.value=b;a.__preset_select.appendChild(d);if(c)a.__preset_select.selectedIndex=a.__preset_select.length-1}function B(a,b){var c=a.__preset_select[a.__preset_select.selectedIndex];c.innerHTML=b?c.value+"*":c.value}function E(a){a.length!= <del>0&&o(function(){E(a)});i.each(a,function(a){a.updateDisplay()})}e.inject(c);var w="Default",u;try{u="localStorage"in window&&window.localStorage!==null}catch(K){u=false}var x,F=true,v,A=false,G=[],k=function(a){function b(){localStorage.setItem(document.location.href+".gui",JSON.stringify(d.getSaveObject()))}function c(){var a=d.getRoot();a.width+=1;i.defer(function(){a.width-=1})}var d=this;this.domElement=document.createElement("div");this.__ul=document.createElement("ul");this.domElement.appendChild(this.__ul); <del>g.addClass(this.domElement,"dg");this.__folders={};this.__controllers=[];this.__rememberedObjects=[];this.__rememberedObjectIndecesToControllers=[];this.__listening=[];a=a||{};a=i.defaults(a,{autoPlace:true,width:k.DEFAULT_WIDTH});a=i.defaults(a,{resizable:a.autoPlace,hideable:a.autoPlace});if(i.isUndefined(a.load))a.load={preset:w};else if(a.preset)a.load.preset=a.preset;i.isUndefined(a.parent)&&a.hideable&&G.push(this);a.resizable=i.isUndefined(a.parent)&&a.resizable;if(a.autoPlace&&i.isUndefined(a.scrollable))a.scrollable= <del>true;var e=u&&localStorage.getItem(document.location.href+".isLocal")==="true";Object.defineProperties(this,{parent:{get:function(){return a.parent}},scrollable:{get:function(){return a.scrollable}},autoPlace:{get:function(){return a.autoPlace}},preset:{get:function(){return d.parent?d.getRoot().preset:a.load.preset},set:function(b){d.parent?d.getRoot().preset=b:a.load.preset=b;for(b=0;b<this.__preset_select.length;b++)if(this.__preset_select[b].value==this.preset)this.__preset_select.selectedIndex= <del>b;d.revert()}},width:{get:function(){return a.width},set:function(b){a.width=b;D(d,b)}},name:{get:function(){return a.name},set:function(b){a.name=b;if(m)m.innerHTML=a.name}},closed:{get:function(){return a.closed},set:function(b){a.closed=b;a.closed?g.addClass(d.__ul,k.CLASS_CLOSED):g.removeClass(d.__ul,k.CLASS_CLOSED);this.onResize();if(d.__closeButton)d.__closeButton.innerHTML=b?k.TEXT_OPEN:k.TEXT_CLOSED}},load:{get:function(){return a.load}},useLocalStorage:{get:function(){return e},set:function(a){u&& <del>((e=a)?g.bind(window,"unload",b):g.unbind(window,"unload",b),localStorage.setItem(document.location.href+".isLocal",a))}}});if(i.isUndefined(a.parent)){a.closed=false;g.addClass(this.domElement,k.CLASS_MAIN);g.makeSelectable(this.domElement,false);if(u&&e){d.useLocalStorage=true;var f=localStorage.getItem(document.location.href+".gui");if(f)a.load=JSON.parse(f)}this.__closeButton=document.createElement("div");this.__closeButton.innerHTML=k.TEXT_CLOSED;g.addClass(this.__closeButton,k.CLASS_CLOSE_BUTTON); <del>this.domElement.appendChild(this.__closeButton);g.bind(this.__closeButton,"click",function(){d.closed=!d.closed})}else{if(a.closed===void 0)a.closed=true;var m=document.createTextNode(a.name);g.addClass(m,"controller-name");f=s(d,m);g.addClass(this.__ul,k.CLASS_CLOSED);g.addClass(f,"title");g.bind(f,"click",function(a){a.preventDefault();d.closed=!d.closed;return false});if(!a.closed)this.closed=false}a.autoPlace&&(i.isUndefined(a.parent)&&(F&&(v=document.createElement("div"),g.addClass(v,"dg"),g.addClass(v, <del>k.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(v),F=false),v.appendChild(this.domElement),g.addClass(this.domElement,k.CLASS_AUTO_PLACE)),this.parent||D(d,a.width));g.bind(window,"resize",function(){d.onResize()});g.bind(this.__ul,"webkitTransitionEnd",function(){d.onResize()});g.bind(this.__ul,"transitionend",function(){d.onResize()});g.bind(this.__ul,"oTransitionEnd",function(){d.onResize()});this.onResize();a.resizable&&J(this);d.getRoot();a.parent||c()};k.toggleHide=function(){A=!A;i.each(G, <del>function(a){a.domElement.style.zIndex=A?-999:999;a.domElement.style.opacity=A?0:1})};k.CLASS_AUTO_PLACE="a";k.CLASS_AUTO_PLACE_CONTAINER="ac";k.CLASS_MAIN="main";k.CLASS_CONTROLLER_ROW="cr";k.CLASS_TOO_TALL="taller-than-window";k.CLASS_CLOSED="closed";k.CLASS_CLOSE_BUTTON="close-button";k.CLASS_DRAG="drag";k.DEFAULT_WIDTH=245;k.TEXT_CLOSED="Close Controls";k.TEXT_OPEN="Open Controls";g.bind(window,"keydown",function(a){document.activeElement.type!=="text"&&(a.which===72||a.keyCode==72)&&k.toggleHide()}, <del>false);i.extend(k.prototype,{add:function(a,b){return q(this,a,b,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(a,b){return q(this,a,b,{color:true})},remove:function(a){this.__ul.removeChild(a.__li);this.__controllers.slice(this.__controllers.indexOf(a),1);var b=this;i.defer(function(){b.onResize()})},destroy:function(){this.autoPlace&&v.removeChild(this.domElement)},addFolder:function(a){if(this.__folders[a]!==void 0)throw Error('You already have a folder in this GUI by the name "'+ <del>a+'"');var b={name:a,parent:this};b.autoPlace=this.autoPlace;if(this.load&&this.load.folders&&this.load.folders[a])b.closed=this.load.folders[a].closed,b.load=this.load.folders[a];b=new k(b);this.__folders[a]=b;a=s(this,b.domElement);g.addClass(a,"folder");return b},open:function(){this.closed=false},close:function(){this.closed=true},onResize:function(){var a=this.getRoot();if(a.scrollable){var b=g.getOffset(a.__ul).top,c=0;i.each(a.__ul.childNodes,function(b){a.autoPlace&&b===a.__save_row||(c+= <del>g.getHeight(b))});window.innerHeight-b-20<c?(g.addClass(a.domElement,k.CLASS_TOO_TALL),a.__ul.style.height=window.innerHeight-b-20+"px"):(g.removeClass(a.domElement,k.CLASS_TOO_TALL),a.__ul.style.height="auto")}a.__resize_handle&&i.defer(function(){a.__resize_handle.style.height=a.__ul.offsetHeight+"px"});if(a.__closeButton)a.__closeButton.style.width=a.width+"px"},remember:function(){if(i.isUndefined(x))x=new y,x.domElement.innerHTML=a;if(this.parent)throw Error("You can only call remember on a top level GUI."); <del>var b=this;i.each(Array.prototype.slice.call(arguments),function(a){b.__rememberedObjects.length==0&&I(b);b.__rememberedObjects.indexOf(a)==-1&&b.__rememberedObjects.push(a)});this.autoPlace&&D(this,this.width)},getRoot:function(){for(var a=this;a.parent;)a=a.parent;return a},getSaveObject:function(){var a=this.load;a.closed=this.closed;if(this.__rememberedObjects.length>0){a.preset=this.preset;if(!a.remembered)a.remembered={};a.remembered[this.preset]=z(this)}a.folders={};i.each(this.__folders,function(b, <del>c){a.folders[c]=b.getSaveObject()});return a},save:function(){if(!this.load.remembered)this.load.remembered={};this.load.remembered[this.preset]=z(this);B(this,false)},saveAs:function(a){if(!this.load.remembered)this.load.remembered={},this.load.remembered[w]=z(this,true);this.load.remembered[a]=z(this);this.preset=a;C(this,a,true)},revert:function(a){i.each(this.__controllers,function(b){this.getRoot().load.remembered?t(a||this.getRoot(),b):b.setValue(b.initialValue)},this);i.each(this.__folders, <del>function(a){a.revert(a)});a||B(this.getRoot(),false)},listen:function(a){var b=this.__listening.length==0;this.__listening.push(a);b&&E(this.__listening)}});return k}(dat.utils.css,'<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n \n </div>\n \n </div>\n\n</div>', <del>".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n", <del>dat.controllers.factory=function(e,a,c,d,f,b,n){return function(h,j,m,l){var o=h[j];if(n.isArray(m)||n.isObject(m))return new e(h,j,m);if(n.isNumber(o))return n.isNumber(m)&&n.isNumber(l)?new c(h,j,m,l):new a(h,j,{min:m,max:l});if(n.isString(o))return new d(h,j);if(n.isFunction(o))return new f(h,j,"");if(n.isBoolean(o))return new b(h,j)}}(dat.controllers.OptionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.StringController=function(e,a,c){var d= <del>function(c,b){function e(){h.setValue(h.__input.value)}d.superclass.call(this,c,b);var h=this;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"keyup",e);a.bind(this.__input,"change",e);a.bind(this.__input,"blur",function(){h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())});a.bind(this.__input,"keydown",function(a){a.keyCode===13&&this.blur()});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;c.extend(d.prototype, <del>e.prototype,{updateDisplay:function(){if(!a.isActive(this.__input))this.__input.value=this.getValue();return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.FunctionController,dat.controllers.BooleanController,dat.utils.common),dat.controllers.Controller,dat.controllers.BooleanController,dat.controllers.FunctionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.OptionController, <del>dat.controllers.ColorController=function(e,a,c,d,f){function b(a,b,c,d){a.style.background="";f.each(j,function(e){a.style.cssText+="background: "+e+"linear-gradient("+b+", "+c+" 0%, "+d+" 100%); "})}function n(a){a.style.background="";a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"; <del>a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var h=function(e,l){function o(b){q(b);a.bind(window,"mousemove",q);a.bind(window, <del>"mouseup",j)}function j(){a.unbind(window,"mousemove",q);a.unbind(window,"mouseup",j)}function g(){var a=d(this.value);a!==false?(p.__color.__state=a,p.setValue(p.__color.toOriginal())):this.value=p.__color.toString()}function i(){a.unbind(window,"mousemove",s);a.unbind(window,"mouseup",i)}function q(b){b.preventDefault();var c=a.getWidth(p.__saturation_field),d=a.getOffset(p.__saturation_field),e=(b.clientX-d.left+document.body.scrollLeft)/c,b=1-(b.clientY-d.top+document.body.scrollTop)/c;b>1?b= <del>1:b<0&&(b=0);e>1?e=1:e<0&&(e=0);p.__color.v=b;p.__color.s=e;p.setValue(p.__color.toOriginal());return false}function s(b){b.preventDefault();var c=a.getHeight(p.__hue_field),d=a.getOffset(p.__hue_field),b=1-(b.clientY-d.top+document.body.scrollTop)/c;b>1?b=1:b<0&&(b=0);p.__color.h=b*360;p.setValue(p.__color.toOriginal());return false}h.superclass.call(this,e,l);this.__color=new c(this.getValue());this.__temp=new c(0);var p=this;this.domElement=document.createElement("div");a.makeSelectable(this.domElement, <del>false);this.__selector=document.createElement("div");this.__selector.className="selector";this.__saturation_field=document.createElement("div");this.__saturation_field.className="saturation-field";this.__field_knob=document.createElement("div");this.__field_knob.className="field-knob";this.__field_knob_border="2px solid ";this.__hue_knob=document.createElement("div");this.__hue_knob.className="hue-knob";this.__hue_field=document.createElement("div");this.__hue_field.className="hue-field";this.__input= <del>document.createElement("input");this.__input.type="text";this.__input_textShadow="0 1px 1px ";a.bind(this.__input,"keydown",function(a){a.keyCode===13&&g.call(this)});a.bind(this.__input,"blur",g);a.bind(this.__selector,"mousedown",function(){a.addClass(this,"drag").bind(window,"mouseup",function(){a.removeClass(p.__selector,"drag")})});var t=document.createElement("div");f.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}); <del>f.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<0.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1});f.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1});f.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"});f.extend(t.style, <del>{width:"100%",height:"100%",background:"none"});b(t,"top","rgba(0,0,0,0)","#000");f.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"});n(this.__hue_field);f.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"});a.bind(this.__saturation_field,"mousedown",o);a.bind(this.__field_knob,"mousedown",o);a.bind(this.__hue_field,"mousedown", <del>function(b){s(b);a.bind(window,"mousemove",s);a.bind(window,"mouseup",i)});this.__saturation_field.appendChild(t);this.__selector.appendChild(this.__field_knob);this.__selector.appendChild(this.__saturation_field);this.__selector.appendChild(this.__hue_field);this.__hue_field.appendChild(this.__hue_knob);this.domElement.appendChild(this.__input);this.domElement.appendChild(this.__selector);this.updateDisplay()};h.superclass=e;f.extend(h.prototype,e.prototype,{updateDisplay:function(){var a=d(this.getValue()); <del>if(a!==false){var e=false;f.each(c.COMPONENTS,function(b){if(!f.isUndefined(a[b])&&!f.isUndefined(this.__color.__state[b])&&a[b]!==this.__color.__state[b])return e=true,{}},this);e&&f.extend(this.__color.__state,a)}f.extend(this.__temp.__state,this.__color.__state);this.__temp.a=1;var h=this.__color.v<0.5||this.__color.s>0.5?255:0,j=255-h;f.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+ <del>"rgb("+h+","+h+","+h+")"});this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px";this.__temp.s=1;this.__temp.v=1;b(this.__saturation_field,"left","#fff",this.__temp.toString());f.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+h+","+h+","+h+")",textShadow:this.__input_textShadow+"rgba("+j+","+j+","+j+",.7)"})}});var j=["-moz-","-o-","-webkit-","-ms-",""];return h}(dat.controllers.Controller,dat.dom.dom,dat.color.Color=function(e,a,c,d){function f(a, <del>b,c){Object.defineProperty(a,b,{get:function(){if(this.__state.space==="RGB")return this.__state[b];n(this,b,c);return this.__state[b]},set:function(a){if(this.__state.space!=="RGB")n(this,b,c),this.__state.space="RGB";this.__state[b]=a}})}function b(a,b){Object.defineProperty(a,b,{get:function(){if(this.__state.space==="HSV")return this.__state[b];h(this);return this.__state[b]},set:function(a){if(this.__state.space!=="HSV")h(this),this.__state.space="HSV";this.__state[b]=a}})}function n(b,c,e){if(b.__state.space=== <del>"HEX")b.__state[c]=a.component_from_hex(b.__state.hex,e);else if(b.__state.space==="HSV")d.extend(b.__state,a.hsv_to_rgb(b.__state.h,b.__state.s,b.__state.v));else throw"Corrupted color state";}function h(b){var c=a.rgb_to_hsv(b.r,b.g,b.b);d.extend(b.__state,{s:c.s,v:c.v});if(d.isNaN(c.h)){if(d.isUndefined(b.__state.h))b.__state.h=0}else b.__state.h=c.h}var j=function(){this.__state=e.apply(this,arguments);if(this.__state===false)throw"Failed to interpret color arguments";this.__state.a=this.__state.a|| <del>1};j.COMPONENTS="r,g,b,h,s,v,hex,a".split(",");d.extend(j.prototype,{toString:function(){return c(this)},toOriginal:function(){return this.__state.conversion.write(this)}});f(j.prototype,"r",2);f(j.prototype,"g",1);f(j.prototype,"b",0);b(j.prototype,"h");b(j.prototype,"s");b(j.prototype,"v");Object.defineProperty(j.prototype,"a",{get:function(){return this.__state.a},set:function(a){this.__state.a=a}});Object.defineProperty(j.prototype,"hex",{get:function(){if(!this.__state.space!=="HEX")this.__state.hex= <del>a.rgb_to_hex(this.r,this.g,this.b);return this.__state.hex},set:function(a){this.__state.space="HEX";this.__state.hex=a}});return j}(dat.color.interpret,dat.color.math=function(){var e;return{hsv_to_rgb:function(a,c,d){var e=a/60-Math.floor(a/60),b=d*(1-c),n=d*(1-e*c),c=d*(1-(1-e)*c),a=[[d,c,b],[n,d,b],[b,d,c],[b,n,d],[c,b,d],[d,b,n]][Math.floor(a/60)%6];return{r:a[0]*255,g:a[1]*255,b:a[2]*255}},rgb_to_hsv:function(a,c,d){var e=Math.min(a,c,d),b=Math.max(a,c,d),e=b-e;if(b==0)return{h:NaN,s:0,v:0}; <del>a=a==b?(c-d)/e:c==b?2+(d-a)/e:4+(a-c)/e;a/=6;a<0&&(a+=1);return{h:a*360,s:e/b,v:b/255}},rgb_to_hex:function(a,c,d){a=this.hex_with_component(0,2,a);a=this.hex_with_component(a,1,c);return a=this.hex_with_component(a,0,d)},component_from_hex:function(a,c){return a>>c*8&255},hex_with_component:function(a,c,d){return d<<(e=c*8)|a&~(255<<e)}}}(),dat.color.toString,dat.utils.common),dat.color.interpret,dat.utils.common),dat.utils.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame|| <del>window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1E3/60)}}(),dat.dom.CenteredDiv=function(e,a){var c=function(){this.backgroundElement=document.createElement("div");a.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear"});e.makeFullscreen(this.backgroundElement);this.backgroundElement.style.position="fixed";this.domElement= <del>document.createElement("div");a.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear"});document.body.appendChild(this.backgroundElement);document.body.appendChild(this.domElement);var c=this;e.bind(this.backgroundElement,"click",function(){c.hide()})};c.prototype.show=function(){var c=this;this.backgroundElement.style.display="block";this.domElement.style.display="block";this.domElement.style.opacity= <del>0;this.domElement.style.webkitTransform="scale(1.1)";this.layout();a.defer(function(){c.backgroundElement.style.opacity=1;c.domElement.style.opacity=1;c.domElement.style.webkitTransform="scale(1)"})};c.prototype.hide=function(){var a=this,c=function(){a.domElement.style.display="none";a.backgroundElement.style.display="none";e.unbind(a.domElement,"webkitTransitionEnd",c);e.unbind(a.domElement,"transitionend",c);e.unbind(a.domElement,"oTransitionEnd",c)};e.bind(this.domElement,"webkitTransitionEnd", <del>c);e.bind(this.domElement,"transitionend",c);e.bind(this.domElement,"oTransitionEnd",c);this.backgroundElement.style.opacity=0;this.domElement.style.opacity=0;this.domElement.style.webkitTransform="scale(1.1)"};c.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-e.getWidth(this.domElement)/2+"px";this.domElement.style.top=window.innerHeight/2-e.getHeight(this.domElement)/2+"px"};return c}(dat.dom.dom,dat.utils.common),dat.dom.dom,dat.utils.common); <ide>\ No newline at end of file <add>!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dat=t():e.dat=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";t.__esModule=!0,t["default"]=n(1),e.exports=t["default"]},function(e,t,n){"use strict";t.__esModule=!0,t["default"]={color:{Color:n(2),math:n(6),interpret:n(3)},controllers:{Controller:n(7),BooleanController:n(8),OptionController:n(10),StringController:n(11),NumberController:n(12),NumberControllerBox:n(13),NumberControllerSlider:n(14),FunctionController:n(15),ColorController:n(16)},dom:{dom:n(9)},gui:{GUI:n(17)},GUI:n(17)},e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(p.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(p.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function r(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(p.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(p.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}t.__esModule=!0;var s=n(3),l=o(s),d=n(6),u=o(d),c=n(4),f=o(c),h=n(5),_=o(h),p=function(){function e(){if(i(this,e),this.__state=l["default"].apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return e.prototype.toString=function(){return f["default"](this)},e.prototype.toOriginal=function(){return this.__state.conversion.write(this)},e}();p.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=u["default"].component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");_["default"].extend(e.__state,u["default"].hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},p.recalculateHSV=function(e){var t=u["default"].rgb_to_hsv(e.r,e.g,e.b);_["default"].extend(e.__state,{s:t.s,v:t.v}),_["default"].isNaN(t.h)?_["default"].isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},p.COMPONENTS=["r","g","b","h","s","v","hex","a"],a(p.prototype,"r",2),a(p.prototype,"g",1),a(p.prototype,"b",0),r(p.prototype,"h"),r(p.prototype,"s"),r(p.prototype,"v"),Object.defineProperty(p.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(p.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=u["default"].rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(4),a=o(i),r=n(5),s=o(r),l=[{litmus:s["default"].isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:a["default"]},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:a["default"]},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:a["default"]},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:a["default"]}}},{litmus:s["default"].isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:s["default"].isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:s["default"].isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(s["default"].isNumber(e.r)&&s["default"].isNumber(e.g)&&s["default"].isNumber(e.b)&&s["default"].isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(s["default"].isNumber(e.r)&&s["default"].isNumber(e.g)&&s["default"].isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(s["default"].isNumber(e.h)&&s["default"].isNumber(e.s)&&s["default"].isNumber(e.v)&&s["default"].isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(s["default"].isNumber(e.h)&&s["default"].isNumber(e.s)&&s["default"].isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],d=void 0,u=void 0,c=function(){u=!1;var e=arguments.length>1?s["default"].toArray(arguments):arguments[0];return s["default"].each(l,function(t){if(t.litmus(e))return s["default"].each(t.conversions,function(t,n){if(d=t.read(e),u===!1&&d!==!1)return u=d,d.conversionName=n,d.conversion=t,s["default"].BREAK}),s["default"].BREAK}),u};t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(5),a=o(i);t["default"]=function(e){if(1===e.a||a["default"].isUndefined(e.a)){for(var t=e.hex.toString(16);t.length<6;)t="0"+t;return"#"+t}return"rgba("+Math.round(e.r)+","+Math.round(e.g)+","+Math.round(e.b)+","+e.a+")"},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){if(!this.isUndefined(t)){var n=Object.keys(t);n.forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){if(!this.isUndefined(t)){var n=Object.keys(t);n.forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i=void 0,a=void 0;for(i=0,a=e.length;i<a;i++)if(i in e&&t.call(o,e[i],i)===this.BREAK)return}else{if(this.isUndefined(e))return;var r=Object.keys(e);r.forEach(function(n){t.call(o,e[n],n)===this.BREAK}.bind(this))}},defer:function(e){setTimeout(e,0)},debounce:function(e,t){var n=void 0;return function(){function o(){n=null}var i=this,a=arguments,r=!n;clearTimeout(n),n=setTimeout(o,t),r&&e.apply(i,a)}},toArray:function(e){return e.toArray?e.toArray():o.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)}};t["default"]=i,e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n=void 0,o={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),a=n*(1-t),r=n*(1-i*t),s=n*(1-(1-i)*t),l=[[n,s,a],[r,n,a],[a,n,s],[a,r,n],[s,a,n],[n,a,r]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),a=i-o,r=void 0,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=a/i,r=e===i?(t-n)/a:t===i?2+(n-e)/a:4+(e-t)/a,r/=6,r<0&&(r+=1),{h:360*r,s:s,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,o){return o<<(n=8*t)|e&~(255<<n)}};t["default"]=o,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t,o){n(this,e),this.initialValue=t[o],this.domElement=document.createElement("div"),this.object=t,this.property=o,this.__onChange=void 0,this.__onFinishChange=void 0}return e.prototype.onChange=function(e){return this.__onChange=e,this},e.prototype.onFinishChange=function(e){return this.__onFinishChange=e,this},e.prototype.setValue=function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this},e.prototype.getValue=function(){return this.object[this.property]},e.prototype.updateDisplay=function(){return this},e.prototype.isModified=function(){return this.initialValue!==this.getValue()},e}();t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=function(e){function t(n,o){function a(){r.setValue(!r.__prev)}i(this,t),e.call(this,n,o);var r=this;this.__prev=this.getValue(),this.__checkbox=document.createElement("input"),this.__checkbox.setAttribute("type","checkbox"),d["default"].bind(this.__checkbox,"change",a,!1),this.domElement.appendChild(this.__checkbox),this.updateDisplay()}return a(t,e),t.prototype.setValue=function(t){var n=e.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n},t.prototype.updateDisplay=function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1,e.prototype.updateDisplay.call(this)},t}(s["default"]);t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e){if("0"===e||r["default"].isUndefined(e))return 0;var t=e.match(d);return r["default"].isNull(t)?0:parseFloat(t[1])}t.__esModule=!0;var a=n(5),r=o(a),s={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},l={};r["default"].each(s,function(e,t){r["default"].each(e,function(e){l[e]=t})});var d=/(\d+(\.\d+)?)px/,u={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var o=n,i=t;r["default"].isUndefined(i)&&(i=!0),r["default"].isUndefined(o)&&(o=!0),e.style.position="absolute",i&&(e.style.left=0,e.style.right=0),o&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,o){var i=n||{},a=l[t];if(!a)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(a);switch(a){case"MouseEvents":var d=i.x||i.clientX||0,u=i.y||i.clientY||0;s.initMouseEvent(t,i.bubbles||!1,i.cancelable||!0,window,i.clickCount||1,0,0,d,u,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=s.initKeyboardEvent||s.initKeyEvent;r["default"].defaults(i,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,i.bubbles||!1,i.cancelable,window,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.keyCode,i.charCode);break;default:s.initEvent(t,i.bubbles||!1,i.cancelable||!0)}r["default"].defaults(s,o),e.dispatchEvent(s)},bind:function(e,t,n,o){var i=o||!1;return e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on"+t,n),u},unbind:function(e,t,n,o){var i=o||!1;return e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on"+t,n),u},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);n.indexOf(t)===-1&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return u},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),o=n.indexOf(t);o!==-1&&(n.splice(o,1),e.className=n.join(" "))}else e.className=void 0;return u},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return i(t["border-left-width"])+i(t["border-right-width"])+i(t["padding-left"])+i(t["padding-right"])+i(t.width)},getHeight:function(e){var t=getComputedStyle(e);return i(t["border-top-width"])+i(t["border-bottom-width"])+i(t["padding-top"])+i(t["padding-bottom"])+i(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}};t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=n(5),c=o(u),f=function(e){function t(n,o,a){i(this,t),e.call(this,n,o);var r=a,s=this;this.__select=document.createElement("select"),c["default"].isArray(r)&&!function(){var e={};c["default"].each(r,function(t){e[t]=t}),r=e}(),c["default"].each(r,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),s.__select.appendChild(n)}),this.updateDisplay(),d["default"].bind(this.__select,"change",function(){var e=this.options[this.selectedIndex].value;s.setValue(e)}),this.domElement.appendChild(this.__select)}return a(t,e),t.prototype.setValue=function(t){var n=e.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n},t.prototype.updateDisplay=function(){return d["default"].isActive(this.__select)?this:(this.__select.value=this.getValue(),e.prototype.updateDisplay.call(this))},t}(s["default"]);t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=function(e){function t(n,o){function a(){s.setValue(s.__input.value)}function r(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}i(this,t),e.call(this,n,o);var s=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),d["default"].bind(this.__input,"keyup",a),d["default"].bind(this.__input,"change",a),d["default"].bind(this.__input,"blur",r),d["default"].bind(this.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),this.updateDisplay(),this.domElement.appendChild(this.__input)}return a(t,e),t.prototype.updateDisplay=function(){return d["default"].isActive(this.__input)||(this.__input.value=this.getValue()),e.prototype.updateDisplay.call(this)},t}(s["default"]);t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}t.__esModule=!0;var s=n(7),l=o(s),d=n(5),u=o(d),c=function(e){function t(n,o,a){i(this,t),e.call(this,n,o);var s=a||{};this.__min=s.min,this.__max=s.max,this.__step=s.step,u["default"].isUndefined(this.__step)?0===this.initialValue?this.__impliedStep=1:this.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(this.initialValue))/Math.LN10))/10:this.__impliedStep=this.__step,this.__precision=r(this.__impliedStep)}return a(t,e),t.prototype.setValue=function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!==0&&(n=Math.round(n/this.__step)*this.__step),e.prototype.setValue.call(this,n)},t.prototype.min=function(e){return this.__min=e,this},t.prototype.max=function(e){return this.__max=e,this},t.prototype.step=function(e){return this.__step=e,this.__impliedStep=e,this.__precision=r(e),this},t}(l["default"]);t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}t.__esModule=!0;var s=n(12),l=o(s),d=n(9),u=o(d),c=n(5),f=o(c),h=function(e){function t(n,o,a){function r(){var e=parseFloat(h.__input.value);f["default"].isNaN(e)||h.setValue(e)}function s(){r(),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}function l(e){document.activeElement.blur();var t=_-e.clientY;h.setValue(h.getValue()+t*h.__impliedStep),_=e.clientY}function d(){u["default"].unbind(window,"mousemove",l),u["default"].unbind(window,"mouseup",d)}function c(e){u["default"].bind(window,"mousemove",l),u["default"].bind(window,"mouseup",d),_=e.clientY}i(this,t),e.call(this,n,o,a),this.__truncationSuspended=!1;var h=this,_=void 0;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),u["default"].bind(this.__input,"change",r),u["default"].bind(this.__input,"blur",s),u["default"].bind(this.__input,"mousedown",c),u["default"].bind(this.__input,"keydown",function(e){13===e.keyCode&&(h.__truncationSuspended=!0,this.blur(),h.__truncationSuspended=!1)}),this.updateDisplay(),this.domElement.appendChild(this.__input)}return a(t,e),t.prototype.updateDisplay=function(){return u["default"].isActive(this.__input)?this:(this.__input.value=this.__truncationSuspended?this.getValue():r(this.getValue(),this.__precision),e.prototype.updateDisplay.call(this))},t}(l["default"]);t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t,n,o,i){return o+(i-o)*((e-t)/(n-t))}t.__esModule=!0;var s=n(12),l=o(s),d=n(9),u=o(d),c=function(e){function t(n,o,a,s,l){function d(e){document.activeElement.blur(),u["default"].bind(window,"mousemove",c),u["default"].bind(window,"mouseup",f),c(e)}function c(e){e.preventDefault();var t=u["default"].getOffset(h.__background),n=u["default"].getWidth(h.__background);return h.setValue(r(e.clientX,t.left,t.left+n,h.__min,h.__max)),!1}function f(){u["default"].unbind(window,"mousemove",c),u["default"].unbind(window,"mouseup",f),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}i(this,t),e.call(this,n,o,{min:a,max:s,step:l});var h=this;this.__background=document.createElement("div"),this.__foreground=document.createElement("div"),u["default"].bind(this.__background,"mousedown",d),u["default"].addClass(this.__background,"slider"),u["default"].addClass(this.__foreground,"slider-fg"),this.updateDisplay(),this.__background.appendChild(this.__foreground),this.domElement.appendChild(this.__background)}return a(t,e),t.prototype.updateDisplay=function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",e.prototype.updateDisplay.call(this)},t}(l["default"]);t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=function(e){function t(n,o,a){i(this,t),e.call(this,n,o);var r=this;this.__button=document.createElement("div"),this.__button.innerHTML=void 0===a?"Fire":a,d["default"].bind(this.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),d["default"].addClass(this.__button,"button"),this.domElement.appendChild(this.__button)}return a(t,e),t.prototype.fire=function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())},t}(s["default"]);t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t,n,o){e.style.background="",b["default"].each(v,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function s(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}t.__esModule=!0;var l=n(7),d=o(l),u=n(9),c=o(u),f=n(2),h=o(f),_=n(3),p=o(_),m=n(5),b=o(m),g=function(e){function t(n,o){function a(e){_(e),c["default"].bind(window,"mousemove",_),c["default"].bind(window,"mouseup",l)}function l(){c["default"].unbind(window,"mousemove",_),c["default"].unbind(window,"mouseup",l),f()}function d(){var e=p["default"](this.value);e!==!1?(g.__color.__state=e,g.setValue(g.__color.toOriginal())):this.value=g.__color.toString()}function u(){c["default"].unbind(window,"mousemove",m),c["default"].unbind(window,"mouseup",u),f()}function f(){g.__onFinishChange&&g.__onFinishChange.call(g,g.__color.toString())}function _(e){e.preventDefault();var t=c["default"].getWidth(g.__saturation_field),n=c["default"].getOffset(g.__saturation_field),o=(e.clientX-n.left+document.body.scrollLeft)/t,i=1-(e.clientY-n.top+document.body.scrollTop)/t;return i>1?i=1:i<0&&(i=0),o>1?o=1:o<0&&(o=0),g.__color.v=i,g.__color.s=o,g.setValue(g.__color.toOriginal()),!1}function m(e){e.preventDefault();var t=c["default"].getHeight(g.__hue_field),n=c["default"].getOffset(g.__hue_field),o=1-(e.clientY-n.top+document.body.scrollTop)/t;return o>1?o=1:o<0&&(o=0),g.__color.h=360*o,g.setValue(g.__color.toOriginal()),!1}i(this,t),e.call(this,n,o),this.__color=new h["default"](this.getValue()),this.__temp=new h["default"](0);var g=this;this.domElement=document.createElement("div"),c["default"].makeSelectable(this.domElement,!1),this.__selector=document.createElement("div"),this.__selector.className="selector",this.__saturation_field=document.createElement("div"),this.__saturation_field.className="saturation-field",this.__field_knob=document.createElement("div"),this.__field_knob.className="field-knob",this.__field_knob_border="2px solid ",this.__hue_knob=document.createElement("div"),this.__hue_knob.className="hue-knob",this.__hue_field=document.createElement("div"),this.__hue_field.className="hue-field",this.__input=document.createElement("input"),this.__input.type="text",this.__input_textShadow="0 1px 1px ",c["default"].bind(this.__input,"keydown",function(e){13===e.keyCode&&d.call(this)}),c["default"].bind(this.__input,"blur",d),c["default"].bind(this.__selector,"mousedown",function(){c["default"].addClass(this,"drag").bind(window,"mouseup",function(){c["default"].removeClass(g.__selector,"drag")})});var v=document.createElement("div");b["default"].extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),b["default"].extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),b["default"].extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),b["default"].extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),b["default"].extend(v.style,{width:"100%",height:"100%",background:"none"}),r(v,"top","rgba(0,0,0,0)","#000"),b["default"].extend(this.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),s(this.__hue_field),b["default"].extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"}),c["default"].bind(this.__saturation_field,"mousedown",a),c["default"].bind(this.__field_knob,"mousedown",a),c["default"].bind(this.__hue_field,"mousedown",function(e){m(e),c["default"].bind(window,"mousemove",m),c["default"].bind(window,"mouseup",u)}),this.__saturation_field.appendChild(v),this.__selector.appendChild(this.__field_knob),this.__selector.appendChild(this.__saturation_field),this.__selector.appendChild(this.__hue_field),this.__hue_field.appendChild(this.__hue_knob),this.domElement.appendChild(this.__input),this.domElement.appendChild(this.__selector),this.updateDisplay()}return a(t,e),t.prototype.updateDisplay=function(){var e=p["default"](this.getValue());if(e!==!1){var t=!1;b["default"].each(h["default"].COMPONENTS,function(n){if(!b["default"].isUndefined(e[n])&&!b["default"].isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&b["default"].extend(this.__color.__state,e)}b["default"].extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;b["default"].extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,r(this.__saturation_field,"left","#fff",this.__temp.toString()),b["default"].extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})},t}(d["default"]),v=["-moz-","-o-","-webkit-","-ms-",""];t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function a(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];t?n.innerHTML=n.value+"*":n.innerHTML=n.value}function r(e,t,n){if(n.__li=t,n.__gui=e,U["default"].extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),l(e,n.object,n.property,{before:o,factoryArgs:[U["default"].toArray(arguments)]})}if(U["default"].isArray(t)||U["default"].isObject(t)){var o=n.__li.nextElementSibling;return n.remove(),l(e,n.object,n.property,{before:o,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof R["default"])!function(){var e=new N["default"](n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});U["default"].each(["updateDisplay","onChange","onFinishChange","step"],function(t){var o=n[t],i=e[t];n[t]=e[t]=function(){var t=Array.prototype.slice.call(arguments);return i.apply(e,t),o.apply(n,t)}}),I["default"].addClass(t,"has-slider"),n.domElement.insertBefore(e.domElement,n.domElement.firstElementChild)}();else if(n instanceof N["default"]){var o=function(t){return U["default"].isNumber(n.__min)&&U["default"].isNumber(n.__max)?(n.remove(),l(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]})):t};n.min=U["default"].compose(o,n.min),n.max=U["default"].compose(o,n.max)}else n instanceof S["default"]?(I["default"].bind(t,"click",function(){I["default"].fakeEvent(n.__checkbox,"click")}),I["default"].bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof T["default"]?(I["default"].bind(t,"click",function(){I["default"].fakeEvent(n.__button,"click")}),I["default"].bind(t,"mouseover",function(){I["default"].addClass(n.__button,"hover")}),I["default"].bind(t,"mouseout",function(){I["default"].removeClass(n.__button,"hover")})):n instanceof j["default"]&&(I["default"].addClass(t,"color"),n.updateDisplay=U["default"].compose(function(e){return t.style.borderLeftColor=n.__color.toString(), <add>e},n.updateDisplay),n.updateDisplay());n.setValue=U["default"].compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&a(e.getRoot(),!0),t},n.setValue)}function s(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(o!==-1){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var a=n.load.remembered,r=void 0;if(a[e.preset])r=a[e.preset];else{if(!a[Q])return;r=a[Q]}if(r[o]&&void 0!==r[o][t.property]){var s=r[o][t.property];t.initialValue=s,t.setValue(s)}}}}function l(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(o.color)a=new j["default"](t,n);else{var l=[t,n].concat(o.factoryArgs);a=E["default"].apply(e,l)}o.before instanceof A["default"]&&(o.before=o.before.__li),s(e,a),I["default"].addClass(a.domElement,"c");var d=document.createElement("span");I["default"].addClass(d,"property-name"),d.innerHTML=a.property;var u=document.createElement("div");u.appendChild(d),u.appendChild(a.domElement);var c=i(e,u,o.before);return I["default"].addClass(c,ne.CLASS_CONTROLLER_ROW),a instanceof j["default"]?I["default"].addClass(c,"color"):I["default"].addClass(c,typeof a.getValue()),r(e,c,a),e.__controllers.push(a),a}function d(e,t){return document.location.href+"."+t}function u(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function c(e,t){t.style.display=e.useLocalStorage?"block":"none"}function f(e){var t=e.__save_row=document.createElement("li");I["default"].addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),I["default"].addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",I["default"].addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",I["default"].addClass(o,"button"),I["default"].addClass(o,"save");var i=document.createElement("span");i.innerHTML="New",I["default"].addClass(i,"button"),I["default"].addClass(i,"save-as");var a=document.createElement("span");a.innerHTML="Revert",I["default"].addClass(a,"button"),I["default"].addClass(a,"revert");var r=e.__preset_select=document.createElement("select");e.load&&e.load.remembered?U["default"].each(e.load.remembered,function(t,n){u(e,n,n===e.preset)}):u(e,Q,!1),I["default"].bind(r,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(r),t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(a),J&&!function(){var t=document.getElementById("dg-local-explain"),n=document.getElementById("dg-local-storage"),o=document.getElementById("dg-save-locally");o.style.display="block","true"===localStorage.getItem(d(e,"isLocal"))&&n.setAttribute("checked","checked"),c(e,t),I["default"].bind(n,"change",function(){e.useLocalStorage=!e.useLocalStorage,c(e,t)})}();var s=document.getElementById("dg-new-constructor");I["default"].bind(s,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||q.hide()}),I["default"].bind(n,"click",function(){s.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),q.show(),s.focus(),s.select()}),I["default"].bind(o,"click",function(){e.save()}),I["default"].bind(i,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),I["default"].bind(a,"click",function(){e.revert()})}function h(e){function t(t){return t.preventDefault(),e.width+=i-t.clientX,e.onResize(),i=t.clientX,!1}function n(){I["default"].removeClass(e.__closeButton,ne.CLASS_DRAG),I["default"].unbind(window,"mousemove",t),I["default"].unbind(window,"mouseup",n)}function o(o){return o.preventDefault(),i=o.clientX,I["default"].addClass(e.__closeButton,ne.CLASS_DRAG),I["default"].bind(window,"mousemove",t),I["default"].bind(window,"mouseup",n),!1}var i=void 0;e.__resize_handle=document.createElement("div"),U["default"].extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),I["default"].bind(e.__resize_handle,"mousedown",o),I["default"].bind(e.__closeButton,"mousedown",o),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function _(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function p(e,t){var n={};return U["default"].each(e.__rememberedObjects,function(o,i){var a={},r=e.__rememberedObjectIndecesToControllers[i];U["default"].each(r,function(e,n){a[n]=t?e.initialValue:e.getValue()}),n[i]=a}),n}function m(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}function b(e){0!==e.length&&P["default"].call(window,function(){b(e)}),U["default"].each(e,function(e){e.updateDisplay()})}var g=n(18),v=o(g),y=n(19),w=o(y),x=n(20),E=o(x),C=n(7),A=o(C),k=n(8),S=o(k),O=n(15),T=o(O),L=n(13),N=o(L),M=n(14),R=o(M),B=n(16),j=o(B),H=n(21),P=o(H),D=n(22),V=o(D),F=n(9),I=o(F),z=n(5),U=o(z),G=n(23),X=o(G);v["default"].inject(X["default"]);var K="dg",W=72,Y=20,Q="Default",J=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}(),q=void 0,Z=!0,$=void 0,ee=!1,te=[],ne=function oe(e){function t(){var e=n.getRoot();e.width+=1,U["default"].defer(function(){e.width-=1})}var n=this,o=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),I["default"].addClass(this.domElement,K),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=U["default"].defaults(o,{autoPlace:!0,width:oe.DEFAULT_WIDTH}),o=U["default"].defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),U["default"].isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),U["default"].isUndefined(o.parent)&&o.hideable&&te.push(this),o.resizable=U["default"].isUndefined(o.parent)&&o.resizable,o.autoPlace&&U["default"].isUndefined(o.scrollable)&&(o.scrollable=!0);var a=J&&"true"===localStorage.getItem(d(this,"isLocal")),r=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,m(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,_(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,titleRowName&&(titleRowName.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(e){o.closed=e,o.closed?I["default"].addClass(n.__ul,oe.CLASS_CLOSED):I["default"].removeClass(n.__ul,oe.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?oe.TEXT_OPEN:oe.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return a},set:function(e){J&&(a=e,e?I["default"].bind(window,"unload",r):I["default"].unbind(window,"unload",r),localStorage.setItem(d(n,"isLocal"),e))}}}),U["default"].isUndefined(o.parent)){if(o.closed=!1,I["default"].addClass(this.domElement,oe.CLASS_MAIN),I["default"].makeSelectable(this.domElement,!1),J&&a){n.useLocalStorage=!0;var s=localStorage.getItem(d(this,"gui"));s&&(o.load=JSON.parse(s))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=oe.TEXT_CLOSED,I["default"].addClass(this.__closeButton,oe.CLASS_CLOSE_BUTTON),this.domElement.appendChild(this.__closeButton),I["default"].bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var l=document.createTextNode(o.name);I["default"].addClass(l,"controller-name");var u=i(n,l),c=function(e){return e.preventDefault(),n.closed=!n.closed,!1};I["default"].addClass(this.__ul,oe.CLASS_CLOSED),I["default"].addClass(u,"title"),I["default"].bind(u,"click",c),o.closed||(this.closed=!1)}o.autoPlace&&(U["default"].isUndefined(o.parent)&&(Z&&($=document.createElement("div"),I["default"].addClass($,K),I["default"].addClass($,oe.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild($),Z=!1),$.appendChild(this.domElement),I["default"].addClass(this.domElement,oe.CLASS_AUTO_PLACE)),this.parent||_(n,o.width)),this.__resizeHandler=function(){n.onResize()},I["default"].bind(window,"resize",this.__resizeHandler),I["default"].bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),I["default"].bind(this.__ul,"transitionend",this.__resizeHandler),I["default"].bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&h(this),r=function(){J&&"true"===localStorage.getItem(d(n,"isLocal"))&&localStorage.setItem(d(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=r,o.parent||t()};ne.toggleHide=function(){ee=!ee,U["default"].each(te,function(e){e.domElement.style.display=ee?"none":""})},ne.CLASS_AUTO_PLACE="a",ne.CLASS_AUTO_PLACE_CONTAINER="ac",ne.CLASS_MAIN="main",ne.CLASS_CONTROLLER_ROW="cr",ne.CLASS_TOO_TALL="taller-than-window",ne.CLASS_CLOSED="closed",ne.CLASS_CLOSE_BUTTON="close-button",ne.CLASS_DRAG="drag",ne.DEFAULT_WIDTH=245,ne.TEXT_CLOSED="Close Controls",ne.TEXT_OPEN="Open Controls",ne._keydownHandler=function(e){"text"===document.activeElement.type||e.which!==W&&e.keyCode!==W||ne.toggleHide()},I["default"].bind(window,"keydown",ne._keydownHandler,!1),U["default"].extend(ne.prototype,{add:function(e,t){return l(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return l(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;U["default"].defer(function(){t.onResize()})},destroy:function(){this.autoPlace&&$.removeChild(this.domElement),I["default"].unbind(window,"keydown",ne._keydownHandler,!1),I["default"].unbind(window,"resize",this.__resizeHandler),this.saveToLocalStorageIfPossible&&I["default"].unbind(window,"unload",this.saveToLocalStorageIfPossible)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new ne(t);this.__folders[e]=n;var o=i(this,n.domElement);return I["default"].addClass(o,"folder"),n},open:function(){this.closed=!1},close:function(){this.closed=!0},onResize:U["default"].debounce(function(){var e=this.getRoot();if(e.scrollable){var t=I["default"].getOffset(e.__ul).top,n=0;U["default"].each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=I["default"].getHeight(t))}),window.innerHeight-t-Y<n?(I["default"].addClass(e.domElement,ne.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-Y+"px"):(I["default"].removeClass(e.domElement,ne.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&U["default"].defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},200),remember:function(){if(U["default"].isUndefined(q)&&(q=new V["default"],q.domElement.innerHTML=w["default"]),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;U["default"].each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&f(e),e.__rememberedObjects.indexOf(t)===-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&_(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=p(this)),e.folders={},U["default"].each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=p(this),a(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=p(this,!0)),this.load.remembered[e]=p(this),this.preset=e,u(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){U["default"].each(this.__controllers,function(t){this.getRoot().load.remembered?s(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),U["default"].each(this.__folders,function(e){e.revert(e)}),e||a(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&b(this.__listening)},updateDisplay:function(){U["default"].each(this.__controllers,function(e){e.updateDisplay()}),U["default"].each(this.__folders,function(e){e.updateDisplay()})}}),e.exports=ne},function(e,t){"use strict";e.exports={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(a){}}}},function(e,t){e.exports='<div id=dg-save class="dg dialogue">Here\'s the new load parameter for your <code>GUI</code>\'s constructor:<textarea id=dg-new-constructor></textarea><div id=dg-save-locally><input id=dg-local-storage type="checkbox"> Automatically save values to <code>localStorage</code> on exit.<div id=dg-local-explain>The values saved to <code>localStorage</code> will override those passed to <code>dat.GUI</code>\'s constructor. This makes it easier to work incrementally, but <code>localStorage</code> is fragile, and your friends may not see the same values you do.</div></div></div>'},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(10),a=o(i),r=n(13),s=o(r),l=n(14),d=o(l),u=n(11),c=o(u),f=n(15),h=o(f),_=n(8),p=o(_),m=n(5),b=o(m),g=function(e,t){var n=e[t];return b["default"].isArray(arguments[2])||b["default"].isObject(arguments[2])?new a["default"](e,t,arguments[2]):b["default"].isNumber(n)?b["default"].isNumber(arguments[2])&&b["default"].isNumber(arguments[3])?b["default"].isNumber(arguments[4])?new d["default"](e,t,arguments[2],arguments[3],arguments[4]):new d["default"](e,t,arguments[2],arguments[3]):b["default"].isNumber(arguments[4])?new s["default"](e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new s["default"](e,t,{min:arguments[2],max:arguments[3]}):b["default"].isString(n)?new c["default"](e,t):b["default"].isFunction(n)?new h["default"](e,t,""):b["default"].isBoolean(n)?new p["default"](e,t):null};t["default"]=g,e.exports=t["default"]},function(e,t){"use strict";function n(e){setTimeout(e,1e3/60)}t.__esModule=!0,t["default"]=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||n,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var a=n(9),r=o(a),s=n(5),l=o(s),d=function(){function e(){i(this,e),this.backgroundElement=document.createElement("div"),l["default"].extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),r["default"].makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),l["default"].extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;r["default"].bind(this.backgroundElement,"click",function(){t.hide()})}return e.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),l["default"].defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},e.prototype.hide=function t(){var e=this,t=function n(){e.domElement.style.display="none",e.backgroundElement.style.display="none",r["default"].unbind(e.domElement,"webkitTransitionEnd",n),r["default"].unbind(e.domElement,"transitionend",n),r["default"].unbind(e.domElement,"oTransitionEnd",n)};r["default"].bind(this.domElement,"webkitTransitionEnd",t),r["default"].bind(this.domElement,"transitionend",t),r["default"].bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},e.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-r["default"].getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-r["default"].getHeight(this.domElement)/2+"px"},e}();t["default"]=d,e.exports=t["default"]},function(e,t,n){t=e.exports=n(24)(),t.push([e.id,".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1!important}.dg.main .close-button.drag,.dg.main:hover .close-button{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;transition:opacity .1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save>ul{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height .1s ease-out;transition:height .1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid transparent}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.boolean,.dg .cr.boolean *,.dg .cr.function,.dg .cr.function *,.dg .cr.function .property-name{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco,monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:9pt 0;display:block;width:440px;overflow-y:scroll;height:75pt;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande',sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:81pt}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:1pc;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.boolean:hover,.dg .cr.function:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:0}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(o[a]=!0)}for(i=0;i<t.length;i++){var r=t[i];"number"==typeof r[0]&&o[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}}])}); <ide>\ No newline at end of file
1
PHP
PHP
increase context depth in error messages
7d74f3e5981d51150af1c34c98203a28ad7d7730
<ide><path>lib/Cake/Utility/Debugger.php <ide> public function outputError($data) { <ide> $info = ''; <ide> <ide> foreach ((array)$data['context'] as $var => $value) { <del> $context[] = "\${$var} = " . $this->exportVar($value, 1); <add> $context[] = "\${$var} = " . $this->exportVar($value, 3); <ide> } <ide> <ide> switch ($this->_outputFormat) {
1
PHP
PHP
add tests for
1bf67c191a36f1f320357bf8c907d3232f70a662
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> public function testError() <ide> $this->assertHtml($expected, $result); <ide> } <ide> <add> /** <add> * test error translation can use rule names for translating. <add> * <add> * @return void <add> */ <add> public function testErrorRuleName() <add> { <add> $this->article['errors'] = [ <add> 'Article' => [ <add> 'field' => ['email' => 'Your email was not good'] <add> ] <add> ]; <add> $this->Form->create($this->article); <add> <add> $result = $this->Form->error('Article.field'); <add> $expected = [ <add> ['div' => ['class' => 'error-message']], <add> 'Your email was not good', <add> '/div', <add> ]; <add> $this->assertHtml($expected, $result); <add> <add> $result = $this->Form->error('Article.field', ['email' => 'Email in use']); <add> $expected = [ <add> ['div' => ['class' => 'error-message']], <add> 'Email in use', <add> '/div', <add> ]; <add> $this->assertHtml($expected, $result); <add> <add> $result = $this->Form->error('Article.field', ['Your email was not good' => 'Email in use']); <add> $expected = [ <add> ['div' => ['class' => 'error-message']], <add> 'Email in use', <add> '/div', <add> ]; <add> $this->assertHtml($expected, $result); <add> <add> $result = $this->Form->error('Article.field', [ <add> 'email' => 'Key is preferred', <add> 'Your email was not good' => 'Email in use' <add> ]); <add> $expected = [ <add> ['div' => ['class' => 'error-message']], <add> 'Key is preferred', <add> '/div', <add> ]; <add> $this->assertHtml($expected, $result); <add> } <add> <ide> /** <ide> * Test error with nested lists. <ide> *
1
PHP
PHP
use arguments instead of using properties
fed7d9dd4130b9036f6b82e53183eb42357511ed
<ide><path>src/Command/ServerCommand.php <ide> class ServerCommand extends Command <ide> */ <ide> protected $_iniPath = ''; <ide> <del> /** <del> * Arguments <del> * <del> * @var \Cake\Console\Arguments <del> */ <del> protected $args; <del> <del> /** <del> * Console IO <del> * <del> * @var \Cake\Console\ConsoleIo <del> */ <del> protected $io; <del> <ide> /** <ide> * Starts up the Command and displays the welcome message. <ide> * Allows for checking and configuring prior to command or main execution <ide> * <add> * @param \Cake\Console\Arguments $args The command arguments. <add> * @param \Cake\Console\ConsoleIo $io The console io <ide> * @return void <ide> */ <del> protected function startup(): void <add> protected function startup(Arguments $args, ConsoleIo $io): void <ide> { <del> if ($this->args->getOption('host')) { <del> $this->_host = (string)$this->args->getOption('host'); <add> if ($args->getOption('host')) { <add> $this->_host = (string)$args->getOption('host'); <ide> } <del> if ($this->args->getOption('port')) { <del> $this->_port = (int)$this->args->getOption('port'); <add> if ($args->getOption('port')) { <add> $this->_port = (int)$args->getOption('port'); <ide> } <del> if ($this->args->getOption('document_root')) { <del> $this->_documentRoot = (string)$this->args->getOption('document_root'); <add> if ($args->getOption('document_root')) { <add> $this->_documentRoot = (string)$args->getOption('document_root'); <ide> } <del> if ($this->args->getOption('ini_path')) { <del> $this->_iniPath = (string)$this->args->getOption('ini_path'); <add> if ($args->getOption('ini_path')) { <add> $this->_iniPath = (string)$args->getOption('ini_path'); <ide> } <ide> <ide> // For Windows <ide> protected function startup(): void <ide> $this->_iniPath = $m[1] . '\\' . $m[2]; <ide> } <ide> <del> $this->_welcome(); <del> } <del> <del> /** <del> * Displays a header for the command <del> * <del> * @return void <del> */ <del> protected function _welcome(): void <del> { <del> $this->io->out(); <del> $this->io->out(sprintf('<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version())); <del> $this->io->hr(); <del> $this->io->out(sprintf('App : %s', Configure::read('App.dir'))); <del> $this->io->out(sprintf('Path: %s', APP)); <del> $this->io->out(sprintf('DocumentRoot: %s', $this->_documentRoot)); <del> $this->io->out(sprintf('Ini Path: %s', $this->_iniPath)); <del> $this->io->hr(); <add> $io->out(); <add> $io->out(sprintf('<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version())); <add> $io->hr(); <add> $io->out(sprintf('App : %s', Configure::read('App.dir'))); <add> $io->out(sprintf('Path: %s', APP)); <add> $io->out(sprintf('DocumentRoot: %s', $this->_documentRoot)); <add> $io->out(sprintf('Ini Path: %s', $this->_iniPath)); <add> $io->hr(); <ide> } <ide> <ide> /** <ide> protected function _welcome(): void <ide> */ <ide> public function execute(Arguments $args, ConsoleIo $io): ?int <ide> { <del> $this->io = $io; <del> $this->args = $args; <del> $this->startup(); <add> $this->startup($args, $io); <ide> $command = sprintf( <ide> 'php -S %s:%d -t %s', <ide> $this->_host, <ide> public function execute(Arguments $args, ConsoleIo $io): ?int <ide> $command = sprintf('%s %s', $command, escapeshellarg($this->_documentRoot . '/index.php')); <ide> <ide> $port = ':' . $this->_port; <del> $this->io->out(sprintf('built-in server is running in http://%s%s/', $this->_host, $port)); <del> $this->io->out(sprintf('You can exit with <info>`CTRL-C`</info>')); <add> $io->out(sprintf('built-in server is running in http://%s%s/', $this->_host, $port)); <add> $io->out(sprintf('You can exit with <info>`CTRL-C`</info>')); <ide> system($command); <ide> <ide> return static::CODE_SUCCESS;
1
Ruby
Ruby
fix installation of local bottles
f1e4add444fa7ce4848a9b51c71f7a99d42ec796
<ide><path>Library/Homebrew/formula_installer.rb <ide> def pour_bottle?(output_warning: false) <ide> return false <ide> end <ide> <add> return true if formula.local_bottle_path.present? <add> <ide> bottle = formula.bottle_for_tag(Utils::Bottles.tag.to_sym) <ide> return false if bottle.nil? <ide>
1
Text
Text
fix a typo in readme
689dcc0851d437cf4cfe703bff2600609ee98d9e
<ide><path>README.md <ide> Seq is never used: <ide> .filter(x => x % 2).map(x => x * x); <ide> <ide> Once the Seq is used, it performs only the work necessary. In this <del>example, no intermediate arrays are ever created, filter is called three times <del>twice, and map is only called two times: <add>example, no intermediate arrays are ever created, filter is called three times, <add>and map is only called twice: <ide> <ide> console.log(oddSquares.get(1)); // 9 <ide>
1
Go
Go
remove the ghosts and kill everything
772ef99d2816b629d084e11fe7fba5953687b620
<ide><path>container.go <ide> type Container struct { <ide> HostsPath string <ide> Name string <ide> Driver string <add> ExecDriver string <ide> <ide> command *execdriver.Command <ide> stdout *utils.WriteBroadcaster <ide> func (container *Container) monitor(callback execdriver.StartCallback) error { <ide> exitCode int <ide> ) <ide> <del> if container.command == nil { <del> // This happends when you have a GHOST container with lxc <del> populateCommand(container) <del> err = container.runtime.RestoreCommand(container) <del> } else { <del> pipes := execdriver.NewPipes(container.stdin, container.stdout, container.stderr, container.Config.OpenStdin) <del> exitCode, err = container.runtime.Run(container, pipes, callback) <del> } <del> <add> pipes := execdriver.NewPipes(container.stdin, container.stdout, container.stderr, container.Config.OpenStdin) <add> exitCode, err = container.runtime.Run(container, pipes, callback) <ide> if err != nil { <ide> utils.Errorf("Error running container: %s", err) <ide> } <ide><path>execdriver/driver.go <ide> type TtyTerminal interface { <ide> type Driver interface { <ide> Run(c *Command, pipes *Pipes, startCallback StartCallback) (int, error) // Run executes the process and blocks until the process exits and returns the exit code <ide> Kill(c *Command, sig int) error <del> Restore(c *Command) error // Wait and try to re-attach on an out of process command <ide> Name() string // Driver name <ide> Info(id string) Info // "temporary" hack (until we move state from core to plugins) <ide> GetPidsForContainer(id string) ([]int, error) // Returns a list of pids for the given container. <ide><path>execdriver/lxc/driver.go <ide> func getExitCode(c *execdriver.Command) int { <ide> } <ide> <ide> func (d *driver) Kill(c *execdriver.Command, sig int) error { <del> return d.kill(c, sig) <del>} <del> <del>func (d *driver) Restore(c *execdriver.Command) error { <del> for { <del> output, err := exec.Command("lxc-info", "-n", c.ID).CombinedOutput() <del> if err != nil { <del> return err <del> } <del> if !strings.Contains(string(output), "RUNNING") { <del> return nil <del> } <del> time.Sleep(500 * time.Millisecond) <del> } <add> return KillLxc(c.ID, sig) <ide> } <ide> <ide> func (d *driver) version() string { <ide> func (d *driver) version() string { <ide> return version <ide> } <ide> <del>func (d *driver) kill(c *execdriver.Command, sig int) error { <add>func KillLxc(id string, sig int) error { <ide> var ( <ide> err error <ide> output []byte <ide> ) <ide> _, err = exec.LookPath("lxc-kill") <ide> if err == nil { <del> output, err = exec.Command("lxc-kill", "-n", c.ID, strconv.Itoa(sig)).CombinedOutput() <add> output, err = exec.Command("lxc-kill", "-n", id, strconv.Itoa(sig)).CombinedOutput() <ide> } else { <del> output, err = exec.Command("lxc-stop", "-k", "-n", c.ID, strconv.Itoa(sig)).CombinedOutput() <add> output, err = exec.Command("lxc-stop", "-k", "-n", id, strconv.Itoa(sig)).CombinedOutput() <ide> } <ide> if err != nil { <ide> return fmt.Errorf("Err: %s Output: %s", err, output) <ide><path>execdriver/native/driver.go <ide> import ( <ide> "strconv" <ide> "strings" <ide> "syscall" <del> "time" <ide> ) <ide> <ide> const ( <ide> func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <ide> } <ide> <ide> func (d *driver) Kill(p *execdriver.Command, sig int) error { <del> return syscall.Kill(p.Process.Pid, syscall.Signal(sig)) <del>} <del> <del>func (d *driver) Restore(c *execdriver.Command) error { <del> var nspid int <del> f, err := os.Open(filepath.Join(d.root, c.ID, "pid")) <del> if err != nil { <del> return err <del> } <del> defer d.removeContainerRoot(c.ID) <del> <del> if _, err := fmt.Fscanf(f, "%d", &nspid); err != nil { <del> f.Close() <del> return err <del> } <del> f.Close() <del> <del> if _, err := os.FindProcess(nspid); err != nil { <del> return fmt.Errorf("finding existing pid %d %s", nspid, err) <del> } <del> c.Process = &os.Process{ <del> Pid: nspid, <del> } <del> ticker := time.NewTicker(500 * time.Millisecond) <del> defer ticker.Stop() <del> <del> for _ = range ticker.C { <del> if err := syscall.Kill(nspid, 0); err != nil { <del> if strings.Contains(err.Error(), "no such process") { <del> return nil <del> } <del> return fmt.Errorf("signal error %s", err) <del> } <del> } <del> return nil <add> err := syscall.Kill(p.Process.Pid, syscall.Signal(sig)) <add> d.removeContainerRoot(p.ID) <add> return err <ide> } <ide> <ide> func (d *driver) Info(id string) execdriver.Info { <ide><path>integration/runtime_test.go <ide> func TestRestore(t *testing.T) { <ide> container2.State.SetStopped(0) <ide> } <ide> <del>func TestReloadContainerLinks(t *testing.T) { <del> root, err := newTestDirectory(unitTestStoreBase) <del> if err != nil { <del> t.Fatal(err) <del> } <del> // FIXME: here we don't use NewTestEngine because it calls initserver with Autorestart=false, <del> // and we want to set it to true. <del> <del> eng := newTestEngine(t, true, root) <del> <del> runtime1 := mkRuntimeFromEngine(eng, t) <del> defer nuke(runtime1) <del> // Create a container with one instance of docker <del> container1, _, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/sh"}, t) <del> defer runtime1.Destroy(container1) <del> <del> // Create a second container meant to be killed <del> container2, _, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/cat"}, t) <del> defer runtime1.Destroy(container2) <del> <del> // Start the container non blocking <del> if err := container2.Start(); err != nil { <del> t.Fatal(err) <del> } <del> // Add a link to container 2 <del> // FIXME @shykes: setting hostConfig.Links seems redundant with calling RegisterLink(). <del> // Why do we need it @crosbymichael? <del> // container1.hostConfig.Links = []string{"/" + container2.ID + ":first"} <del> if err := runtime1.RegisterLink(container1, container2, "first"); err != nil { <del> t.Fatal(err) <del> } <del> if err := container1.Start(); err != nil { <del> t.Fatal(err) <del> } <del> <del> if !container2.State.IsRunning() { <del> t.Fatalf("Container %v should appear as running but isn't", container2.ID) <del> } <del> <del> if !container1.State.IsRunning() { <del> t.Fatalf("Container %s should appear as running but isn't", container1.ID) <del> } <del> <del> if len(runtime1.List()) != 2 { <del> t.Errorf("Expected 2 container, %v found", len(runtime1.List())) <del> } <del> <del> // Here are are simulating a docker restart - that is, reloading all containers <del> // from scratch <del> eng = newTestEngine(t, false, root) <del> runtime2 := mkRuntimeFromEngine(eng, t) <del> if len(runtime2.List()) != 2 { <del> t.Errorf("Expected 2 container, %v found", len(runtime2.List())) <del> } <del> runningCount := 0 <del> for _, c := range runtime2.List() { <del> if c.State.IsRunning() { <del> runningCount++ <del> } <del> } <del> if runningCount != 2 { <del> t.Fatalf("Expected 2 container alive, %d found", runningCount) <del> } <del> <del> // FIXME: we no longer test if containers were registered in the right order, <del> // because there is no public <del> // Make sure container 2 ( the child of container 1 ) was registered and started first <del> // with the runtime <del> // <del> containers := runtime2.List() <del> if len(containers) == 0 { <del> t.Fatalf("Runtime has no containers") <del> } <del> first := containers[0] <del> if first.ID != container2.ID { <del> t.Fatalf("Container 2 %s should be registered first in the runtime", container2.ID) <del> } <del> <del> // Verify that the link is still registered in the runtime <del> if c := runtime2.Get(container1.Name); c == nil { <del> t.Fatal("Named container is no longer registered after restart") <del> } <del>} <del> <ide> func TestDefaultContainerName(t *testing.T) { <ide> eng := NewTestEngine(t) <ide> runtime := mkRuntimeFromEngine(eng, t) <ide><path>pkg/libcontainer/nsinit/init.go <ide> func (ns *linuxNs) Init(container *libcontainer.Container, uncleanRootfs, consol <ide> return fmt.Errorf("setctty %s", err) <ide> } <ide> } <del> <del> /* this is commented out so that we get the current Ghost functionality <del> if err := system.ParentDeathSignal(); err != nil { <del> return fmt.Errorf("parent death signal %s", err) <del> } <add> /* <add> if err := system.ParentDeathSignal(); err != nil { <add> return fmt.Errorf("parent death signal %s", err) <add> } <ide> */ <del> <ide> if err := setupNewMountNamespace(rootfs, console, container.ReadonlyFs); err != nil { <ide> return fmt.Errorf("setup mount namespace %s", err) <ide> } <del> <ide> if err := setupNetwork(container, context); err != nil { <ide> return fmt.Errorf("setup networking %s", err) <ide> } <ide><path>runtime.go <ide> func (runtime *Runtime) Register(container *Container) error { <ide> // if so, then we need to restart monitor and init a new lock <ide> // If the container is supposed to be running, make sure of it <ide> if container.State.IsRunning() { <del> info := runtime.execDriver.Info(container.ID) <add> if container.State.IsGhost() { <add> utils.Debugf("killing ghost %s", container.ID) <add> <add> existingPid := container.State.Pid <add> container.State.SetGhost(false) <add> container.State.SetStopped(0) <ide> <add> if container.ExecDriver == "" || strings.Contains(container.ExecDriver, "lxc") { <add> lxc.KillLxc(container.ID, 9) <add> } else { <add> command := &execdriver.Command{ <add> ID: container.ID, <add> } <add> command.Process = &os.Process{Pid: existingPid} <add> runtime.execDriver.Kill(command, 9) <add> } <add> // ensure that the filesystem is also unmounted <add> unmountVolumesForContainer(container) <add> if err := container.Unmount(); err != nil { <add> utils.Debugf("ghost unmount error %s", err) <add> } <add> } <add> <add> info := runtime.execDriver.Info(container.ID) <ide> if !info.IsRunning() { <ide> utils.Debugf("Container %s was supposed to be running but is not.", container.ID) <ide> if runtime.config.AutoRestart { <ide> utils.Debugf("Restarting") <add> unmountVolumesForContainer(container) <add> if err := container.Unmount(); err != nil { <add> utils.Debugf("restart unmount error %s", err) <add> } <add> <ide> container.State.SetGhost(false) <ide> container.State.SetStopped(0) <ide> if err := container.Start(); err != nil { <ide> func (runtime *Runtime) Register(container *Container) error { <ide> return err <ide> } <ide> } <del> } else { <del> utils.Debugf("Reconnecting to container %v", container.ID) <del> <del> if err := container.allocateNetwork(); err != nil { <del> return err <del> } <del> <del> container.waitLock = make(chan struct{}) <del> go container.monitor(nil) <ide> } <ide> } else { <ide> // When the container is not running, we still initialize the waitLock <ide> func (runtime *Runtime) Create(config *runconfig.Config, name string) (*Containe <ide> NetworkSettings: &NetworkSettings{}, <ide> Name: name, <ide> Driver: runtime.driver.String(), <add> ExecDriver: runtime.execDriver.Name(), <ide> } <ide> container.root = runtime.containerRoot(container.ID) <ide> // Step 1: create the container directory. <ide> func (runtime *Runtime) Kill(c *Container, sig int) error { <ide> return runtime.execDriver.Kill(c.command, sig) <ide> } <ide> <del>func (runtime *Runtime) RestoreCommand(c *Container) error { <del> return runtime.execDriver.Restore(c.command) <del>} <del> <ide> // Nuke kills all containers then removes all content <ide> // from the content root, including images, volumes and <ide> // container filesystems.
7
Javascript
Javascript
improve test cases for more edge cases
61d508e9f21b0ec5b112a1fe0dc442b271e57d4b
<ide><path>test/configCases/loaders/issue-9053/a.js <del>module.exports = require("c.js!=!loader1!./b.js"); <ide><path>test/configCases/loaders/issue-9053/b.js <del>module.exports = "b"; <add>module.exports = ["b"]; <ide><path>test/configCases/loaders/issue-9053/c.js <add>module.exports = ["c"]; <ide><path>test/configCases/loaders/issue-9053/index.js <ide> it("should apply inline loaders before matchResource", function() { <del> var foo = require("./a"); <add> var foo = require("c.js!=!loader1!./b.js"); <ide> <del> expect(foo).toBe("d"); <add> expect(foo).toEqual(["b", "1", "2"]); <add>}); <add> <add>it("should apply config loaders before inline loaders", function() { <add> var foo = require("loader1!./c.js"); <add> <add> expect(foo).toEqual(["c", "2", "1"]); <add>}); <add> <add>it("should not apply config loaders when matchResource is used", function() { <add> var foo = require("d.js!=!loader1!./c.js"); <add> <add> expect(foo).toEqual(["c", "1", "3"]); <ide> }); <ide><path>test/configCases/loaders/issue-9053/node_modules/loader1.js <ide> module.exports = function(source) { <del> return "module.exports = \"c\";"; <add> return source + '\nmodule.exports.push("1");'; <ide> }; <ide><path>test/configCases/loaders/issue-9053/node_modules/loader2.js <ide> module.exports = function(source) { <del> return "module.exports = \"d\";"; <add> return source + '\nmodule.exports.push("2");'; <ide> }; <ide><path>test/configCases/loaders/issue-9053/node_modules/loader3.js <add>module.exports = function(source) { <add> return source + '\nmodule.exports.push("3");'; <add>}; <ide><path>test/configCases/loaders/issue-9053/webpack.config.js <ide> module.exports = { <ide> { <ide> test: /c\.js$/, <ide> use: ["loader2"] <add> }, <add> { <add> test: /d\.js$/, <add> use: ["loader3"] <ide> } <ide> ] <ide> }
8
Javascript
Javascript
improve readability on conditional assignment
8c5cbcba20dfccbd01c246984d985378dcc197b5
<ide><path>src/ng/filter/filters.js <ide> function dateFilter($locale) { <ide> format = format || 'mediumDate'; <ide> format = $locale.DATETIME_FORMATS[format] || format; <ide> if (isString(date)) { <del> if (NUMBER_STRING.test(date)) { <del> date = int(date); <del> } else { <del> date = jsonStringToDate(date); <del> } <add> date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date); <ide> } <ide> <ide> if (isNumber(date)) {
1
Go
Go
remove leading spaces of username when login
2687502ba4e3d3eb41b6da6b52de151ef5dca9a2
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) CmdLogin(args ...string) error { <ide> if username == "" { <ide> promptDefault("Username", authconfig.Username) <ide> username = readInput(cli.in, cli.out) <add> username = strings.Trim(username, " ") <ide> if username == "" { <ide> username = authconfig.Username <ide> }
1
Python
Python
fix infinite recursion with deepcopy on request
d507cd851c4b1185e3dc720de9ba6a642459d738
<ide><path>rest_framework/request.py <ide> def __getattr__(self, attr): <ide> to proxy it to the underlying HttpRequest object. <ide> """ <ide> try: <del> return getattr(self._request, attr) <add> _request = self.__getattribute__("_request") <add> return getattr(_request, attr) <ide> except AttributeError: <ide> return self.__getattribute__(attr) <ide> <ide><path>tests/test_request.py <ide> """ <ide> Tests for content parsing, and form-overloaded content parsing. <ide> """ <add>import copy <ide> import os.path <ide> import tempfile <ide> <ide> def test_duplicate_request_form_data_access(self): <ide> # ensure that request stream was consumed by form parser <ide> assert request.content_type.startswith('multipart/form-data') <ide> assert response.data == {'a': ['b']} <add> <add> <add>class TestDeepcopy(TestCase): <add> <add> def test_deepcopy_works(self): <add> request = Request(factory.get('/', secure=False)) <add> copy.deepcopy(request)
2
Python
Python
fix tests of ma.count return type
9592bfa7d29c238bc891be255a4a666b407a9e2f
<ide><path>numpy/ma/tests/test_core.py <ide> def test_basic_ufuncs(self): <ide> <ide> def test_count_func(self): <ide> # Tests count <del> ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0]) <del> ott1= array([0., 1., 2., 3.]) <del> if sys.version_info[0] >= 3: <del> self.assertTrue(isinstance(count(ott), np.integer)) <del> else: <del> self.assertTrue(isinstance(count(ott), int)) <del> assert_equal(3, count(ott)) <ide> assert_equal(1, count(1)) <ide> assert_equal(0, array(1, mask=[1])) <add> <add> ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0]) <add> res = count(ott) <add> self.assertTrue(res.dtype.type is np.intp) <add> assert_equal(3, res) <add> <ide> ott = ott.reshape((2, 2)) <del> assert_(isinstance(count(ott, 0), ndarray)) <del> if sys.version_info[0] >= 3: <del> assert_(isinstance(count(ott), np.integer)) <del> else: <del> assert_(isinstance(count(ott), int)) <del> assert_equal(3, count(ott)) <del> assert_(getmask(count(ott, 0)) is nomask) <del> assert_equal([1, 2], count(ott, 0)) <del> assert_equal(type(count(ott, 0)), type(count(ott1, 0))) <del> assert_equal(count(ott, 0).dtype, count(ott1, 0).dtype) <del> assert_raises(IndexError, ott1.count, 1) <add> res = count(ott) <add> assert_(res.dtype.type is np.intp) <add> assert_equal(3, res) <add> res = count(ott, 0) <add> assert_(isinstance(res, ndarray)) <add> assert_equal([1, 2], res) <add> assert_(getmask(res) is nomask) <add> <add> ott= array([0., 1., 2., 3.]) <add> res = count(ott, 0) <add> assert_(isinstance(res, ndarray)) <add> assert_(res.dtype.type is np.intp) <add> <add> assert_raises(IndexError, ott.count, 1) <ide> <ide> def test_minmax_func(self): <ide> # Tests minimum and maximum. <ide><path>numpy/ma/tests/test_old_ma.py <ide> def test_testUfuncs1(self): <ide> def test_xtestCount(self): <ide> # Test count <ide> ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0]) <del> if sys.version_info[0] >= 3: <del> self.assertTrue(isinstance(count(ott), np.integer)) <del> else: <del> self.assertTrue(isinstance(count(ott), int)) <add> self.assertTrue(count(ott).dtype.type is np.intp) <ide> self.assertEqual(3, count(ott)) <ide> self.assertEqual(1, count(1)) <ide> self.assertTrue(eq(0, array(1, mask=[1]))) <ide> ott = ott.reshape((2, 2)) <add> self.assertTrue(count(ott).dtype.type is np.intp) <ide> assert_(isinstance(count(ott, 0), np.ndarray)) <del> if sys.version_info[0] >= 3: <del> assert_(isinstance(count(ott), np.integer)) <del> else: <del> assert_(isinstance(count(ott), int)) <add> self.assertTrue(count(ott).dtype.type is np.intp) <ide> self.assertTrue(eq(3, count(ott))) <ide> assert_(getmask(count(ott, 0)) is nomask) <ide> self.assertTrue(eq([1, 2], count(ott, 0)))
2
Python
Python
fix tokenizer_exceptions in thai
2ea27d07f474332486db0a047999870f40ba37a4
<ide><path>spacy/lang/th/tokenizer_exceptions.py <ide> # encoding: utf8 <ide> from __future__ import unicode_literals <ide> <del>from ..symbols import * <del>from ..language_data import PRON_LEMMA <del> <add>from ...symbols import * <ide> <ide> TOKENIZER_EXCEPTIONS = { <ide> "ม.ค.": [ <ide> {ORTH: "ธ.ค.", LEMMA: "ธันวาคม"} <ide> ] <ide> } <del> <del> <del># exceptions mapped to a single token containing only ORTH property <del># example: {"string": [{ORTH: "string"}]} <del># converted using strings_to_exc() util <del>''' <del>ORTH_ONLY = [ <del> "a.", <del> "b.", <del> "c.", <del> "d.", <del> "e.", <del> "f.", <del> "g.", <del> "h.", <del> "i.", <del> "j.", <del> "k.", <del> "l.", <del> "m.", <del> "n.", <del> "o.", <del> "p.", <del> "q.", <del> "r.", <del> "s.", <del> "t.", <del> "u.", <del> "v.", <del> "w.", <del> "x.", <del> "y.", <del> "z." <del>] <del>''' <ide>\ No newline at end of file
1
Text
Text
fix wrong link in “splitting up reducer logic” doc
bf490bd1ff0278103c570276b330af8add6b301f
<ide><path>docs/recipes/reducers/02-SplittingReducerLogic.md <ide> For clarity, these terms will be used to distinguish between different types of <ide> The term "*sub-reducer*" has also been used in various discussions to mean any function that is not the root reducer, although the term is not very precise. Some people may also refer to some functions as "*business logic*" (functions that relate to application-specific behavior) or "*utility functions*" (generic functions that are not application-specific). <ide> <ide> <del>Breaking down a complex process into smaller, more understandable parts is usually described with the term ***[functional decomposition](http://stackoverflow.com/questions/947874/what-is-functional-decomposition)***. This term and concept can be applied generically to any code. However, in Redux it is *very* common to structure reducer logic using approach #3, where update logic is delegated to other functions based on slice of state. Redux refers to this concept as ***reducer composition***, and it is by far the most widely-used approach to structuring reducer logic. In fact, it's so common that Redux includes a utility function called [`combineReducers()`](../../api/combineReducers.md), which specifically abstracts the process of delegating work to other reducer functions based on slices of state. However, it's important to note that it is not the *only* pattern that can be used. In fact, it's entirely possible to use all three approaches for splitting up logic into functions, and usually a good idea as well. The [Refactoring Reducers](./03-RefactoringReducers.md) section shows some examples of this in action. <ide>\ No newline at end of file <add>Breaking down a complex process into smaller, more understandable parts is usually described with the term ***[functional decomposition](http://stackoverflow.com/questions/947874/what-is-functional-decomposition)***. This term and concept can be applied generically to any code. However, in Redux it is *very* common to structure reducer logic using approach #3, where update logic is delegated to other functions based on slice of state. Redux refers to this concept as ***reducer composition***, and it is by far the most widely-used approach to structuring reducer logic. In fact, it's so common that Redux includes a utility function called [`combineReducers()`](../../api/combineReducers.md), which specifically abstracts the process of delegating work to other reducer functions based on slices of state. However, it's important to note that it is not the *only* pattern that can be used. In fact, it's entirely possible to use all three approaches for splitting up logic into functions, and usually a good idea as well. The [Refactoring Reducers](./03-RefactoringReducersExample.md) section shows some examples of this in action.
1
PHP
PHP
extract key generation
6623996212b3d59aa31a374b70311f03fd158075
<ide><path>src/Illuminate/Encryption/Encrypter.php <ide> public static function supported($key, $cipher) <ide> ($cipher === 'AES-256-CBC' && $length === 32); <ide> } <ide> <add> /** <add> * Create a new encryption key for the given cipher. <add> * <add> * @param string $cipher <add> * @return string <add> */ <add> public static function generateKey($cipher) <add> { <add> return random_bytes($cipher == 'AES-128-CBC' ? 16 : 32); <add> } <add> <ide> /** <ide> * Encrypt the given value. <ide> * <ide><path>src/Illuminate/Foundation/Console/KeyGenerateCommand.php <ide> namespace Illuminate\Foundation\Console; <ide> <ide> use Illuminate\Console\Command; <add>use Illuminate\Encryption\Encrypter; <ide> use Illuminate\Console\ConfirmableTrait; <ide> <ide> class KeyGenerateCommand extends Command <ide> public function handle() <ide> */ <ide> protected function generateRandomKey() <ide> { <del> return 'base64:'.base64_encode(random_bytes( <del> $this->laravel['config']['app.cipher'] == 'AES-128-CBC' ? 16 : 32 <del> )); <add> return 'base64:'.base64_encode( <add> Encrypter::generateKey($this->laravel['config']['app.cipher']) <add> ); <ide> } <ide> <ide> /**
2
Javascript
Javascript
use language substrings
0933502521ac377b10270e4ac94a285ab533ac1b
<ide><path>moment.js <ide> } <ide> <ide> // compare two arrays, return the number of differences <del> function compareArrays(array1, array2) { <add> function compareArrays(array1, array2, dontConvert) { <ide> var len = Math.min(array1.length, array2.length), <ide> lengthDiff = Math.abs(array1.length - array2.length), <ide> diffs = 0, <ide> i; <ide> for (i = 0; i < len; i++) { <del> if (toInt(array1[i]) !== toInt(array2[i])) { <add> if ((dontConvert && array1[i] !== array2[i]) || <add> (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { <ide> diffs++; <ide> } <ide> } <ide> } <ide> <ide> function normalizeLanguage(key) { <del> return key.toLowerCase().replace('_', '-'); <add> return key ? key.toLowerCase().replace('_', '-') : key; <ide> } <ide> <ide> /************************************ <ide> // definition for 'en', so long as 'en' has already been loaded using <ide> // moment.lang. <ide> function getLangDefinition(key) { <del> var i, lang, <add> var i = 0, j, lang, next, split, <ide> get = function (k) { <del> k = normalizeLanguage(k); <ide> if (!languages[k] && hasModule) { <ide> try { <ide> require('./lang/' + k); <ide> return languages[k]; <ide> }; <ide> <del> if (isArray(key)) { <del> for (i in key) { <del> lang = get(key[i]); <add> if (!key) { <add> return moment.fn._lang; <add> } <add> <add> if (!isArray(key)) { <add> //short-circuit everything else <add> lang = get(key); <add> if (lang) { <add> return lang; <add> } <add> key = [key]; <add> } <add> <add> while (i < key.length) { <add> split = normalizeLanguage(key[i]).split('-'); <add> j = split.length; <add> next = normalizeLanguage(key[i + 1]); <add> next = next ? next.split('-') : null; <add> while (j > 0) { <add> lang = get(split.slice(0, j).join('-')); <ide> if (lang) { <ide> return lang; <ide> } <add> if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { <add> //the next array item is better than a shallower substring of this one <add> break; <add> } <add> j--; <ide> } <add> i++; <ide> } <del> else if (key) { <del> return get(key) || moment.fn._lang; <del> } <del> <ide> return moment.fn._lang; <ide> } <ide> <del> <ide> /************************************ <ide> Formatting <ide> ************************************/ <ide><path>test/moment/lang.js <ide> exports.lang = { <ide> test.done(); <ide> }, <ide> <add> "library getter language substrings" : function (test) { <add> test.equal(moment.lang('fr-crap'), 'fr', "use substrings"); <add> test.equal(moment.lang('fr-does-not-exist'), 'fr', "uses deep substrings"); <add> test.equal(moment.lang('fr-CA-does-not-exist'), 'fr-ca', "uses deepest substring"); <add> test.done(); <add> }, <add> <add> "library getter language array and substrings" : function (test) { <add> test.equal(moment.lang(['en-CH', 'fr']), 'en', "prefer root languages to shallower ones"); <add> test.equal(moment.lang(['en-gb-leeds', 'en-CA']), 'en-gb', "prefer root languages to shallower ones"); <add> test.equal(moment.lang(['en-CH', 'en-CA']), 'en-ca', "prefer alternatives with shared roots"); <add> test.equals(moment.lang(['fake-CA', 'fake-MX', 'fr']), 'fr', "always find something if possible"); <add> test.equals(moment.lang(['fake-CA', 'fake-MX', 'fr']), 'fr', "always find something if possible"); <add> test.equals(moment.lang(['fake-CA', 'fake-MX', 'fr-fake-fake-fake']), 'fr', "always find something if possible"); <add> test.done(); <add> }, <add> <ide> "library ensure inheritance" : function (test) { <ide> test.expect(2); <ide> <ide> exports.lang = { <ide> test.done(); <ide> }, <ide> <add> "instance getter language substrings" : function (test) { <add> var m = moment(); <add> <add> m.lang('fr-crap'); <add> test.equal(m.lang()._abbr, 'fr', "use substrings"); <add> <add> m.lang('fr-does-not-exist'); <add> test.equal(m.lang()._abbr, 'fr', "uses deep substrings"); <add> <add> test.done(); <add> }, <add> <ide> "instance lang persists with manipulation" : function (test) { <ide> test.expect(3); <ide> moment.lang('en');
2
Javascript
Javascript
use farthest verts on frustum
933f7f0c6b64975795a770f63134f6f049841ae6
<ide><path>examples/jsm/csm/CSM.js <ide> export default class CSM { <ide> _cameraToLightMatrix.multiplyMatrices( light.shadow.camera.matrixWorldInverse, cameraMatrix ); <ide> frustums[ i ].toSpace( _cameraToLightMatrix, _lightSpaceFrustum ); <ide> <del> const farTopRight = _lightSpaceFrustum.vertices.far[ 0 ]; <del> const nearBotLeft = _lightSpaceFrustum.vertices.near[ 2 ]; <del> let squaredBBWidth = farTopRight.distanceTo( nearBotLeft ); <add> // Get the two points that represent that furthest points on the frustum assuming <add> // that's either the diagonal across the far plane or the diagonal across the whole <add> // frustum itself. <add> const nearVerts = _lightSpaceFrustum.vertices.near; <add> const farVerts = _lightSpaceFrustum.vertices.far; <add> const point1 = farVerts[ 0 ]; <add> let point2; <add> if ( point1.distanceTo( farVerts[ 2 ] ) > point1.distanceTo( nearVerts[ 2 ] ) ) { <ide> <add> point2 = farVerts[ 2 ]; <add> <add> } else { <add> <add> point2 = nearVerts[ 2 ]; <add> <add> } <add> <add> let squaredBBWidth = point1.distanceTo( point2 ); <ide> _bbox.makeEmpty(); <ide> for ( let j = 0; j < 4; j ++ ) { <ide> <del> _bbox.expandByPoint( _lightSpaceFrustum.vertices.near[ j ] ); <del> _bbox.expandByPoint( _lightSpaceFrustum.vertices.far[ j ] ); <add> _bbox.expandByPoint( nearVerts[ j ] ); <add> _bbox.expandByPoint( farVerts[ j ] ); <ide> <ide> } <ide>
1
Javascript
Javascript
use more es6 syntax in `src/core/annotation.js`
2866c8a39e01d2ce42dfa42ac324453b60cd8c54
<ide><path>src/core/annotation.js <ide> class AnnotationFactory { <ide> * @private <ide> */ <ide> static _create(xref, ref, pdfManager, idFactory) { <del> let dict = xref.fetchIfRef(ref); <add> const dict = xref.fetchIfRef(ref); <ide> if (!isDict(dict)) { <ide> return undefined; <ide> } <del> let id = isRef(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`; <add> const id = isRef(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`; <ide> <ide> // Determine the annotation's subtype. <ide> let subtype = dict.get('Subtype'); <ide> subtype = isName(subtype) ? subtype.name : null; <ide> <ide> // Return the right annotation object based on the subtype and field type. <del> let parameters = { <add> const parameters = { <ide> xref, <ide> dict, <ide> subtype, <ide> function getQuadPoints(dict, rect) { <ide> <ide> function getTransformMatrix(rect, bbox, matrix) { <ide> // 12.5.5: Algorithm: Appearance streams <del> let bounds = Util.getAxialAlignedBoundingBox(bbox, matrix); <del> let minX = bounds[0]; <del> let minY = bounds[1]; <del> let maxX = bounds[2]; <del> let maxY = bounds[3]; <del> <add> const [minX, minY, maxX, maxY] = <add> Util.getAxialAlignedBoundingBox(bbox, matrix); <ide> if (minX === maxX || minY === maxY) { <ide> // From real-life file, bbox was [0, 0, 0, 0]. In this case, <ide> // just apply the transform for rect <ide> return [1, 0, 0, 1, rect[0], rect[1]]; <ide> } <ide> <del> let xRatio = (rect[2] - rect[0]) / (maxX - minX); <del> let yRatio = (rect[3] - rect[1]) / (maxY - minY); <add> const xRatio = (rect[2] - rect[0]) / (maxX - minX); <add> const yRatio = (rect[3] - rect[1]) / (maxY - minY); <ide> return [ <ide> xRatio, <ide> 0, <ide> class Annotation { <ide> * 4 (CMYK) elements <ide> */ <ide> setColor(color) { <del> let rgbColor = new Uint8ClampedArray(3); <add> const rgbColor = new Uint8ClampedArray(3); <ide> if (!Array.isArray(color)) { <ide> this.color = rgbColor; <ide> return; <ide> class Annotation { <ide> return; <ide> } <ide> if (borderStyle.has('BS')) { <del> let dict = borderStyle.get('BS'); <del> let dictType = dict.get('Type'); <add> const dict = borderStyle.get('BS'); <add> const dictType = dict.get('Type'); <ide> <ide> if (!dictType || isName(dictType, 'Border')) { <ide> this.borderStyle.setWidth(dict.get('W'), this.rectangle); <ide> this.borderStyle.setStyle(dict.get('S')); <ide> this.borderStyle.setDashArray(dict.getArray('D')); <ide> } <ide> } else if (borderStyle.has('Border')) { <del> let array = borderStyle.getArray('Border'); <add> const array = borderStyle.getArray('Border'); <ide> if (Array.isArray(array) && array.length >= 3) { <ide> this.borderStyle.setHorizontalCornerRadius(array[0]); <ide> this.borderStyle.setVerticalCornerRadius(array[1]); <ide> class Annotation { <ide> setAppearance(dict) { <ide> this.appearance = null; <ide> <del> let appearanceStates = dict.get('AP'); <add> const appearanceStates = dict.get('AP'); <ide> if (!isDict(appearanceStates)) { <ide> return; <ide> } <ide> <ide> // In case the normal appearance is a stream, then it is used directly. <del> let normalAppearanceState = appearanceStates.get('N'); <add> const normalAppearanceState = appearanceStates.get('N'); <ide> if (isStream(normalAppearanceState)) { <ide> this.appearance = normalAppearanceState; <ide> return; <ide> class Annotation { <ide> <ide> // In case the normal appearance is a dictionary, the `AS` entry provides <ide> // the key of the stream in this dictionary. <del> let as = dict.get('AS'); <add> const as = dict.get('AS'); <ide> if (!isName(as) || !normalAppearanceState.has(as.name)) { <ide> return; <ide> } <ide> class Annotation { <ide> if (!resources) { <ide> return undefined; <ide> } <del> let objectLoader = new ObjectLoader(resources, keys, resources.xref); <ide> <add> const objectLoader = new ObjectLoader(resources, keys, resources.xref); <ide> return objectLoader.load().then(function() { <ide> return resources; <ide> }); <ide> class Annotation { <ide> return Promise.resolve(new OperatorList()); <ide> } <ide> <del> let data = this.data; <del> let appearanceDict = this.appearance.dict; <del> let resourcesPromise = this.loadResources([ <add> const data = this.data; <add> const appearanceDict = this.appearance.dict; <add> const resourcesPromise = this.loadResources([ <ide> 'ExtGState', <ide> 'ColorSpace', <ide> 'Pattern', <ide> 'Shading', <ide> 'XObject', <ide> 'Font', <del> // ProcSet <del> // Properties <ide> ]); <del> let bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1]; <del> let matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0]; <del> let transform = getTransformMatrix(data.rect, bbox, matrix); <add> const bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1]; <add> const matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0]; <add> const transform = getTransformMatrix(data.rect, bbox, matrix); <ide> <ide> return resourcesPromise.then((resources) => { <del> let opList = new OperatorList(); <add> const opList = new OperatorList(); <ide> opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]); <ide> return evaluator.getOperatorList({ <ide> stream: this.appearance, <ide> class AnnotationBorderStyle { <ide> // shall be numbers that are nonnegative and not all equal to zero. <ide> let isValid = true; <ide> let allZeros = true; <del> for (let i = 0, len = dashArray.length; i < len; i++) { <del> let element = dashArray[i]; <del> let validNumber = (+element >= 0); <add> for (const element of dashArray) { <add> const validNumber = (+element >= 0); <ide> if (!validNumber) { <ide> isValid = false; <ide> break; <ide> class WidgetAnnotation extends Annotation { <ide> constructor(params) { <ide> super(params); <ide> <del> let dict = params.dict; <del> let data = this.data; <add> const dict = params.dict; <add> const data = this.data; <ide> <ide> data.annotationType = AnnotationType.WIDGET; <ide> data.fieldName = this._constructFieldName(dict); <ide> data.fieldValue = getInheritableProperty({ dict, key: 'V', <ide> getArray: true, }); <ide> data.alternativeText = stringToPDFString(dict.get('TU') || ''); <ide> data.defaultAppearance = getInheritableProperty({ dict, key: 'DA', }) || ''; <del> let fieldType = getInheritableProperty({ dict, key: 'FT', }); <add> const fieldType = getInheritableProperty({ dict, key: 'FT', }); <ide> data.fieldType = isName(fieldType) ? fieldType.name : null; <ide> this.fieldResources = getInheritableProperty({ dict, key: 'DR', }) || <ide> Dict.empty; <ide> class WidgetAnnotation extends Annotation { <ide> <ide> // Form the fully qualified field name by appending the partial name to <ide> // the parent's fully qualified name, separated by a period. <del> let fieldName = []; <add> const fieldName = []; <ide> if (dict.has('T')) { <ide> fieldName.unshift(stringToPDFString(dict.get('T'))); <ide> } <ide> class TextWidgetAnnotation extends WidgetAnnotation { <ide> return super.getOperatorList(evaluator, task, renderForms); <ide> } <ide> <del> let operatorList = new OperatorList(); <add> const operatorList = new OperatorList(); <ide> <ide> // Even if there is an appearance stream, ignore it. This is the <ide> // behaviour used by Adobe Reader. <ide> if (!this.data.defaultAppearance) { <ide> return Promise.resolve(operatorList); <ide> } <ide> <del> let stream = new Stream(stringToBytes(this.data.defaultAppearance)); <add> const stream = new Stream(stringToBytes(this.data.defaultAppearance)); <ide> return evaluator.getOperatorList({ <ide> stream, <ide> task, <ide> class ButtonWidgetAnnotation extends WidgetAnnotation { <ide> <ide> // The parent field's `V` entry holds a `Name` object with the appearance <ide> // state of whichever child field is currently in the "on" state. <del> let fieldParent = params.dict.get('Parent'); <add> const fieldParent = params.dict.get('Parent'); <ide> if (isDict(fieldParent) && fieldParent.has('V')) { <del> let fieldParentValue = fieldParent.get('V'); <add> const fieldParentValue = fieldParent.get('V'); <ide> if (isName(fieldParentValue)) { <ide> this.data.fieldValue = fieldParentValue.name; <ide> } <ide> } <ide> <ide> // The button's value corresponds to its appearance state. <del> let appearanceStates = params.dict.get('AP'); <add> const appearanceStates = params.dict.get('AP'); <ide> if (!isDict(appearanceStates)) { <ide> return; <ide> } <del> let normalAppearanceState = appearanceStates.get('N'); <add> const normalAppearanceState = appearanceStates.get('N'); <ide> if (!isDict(normalAppearanceState)) { <ide> return; <ide> } <del> let keys = normalAppearanceState.getKeys(); <del> for (let i = 0, ii = keys.length; i < ii; i++) { <del> if (keys[i] !== 'Off') { <del> this.data.buttonValue = keys[i]; <add> for (const key of normalAppearanceState.getKeys()) { <add> if (key !== 'Off') { <add> this.data.buttonValue = key; <ide> break; <ide> } <ide> } <ide> class ChoiceWidgetAnnotation extends WidgetAnnotation { <ide> // inherit the options from a parent annotation (issue 8094). <ide> this.data.options = []; <ide> <del> let options = getInheritableProperty({ dict: params.dict, key: 'Opt', }); <add> const options = getInheritableProperty({ dict: params.dict, key: 'Opt', }); <ide> if (Array.isArray(options)) { <del> let xref = params.xref; <add> const xref = params.xref; <ide> for (let i = 0, ii = options.length; i < ii; i++) { <ide> let option = xref.fetchIfRef(options[i]); <ide> let isOptionArray = Array.isArray(option); <ide> class PopupAnnotation extends Annotation { <ide> <ide> this.data.annotationType = AnnotationType.POPUP; <ide> <del> let dict = parameters.dict; <del> let parentItem = dict.get('Parent'); <add> let parentItem = parameters.dict.get('Parent'); <ide> if (!parentItem) { <ide> warn('Popup annotation has a missing or invalid parent annotation.'); <ide> return; <ide> } <ide> <del> let parentSubtype = parentItem.get('Subtype'); <add> const parentSubtype = parentItem.get('Subtype'); <ide> this.data.parentType = isName(parentSubtype) ? parentSubtype.name : null; <del> const rawParent = dict.getRaw('Parent'); <add> const rawParent = parameters.dict.getRaw('Parent'); <ide> this.data.parentId = isRef(rawParent) ? rawParent.toString() : null; <ide> <ide> const rt = parentItem.get('RT'); <ide> class PopupAnnotation extends Annotation { <ide> // that is most likely a bug. Fallback to inherit the flags from the parent <ide> // annotation (this is consistent with the behaviour in Adobe Reader). <ide> if (!this.viewable) { <del> let parentFlags = parentItem.get('F'); <add> const parentFlags = parentItem.get('F'); <ide> if (this._isViewable(parentFlags)) { <ide> this.setFlags(parentFlags); <ide> } <ide> class LineAnnotation extends MarkupAnnotation { <ide> <ide> this.data.annotationType = AnnotationType.LINE; <ide> <del> let dict = parameters.dict; <del> this.data.lineCoordinates = Util.normalizeRect(dict.getArray('L')); <add> this.data.lineCoordinates = <add> Util.normalizeRect(parameters.dict.getArray('L')); <ide> } <ide> } <ide> <ide> class PolylineAnnotation extends MarkupAnnotation { <ide> // The vertices array is an array of numbers representing the alternating <ide> // horizontal and vertical coordinates, respectively, of each vertex. <ide> // Convert this to an array of objects with x and y coordinates. <del> let dict = parameters.dict; <del> let rawVertices = dict.getArray('Vertices'); <del> <add> const rawVertices = parameters.dict.getArray('Vertices'); <ide> this.data.vertices = []; <ide> for (let i = 0, ii = rawVertices.length; i < ii; i += 2) { <ide> this.data.vertices.push({ <ide> class InkAnnotation extends MarkupAnnotation { <ide> <ide> this.data.annotationType = AnnotationType.INK; <ide> <del> let dict = parameters.dict; <ide> const xref = parameters.xref; <del> <del> let originalInkLists = dict.getArray('InkList'); <add> const originalInkLists = parameters.dict.getArray('InkList'); <ide> this.data.inkLists = []; <ide> for (let i = 0, ii = originalInkLists.length; i < ii; ++i) { <ide> // The raw ink lists array contains arrays of numbers representing <ide> class FileAttachmentAnnotation extends MarkupAnnotation { <ide> constructor(parameters) { <ide> super(parameters); <ide> <del> let file = new FileSpec(parameters.dict.get('FS'), parameters.xref); <add> const file = new FileSpec(parameters.dict.get('FS'), parameters.xref); <ide> <ide> this.data.annotationType = AnnotationType.FILEATTACHMENT; <ide> this.data.file = file.serializable;
1
Text
Text
add immer link
4600cd2dd46b1b585b2fd6e44478baf4682b5f05
<ide><path>docs/introduction/Ecosystem.md <ide> const obj3 = icepicke.merge(obj1, obj2); <ide> <ide> #### Immutable Update Utilities <ide> <add> <add>**[mweststrate/immer](https://github.com/mweststrate/immer)** <add>Immutable updates with normal mutative code, using Proxies <add>```js <add>const nextState = produce(baseState, draftState => { <add> draftState.push({ todo: "Tweet about it" }) <add> draftState[1].done = true <add>}) <add>``` <add> <ide> **[kolodny/immutability-helper]()** <ide> A drop-in replacement for react-addons-update <ide> ```js <ide> const newData = update(myData, { <ide> **[mariocasciaro/object-path-immutable]()** <ide> Simpler alternative to immutability-helpers and Immutable.js <ide> ```js <del>const newObj = immutable(obj) <del> .set('a.b', 'f') <del> .del(['a', 'c', 0]) <del> .value() <add>const newObj = immutable(obj).set('a.b', 'f').del(['a', 'c', 0]).value() <ide> ``` <ide> <ide> <del> <ide> **[debitoor/dot-prop-immutable]()** <ide> Immutable version of the dot-prop lib, with some extensions <ide> ```js <ide> const newState = dotProp.set(state, `todos.${index}.complete`, true) <ide> const endOfArray = dotProp.get(obj, 'foo.$end') <ide> ``` <ide> <del>**[hex13/transmutable]()** <del>Immutable updates with normal mutative code, using Proxies <del>```js <del>const copy = transform(foo, stage => { <del> stage.bar.baz = 123; <del>}); <del>``` <ide> <ide> #### Immutable/Redux Interop <ide>
1
Go
Go
move getlongpathname to integration-cli
ad371893f22ae7b13e34fb6630387347dd834eb3
<ide><path>integration-cli/docker_cli_build_test.go <ide> import ( <ide> "github.com/docker/docker/integration-cli/cli" <ide> "github.com/docker/docker/integration-cli/cli/build" <ide> "github.com/docker/docker/pkg/archive" <del> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/testutil" <ide> "github.com/docker/docker/testutil/fakecontext" <ide> "github.com/docker/docker/testutil/fakegit" <ide> func (s *DockerCLIBuildSuite) TestBuildSymlinkBreakout(c *testing.T) { <ide> assert.NilError(c, err) <ide> <ide> // See https://github.com/moby/moby/pull/37770 for reason for next line. <del> tmpdir, err = system.GetLongPathName(tmpdir) <add> tmpdir, err = getLongPathName(tmpdir) <ide> assert.NilError(c, err) <ide> <ide> defer os.RemoveAll(tmpdir) <ide><path>integration-cli/utils_unix_test.go <add>//go:build !windows <add>// +build !windows <add> <add>package main <add> <add>// getLongPathName converts Windows short pathnames to full pathnames. <add>// For example C:\Users\ADMIN~1 --> C:\Users\Administrator. <add>// It is a no-op on non-Windows platforms <add>func getLongPathName(path string) (string, error) { <add> return path, nil <add>} <ide><path>integration-cli/utils_windows_test.go <add>package main <add> <add>import "golang.org/x/sys/windows" <add> <add>// getLongPathName converts Windows short pathnames to full pathnames. <add>// For example C:\Users\ADMIN~1 --> C:\Users\Administrator. <add>// It is a no-op on non-Windows platforms <add>func getLongPathName(path string) (string, error) { <add> // See https://groups.google.com/forum/#!topic/golang-dev/1tufzkruoTg <add> p, err := windows.UTF16FromString(path) <add> if err != nil { <add> return "", err <add> } <add> b := p // GetLongPathName says we can reuse buffer <add> n, err := windows.GetLongPathName(&p[0], &b[0], uint32(len(b))) <add> if err != nil { <add> return "", err <add> } <add> if n > uint32(len(b)) { <add> b = make([]uint16, n) <add> _, err = windows.GetLongPathName(&p[0], &b[0], uint32(len(b))) <add> if err != nil { <add> return "", err <add> } <add> } <add> return windows.UTF16ToString(b), nil <add>} <ide><path>pkg/system/path_unix.go <ide> <ide> package system // import "github.com/docker/docker/pkg/system" <ide> <del>// GetLongPathName converts Windows short pathnames to full pathnames. <del>// For example C:\Users\ADMIN~1 --> C:\Users\Administrator. <del>// It is a no-op on non-Windows platforms <del>func GetLongPathName(path string) (string, error) { <del> return path, nil <del>} <del> <ide> // checkSystemDriveAndRemoveDriveLetter is the non-Windows implementation <ide> // of CheckSystemDriveAndRemoveDriveLetter <ide> func checkSystemDriveAndRemoveDriveLetter(path string) (string, error) { <ide><path>pkg/system/path_windows.go <ide> import ( <ide> "fmt" <ide> "path/filepath" <ide> "strings" <del> <del> "golang.org/x/sys/windows" <ide> ) <ide> <del>// GetLongPathName converts Windows short pathnames to full pathnames. <del>// For example C:\Users\ADMIN~1 --> C:\Users\Administrator. <del>// It is a no-op on non-Windows platforms <del>func GetLongPathName(path string) (string, error) { <del> // See https://groups.google.com/forum/#!topic/golang-dev/1tufzkruoTg <del> p, err := windows.UTF16FromString(path) <del> if err != nil { <del> return "", err <del> } <del> b := p // GetLongPathName says we can reuse buffer <del> n, err := windows.GetLongPathName(&p[0], &b[0], uint32(len(b))) <del> if err != nil { <del> return "", err <del> } <del> if n > uint32(len(b)) { <del> b = make([]uint16, n) <del> _, err = windows.GetLongPathName(&p[0], &b[0], uint32(len(b))) <del> if err != nil { <del> return "", err <del> } <del> } <del> return windows.UTF16ToString(b), nil <del>} <del> <ide> // checkSystemDriveAndRemoveDriveLetter is the Windows implementation <ide> // of CheckSystemDriveAndRemoveDriveLetter <ide> func checkSystemDriveAndRemoveDriveLetter(path string) (string, error) {
5
Text
Text
add example for ## a word on 'scope'
dbc6c05166c7cda310484175779cb1040205f0d9
<ide><path>guide/english/c/functions/index.md <ide> With that, the conditions for a being greater than b, and b being greater than a <ide> ## A word on 'scope' <ide> Scope is a thing to be aware of. It refers to the areas in your code where a variable is accessible. When you pass a variable to a function, the function gets its own copy to use. This means that adjusting the variable in the function will not adjust it anywhere else. Similarly, if you haven't passed a variable to a function, it doesn't have it and can't use it. <ide> <add>One of the ways to change value outside of function is using &: <add>```C <add>//After calling the function, the s value outside of the function will be updated <add>void sumOfTwoNums(int a, int b, int &s) { <add> s = a + b; <add>} <add>``` <add> <ide> You may have observed a similar issue with things like if statements and any of the loops. If you declare a variable within brackets, it won't be accessible outside of those brackets. This is true for functions in the same way, but there are some ways to get around it: <ide> * Make a global variable by declaring it outside of any functions <ide> * This makes your code messier and is generally not recommended. It should be avoided whenever possible
1
Java
Java
add websocketclient and websocketconnectionmanager
2046629945d288944b13401958f5d27e04bbe835
<ide><path>spring-websocket/src/main/java/org/springframework/websocket/HandlerProvider.java <ide> package org.springframework.websocket; <ide> <ide> import org.apache.commons.logging.Log; <add>import org.apache.commons.logging.LogFactory; <ide> import org.springframework.beans.BeansException; <ide> import org.springframework.beans.factory.BeanFactory; <ide> import org.springframework.beans.factory.BeanFactoryAware; <ide> */ <ide> public class HandlerProvider<T> implements BeanFactoryAware { <ide> <add> private Log logger = LogFactory.getLog(this.getClass()); <add> <ide> private final T handlerBean; <ide> <ide> private final Class<? extends T> handlerClass; <ide> <ide> private AutowireCapableBeanFactory beanFactory; <ide> <del> private Log logger; <del> <ide> <ide> public HandlerProvider(T handlerBean) { <ide> Assert.notNull(handlerBean, "handlerBean is required"); <ide><path>spring-websocket/src/main/java/org/springframework/websocket/WebSocketHandshakeRequest.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket; <add> <add>import java.net.URI; <add> <add>import org.springframework.http.HttpHeaders; <add> <add> <add>/** <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>public class WebSocketHandshakeRequest { <add> <add> private final URI uri; <add> <add> private final HttpHeaders headers; <add> <add> <add> public WebSocketHandshakeRequest(HttpHeaders headers, URI uri) { <add> this.headers = HttpHeaders.readOnlyHttpHeaders(headers); <add> this.uri = uri; <add> } <add> <add> public URI getUri() { <add> return this.uri; <add> } <add> <add> public HttpHeaders getHeaders() { <add> return this.headers; <add> } <add> <add>} <add><path>spring-websocket/src/main/java/org/springframework/websocket/client/AbstractWebSocketConnectionManager.java <del><path>spring-websocket/src/main/java/org/springframework/websocket/client/AbstractEndpointConnectionManager.java <ide> * you may not use this file except in compliance with the License. <ide> * You may obtain a copy of the License at <ide> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <add> * http://www.apache.org/licenses/LICENSE-2.0 <ide> * <ide> * Unless required by applicable law or agreed to in writing, software <ide> * distributed under the License is distributed on an "AS IS" BASIS, <ide> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del> <ide> package org.springframework.websocket.client; <ide> <del>import java.io.IOException; <ide> import java.net.URI; <ide> <del>import javax.websocket.ContainerProvider; <del>import javax.websocket.DeploymentException; <del>import javax.websocket.Session; <del>import javax.websocket.WebSocketContainer; <del> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <ide> import org.springframework.context.SmartLifecycle; <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> */ <del>public abstract class AbstractEndpointConnectionManager implements SmartLifecycle { <add>public abstract class AbstractWebSocketConnectionManager implements SmartLifecycle { <ide> <ide> protected final Log logger = LogFactory.getLog(getClass()); <ide> <ide> public abstract class AbstractEndpointConnectionManager implements SmartLifecycl <ide> <ide> private int phase = Integer.MAX_VALUE; <ide> <del> private final WebSocketContainer webSocketContainer = ContainerProvider.getWebSocketContainer(); <del> <del> private Session session; <del> <ide> private TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor("EndpointConnectionManager-"); <ide> <ide> private final Object lifecycleMonitor = new Object(); <ide> <ide> <del> public AbstractEndpointConnectionManager(String uriTemplate, Object... uriVariables) { <add> public AbstractWebSocketConnectionManager(String uriTemplate, Object... uriVariables) { <ide> this.uri = UriComponentsBuilder.fromUriString(uriTemplate).buildAndExpand(uriVariables).encode().toUri(); <ide> } <ide> <del> public void setAsyncSendTimeout(long timeoutInMillis) { <del> this.webSocketContainer.setAsyncSendTimeout(timeoutInMillis); <del> } <del> <del> public void setMaxSessionIdleTimeout(long timeoutInMillis) { <del> this.webSocketContainer.setDefaultMaxSessionIdleTimeout(timeoutInMillis); <del> } <del> <del> public void setMaxTextMessageBufferSize(int bufferSize) { <del> this.webSocketContainer.setDefaultMaxTextMessageBufferSize(bufferSize); <del> } <del> <del> public void setMaxBinaryMessageBufferSize(Integer bufferSize) { <del> this.webSocketContainer.setDefaultMaxBinaryMessageBufferSize(bufferSize); <del> } <del> <ide> /** <ide> * Set whether to auto-connect to the remote endpoint after this connection manager <ide> * has been initialized and the Spring context has been refreshed. <ide> protected URI getUri() { <ide> return this.uri; <ide> } <ide> <del> protected WebSocketContainer getWebSocketContainer() { <del> return this.webSocketContainer; <del> } <del> <ide> /** <del> * Auto-connects to the configured {@link #setDefaultUri(URI) default URI}. <add> * Connect to the configured {@link #setDefaultUri(URI) default URI}. If already <add> * connected, the method has no impact. <ide> */ <del> public void start() { <add> public final void start() { <ide> synchronized (this.lifecycleMonitor) { <ide> if (!isRunning()) { <ide> this.taskExecutor.execute(new Runnable() { <ide> @Override <ide> public void run() { <ide> synchronized (lifecycleMonitor) { <ide> try { <del> logger.info("Connecting to endpoint at URI " + uri); <del> session = connect(); <add> logger.info("Connecting to WebSocket at " + uri); <add> openConnection(); <ide> logger.info("Successfully connected"); <ide> } <ide> catch (Throwable ex) { <del> logger.error("Failed to connect to endpoint at " + uri, ex); <add> logger.error("Failed to connect", ex); <ide> } <ide> } <ide> } <ide> public void run() { <ide> } <ide> } <ide> <del> protected abstract Session connect() throws DeploymentException, IOException; <add> protected abstract void openConnection() throws Exception; <ide> <ide> /** <del> * Deactivates the configured message endpoint. <add> * Closes the configured message WebSocket connection. <ide> */ <del> public void stop() { <add> public final void stop() { <ide> synchronized (this.lifecycleMonitor) { <ide> if (isRunning()) { <ide> try { <del> this.session.close(); <add> closeConnection(); <ide> } <del> catch (IOException e) { <del> // ignore <add> catch (Throwable e) { <add> logger.error("Failed to stop WebSocket connection", e); <ide> } <ide> } <del> this.session = null; <ide> } <ide> } <ide> <add> protected abstract void closeConnection() throws Exception; <add> <ide> public void stop(Runnable callback) { <ide> synchronized (this.lifecycleMonitor) { <ide> this.stop(); <ide> public void stop(Runnable callback) { <ide> */ <ide> public boolean isRunning() { <ide> synchronized (this.lifecycleMonitor) { <del> if ((this.session != null) && this.session.isOpen()) { <del> return true; <del> } <del> this.session = null; <del> return false; <add> return isConnected(); <ide> } <ide> } <ide> <add> protected abstract boolean isConnected(); <add> <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketClient.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.client; <add> <add>import java.net.URI; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.websocket.WebSocketHandler; <add>import org.springframework.websocket.WebSocketSession; <add> <add> <add>/** <add> * Contract for starting a WebSocket handshake request. <add> * <add> * <p>To automatically start a WebSocket connection when the application starts, see <add> * {@link WebSocketConnectionManager}. <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> * <add> * @see WebSocketConnectionManager <add> */ <add>public interface WebSocketClient { <add> <add> <add> WebSocketSession doHandshake(WebSocketHandler handler, String uriTemplate, Object... uriVariables) <add> throws WebSocketConnectFailureException; <add> <add> WebSocketSession doHandshake(WebSocketHandler handler, URI uri) <add> throws WebSocketConnectFailureException; <add> <add> WebSocketSession doHandshake(WebSocketHandler handler, HttpHeaders headers, URI uri) <add> throws WebSocketConnectFailureException; <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketConnectFailureException.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.client; <add> <add>import org.springframework.core.NestedRuntimeException; <add> <add> <add>/** <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>@SuppressWarnings("serial") <add>public class WebSocketConnectFailureException extends NestedRuntimeException { <add> <add> <add> public WebSocketConnectFailureException(String msg, Throwable cause) { <add> super(msg, cause); <add> } <add> <add> public WebSocketConnectFailureException(String msg) { <add> super(msg); <add> } <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketConnectionManager.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.client; <add> <add>import java.util.List; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.websocket.HandlerProvider; <add>import org.springframework.websocket.WebSocketHandler; <add>import org.springframework.websocket.WebSocketSession; <add> <add> <add>/** <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>public class WebSocketConnectionManager extends AbstractWebSocketConnectionManager { <add> <add> private final WebSocketClient client; <add> <add> private final HandlerProvider<WebSocketHandler> webSocketHandlerProvider; <add> <add> private WebSocketSession webSocketSession; <add> <add> private List<String> subProtocols; <add> <add> <add> public WebSocketConnectionManager(WebSocketClient webSocketClient, <add> WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables) { <add> <add> super(uriTemplate, uriVariables); <add> this.webSocketHandlerProvider = new HandlerProvider<WebSocketHandler>(webSocketHandler); <add> this.client = webSocketClient; <add> } <add> <add> public void setSubProtocols(List<String> subProtocols) { <add> this.subProtocols = subProtocols; <add> } <add> <add> public List<String> getSubProtocols() { <add> return this.subProtocols; <add> } <add> <add> @Override <add> protected void openConnection() throws Exception { <add> WebSocketHandler webSocketHandler = this.webSocketHandlerProvider.getHandler(); <add> HttpHeaders headers = new HttpHeaders(); <add> headers.setSecWebSocketProtocol(this.subProtocols); <add> this.webSocketSession = this.client.doHandshake(webSocketHandler, headers, getUri()); <add> } <add> <add> @Override <add> protected void closeConnection() throws Exception { <add> this.webSocketSession.close(); <add> } <add> <add> @Override <add> protected boolean isConnected() { <add> return ((this.webSocketSession != null) && (this.webSocketSession.isOpen())); <add> } <add> <add>} <add><path>spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/AnnotatedEndpointConnectionManager.java <del><path>spring-websocket/src/main/java/org/springframework/websocket/client/AnnotatedEndpointConnectionManager.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.websocket.client; <add>package org.springframework.websocket.client.endpoint; <ide> <del>import java.io.IOException; <del> <del>import javax.websocket.DeploymentException; <ide> import javax.websocket.Session; <ide> <del>import org.apache.commons.logging.Log; <del>import org.apache.commons.logging.LogFactory; <ide> import org.springframework.beans.BeansException; <ide> import org.springframework.beans.factory.BeanFactory; <ide> import org.springframework.beans.factory.BeanFactoryAware; <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> */ <del>public class AnnotatedEndpointConnectionManager extends AbstractEndpointConnectionManager <add>public class AnnotatedEndpointConnectionManager extends EndpointConnectionManagerSupport <ide> implements BeanFactoryAware { <ide> <del> private static Log logger = LogFactory.getLog(AnnotatedEndpointConnectionManager.class); <del> <ide> private final HandlerProvider<Object> endpointProvider; <ide> <ide> <ide> public AnnotatedEndpointConnectionManager(Class<?> endpointClass, String uriTemplate, Object... uriVariables) { <ide> super(uriTemplate, uriVariables); <ide> this.endpointProvider = new HandlerProvider<Object>(endpointClass); <del> this.endpointProvider.setLogger(logger); <ide> } <ide> <ide> public AnnotatedEndpointConnectionManager(Object endpointBean, String uriTemplate, Object... uriVariables) { <ide> super(uriTemplate, uriVariables); <ide> this.endpointProvider = new HandlerProvider<Object>(endpointBean); <del> this.endpointProvider.setLogger(logger); <ide> } <ide> <ide> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> this.endpointProvider.setBeanFactory(beanFactory); <ide> } <ide> <add> <ide> @Override <del> protected Session connect() throws DeploymentException, IOException { <add> protected void openConnection() throws Exception { <ide> Object endpoint = this.endpointProvider.getHandler(); <del> return getWebSocketContainer().connectToServer(endpoint, getUri()); <add> Session session = getWebSocketContainer().connectToServer(endpoint, getUri()); <add> updateSession(session); <ide> } <ide> <ide> } <add><path>spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/EndpointConnectionManager.java <del><path>spring-websocket/src/main/java/org/springframework/websocket/client/EndpointConnectionManager.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.websocket.client; <add>package org.springframework.websocket.client.endpoint; <ide> <del>import java.io.IOException; <ide> import java.util.Arrays; <ide> import java.util.List; <ide> <ide> import javax.websocket.ClientEndpointConfig; <ide> import javax.websocket.ClientEndpointConfig.Configurator; <ide> import javax.websocket.Decoder; <del>import javax.websocket.DeploymentException; <ide> import javax.websocket.Encoder; <ide> import javax.websocket.Endpoint; <ide> import javax.websocket.Extension; <ide> import javax.websocket.Session; <ide> <del>import org.apache.commons.logging.Log; <del>import org.apache.commons.logging.LogFactory; <ide> import org.springframework.beans.BeansException; <ide> import org.springframework.beans.factory.BeanFactory; <ide> import org.springframework.beans.factory.BeanFactoryAware; <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> */ <del>public class EndpointConnectionManager extends AbstractEndpointConnectionManager implements BeanFactoryAware { <del> <del> private static Log logger = LogFactory.getLog(EndpointConnectionManager.class); <add>public class EndpointConnectionManager extends EndpointConnectionManagerSupport implements BeanFactoryAware { <ide> <ide> private final ClientEndpointConfig.Builder configBuilder = ClientEndpointConfig.Builder.create(); <ide> <ide> private final HandlerProvider<Endpoint> endpointProvider; <ide> <ide> <del> public EndpointConnectionManager(Class<? extends Endpoint> endpointClass, String uriTemplate, Object... uriVariables) { <del> super(uriTemplate, uriVariables); <del> Assert.notNull(endpointClass, "endpointClass is required"); <del> this.endpointProvider = new HandlerProvider<Endpoint>(endpointClass); <del> this.endpointProvider.setLogger(logger); <del> } <del> <ide> public EndpointConnectionManager(Endpoint endpointBean, String uriTemplate, Object... uriVariables) { <ide> super(uriTemplate, uriVariables); <ide> Assert.notNull(endpointBean, "endpointBean is required"); <ide> this.endpointProvider = new HandlerProvider<Endpoint>(endpointBean); <del> this.endpointProvider.setLogger(logger); <add> } <add> <add> public EndpointConnectionManager(Class<? extends Endpoint> endpointClass, String uriTemplate, Object... uriVars) { <add> super(uriTemplate, uriVars); <add> Assert.notNull(endpointClass, "endpointClass is required"); <add> this.endpointProvider = new HandlerProvider<Endpoint>(endpointClass); <ide> } <ide> <ide> public void setSubProtocols(String... subprotocols) { <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> } <ide> <ide> @Override <del> protected Session connect() throws DeploymentException, IOException { <del> Endpoint typedEndpoint = this.endpointProvider.getHandler(); <add> protected void openConnection() throws Exception { <add> Endpoint endpoint = this.endpointProvider.getHandler(); <ide> ClientEndpointConfig endpointConfig = this.configBuilder.build(); <del> return getWebSocketContainer().connectToServer(typedEndpoint, endpointConfig, getUri()); <add> Session session = getWebSocketContainer().connectToServer(endpoint, endpointConfig, getUri()); <add> updateSession(session); <ide> } <ide> <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/EndpointConnectionManagerSupport.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.websocket.client.endpoint; <add> <add>import javax.websocket.ContainerProvider; <add>import javax.websocket.Session; <add>import javax.websocket.WebSocketContainer; <add> <add>import org.springframework.websocket.client.AbstractWebSocketConnectionManager; <add> <add> <add>/** <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>public abstract class EndpointConnectionManagerSupport extends AbstractWebSocketConnectionManager { <add> <add> private WebSocketContainer webSocketContainer = ContainerProvider.getWebSocketContainer(); <add> <add> private Session session; <add> <add> <add> public EndpointConnectionManagerSupport(String uriTemplate, Object... uriVariables) { <add> super(uriTemplate, uriVariables); <add> } <add> <add> public void setWebSocketContainer(WebSocketContainer webSocketContainer) { <add> this.webSocketContainer = webSocketContainer; <add> } <add> <add> public WebSocketContainer getWebSocketContainer() { <add> return this.webSocketContainer; <add> } <add> <add> protected void updateSession(Session session) { <add> this.session = session; <add> } <add> <add> @Override <add> protected void closeConnection() throws Exception { <add> try { <add> if (isConnected()) { <add> this.session.close(); <add> } <add> } <add> finally { <add> this.session = null; <add> } <add> } <add> <add> @Override <add> protected boolean isConnected() { <add> return ((this.session != null) && this.session.isOpen()); <add> } <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/StandardWebSocketClient.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.client.endpoint; <add> <add>import java.net.URI; <add>import java.util.Arrays; <add>import java.util.HashSet; <add>import java.util.List; <add>import java.util.Map; <add>import java.util.Set; <add> <add>import javax.websocket.ClientEndpointConfig; <add>import javax.websocket.ClientEndpointConfig.Configurator; <add>import javax.websocket.ContainerProvider; <add>import javax.websocket.Endpoint; <add>import javax.websocket.Session; <add>import javax.websocket.WebSocketContainer; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.web.util.UriComponentsBuilder; <add>import org.springframework.websocket.WebSocketHandler; <add>import org.springframework.websocket.WebSocketSession; <add>import org.springframework.websocket.client.WebSocketClient; <add>import org.springframework.websocket.client.WebSocketConnectFailureException; <add>import org.springframework.websocket.endpoint.StandardWebSocketSession; <add>import org.springframework.websocket.endpoint.WebSocketHandlerEndpoint; <add> <add> <add>/** <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>public class StandardWebSocketClient implements WebSocketClient { <add> <add> private static final Set<String> EXCLUDED_HEADERS = new HashSet<String>( <add> Arrays.asList("Sec-WebSocket-Accept", "Sec-WebSocket-Extensions", "Sec-WebSocket-Key", <add> "Sec-WebSocket-Protocol", "Sec-WebSocket-Version")); <add> <add> private WebSocketContainer webSocketContainer = ContainerProvider.getWebSocketContainer(); <add> <add> <add> public void setWebSocketContainer(WebSocketContainer container) { <add> this.webSocketContainer = container; <add> } <add> <add> public WebSocketSession doHandshake(WebSocketHandler handler, String uriTemplate, <add> Object... uriVariables) throws WebSocketConnectFailureException { <add> <add> URI uri = UriComponentsBuilder.fromUriString(uriTemplate).buildAndExpand(uriVariables).encode().toUri(); <add> return doHandshake(handler, uri); <add> } <add> <add> @Override <add> public WebSocketSession doHandshake(WebSocketHandler handler, URI uri) throws WebSocketConnectFailureException { <add> return doHandshake(handler, null, uri); <add> } <add> <add> @Override <add> public WebSocketSession doHandshake(WebSocketHandler handler, final HttpHeaders httpHeaders, URI uri) <add> throws WebSocketConnectFailureException { <add> <add> Endpoint endpoint = new WebSocketHandlerEndpoint(handler); <add> <add> ClientEndpointConfig.Builder configBuidler = ClientEndpointConfig.Builder.create(); <add> if (httpHeaders != null) { <add> List<String> protocols = httpHeaders.getSecWebSocketProtocol(); <add> if (!protocols.isEmpty()) { <add> configBuidler.preferredSubprotocols(protocols); <add> } <add> configBuidler.configurator(new Configurator() { <add> @Override <add> public void beforeRequest(Map<String, List<String>> headers) { <add> for (String headerName : httpHeaders.keySet()) { <add> if (!EXCLUDED_HEADERS.contains(headerName)) { <add> headers.put(headerName, httpHeaders.get(headerName)); <add> } <add> } <add> } <add> }); <add> } <add> <add> try { <add> Session session = this.webSocketContainer.connectToServer(endpoint, configBuidler.build(), uri); <add> return new StandardWebSocketSession(session); <add> } <add> catch (Exception e) { <add> throw new WebSocketConnectFailureException("Failed to connect to " + uri, e); <add> } <add> } <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/WebSocketContainerFactoryBean.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.client.endpoint; <add> <add>import javax.websocket.ContainerProvider; <add>import javax.websocket.WebSocketContainer; <add> <add>import org.springframework.beans.factory.FactoryBean; <add> <add> <add>/** <add> * A FactoryBean for creating and configuring a {@link javax.websocket.WebSocketContainer} <add> * through Spring XML configuration. In Java configuration, ignore this class and use <add> * {@code ContainerProvider.getWebSocketContainer()} instead. <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>public class WebSocketContainerFactoryBean implements FactoryBean<WebSocketContainer> { <add> <add> private final WebSocketContainer webSocketContainer = ContainerProvider.getWebSocketContainer(); <add> <add> <add> public void setAsyncSendTimeout(long timeoutInMillis) { <add> this.webSocketContainer.setAsyncSendTimeout(timeoutInMillis); <add> } <add> <add> public long getAsyncSendTimeout() { <add> return this.webSocketContainer.getDefaultAsyncSendTimeout(); <add> } <add> <add> public void setMaxSessionIdleTimeout(long timeoutInMillis) { <add> this.webSocketContainer.setDefaultMaxSessionIdleTimeout(timeoutInMillis); <add> } <add> <add> public long getMaxSessionIdleTimeout() { <add> return this.webSocketContainer.getDefaultMaxSessionIdleTimeout(); <add> } <add> <add> public void setMaxTextMessageBufferSize(int bufferSize) { <add> this.webSocketContainer.setDefaultMaxTextMessageBufferSize(bufferSize); <add> } <add> <add> public int getMaxTextMessageBufferSize() { <add> return this.webSocketContainer.getDefaultMaxTextMessageBufferSize(); <add> } <add> <add> public void setMaxBinaryMessageBufferSize(int bufferSize) { <add> this.webSocketContainer.setDefaultMaxBinaryMessageBufferSize(bufferSize); <add> } <add> <add> public int getMaxBinaryMessageBufferSize() { <add> return this.webSocketContainer.getDefaultMaxBinaryMessageBufferSize(); <add> } <add> <add> @Override <add> public WebSocketContainer getObject() throws Exception { <add> return this.webSocketContainer; <add> } <add> <add> @Override <add> public Class<?> getObjectType() { <add> return WebSocketContainer.class; <add> } <add> <add> @Override <add> public boolean isSingleton() { <add> return true; <add> } <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/package-info.java <add>/** <add> * Client-side classes for use with standard Java WebSocket endpoints including <add> * {@link org.springframework.websocket.client.endpoint.EndpointConnectionManager} and <add> * {@link org.springframework.websocket.client.endpoint.AnnotatedEndpointConnectionManager} <add> * for connecting to server endpoints using type-based or annotated endpoints respectively. <add> */ <add>package org.springframework.websocket.client.endpoint; <add> <ide><path>spring-websocket/src/main/java/org/springframework/websocket/client/package-info.java <del> <ide> /** <del> * Client-side support for WebSocket applications. <add> * Server-side abstractions for WebSocket applications. <ide> * <ide> */ <ide> package org.springframework.websocket.client; <ide><path>spring-websocket/src/main/java/org/springframework/websocket/endpoint/WebSocketHandlerEndpoint.java <ide> public WebSocketHandlerEndpoint(WebSocketHandler webSocketHandler) { <ide> @Override <ide> public void onOpen(javax.websocket.Session session, EndpointConfig config) { <ide> if (logger.isDebugEnabled()) { <del> logger.debug("Client connected, WebSocket session id=" + session.getId() <del> + ", path=" + session.getRequestURI().getPath()); <add> logger.debug("Client connected, WebSocket session id=" + session.getId() + ", uri=" + session.getRequestURI()); <ide> } <ide> try { <ide> WebSocketSession webSocketSession = new StandardWebSocketSession(session); <ide><path>spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/EndpointExporter.java <ide> */ <ide> package org.springframework.websocket.server.endpoint; <ide> <add>import java.lang.reflect.Method; <add>import java.util.ArrayList; <add>import java.util.Arrays; <add>import java.util.List; <ide> import java.util.Map; <ide> <ide> import javax.websocket.DeploymentException; <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <ide> import org.springframework.beans.BeansException; <del>import org.springframework.beans.factory.BeanFactory; <del>import org.springframework.beans.factory.BeanFactoryAware; <ide> import org.springframework.beans.factory.InitializingBean; <del>import org.springframework.beans.factory.ListableBeanFactory; <ide> import org.springframework.beans.factory.config.BeanPostProcessor; <add>import org.springframework.context.ApplicationContext; <add>import org.springframework.context.ApplicationContextAware; <ide> import org.springframework.util.Assert; <del>import org.springframework.util.ObjectUtils; <add>import org.springframework.util.ClassUtils; <add>import org.springframework.util.ReflectionUtils; <ide> <ide> /** <ide> * BeanPostProcessor that detects beans of type <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> */ <del>public abstract class EndpointExporter implements InitializingBean, BeanPostProcessor, BeanFactoryAware { <add>public class EndpointExporter implements InitializingBean, BeanPostProcessor, ApplicationContextAware { <ide> <del> private static Log logger = LogFactory.getLog(EndpointExporter.class); <add> private static final boolean isServletApiPresent = <add> ClassUtils.isPresent("javax.servlet.ServletContext", EndpointExporter.class.getClassLoader()); <ide> <del> private Class<?>[] annotatedEndpointClasses; <add> private static Log logger = LogFactory.getLog(EndpointExporter.class); <ide> <del> private Long maxSessionIdleTimeout; <add> private final List<Class<?>> annotatedEndpointClasses = new ArrayList<Class<?>>(); <ide> <del> private Integer maxTextMessageBufferSize; <add> private final List<Class<?>> annotatedEndpointBeanTypes = new ArrayList<Class<?>>(); <ide> <del> private Integer maxBinaryMessageBufferSize; <add> private ApplicationContext applicationContext; <ide> <add> private ServerContainer serverContainer; <ide> <ide> /** <ide> * TODO <ide> * @param annotatedEndpointClasses <ide> */ <ide> public void setAnnotatedEndpointClasses(Class<?>... annotatedEndpointClasses) { <del> this.annotatedEndpointClasses = annotatedEndpointClasses; <add> this.annotatedEndpointClasses.clear(); <add> this.annotatedEndpointClasses.addAll(Arrays.asList(annotatedEndpointClasses)); <ide> } <ide> <del> /** <del> * If this property set it is in turn used to configure <del> * {@link ServerContainer#setDefaultMaxSessionIdleTimeout(long)}. <del> */ <del> public void setMaxSessionIdleTimeout(long maxSessionIdleTimeout) { <del> this.maxSessionIdleTimeout = maxSessionIdleTimeout; <del> } <add> @Override <add> public void setApplicationContext(ApplicationContext applicationContext) { <ide> <del> public Long getMaxSessionIdleTimeout() { <del> return this.maxSessionIdleTimeout; <del> } <add> this.applicationContext = applicationContext; <ide> <del> /** <del> * If this property set it is in turn used to configure <del> * {@link ServerContainer#setDefaultMaxTextMessageBufferSize(int)} <del> */ <del> public void setMaxTextMessageBufferSize(int maxTextMessageBufferSize) { <del> this.maxTextMessageBufferSize = maxTextMessageBufferSize; <del> } <del> <del> public Integer getMaxTextMessageBufferSize() { <del> return this.maxTextMessageBufferSize; <del> } <add> this.serverContainer = getServerContainer(); <ide> <del> /** <del> * If this property set it is in turn used to configure <del> * {@link ServerContainer#setDefaultMaxBinaryMessageBufferSize(int)}. <del> */ <del> public void setMaxBinaryMessageBufferSize(int maxBinaryMessageBufferSize) { <del> this.maxBinaryMessageBufferSize = maxBinaryMessageBufferSize; <add> Map<String, Object> beans = applicationContext.getBeansWithAnnotation(ServerEndpoint.class); <add> for (String beanName : beans.keySet()) { <add> Class<?> beanType = applicationContext.getType(beanName); <add> if (logger.isInfoEnabled()) { <add> logger.info("Detected @ServerEndpoint bean '" + beanName + "', registering it as an endpoint by type"); <add> } <add> this.annotatedEndpointBeanTypes.add(beanType); <add> } <ide> } <ide> <del> public Integer getMaxBinaryMessageBufferSize() { <del> return this.maxBinaryMessageBufferSize; <del> } <add> protected ServerContainer getServerContainer() { <add> if (isServletApiPresent) { <add> try { <add> Method getter = ReflectionUtils.findMethod(this.applicationContext.getClass(), "getServletContext"); <add> Object servletContext = getter.invoke(this.applicationContext); <ide> <del> @Override <del> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <del> if (beanFactory instanceof ListableBeanFactory) { <del> ListableBeanFactory lbf = (ListableBeanFactory) beanFactory; <del> Map<String, Object> annotatedEndpoints = lbf.getBeansWithAnnotation(ServerEndpoint.class); <del> for (String beanName : annotatedEndpoints.keySet()) { <del> Class<?> beanType = lbf.getType(beanName); <del> try { <del> if (logger.isInfoEnabled()) { <del> logger.info("Detected @ServerEndpoint bean '" + beanName + "', registering it as an endpoint by type"); <del> } <del> getServerContainer().addEndpoint(beanType); <del> } <del> catch (DeploymentException e) { <del> throw new IllegalStateException("Failed to register @ServerEndpoint bean type " + beanName, e); <del> } <add> Method attrMethod = ReflectionUtils.findMethod(servletContext.getClass(), "getAttribute", String.class); <add> return (ServerContainer) attrMethod.invoke(servletContext, "javax.websocket.server.ServerContainer"); <add> } <add> catch (Exception ex) { <add> throw new IllegalStateException( <add> "Failed to get javax.websocket.server.ServerContainer via ServletContext attribute", ex); <ide> } <ide> } <add> return null; <ide> } <ide> <del> /** <del> * Return the {@link ServerContainer} instance, a process which is undefined outside <del> * of standalone containers (section 6.4 of the spec). <del> */ <del> protected abstract ServerContainer getServerContainer(); <del> <ide> @Override <ide> public void afterPropertiesSet() throws Exception { <ide> <del> ServerContainer serverContainer = getServerContainer(); <ide> Assert.notNull(serverContainer, "javax.websocket.server.ServerContainer not available"); <ide> <del> if (this.maxSessionIdleTimeout != null) { <del> serverContainer.setDefaultMaxSessionIdleTimeout(this.maxSessionIdleTimeout); <del> } <del> if (this.maxTextMessageBufferSize != null) { <del> serverContainer.setDefaultMaxTextMessageBufferSize(this.maxTextMessageBufferSize); <del> } <del> if (this.maxBinaryMessageBufferSize != null) { <del> serverContainer.setDefaultMaxBinaryMessageBufferSize(this.maxBinaryMessageBufferSize); <del> } <add> List<Class<?>> allClasses = new ArrayList<Class<?>>(this.annotatedEndpointClasses); <add> allClasses.addAll(this.annotatedEndpointBeanTypes); <ide> <del> if (!ObjectUtils.isEmpty(this.annotatedEndpointClasses)) { <del> for (Class<?> clazz : this.annotatedEndpointClasses) { <del> try { <del> logger.info("Registering @ServerEndpoint type " + clazz); <del> serverContainer.addEndpoint(clazz); <del> } <del> catch (DeploymentException e) { <del> throw new IllegalStateException("Failed to register @ServerEndpoint type " + clazz, e); <del> } <add> for (Class<?> clazz : allClasses) { <add> try { <add> logger.info("Registering @ServerEndpoint type " + clazz); <add> this.serverContainer.addEndpoint(clazz); <add> } <add> catch (DeploymentException e) { <add> throw new IllegalStateException("Failed to register @ServerEndpoint type " + clazz, e); <ide> } <ide> } <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/ServletEndpointExporter.java <del>/* <del> * Copyright 2002-2013 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.websocket.server.endpoint; <del> <del>import javax.servlet.ServletContext; <del>import javax.websocket.server.ServerContainer; <del>import javax.websocket.server.ServerContainerProvider; <del> <del>import org.springframework.util.Assert; <del>import org.springframework.web.context.ServletContextAware; <del> <del> <del>/** <del> * A sub-class of {@link EndpointExporter} for use with a Servlet container runtime. <del> * <del> * @author Rossen Stoyanchev <del> * @since 4.0 <del> */ <del>public class ServletEndpointExporter extends EndpointExporter implements ServletContextAware { <del> <del> private static final String SERVER_CONTAINER_ATTR_NAME = "javax.websocket.server.ServerContainer"; <del> <del> private ServletContext servletContext; <del> <del> <del> @Override <del> public void setServletContext(ServletContext servletContext) { <del> this.servletContext = servletContext; <del> } <del> <del> public ServletContext getServletContext() { <del> return this.servletContext; <del> } <del> <del> @Override <del> protected ServerContainer getServerContainer() { <del> Assert.notNull(this.servletContext, "A ServletContext is needed to access the WebSocket ServerContainer"); <del> ServerContainer container = (ServerContainer) this.servletContext.getAttribute(SERVER_CONTAINER_ATTR_NAME); <del> if (container == null) { <del> // Remove when Tomcat has caught up to http://java.net/jira/browse/WEBSOCKET_SPEC-165 <del> return ServerContainerProvider.getServerContainer(); <del> } <del> return container; <del> } <del> <del>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/ServletServerContainerFactoryBean.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.server.endpoint; <add> <add>import javax.servlet.ServletContext; <add>import javax.websocket.WebSocketContainer; <add>import javax.websocket.server.ServerContainer; <add> <add>import org.springframework.beans.factory.FactoryBean; <add>import org.springframework.beans.factory.InitializingBean; <add>import org.springframework.sockjs.server.SockJsService; <add>import org.springframework.util.Assert; <add>import org.springframework.web.context.ServletContextAware; <add>import org.springframework.websocket.server.DefaultHandshakeHandler; <add> <add> <add>/** <add> * A FactoryBean for {@link javax.websocket.server.ServerContainer}. Since <add> * there is only one {@code ServerContainer} instance accessible under a well-known <add> * {@code javax.servlet.ServletContext} attribute, simply declaring this FactoryBean and <add> * using its setters allows configuring the {@code ServerContainer} through Spring <add> * configuration. This is useful even if the ServerContainer is not injected into any <add> * other bean. For example, an application can configure a {@link DefaultHandshakeHandler} <add> * , a {@link SockJsService}, or {@link EndpointExporter}, and separately declare this <add> * FactoryBean in order to customize the properties of the (one and only) <add> * {@code ServerContainer} instance. <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.0 <add> */ <add>public class ServletServerContainerFactoryBean <add> implements FactoryBean<WebSocketContainer>, InitializingBean, ServletContextAware { <add> <add> private static final String SERVER_CONTAINER_ATTR_NAME = "javax.websocket.server.ServerContainer"; <add> <add> private Long asyncSendTimeout; <add> <add> private Long maxSessionIdleTimeout; <add> <add> private Integer maxTextMessageBufferSize; <add> <add> private Integer maxBinaryMessageBufferSize; <add> <add> <add> private ServerContainer serverContainer; <add> <add> <add> public void setAsyncSendTimeout(long timeoutInMillis) { <add> this.asyncSendTimeout = timeoutInMillis; <add> } <add> <add> public long getAsyncSendTimeout() { <add> return this.asyncSendTimeout; <add> } <add> <add> public void setMaxSessionIdleTimeout(long timeoutInMillis) { <add> this.maxSessionIdleTimeout = timeoutInMillis; <add> } <add> <add> public Long getMaxSessionIdleTimeout() { <add> return this.maxSessionIdleTimeout; <add> } <add> <add> public void setMaxTextMessageBufferSize(int bufferSize) { <add> this.maxTextMessageBufferSize = bufferSize; <add> } <add> <add> public Integer getMaxTextMessageBufferSize() { <add> return this.maxTextMessageBufferSize; <add> } <add> <add> public void setMaxBinaryMessageBufferSize(int bufferSize) { <add> this.maxBinaryMessageBufferSize = bufferSize; <add> } <add> <add> public Integer getMaxBinaryMessageBufferSize() { <add> return this.maxBinaryMessageBufferSize; <add> } <add> <add> @Override <add> public void setServletContext(ServletContext servletContext) { <add> this.serverContainer = (ServerContainer) servletContext.getAttribute(SERVER_CONTAINER_ATTR_NAME); <add> } <add> <add> @Override <add> public ServerContainer getObject() { <add> return this.serverContainer; <add> } <add> <add> @Override <add> public Class<?> getObjectType() { <add> return ServerContainer.class; <add> } <add> <add> @Override <add> public boolean isSingleton() { <add> return false; <add> } <add> <add> @Override <add> public void afterPropertiesSet() throws Exception { <add> <add> Assert.notNull(this.serverContainer, <add> "A ServletContext is required to access the javax.websocket.server.ServerContainer instance"); <add> <add> if (this.asyncSendTimeout != null) { <add> this.serverContainer.setAsyncSendTimeout(this.asyncSendTimeout); <add> } <add> if (this.maxSessionIdleTimeout != null) { <add> this.serverContainer.setDefaultMaxSessionIdleTimeout(this.maxSessionIdleTimeout); <add> } <add> if (this.maxTextMessageBufferSize != null) { <add> this.serverContainer.setDefaultMaxTextMessageBufferSize(this.maxTextMessageBufferSize); <add> } <add> if (this.maxBinaryMessageBufferSize != null) { <add> this.serverContainer.setDefaultMaxBinaryMessageBufferSize(this.maxBinaryMessageBufferSize); <add> } <add> } <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/websocket/server/support/AbstractEndpointContainerFactoryBean.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.websocket.server.support; <add> <add>import javax.websocket.WebSocketContainer; <add> <add>import org.springframework.beans.factory.FactoryBean; <add>import org.springframework.beans.factory.InitializingBean; <add> <add> <add>/** <add>* <add>* @author Rossen Stoyanchev <add>* @since 4.0 <add>*/ <add>public abstract class AbstractEndpointContainerFactoryBean implements FactoryBean<WebSocketContainer>, InitializingBean { <add> <add> private WebSocketContainer container; <add> <add> <add> public void setAsyncSendTimeout(long timeoutInMillis) { <add> this.container.setAsyncSendTimeout(timeoutInMillis); <add> } <add> <add> public long getAsyncSendTimeout() { <add> return this.container.getDefaultAsyncSendTimeout(); <add> } <add> <add> public void setMaxSessionIdleTimeout(long timeoutInMillis) { <add> this.container.setDefaultMaxSessionIdleTimeout(timeoutInMillis); <add> } <add> <add> public long getMaxSessionIdleTimeout() { <add> return this.container.getDefaultMaxSessionIdleTimeout(); <add> } <add> <add> public void setMaxTextMessageBufferSize(int bufferSize) { <add> this.container.setDefaultMaxTextMessageBufferSize(bufferSize); <add> } <add> <add> public int getMaxTextMessageBufferSize() { <add> return this.container.getDefaultMaxTextMessageBufferSize(); <add> } <add> <add> public void setMaxBinaryMessageBufferSize(int bufferSize) { <add> this.container.setDefaultMaxBinaryMessageBufferSize(bufferSize); <add> } <add> <add> public int getMaxBinaryMessageBufferSize() { <add> return this.container.getDefaultMaxBinaryMessageBufferSize(); <add> } <add> <add> @Override <add> public void afterPropertiesSet() throws Exception { <add> this.container = getContainer(); <add> } <add> <add> protected abstract WebSocketContainer getContainer(); <add> <add> @Override <add> public WebSocketContainer getObject() throws Exception { <add> return this.container; <add> } <add> <add> @Override <add> public Class<?> getObjectType() { <add> return WebSocketContainer.class; <add> } <add> <add> @Override <add> public boolean isSingleton() { <add> return true; <add> } <add> <add>}
18
Ruby
Ruby
use array#first instead of array#[0]
2bf65caf565c5923684953557594fc287c80c6ca
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb <ide> def find_some(ids) <ide> <ide> def find_take <ide> if loaded? <del> @records.take(1)[0] <add> @records.take(1).first <ide> else <del> @take ||= limit(1).to_a[0] <add> @take ||= limit(1).to_a.first <ide> end <ide> end <ide> <ide> def find_first <ide> else <ide> @first ||= <ide> if order_values.empty? && primary_key <del> order("#{quoted_table_name}.#{quoted_primary_key} ASC").limit(1).to_a[0] <add> order("#{quoted_table_name}.#{quoted_primary_key} ASC").limit(1).to_a.first <ide> else <del> limit(1).to_a[0] <add> limit(1).to_a.first <ide> end <ide> end <ide> end <ide> def find_last <ide> if offset_value || limit_value <ide> to_a.last <ide> else <del> reverse_order.limit(1).to_a[0] <add> reverse_order.limit(1).to_a.first <ide> end <ide> end <ide> end
1
Text
Text
add link to rails-ujs/dropping jquery pr
5e8dfcd12d1c496cf811a32f9f22de6a40d5abd3
<ide><path>guides/source/5_1_release_notes.md <ide> managed by the asset pipeline, and other code processed via Webpack. It’s all <ide> <ide> ### jQuery no longer a default dependency <ide> <add>[Pull Request](https://github.com/rails/rails/pull/27113) <add> <ide> jQuery was required by default in earlier versions of Rails to provide features <ide> like `data-remote`, `data-confirm` and other parts of Rails' Unobtrusive JavaScript <ide> offerings. It is no longer required, as the UJS has been rewritten to use plain,
1
Javascript
Javascript
update jsm files
2a5b77170ad453da5ba1addb8665fdc1e1fc7274
<ide><path>examples/jsm/postprocessing/EffectComposer.js <ide> Pass.FullScreenQuad = ( function () { <ide> <ide> Object.assign( FullScreenQuad.prototype, { <ide> <add> dispose: function () { <add> <add> this._mesh.geometry.dispose(); <add> <add> }, <add> <ide> render: function ( renderer ) { <ide> <ide> renderer.render( this._mesh, camera ); <ide><path>examples/jsm/renderers/CSS3DRenderer.js <ide> var CSS3DObject = function ( element ) { <ide> <ide> this.element = element; <ide> this.element.style.position = 'absolute'; <add> this.element.style.pointerEvents = 'auto'; <ide> <ide> this.addEventListener( 'removed', function () { <ide> <ide> var CSS3DRenderer = function () { <ide> <ide> cameraElement.style.WebkitTransformStyle = 'preserve-3d'; <ide> cameraElement.style.transformStyle = 'preserve-3d'; <add> cameraElement.style.pointerEvents = 'none'; <ide> <ide> domElement.appendChild( cameraElement ); <ide>
2
Go
Go
improve store locking
44e67adae5695e3e2c3b450453ab0fe6119eb80d
<ide><path>image/store.go <ide> type imageMeta struct { <ide> } <ide> <ide> type store struct { <del> sync.Mutex <add> sync.RWMutex <ide> ls LayerGetReleaser <ide> images map[ID]*imageMeta <ide> fs StoreBackend <ide> func (is *store) Create(config []byte) (ID, error) { <ide> } <ide> <ide> func (is *store) Search(term string) (ID, error) { <del> is.Lock() <del> defer is.Unlock() <del> <ide> dgst, err := is.digestSet.Lookup(term) <ide> if err != nil { <ide> if err == digestset.ErrDigestNotFound { <ide> func (is *store) GetParent(id ID) (ID, error) { <ide> } <ide> <ide> func (is *store) Children(id ID) []ID { <del> is.Lock() <del> defer is.Unlock() <add> is.RLock() <add> defer is.RUnlock() <ide> <ide> return is.children(id) <ide> } <ide> func (is *store) Map() map[ID]*Image { <ide> } <ide> <ide> func (is *store) imagesMap(all bool) map[ID]*Image { <del> is.Lock() <del> defer is.Unlock() <add> is.RLock() <add> defer is.RUnlock() <ide> <ide> images := make(map[ID]*Image) <ide>
1
Javascript
Javascript
display symbol keys in inspect by default
5bfd13b81e38b60a7b9f346fbfcb216192cf0974
<ide><path>lib/util.js <ide> function formatValue(ctx, value, recurseTimes) { <ide> // Look up the keys of the object. <ide> var keys = Object.keys(value); <ide> var visibleKeys = arrayToHash(keys); <add> const symbolKeys = Object.getOwnPropertySymbols(value); <add> const enumSymbolKeys = symbolKeys <add> .filter((key) => Object.prototype.propertyIsEnumerable.call(value, key)); <add> keys = keys.concat(enumSymbolKeys); <ide> <ide> if (ctx.showHidden) { <del> keys = Object.getOwnPropertyNames(value); <del> keys = keys.concat(Object.getOwnPropertySymbols(value)); <add> keys = Object.getOwnPropertyNames(value).concat(symbolKeys); <ide> } <ide> <ide> // This could be a boxed primitive (new String(), etc.), check valueOf() <ide><path>test/parallel/test-util-inspect.js <ide> assert.doesNotThrow(() => { <ide> '{ a: 123, inspect: [Function: inspect] }'); <ide> <ide> const subject = { a: 123, [util.inspect.custom]() { return this; } }; <del> assert.strictEqual(util.inspect(subject), '{ a: 123 }'); <add> const UIC = 'util.inspect.custom'; <add> assert.strictEqual(util.inspect(subject), <add> `{ a: 123,\n [Symbol(${UIC})]: [Function: [${UIC}]] }`); <ide> } <ide> <ide> // util.inspect with "colors" option should produce as many lines as without it <ide> if (typeof Symbol !== 'undefined') { <ide> <ide> subject[Symbol('symbol')] = 42; <ide> <del> assert.strictEqual(util.inspect(subject), '{}'); <add> assert.strictEqual(util.inspect(subject), '{ [Symbol(symbol)]: 42 }'); <ide> assert.strictEqual( <ide> util.inspect(subject, options), <ide> '{ [Symbol(symbol)]: 42 }' <ide> ); <ide> <add> Object.defineProperty( <add> subject, <add> Symbol(), <add> {enumerable: false, value: 'non-enum'}); <add> assert.strictEqual(util.inspect(subject), '{ [Symbol(symbol)]: 42 }'); <add> assert.strictEqual( <add> util.inspect(subject, options), <add> '{ [Symbol(symbol)]: 42, [Symbol()]: \'non-enum\' }' <add> ); <add> <ide> subject = [1, 2, 3]; <ide> subject[Symbol('symbol')] = 42; <ide> <del> assert.strictEqual(util.inspect(subject), '[ 1, 2, 3 ]'); <del> assert.strictEqual(util.inspect(subject, options), <del> '[ 1, 2, 3, [length]: 3, [Symbol(symbol)]: 42 ]'); <add> assert.strictEqual(util.inspect(subject), <add> '[ 1, 2, 3, [Symbol(symbol)]: 42 ]'); <ide> } <ide> <ide> // test Set
2
PHP
PHP
remove bogus data
c714fc935462e6542ab08621e430dd7248e2a89c
<ide><path>Cake/Test/TestCase/ORM/Association/BelongsToManyTest.php <ide> public function testReplaceLinkSuccess() { <ide> $tags = [ <ide> new Entity(['id' => 2], $opts), <ide> new Entity(['id' => 3], $opts), <del> new Entity(['id' => 6, 'articlesTag' => new Entity(['bar' => 'baz'])]) <add> new Entity(['id' => 6]) <ide> ]; <ide> $entity = new Entity(['id' => 1, 'test' => $tags], $opts); <ide>
1
Java
Java
add zip of a collection of observables
5a35bb298df5c609cdf1a011dcd4de8a1d035d20
<ide><path>rxjava-core/src/main/java/rx/Observable.java <ide> <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <add>import java.util.Collection; <ide> import java.util.List; <ide> import java.util.Map; <ide> import java.util.concurrent.CountDownLatch; <ide> public R call(T0 t0, T1 t1, T2 t2, T3 t3) { <ide> }); <ide> } <ide> <add> /** <add> * Returns an Observable that emits the results of a function of your choosing applied to <add> * combinations of four items emitted, in sequence, by four other Observables. <add> * <p> <add> * <code>zip</code> applies this function in strict sequence, so the first item emitted by the <add> * new Observable will be the result of the function applied to the first item emitted by <add> * all of the Observalbes; the second item emitted by the new Observable will be the result of <add> * the function applied to the second item emitted by each of those Observables; and so forth. <add> * <p> <add> * The resulting <code>Observable<R></code> returned from <code>zip</code> will invoke <add> * <code>onNext</code> as many times as the number of <code>onNext</code> invokations of the <add> * source Observable that emits the fewest items. <add> * <p> <add> * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/zip.png"> <add> * <add> * @param ws <add> * A collection of source Observable <add> * @param reduceFunction <add> * a function that, when applied to an item emitted by each of the source <add> * Observables, results in an item that will be emitted by the resulting Observable <add> * @return an Observable that emits the zipped results <add> */ <add> public static <R> Observable<R> zip(Collection<Observable<?>> ws, FuncN<R> reduceFunction) { <add> return create(OperationZip.zip(ws, reduceFunction)); <add> } <add> <add> /** <add> * Returns an Observable that emits the results of a function of your choosing applied to <add> * combinations of four items emitted, in sequence, by four other Observables. <add> * <p> <add> * <code>zip</code> applies this function in strict sequence, so the first item emitted by the <add> * new Observable will be the result of the function applied to the first item emitted by <add> * all of the Observalbes; the second item emitted by the new Observable will be the result of <add> * the function applied to the second item emitted by each of those Observables; and so forth. <add> * <p> <add> * The resulting <code>Observable<R></code> returned from <code>zip</code> will invoke <add> * <code>onNext</code> as many times as the number of <code>onNext</code> invocations of the <add> * source Observable that emits the fewest items. <add> * <p> <add> * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/zip.png"> <add> * <add> * @param ws <add> * A collection of source Observable <add> * @param function <add> * a function that, when applied to an item emitted by each of the source <add> * Observables, results in an item that will be emitted by the resulting Observable <add> * @return an Observable that emits the zipped results <add> */ <add> public static <R> Observable<R> zip(Collection<Observable<?>> ws, final Object function) { <add> @SuppressWarnings({ "unchecked" }) <add> final FuncN<R> _f = Functions.from(function); <add> return zip(ws, _f); <add> } <add> <ide> /** <ide> * Filters an Observable by discarding any items it emits that do not meet some test. <ide> * <p> <ide><path>rxjava-core/src/main/java/rx/operators/OperationZip.java <ide> import static org.mockito.Mockito.*; <ide> <ide> import java.util.Arrays; <add>import java.util.Collection; <ide> import java.util.concurrent.ConcurrentHashMap; <ide> import java.util.concurrent.ConcurrentLinkedQueue; <ide> import java.util.concurrent.atomic.AtomicBoolean; <ide> public static <T0, T1, T2, T3, R> Func1<Observer<R>, Subscription> zip(Observabl <ide> return a; <ide> } <ide> <add> @SuppressWarnings("unchecked") <add> public static <R> Func1<Observer<R>, Subscription> zip(Collection<Observable<?>> ws, FuncN<R> zipFunction) { <add> Aggregator a = new Aggregator(zipFunction); <add> for (Observable<?> w : ws) { <add> ZipObserver zipObserver = new ZipObserver(a, w); <add> a.addObserver(zipObserver); <add> } <add> return a; <add> } <add> <ide> /* <ide> * ThreadSafe <ide> */
2
Javascript
Javascript
fix document indent
3fec7df524c79dc13b36485f23acf62ef1ff07b1
<ide><path>packages/ember-handlebars/lib/controls/text_field.js <ide> Ember.TextField = Ember.View.extend(Ember.TextSupport, <ide> the user presses the return key when editing a text field, and sends <ide> the value of the field as the context. <ide> <del> @property action <del> @type String <del> @default null <add> @property action <add> @type String <add> @default null <ide> */ <ide> action: null, <ide>
1
Java
Java
change the textalign setter to support rtl
54a4450309bfbbcd07e5e2ffe2a2cd1aaf772cc3
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java <ide> import android.text.style.ForegroundColorSpan; <ide> import android.text.style.StrikethroughSpan; <ide> import android.text.style.UnderlineSpan; <add>import android.view.Gravity; <ide> import android.widget.TextView; <ide> <add>import com.facebook.csslayout.CSSDirection; <ide> import com.facebook.csslayout.CSSConstants; <ide> import com.facebook.csslayout.CSSMeasureMode; <ide> import com.facebook.csslayout.CSSNode; <ide> import com.facebook.csslayout.MeasureOutput; <ide> import com.facebook.infer.annotation.Assertions; <add>import com.facebook.react.bridge.JSApplicationIllegalArgumentException; <ide> import com.facebook.react.bridge.ReadableMap; <ide> import com.facebook.react.common.annotations.VisibleForTesting; <ide> import com.facebook.react.uimanager.IllegalViewOperationException; <ide> public void measure( <ide> /** <ide> * Return -1 if the input string is not a valid numeric fontWeight (100, 200, ..., 900), otherwise <ide> * return the weight. <del> * <del> * This code is duplicated in ReactTextInputManager <add> * <add> * This code is duplicated in ReactTextInputManager <ide> * TODO: Factor into a common place they can both use <ide> */ <ide> private static int parseNumericFontWeight(String fontWeightString) { <ide> private static int parseNumericFontWeight(String fontWeightString) { <ide> <ide> protected int mNumberOfLines = UNSET; <ide> protected int mFontSize = UNSET; <add> protected int mTextAlign = UNSET; <ide> <ide> private float mTextShadowOffsetDx = 0; <ide> private float mTextShadowOffsetDy = 0; <ide> public float getEffectiveLineHeight() { <ide> return useInlineViewHeight ? mHeightOfTallestInlineImage : mLineHeight; <ide> } <ide> <add> // Return text alignment according to LTR or RTL style <add> private int getTextAlign() { <add> int textAlign = mTextAlign; <add> if (getLayoutDirection() == CSSDirection.RTL) { <add> if (textAlign == Gravity.RIGHT) { <add> textAlign = Gravity.LEFT; <add> } else if (textAlign == Gravity.LEFT) { <add> textAlign = Gravity.RIGHT; <add> } <add> } <add> return textAlign; <add> } <add> <ide> @Override <ide> public void onBeforeLayout() { <ide> if (mIsVirtual) { <ide> public void setLineHeight(int lineHeight) { <ide> markUpdated(); <ide> } <ide> <add> @ReactProp(name = ViewProps.TEXT_ALIGN) <add> public void setTextAlign(@Nullable String textAlign) { <add> if (textAlign == null || "auto".equals(textAlign)) { <add> mTextAlign = Gravity.NO_GRAVITY; <add> } else if ("left".equals(textAlign)) { <add> mTextAlign = Gravity.LEFT; <add> } else if ("right".equals(textAlign)) { <add> mTextAlign = Gravity.RIGHT; <add> } else if ("center".equals(textAlign)) { <add> mTextAlign = Gravity.CENTER_HORIZONTAL; <add> } else if ("justify".equals(textAlign)) { <add> // Fallback gracefully for cross-platform compat instead of error <add> mTextAlign = Gravity.LEFT; <add> } else { <add> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign); <add> } <add> markUpdated(); <add> } <add> <ide> @ReactProp(name = ViewProps.FONT_SIZE, defaultFloat = UNSET) <ide> public void setFontSize(float fontSize) { <ide> if (fontSize != UNSET) { <ide> public void setBackgroundColor(Integer color) { <ide> markUpdated(); <ide> } <ide> } <del> <add> <ide> @ReactProp(name = ViewProps.FONT_FAMILY) <ide> public void setFontFamily(@Nullable String fontFamily) { <ide> mFontFamily = fontFamily; <ide> markUpdated(); <ide> } <del> <add> <ide> /** <del> /* This code is duplicated in ReactTextInputManager <add> /* This code is duplicated in ReactTextInputManager <ide> /* TODO: Factor into a common place they can both use <ide> */ <ide> @ReactProp(name = ViewProps.FONT_WEIGHT) <ide> public void setFontWeight(@Nullable String fontWeightString) { <ide> markUpdated(); <ide> } <ide> } <del> <add> <ide> /** <del> /* This code is duplicated in ReactTextInputManager <add> /* This code is duplicated in ReactTextInputManager <ide> /* TODO: Factor into a common place they can both use <ide> */ <ide> @ReactProp(name = ViewProps.FONT_STYLE) <ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { <ide> super.onCollectExtraUpdates(uiViewOperationQueue); <ide> if (mPreparedSpannableText != null) { <ide> ReactTextUpdate reactTextUpdate = <del> new ReactTextUpdate(mPreparedSpannableText, UNSET, mContainsImages, getPadding(), getEffectiveLineHeight()); <add> new ReactTextUpdate( <add> mPreparedSpannableText, <add> UNSET, <add> mContainsImages, <add> getPadding(), <add> getEffectiveLineHeight(), <add> getTextAlign() <add> ); <ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); <ide> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java <ide> package com.facebook.react.views.text; <ide> <ide> import android.text.Spannable; <add>import android.view.Gravity; <ide> <ide> import com.facebook.csslayout.Spacing; <ide> <ide> public class ReactTextUpdate { <ide> private final float mPaddingRight; <ide> private final float mPaddingBottom; <ide> private final float mLineHeight; <add> private final int mTextAlign; <ide> <ide> public ReactTextUpdate( <ide> Spannable text, <ide> int jsEventCounter, <ide> boolean containsImages, <ide> Spacing padding, <del> float lineHeight) { <add> float lineHeight, <add> int textAlign) { <ide> mText = text; <ide> mJsEventCounter = jsEventCounter; <ide> mContainsImages = containsImages; <ide> public ReactTextUpdate( <ide> mPaddingRight = padding.get(Spacing.RIGHT); <ide> mPaddingBottom = padding.get(Spacing.BOTTOM); <ide> mLineHeight = lineHeight; <add> mTextAlign = textAlign; <ide> } <ide> <ide> public Spannable getText() { <ide> public float getPaddingBottom() { <ide> public float getLineHeight() { <ide> return mLineHeight; <ide> } <add> <add> public int getTextAlign() { <add> return mTextAlign; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java <ide> public class ReactTextView extends TextView implements ReactCompoundView { <ide> private int mDefaultGravityVertical; <ide> private boolean mTextIsSelectable; <ide> private float mLineHeight = Float.NaN; <add> private int mTextAlign = Gravity.NO_GRAVITY; <ide> <ide> public ReactTextView(Context context) { <ide> super(context); <ide> public void setText(ReactTextUpdate update) { <ide> setLineSpacing(mLineHeight, 0); <ide> } <ide> } <add> <add> int nextTextAlign = update.getTextAlign(); <add> if (mTextAlign != nextTextAlign) { <add> mTextAlign = nextTextAlign; <add> } <add> setGravityHorizontal(mTextAlign); <ide> } <ide> <ide> @Override <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java <ide> public void setNumberOfLines(ReactTextView view, int numberOfLines) { <ide> view.setEllipsize(TextUtils.TruncateAt.END); <ide> } <ide> <del> @ReactProp(name = ViewProps.TEXT_ALIGN) <del> public void setTextAlign(ReactTextView view, @Nullable String textAlign) { <del> if (textAlign == null || "auto".equals(textAlign)) { <del> view.setGravityHorizontal(Gravity.NO_GRAVITY); <del> } else if ("left".equals(textAlign)) { <del> view.setGravityHorizontal(Gravity.LEFT); <del> } else if ("right".equals(textAlign)) { <del> view.setGravityHorizontal(Gravity.RIGHT); <del> } else if ("center".equals(textAlign)) { <del> view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL); <del> } else if ("justify".equals(textAlign)) { <del> // Fallback gracefully for cross-platform compat instead of error <del> view.setGravityHorizontal(Gravity.LEFT); <del> } else { <del> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign); <del> } <del> } <del> <ide> @ReactProp(name = ViewProps.LINE_BREAK_MODE) <ide> public void setLineBreakMode(ReactTextView view, @Nullable String ellipsizeMode) { <ide> if(ellipsizeMode == null) { <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java <ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { <ide> if (mJsEventCount != UNSET) { <ide> Spannable preparedSpannableText = fromTextCSSNode(this); <ide> ReactTextUpdate reactTextUpdate = <del> new ReactTextUpdate(preparedSpannableText, mJsEventCount, mContainsImages, getPadding(), getEffectiveLineHeight()); <add> new ReactTextUpdate( <add> preparedSpannableText, <add> mJsEventCount, <add> mContainsImages, <add> getPadding(), <add> getEffectiveLineHeight(), <add> mTextAlign <add> ); <ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); <ide> } <ide> }
5
PHP
PHP
pass entire configuration
6381aa994756429156b7376e98606458b052b1d7
<ide><path>src/Illuminate/Broadcasting/BroadcastManager.php <ide> protected function createPusherDriver(array $config) <ide> */ <ide> protected function createAblyDriver(array $config) <ide> { <del> return new AblyBroadcaster(new AblyRest($config['key'])); <add> return new AblyBroadcaster(new AblyRest($config)); <ide> } <ide> <ide> /**
1
PHP
PHP
fix cs error
72e7b59aa43d6ac4bed74ed235016f2c98985073
<ide><path>src/Database/Schema/SqliteSchema.php <ide> protected function _convertColumn(string $column): array <ide> return ['type' => TableSchema::TYPE_INTEGER, 'length' => $length, 'unsigned' => $unsigned]; <ide> } <ide> if (strpos($col, 'decimal') !== false) { <del> return ['type' => TableSchema::TYPE_DECIMAL, 'length' => $length, 'precision' => $precision, 'unsigned' => $unsigned]; <add> return [ <add> 'type' => TableSchema::TYPE_DECIMAL, <add> 'length' => $length, <add> 'precision' => $precision, <add> 'unsigned' => $unsigned, <add> ]; <ide> } <ide> if (in_array($col, ['float', 'real', 'double'])) { <del> return ['type' => TableSchema::TYPE_FLOAT, 'length' => $length, 'precision' => $precision, 'unsigned' => $unsigned]; <add> return [ <add> 'type' => TableSchema::TYPE_FLOAT, <add> 'length' => $length, <add> 'precision' => $precision, <add> 'unsigned' => $unsigned, <add> ]; <ide> } <ide> <ide> if (strpos($col, 'boolean') !== false) {
1
Text
Text
correct the spelling of achieve
cc0e2163fb148b4bd9596a5478d692776b8b983e
<ide><path>guide/english/agile/sprint-planning/index.md <ide> There are two defined artifacts that result from a sprint planning meeting: <ide> Sprint Planning is time-boxed to a maximum of eight hours for a one-month Sprint. For shorter Sprints, the event is usually shorter. The Scrum Master ensures that the event takes place and that attendants understand its purpose. The Scrum Master teaches the Scrum Team to keep it within the time-box. <ide> <ide> ## The WHY behind Sprint Planning <del>The purpose of Sprint Planning meeting is to achiev the following goals: <add>The purpose of Sprint Planning meeting is to achieve the following goals: <ide> <ide> * **Know the work** - The Team must first understand the scope of the highest business value items in product backlog. With this understanding they can choose which of these can be brought into the sprint based on their capacity. The team creates task for each of the items in sprint so that teammembers can volunteer for tasks as sprint progresses. <ide>
1
Python
Python
remove duplicate test
a9e8c7f05d63f9aa1fa47d7eff92c4303f41de59
<ide><path>numpy/core/tests/test_multiarray.py <ide> def test_dot_scalar_and_matrix_of_objects(self): <ide> assert_equal(np.dot(arr, 3), desired) <ide> assert_equal(np.dot(3, arr), desired) <ide> <del> def test_dot_override(self): <del> class A(object): <del> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs): <del> return "A" <del> <del> class B(object): <del> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs): <del> return NotImplemented <del> <del> a = A() <del> b = B() <del> c = np.array([[1]]) <del> <del> assert_equal(np.dot(a, b), "A") <del> assert_equal(c.dot(a), "A") <del> assert_raises(TypeError, np.dot, b, c) <del> assert_raises(TypeError, c.dot, b) <del> <ide> def test_accelerate_framework_sgemv_fix(self): <ide> <ide> def aligned_array(shape, align, dtype, order='C'):
1
Java
Java
fix recent regression in webtestclient
30c79404834ff7862c24c4a464c58f681f994f81
<ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java <ide> public RequestBodySpec uri(Function<UriBuilder, URI> uriFunction) { <ide> <ide> @Override <ide> public RequestBodySpec uri(URI uri) { <del> this.uriTemplate = null; <ide> this.uri = uri; <ide> return this; <ide> } <ide><path>spring-test/src/test/java/org/springframework/test/web/reactive/server/DefaultControllerSpecTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2020 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public void configurerConsumers() { <ide> assertThat(codecsConsumer.getValue()).isNotNull(); <ide> assertThat(pathMatchingConsumer.getValue()).isNotNull(); <ide> assertThat(viewResolverConsumer.getValue()).isNotNull(); <add> } <ide> <add> @Test // gh-25854 <add> public void uriTemplate() { <add> new DefaultControllerSpec(new MyController()).build() <add> .get().uri("/") <add> .exchange() <add> .expectStatus().isOk() <add> .expectBody(String.class).isEqualTo("Success") <add> .consumeWith(result -> assertThat(result.getUriTemplate()).isEqualTo("/")); <ide> } <ide> <ide>
2
Javascript
Javascript
fix iterable types with special prototype
2c0a75118cd6a2eaf6b45fe8c67336f44c86ab0f
<ide><path>lib/internal/util/inspect.js <ide> function clazzWithNullPrototype(clazz, name) { <ide> function noPrototypeIterator(ctx, value, recurseTimes) { <ide> let newVal; <ide> if (isSet(value)) { <del> const clazz = Object.getPrototypeOf(value) || <del> clazzWithNullPrototype(Set, 'Set'); <add> const clazz = clazzWithNullPrototype(Set, 'Set'); <ide> newVal = new clazz(setValues(value)); <ide> } else if (isMap(value)) { <del> const clazz = Object.getPrototypeOf(value) || <del> clazzWithNullPrototype(Map, 'Map'); <add> const clazz = clazzWithNullPrototype(Map, 'Map'); <ide> newVal = new clazz(mapEntries(value)); <ide> } else if (Array.isArray(value)) { <del> const clazz = Object.getPrototypeOf(value) || <del> clazzWithNullPrototype(Array, 'Array'); <add> const clazz = clazzWithNullPrototype(Array, 'Array'); <ide> newVal = new clazz(value.length); <ide> } else if (isTypedArray(value)) { <del> let clazz = Object.getPrototypeOf(value); <del> if (!clazz) { <del> const constructor = findTypedConstructor(value); <del> clazz = clazzWithNullPrototype(constructor, constructor.name); <del> } <add> const constructor = findTypedConstructor(value); <add> const clazz = clazzWithNullPrototype(constructor, constructor.name); <ide> newVal = new clazz(value); <ide> } <del> if (newVal) { <add> if (newVal !== undefined) { <ide> Object.defineProperties(newVal, Object.getOwnPropertyDescriptors(value)); <del> return formatValue(ctx, newVal, recurseTimes); <add> return formatRaw(ctx, newVal, recurseTimes); <ide> } <ide> } <ide> <ide> function formatRaw(ctx, value, recurseTimes, typedArray) { <ide> } else { <ide> // The input prototype got manipulated. Special handle these. We have to <ide> // rebuild the information so we are able to display everything. <del> const specialIterator = noPrototypeIterator(ctx, value, recurseTimes); <del> if (specialIterator) { <del> return specialIterator; <add> if (constructor === null) { <add> const specialIterator = noPrototypeIterator(ctx, value, recurseTimes); <add> if (specialIterator) { <add> return specialIterator; <add> } <ide> } <ide> if (isMapIterator(value)) { <ide> braces = [`[${tag || 'Map Iterator'}] {`, '}']; <ide><path>test/parallel/test-util-inspect.js <ide> assert.strictEqual( <ide> util.inspect(new StorageObject()), <ide> '<[Object: null prototype] {}> {}' <ide> ); <add> <add> obj = [1, 2, 3]; <add> Object.setPrototypeOf(obj, Number.prototype); <add> assert.strictEqual(inspect(obj), "Number { '0': 1, '1': 2, '2': 3 }"); <add> <add> Object.setPrototypeOf(obj, Object.create(null)); <add> assert.strictEqual( <add> inspect(obj), <add> "<[Object: null prototype] {}> { '0': 1, '1': 2, '2': 3 }" <add> ); <ide> } <ide> <ide> // Check that the fallback always works.
2
PHP
PHP
remove deprecated helpers
4005e133b3aca9a118a3c971a3de65818a30c3a3
<ide><path>src/Illuminate/Support/helpers.php <ide> function append_config(array $array) <ide> } <ide> } <ide> <del>if (! function_exists('array_add')) { <del> /** <del> * Add an element to an array using "dot" notation if it doesn't exist. <del> * <del> * @param array $array <del> * @param string $key <del> * @param mixed $value <del> * @return array <del> * <del> * @deprecated Arr::add() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_add($array, $key, $value) <del> { <del> return Arr::add($array, $key, $value); <del> } <del>} <del> <del>if (! function_exists('array_collapse')) { <del> /** <del> * Collapse an array of arrays into a single array. <del> * <del> * @param array $array <del> * @return array <del> * <del> * @deprecated Arr::collapse() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_collapse($array) <del> { <del> return Arr::collapse($array); <del> } <del>} <del> <del>if (! function_exists('array_divide')) { <del> /** <del> * Divide an array into two arrays. One with keys and the other with values. <del> * <del> * @param array $array <del> * @return array <del> * <del> * @deprecated Arr::divide() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_divide($array) <del> { <del> return Arr::divide($array); <del> } <del>} <del> <del>if (! function_exists('array_dot')) { <del> /** <del> * Flatten a multi-dimensional associative array with dots. <del> * <del> * @param array $array <del> * @param string $prepend <del> * @return array <del> * <del> * @deprecated Arr::dot() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_dot($array, $prepend = '') <del> { <del> return Arr::dot($array, $prepend); <del> } <del>} <del> <del>if (! function_exists('array_except')) { <del> /** <del> * Get all of the given array except for a specified array of keys. <del> * <del> * @param array $array <del> * @param array|string $keys <del> * @return array <del> * <del> * @deprecated Arr::except() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_except($array, $keys) <del> { <del> return Arr::except($array, $keys); <del> } <del>} <del> <del>if (! function_exists('array_first')) { <del> /** <del> * Return the first element in an array passing a given truth test. <del> * <del> * @param array $array <del> * @param callable|null $callback <del> * @param mixed $default <del> * @return mixed <del> * <del> * @deprecated Arr::first() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_first($array, callable $callback = null, $default = null) <del> { <del> return Arr::first($array, $callback, $default); <del> } <del>} <del> <del>if (! function_exists('array_flatten')) { <del> /** <del> * Flatten a multi-dimensional array into a single level. <del> * <del> * @param array $array <del> * @param int $depth <del> * @return array <del> * <del> * @deprecated Arr::flatten() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_flatten($array, $depth = INF) <del> { <del> return Arr::flatten($array, $depth); <del> } <del>} <del> <del>if (! function_exists('array_forget')) { <del> /** <del> * Remove one or many array items from a given array using "dot" notation. <del> * <del> * @param array $array <del> * @param array|string $keys <del> * @return void <del> * <del> * @deprecated Arr::forget() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_forget(&$array, $keys) <del> { <del> return Arr::forget($array, $keys); <del> } <del>} <del> <del>if (! function_exists('array_get')) { <del> /** <del> * Get an item from an array using "dot" notation. <del> * <del> * @param \ArrayAccess|array $array <del> * @param string $key <del> * @param mixed $default <del> * @return mixed <del> * <del> * @deprecated Arr::get() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_get($array, $key, $default = null) <del> { <del> return Arr::get($array, $key, $default); <del> } <del>} <del> <del>if (! function_exists('array_has')) { <del> /** <del> * Check if an item or items exist in an array using "dot" notation. <del> * <del> * @param \ArrayAccess|array $array <del> * @param string|array $keys <del> * @return bool <del> * <del> * @deprecated Arr::has() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_has($array, $keys) <del> { <del> return Arr::has($array, $keys); <del> } <del>} <del> <del>if (! function_exists('array_last')) { <del> /** <del> * Return the last element in an array passing a given truth test. <del> * <del> * @param array $array <del> * @param callable|null $callback <del> * @param mixed $default <del> * @return mixed <del> * <del> * @deprecated Arr::last() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_last($array, callable $callback = null, $default = null) <del> { <del> return Arr::last($array, $callback, $default); <del> } <del>} <del> <del>if (! function_exists('array_only')) { <del> /** <del> * Get a subset of the items from the given array. <del> * <del> * @param array $array <del> * @param array|string $keys <del> * @return array <del> * <del> * @deprecated Arr::only() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_only($array, $keys) <del> { <del> return Arr::only($array, $keys); <del> } <del>} <del> <del>if (! function_exists('array_pluck')) { <del> /** <del> * Pluck an array of values from an array. <del> * <del> * @param array $array <del> * @param string|array $value <del> * @param string|array|null $key <del> * @return array <del> * <del> * @deprecated Arr::pluck() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_pluck($array, $value, $key = null) <del> { <del> return Arr::pluck($array, $value, $key); <del> } <del>} <del> <del>if (! function_exists('array_prepend')) { <del> /** <del> * Push an item onto the beginning of an array. <del> * <del> * @param array $array <del> * @param mixed $value <del> * @param mixed $key <del> * @return array <del> * <del> * @deprecated Arr::prepend() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_prepend($array, $value, $key = null) <del> { <del> return Arr::prepend($array, $value, $key); <del> } <del>} <del> <del>if (! function_exists('array_pull')) { <del> /** <del> * Get a value from the array, and remove it. <del> * <del> * @param array $array <del> * @param string $key <del> * @param mixed $default <del> * @return mixed <del> * <del> * @deprecated Arr::pull() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_pull(&$array, $key, $default = null) <del> { <del> return Arr::pull($array, $key, $default); <del> } <del>} <del> <del>if (! function_exists('array_random')) { <del> /** <del> * Get a random value from an array. <del> * <del> * @param array $array <del> * @param int|null $num <del> * @return mixed <del> * <del> * @deprecated Arr::random() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_random($array, $num = null) <del> { <del> return Arr::random($array, $num); <del> } <del>} <del> <del>if (! function_exists('array_set')) { <del> /** <del> * Set an array item to a given value using "dot" notation. <del> * <del> * If no key is given to the method, the entire array will be replaced. <del> * <del> * @param array $array <del> * @param string $key <del> * @param mixed $value <del> * @return array <del> * <del> * @deprecated Arr::set() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_set(&$array, $key, $value) <del> { <del> return Arr::set($array, $key, $value); <del> } <del>} <del> <del>if (! function_exists('array_sort')) { <del> /** <del> * Sort the array by the given callback or attribute name. <del> * <del> * @param array $array <del> * @param callable|string|null $callback <del> * @return array <del> * <del> * @deprecated Arr::sort() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_sort($array, $callback = null) <del> { <del> return Arr::sort($array, $callback); <del> } <del>} <del> <del>if (! function_exists('array_sort_recursive')) { <del> /** <del> * Recursively sort an array by keys and values. <del> * <del> * @param array $array <del> * @return array <del> * <del> * @deprecated Arr::sortRecursive() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_sort_recursive($array) <del> { <del> return Arr::sortRecursive($array); <del> } <del>} <del> <del>if (! function_exists('array_where')) { <del> /** <del> * Filter the array using the given callback. <del> * <del> * @param array $array <del> * @param callable $callback <del> * @return array <del> * <del> * @deprecated Arr::where() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_where($array, callable $callback) <del> { <del> return Arr::where($array, $callback); <del> } <del>} <del> <del>if (! function_exists('array_wrap')) { <del> /** <del> * If the given value is not an array, wrap it in one. <del> * <del> * @param mixed $value <del> * @return array <del> * <del> * @deprecated Arr::wrap() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function array_wrap($value) <del> { <del> return Arr::wrap($value); <del> } <del>} <del> <ide> if (! function_exists('blank')) { <ide> /** <ide> * Determine if the given value is "blank". <ide> function blank($value) <ide> } <ide> } <ide> <del>if (! function_exists('camel_case')) { <del> /** <del> * Convert a value to camel case. <del> * <del> * @param string $value <del> * @return string <del> * <del> * @deprecated Str::camel() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function camel_case($value) <del> { <del> return Str::camel($value); <del> } <del>} <del> <ide> if (! function_exists('class_basename')) { <ide> /** <ide> * Get the class "basename" of the given object / class. <ide> function e($value, $doubleEncode = true) <ide> } <ide> } <ide> <del>if (! function_exists('ends_with')) { <del> /** <del> * Determine if a given string ends with a given substring. <del> * <del> * @param string $haystack <del> * @param string|array $needles <del> * @return bool <del> * <del> * @deprecated Str::endsWith() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function ends_with($haystack, $needles) <del> { <del> return Str::endsWith($haystack, $needles); <del> } <del>} <del> <ide> if (! function_exists('env')) { <ide> /** <ide> * Gets the value of an environment variable. <ide> function head($array) <ide> } <ide> } <ide> <del>if (! function_exists('kebab_case')) { <del> /** <del> * Convert a string to kebab case. <del> * <del> * @param string $value <del> * @return string <del> * <del> * @deprecated Str::kebab() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function kebab_case($value) <del> { <del> return Str::kebab($value); <del> } <del>} <del> <ide> if (! function_exists('last')) { <ide> /** <ide> * Get the last element from an array. <ide> function retry($times, callable $callback, $sleep = 0) <ide> } <ide> } <ide> <del>if (! function_exists('snake_case')) { <del> /** <del> * Convert a string to snake case. <del> * <del> * @param string $value <del> * @param string $delimiter <del> * @return string <del> * <del> * @deprecated Str::snake() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function snake_case($value, $delimiter = '_') <del> { <del> return Str::snake($value, $delimiter); <del> } <del>} <del> <del>if (! function_exists('starts_with')) { <del> /** <del> * Determine if a given string starts with a given substring. <del> * <del> * @param string $haystack <del> * @param string|array $needles <del> * @return bool <del> * <del> * @deprecated Str::startsWith() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function starts_with($haystack, $needles) <del> { <del> return Str::startsWith($haystack, $needles); <del> } <del>} <del> <del>if (! function_exists('str_after')) { <del> /** <del> * Return the remainder of a string after a given value. <del> * <del> * @param string $subject <del> * @param string $search <del> * @return string <del> * <del> * @deprecated Str::after() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_after($subject, $search) <del> { <del> return Str::after($subject, $search); <del> } <del>} <del> <del>if (! function_exists('str_before')) { <del> /** <del> * Get the portion of a string before a given value. <del> * <del> * @param string $subject <del> * @param string $search <del> * @return string <del> * <del> * @deprecated Str::before() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_before($subject, $search) <del> { <del> return Str::before($subject, $search); <del> } <del>} <del> <del>if (! function_exists('str_contains')) { <del> /** <del> * Determine if a given string contains a given substring. <del> * <del> * @param string $haystack <del> * @param string|array $needles <del> * @return bool <del> * <del> * @deprecated Str::contains() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_contains($haystack, $needles) <del> { <del> return Str::contains($haystack, $needles); <del> } <del>} <del> <del>if (! function_exists('str_finish')) { <del> /** <del> * Cap a string with a single instance of a given value. <del> * <del> * @param string $value <del> * @param string $cap <del> * @return string <del> * <del> * @deprecated Str::finish() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_finish($value, $cap) <del> { <del> return Str::finish($value, $cap); <del> } <del>} <del> <del>if (! function_exists('str_is')) { <del> /** <del> * Determine if a given string matches a given pattern. <del> * <del> * @param string|array $pattern <del> * @param string $value <del> * @return bool <del> * <del> * @deprecated Str::is() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_is($pattern, $value) <del> { <del> return Str::is($pattern, $value); <del> } <del>} <del> <del>if (! function_exists('str_limit')) { <del> /** <del> * Limit the number of characters in a string. <del> * <del> * @param string $value <del> * @param int $limit <del> * @param string $end <del> * @return string <del> * <del> * @deprecated Str::limit() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_limit($value, $limit = 100, $end = '...') <del> { <del> return Str::limit($value, $limit, $end); <del> } <del>} <del> <del>if (! function_exists('str_plural')) { <del> /** <del> * Get the plural form of an English word. <del> * <del> * @param string $value <del> * @param int $count <del> * @return string <del> * <del> * @deprecated Str::plural() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_plural($value, $count = 2) <del> { <del> return Str::plural($value, $count); <del> } <del>} <del> <del>if (! function_exists('str_random')) { <del> /** <del> * Generate a more truly "random" alpha-numeric string. <del> * <del> * @param int $length <del> * @return string <del> * <del> * @throws \RuntimeException <del> * <del> * @deprecated Str::random() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_random($length = 16) <del> { <del> return Str::random($length); <del> } <del>} <del> <del>if (! function_exists('str_replace_array')) { <del> /** <del> * Replace a given value in the string sequentially with an array. <del> * <del> * @param string $search <del> * @param array $replace <del> * @param string $subject <del> * @return string <del> * <del> * @deprecated Str::replaceArray() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_replace_array($search, array $replace, $subject) <del> { <del> return Str::replaceArray($search, $replace, $subject); <del> } <del>} <del> <del>if (! function_exists('str_replace_first')) { <del> /** <del> * Replace the first occurrence of a given value in the string. <del> * <del> * @param string $search <del> * @param string $replace <del> * @param string $subject <del> * @return string <del> * <del> * @deprecated Str::replaceFirst() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_replace_first($search, $replace, $subject) <del> { <del> return Str::replaceFirst($search, $replace, $subject); <del> } <del>} <del> <del>if (! function_exists('str_replace_last')) { <del> /** <del> * Replace the last occurrence of a given value in the string. <del> * <del> * @param string $search <del> * @param string $replace <del> * @param string $subject <del> * @return string <del> * <del> * @deprecated Str::replaceLast() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_replace_last($search, $replace, $subject) <del> { <del> return Str::replaceLast($search, $replace, $subject); <del> } <del>} <del> <del>if (! function_exists('str_singular')) { <del> /** <del> * Get the singular form of an English word. <del> * <del> * @param string $value <del> * @return string <del> * <del> * @deprecated Str::singular() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_singular($value) <del> { <del> return Str::singular($value); <del> } <del>} <del> <del>if (! function_exists('str_slug')) { <del> /** <del> * Generate a URL friendly "slug" from a given string. <del> * <del> * @param string $title <del> * @param string $separator <del> * @param string $language <del> * @return string <del> * <del> * @deprecated Str::slug() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_slug($title, $separator = '-', $language = 'en') <del> { <del> return Str::slug($title, $separator, $language); <del> } <del>} <del> <del>if (! function_exists('str_start')) { <del> /** <del> * Begin a string with a single instance of a given value. <del> * <del> * @param string $value <del> * @param string $prefix <del> * @return string <del> * <del> * @deprecated Str::start() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function str_start($value, $prefix) <del> { <del> return Str::start($value, $prefix); <del> } <del>} <del> <del>if (! function_exists('studly_case')) { <del> /** <del> * Convert a value to studly caps case. <del> * <del> * @param string $value <del> * @return string <del> * <del> * @deprecated Str::studly() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function studly_case($value) <del> { <del> return Str::studly($value); <del> } <del>} <del> <ide> if (! function_exists('tap')) { <ide> /** <ide> * Call the given Closure with the given value then return the value. <ide> function throw_unless($condition, $exception, ...$parameters) <ide> } <ide> } <ide> <del>if (! function_exists('title_case')) { <del> /** <del> * Convert a value to title case. <del> * <del> * @param string $value <del> * @return string <del> * <del> * @deprecated Str::title() should be used directly instead. Will be removed in Laravel 5.9. <del> */ <del> function title_case($value) <del> { <del> return Str::title($value); <del> } <del>} <del> <ide> if (! function_exists('trait_uses_recursive')) { <ide> /** <ide> * Returns all traits used by a trait and its traits.
1
Javascript
Javascript
allow tabs in input
4b3d493c4b5996d00dc6eac3a7600b124ed4c5b7
<ide><path>lib/readline.js <ide> function Interface(input, output, completer, terminal) { <ide> } <ide> historySize = historySize || kHistorySize; <ide> <del> completer = completer || function() { return []; }; <del> <del> if (typeof completer !== 'function') { <add> if (completer && typeof completer !== 'function') { <ide> throw new TypeError('Argument \'completer\' must be a function'); <ide> } <ide> <ide> function Interface(input, output, completer, terminal) { <ide> this.historySize = historySize; <ide> <ide> // Check arity, 2 - for async, 1 for sync <del> this.completer = completer.length === 2 ? completer : function(v, callback) { <del> callback(null, completer(v)); <del> }; <add> if (typeof completer === 'function') { <add> this.completer = completer.length === 2 ? completer : function(v, cb) { <add> cb(null, completer(v)); <add> }; <add> } <ide> <ide> this.setPrompt('> '); <ide> <ide> Interface.prototype._normalWrite = function(b) { <ide> }; <ide> <ide> Interface.prototype._insertString = function(c) { <del> //BUG: Problem when adding tabs with following content. <del> // Perhaps the bug is in _refreshLine(). Not sure. <del> // A hack would be to insert spaces instead of literal '\t'. <ide> if (this.cursor < this.line.length) { <ide> var beg = this.line.slice(0, this.cursor); <ide> var end = this.line.slice(this.cursor, this.line.length); <ide> Interface.prototype._ttyWrite = function(s, key) { <ide> this._deleteRight(); <ide> break; <ide> <del> case 'tab': // tab completion <del> this._tabComplete(); <del> break; <del> <ide> case 'left': <ide> this._moveCursor(-1); <ide> break; <ide> Interface.prototype._ttyWrite = function(s, key) { <ide> this._historyNext(); <ide> break; <ide> <add> case 'tab': <add> // If tab completion enabled, do that... <add> if (typeof this.completer === 'function') { <add> this._tabComplete(); <add> break; <add> } <add> // falls through <add> <ide> default: <ide> if (s instanceof Buffer) <ide> s = s.toString('utf-8'); <ide><path>test/parallel/test-readline-interface.js <ide> function isWarned(emitter) { <ide> assert.equal(callCount, expectedLines.length); <ide> rli.close(); <ide> <add> // \t when there is no completer function should behave like an ordinary <add> // character <add> fi = new FakeInput(); <add> rli = new readline.Interface({ input: fi, output: fi, terminal: true }); <add> called = false; <add> rli.on('line', function(line) { <add> assert.equal(line, '\t'); <add> assert.strictEqual(called, false); <add> called = true; <add> }); <add> fi.emit('data', '\t'); <add> fi.emit('data', '\n'); <add> assert.ok(called); <add> rli.close(); <add> <add> // \t does not become part of the input when there is a completer function <add> fi = new FakeInput(); <add> var completer = function(line) { <add> return [[], line]; <add> }; <add> rli = new readline.Interface({ <add> input: fi, <add> output: fi, <add> terminal: true, <add> completer: completer <add> }); <add> called = false; <add> rli.on('line', function(line) { <add> assert.equal(line, 'foo'); <add> assert.strictEqual(called, false); <add> called = true; <add> }); <add> fi.emit('data', '\tfo\to\t'); <add> fi.emit('data', '\n'); <add> assert.ok(called); <add> rli.close(); <add> <add> // constructor throws if completer is not a function or undefined <add> fi = new FakeInput(); <add> assert.throws(function() { <add> readline.createInterface({ <add> input: fi, <add> completer: 'string is not valid' <add> }); <add> }, function(err) { <add> if (err instanceof TypeError) { <add> if (/Argument \'completer\' must be a function/.test(err)) { <add> return true; <add> } <add> } <add> return false; <add> }); <add> <ide> // sending a multi-byte utf8 char over multiple writes <ide> var buf = Buffer('☮', 'utf8'); <ide> fi = new FakeInput();
2
Ruby
Ruby
add fake optparse.rb
6ca096125de97955cb4a37166e97c2cb7332cc1e
<ide><path>Library/Homebrew/optparse.rb <add># This file is put here to prevent loading of real optparse.rb, <add># which killed Homebrew. Details of issue can be found here: <add># http://github.com/mxcl/homebrew/issues#issue/97
1
Ruby
Ruby
remove message that is never displayed
d362f5a2fbc82810f819a7d024b92fee4813cf3e
<ide><path>Library/Homebrew/requirements/apr_dependency.rb <ide> class AprDependency < Requirement <ide> ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["apr-util"].opt_libexec}/lib/pkgconfig" <ide> end <ide> end <del> <del> def message <del> message = <<-EOS.undent <del> Due to packaging problems on Apple's part, software that compiles <del> against APR requires the standalone Command Line Tools. <del> EOS <del> if MacOS.version >= :mavericks <del> message += <<-EOS.undent <del> Either <del> `brew install apr-util` <del> or <del> `xcode-select --install` <del> to install APR. <del> EOS <del> else <del> message += <<-EOS.undent <del> The standalone package can be obtained from <del> https://developer.apple.com/downloads/, <del> or it can be installed via Xcode's preferences. <del> Or you can `brew install apr-util`. <del> EOS <del> end <del> end <ide> end
1
Javascript
Javascript
use modulemap instead of hastemap
067496e5f6cbc3ec9b169f1a4ccb603e471b2d63
<ide><path>packager/src/ModuleGraph/node-haste/node-haste.js <ide> * @flow <ide> */ <ide> <del> 'use strict'; <add>'use strict'; <ide> <del> import type { // eslint-disable-line sort-requires <add>import type { // eslint-disable-line sort-requires <ide> Extensions, <ide> Path, <ide> } from './node-haste.flow'; <ide> <del> import type { <add>import type { <ide> ResolveFn, <ide> TransformedFile, <ide> } from '../types.flow'; <ide> <del> const DependencyGraphHelpers = require('../../node-haste/DependencyGraph/DependencyGraphHelpers'); <del> const HasteFS = require('./HasteFS'); <del> const HasteMap = require('../../node-haste/DependencyGraph/HasteMap'); <del> const Module = require('./Module'); <del> const ModuleCache = require('./ModuleCache'); <del> const ResolutionRequest = require('../../node-haste/DependencyGraph/ResolutionRequest'); <add>const DependencyGraphHelpers = require('../../node-haste/DependencyGraph/DependencyGraphHelpers'); <add>const HasteFS = require('./HasteFS'); <add>const HasteMap = require('../../node-haste/DependencyGraph/HasteMap'); <add>const Module = require('./Module'); <add>const ModuleCache = require('./ModuleCache'); <add>const ResolutionRequest = require('../../node-haste/DependencyGraph/ResolutionRequest'); <ide> <del> const defaults = require('../../../defaults'); <add>const defaults = require('../../../defaults'); <ide> <del> type ResolveOptions = {| <add>type ResolveOptions = {| <ide> assetExts: Extensions, <ide> extraNodeModules: {[id: string]: string}, <ide> transformedFiles: {[path: Path]: TransformedFile}, <ide> |}; <ide> <del> const platforms = new Set(defaults.platforms); <add>const platforms = new Set(defaults.platforms); <ide> <del> exports.createResolveFn = function(options: ResolveOptions): ResolveFn { <del> const { <add>/** <add> * We don't need to crawl the filesystem all over again so we just mock <add> * a jest-haste-map's ModuleMap instance. Eventually, though, we'll <add> * want to figure out how to reunify and get rid of `HasteMap`. <add> */ <add>function getFakeModuleMap(hasteMap: HasteMap) { <add> return { <add> getModule(name: string, platform_: string): ?string { <add> const module = hasteMap.getModule(name, platform_); <add> return module && module.type === 'Module' ? module.path : null; <add> }, <add> getPackage(name: string, platform_: string): ?string { <add> const module = hasteMap.getModule(name, platform_); <add> return module && module.type === 'Package' ? module.path : null; <add> }, <add> }; <add>} <add> <add>exports.createResolveFn = function(options: ResolveOptions): ResolveFn { <add> const { <ide> assetExts, <ide> extraNodeModules, <ide> transformedFiles, <ide> hasteMap, <ide> helpers, <ide> moduleCache, <add> moduleMap: getFakeModuleMap(hasteMap), <ide> platform, <ide> platforms, <ide> preferNativePlatform: true, <ide><path>packager/src/node-haste/DependencyGraph/HasteMap.js <ide> class HasteMap extends EventEmitter { <ide> }); <ide> } <ide> <del> getModule(name, platform = null) { <add> getModule(name, platform = null): Module { <ide> const modulesMap = this._map[name]; <ide> if (modulesMap == null) { <ide> return null; <ide><path>packager/src/node-haste/DependencyGraph/ResolutionRequest.js <ide> const debug = require('debug')('RNP:DependencyGraph'); <ide> const util = require('util'); <ide> const path = require('path'); <ide> const realPath = require('path'); <add>const invariant = require('fbjs/lib/invariant'); <ide> const isAbsolutePath = require('absolute-path'); <ide> const getAssetDataFromName = require('../lib/getAssetDataFromName'); <ide> <ide> import type {HasteFS} from '../types'; <ide> import type DependencyGraphHelpers from './DependencyGraphHelpers'; <del>import type HasteMap from './HasteMap'; <ide> import type Module from '../Module'; <ide> import type ModuleCache from '../ModuleCache'; <ide> import type ResolutionResponse from './ResolutionResponse'; <ide> <ide> type DirExistsFn = (filePath: string) => boolean; <ide> <add>/** <add> * `jest-haste-map`'s interface for ModuleMap. <add> */ <add>export type ModuleMap = { <add> getModule(name: string, platform: string, supportsNativePlatform: boolean): ?string, <add> getPackage(name: string, platform: string, supportsNativePlatform: boolean): ?string, <add>}; <add> <ide> type Options = { <ide> dirExists: DirExistsFn, <ide> entryPath: string, <ide> extraNodeModules: ?Object, <ide> hasteFS: HasteFS, <del> hasteMap: HasteMap, <ide> helpers: DependencyGraphHelpers, <ide> // TODO(cpojer): Remove 'any' type. This is used for ModuleGraph/node-haste <ide> moduleCache: ModuleCache | any, <add> moduleMap: ModuleMap, <ide> platform: string, <ide> platforms: Set<string>, <ide> preferNativePlatform: boolean, <ide> class ResolutionRequest { <ide> _entryPath: string; <ide> _extraNodeModules: ?Object; <ide> _hasteFS: HasteFS; <del> _hasteMap: HasteMap; <ide> _helpers: DependencyGraphHelpers; <del> _immediateResolutionCache: {[key: string]: string}; <add> _immediateResolutionCache: {[key: string]: Module}; <ide> _moduleCache: ModuleCache; <add> _moduleMap: ModuleMap; <ide> _platform: string; <ide> _platforms: Set<string>; <ide> _preferNativePlatform: boolean; <ide> class ResolutionRequest { <ide> entryPath, <ide> extraNodeModules, <ide> hasteFS, <del> hasteMap, <ide> helpers, <ide> moduleCache, <add> moduleMap, <ide> platform, <ide> platforms, <ide> preferNativePlatform, <ide> class ResolutionRequest { <ide> this._entryPath = entryPath; <ide> this._extraNodeModules = extraNodeModules; <ide> this._hasteFS = hasteFS; <del> this._hasteMap = hasteMap; <ide> this._helpers = helpers; <ide> this._moduleCache = moduleCache; <add> this._moduleMap = moduleMap; <ide> this._platform = platform; <ide> this._platforms = platforms; <ide> this._preferNativePlatform = preferNativePlatform; <ide> this._resetResolutionCache(); <ide> } <ide> <del> _tryResolve(action: () => Promise<string>, secondaryAction: () => ?Promise<string>) { <add> _tryResolve<T>(action: () => Promise<T>, secondaryAction: () => ?Promise<T>): Promise<T> { <ide> return action().catch(error => { <ide> if (error.type !== 'UnableToResolveError') { <ide> throw error; <ide> class ResolutionRequest { <ide> }); <ide> } <ide> <del> _resolveHasteDependency(fromModule: Module, toModuleName: string) { <add> _resolveHasteDependency(fromModule: Module, toModuleName: string): Promise<Module> { <ide> toModuleName = normalizePath(toModuleName); <ide> <ide> let p = fromModule.getPackage(); <ide> class ResolutionRequest { <ide> } <ide> <ide> return p.then(realModuleName => { <del> let dep = this._hasteMap.getModule(realModuleName, this._platform); <del> if (dep && dep.type === 'Module') { <del> return dep; <add> const modulePath = this._moduleMap <add> .getModule(realModuleName, this._platform, /* supportsNativePlatform */ true); <add> if (modulePath != null) { <add> const module = this._moduleCache.getModule(modulePath); <add> /* temporary until we strengthen the typing */ <add> invariant(module.type === 'Module', 'expected Module type'); <add> return module; <ide> } <ide> <ide> let packageName = realModuleName; <add> let packagePath; <ide> while (packageName && packageName !== '.') { <del> dep = this._hasteMap.getModule(packageName, this._platform); <del> if (dep && dep.type === 'Package') { <add> packagePath = this._moduleMap <add> .getPackage(packageName, this._platform, /* supportsNativePlatform */ true); <add> if (packagePath != null) { <ide> break; <ide> } <ide> packageName = path.dirname(packageName); <ide> } <ide> <del> if (dep && dep.type === 'Package') { <add> if (packagePath != null) { <add> <add> const package_ = this._moduleCache.getPackage(packagePath); <add> /* temporary until we strengthen the typing */ <add> invariant(package_.type === 'Package', 'expected Package type'); <add> <ide> const potentialModulePath = path.join( <del> dep.root, <add> package_.root, <ide> path.relative(packageName, realModuleName) <ide> ); <ide> return this._tryResolve( <ide> class ResolutionRequest { <ide> } <ide> } <ide> <del> _loadAsFile(potentialModulePath: string, fromModule: Module, toModule: string) { <add> _loadAsFile(potentialModulePath: string, fromModule: Module, toModule: string): Promise<Module> { <ide> return Promise.resolve().then(() => { <ide> if (this._helpers.isAssetFile(potentialModulePath)) { <ide> let dirname = path.dirname(potentialModulePath); <ide><path>packager/src/node-haste/ModuleCache.js <ide> class ModuleCache { <ide> this._reporter = reporter; <ide> } <ide> <del> getModule(filePath: string) { <add> getModule(filePath: string): Module { <ide> if (!this._moduleCache[filePath]) { <ide> this._moduleCache[filePath] = new Module({ <ide> cache: this._cache, <ide><path>packager/src/node-haste/index.js <ide> import type {Options as TransformOptions} from '../JSTransformer/worker/worker'; <ide> import type GlobalTransformCache from '../lib/GlobalTransformCache'; <ide> import type {GetTransformCacheKey} from '../lib/TransformCache'; <ide> import type {Reporter} from '../lib/reporting'; <add>import type {ModuleMap} from './DependencyGraph/ResolutionRequest'; <ide> import type { <ide> Options as ModuleOptions, <ide> TransformCode, <ide> class DependencyGraph extends EventEmitter { <ide> _hasteMapError: ?Error; <ide> _helpers: DependencyGraphHelpers; <ide> _moduleCache: ModuleCache; <add> _moduleMap: ModuleMap; <ide> <ide> _loading: Promise<void>; <ide> <ide> class DependencyGraph extends EventEmitter { <ide> const initializingPackagerLogEntry = <ide> log(createActionStartEntry('Initializing Packager')); <ide> this._opts.reporter.update({type: 'dep_graph_loading'}); <del> this._loading = this._haste.build().then(({hasteFS}) => { <add> this._loading = this._haste.build().then(({hasteFS, moduleMap}) => { <ide> this._hasteFS = hasteFS; <add> this._moduleMap = moduleMap; <ide> const hasteFSFiles = hasteFS.getAllFiles(); <ide> <ide> this._moduleCache = new ModuleCache({ <ide> class DependencyGraph extends EventEmitter { <ide> platforms: this._opts.platforms, <ide> }); <ide> <del> this._haste.on('change', ({eventsQueue, hasteFS: newHasteFS}) => { <del> this._hasteFS = newHasteFS; <del> eventsQueue.forEach(({type, filePath, stat}) => <add> this._haste.on('change', event => { <add> this._hasteFS = event.hasteFS; <add> this._moduleMap = event.moduleMap; <add> event.eventsQueue.forEach(({type, filePath, stat}) => <ide> this.processFileChange(type, filePath, stat) <ide> ); <ide> this.emit('change'); <ide> class DependencyGraph extends EventEmitter { <ide> * Returns a promise with the direct dependencies the module associated to <ide> * the given entryPath has. <ide> */ <del> getShallowDependencies(entryPath: string, transformOptions: mixed) { <add> getShallowDependencies(entryPath: string, transformOptions: TransformOptions) { <ide> return this._moduleCache <ide> .getModule(entryPath) <ide> .getDependencies(transformOptions); <ide> class DependencyGraph extends EventEmitter { <ide> entryPath: absPath, <ide> extraNodeModules: this._opts.extraNodeModules, <ide> hasteFS: this._hasteFS, <del> hasteMap: this._hasteMap, <ide> helpers: this._helpers, <ide> moduleCache: this._moduleCache, <add> moduleMap: this._moduleMap, <ide> platform, <ide> platforms: this._opts.platforms, <ide> preferNativePlatform: this._opts.preferNativePlatform,
5
Ruby
Ruby
take advantage of string#unpack1
4b42c7e52aa23081ce02ffad53c76ab786214e87
<ide><path>actionpack/test/controller/routing_test.rb <ide> def setup <ide> end <ide> <ide> safe, unsafe = %w(: @ & = + $ , ;), %w(^ ? # [ ]) <del> hex = unsafe.map { |char| "%" + char.unpack("H2").first.upcase } <add> hex = unsafe.map { |char| "%" + char.unpack1("H2").upcase } <ide> <ide> @segment = "#{safe.join}#{unsafe.join}".freeze <ide> @escaped = "#{safe.join}#{hex.join}".freeze <ide><path>activemodel/lib/active_model/attributes.rb <ide> def attribute(name, type = Type::Value.new, **options) <ide> private <ide> <ide> def define_method_attribute=(name) <del> safe_name = name.unpack("h*".freeze).first <add> safe_name = name.unpack1("h*".freeze) <ide> ActiveModel::AttributeMethods::AttrNames.set_name_cache safe_name, name <ide> <ide> generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 <ide><path>activemodel/lib/active_model/type/binary.rb <ide> def to_s <ide> alias_method :to_str, :to_s <ide> <ide> def hex <del> @value.unpack("H*")[0] <add> @value.unpack1("H*") <ide> end <ide> <ide> def ==(other) <ide><path>activerecord/lib/active_record/attribute_methods/read.rb <ide> module ClassMethods # :nodoc: <ide> # Making it frozen means that it doesn't get duped when used to <ide> # key the @attributes in read_attribute. <ide> def define_method_attribute(name) <del> safe_name = name.unpack("h*".freeze).first <add> safe_name = name.unpack1("h*".freeze) <ide> temp_method = "__temp__#{safe_name}" <ide> <ide> ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name <ide><path>activerecord/lib/active_record/attribute_methods/write.rb <ide> module ClassMethods # :nodoc: <ide> private <ide> <ide> def define_method_attribute=(name) <del> safe_name = name.unpack("h*".freeze).first <add> safe_name = name.unpack1("h*".freeze) <ide> ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name <ide> sync_with_transaction_state = "sync_with_transaction_state" if name == primary_key <ide> <ide><path>activesupport/lib/active_support/testing/isolation.rb <ide> def run_in_isolation(&blk) <ide> write.close <ide> result = read.read <ide> Process.wait2(pid) <del> result.unpack("m")[0] <add> result.unpack1("m") <ide> end <ide> end <ide> <ide> def run_in_isolation(&blk) <ide> nil <ide> end <ide> <del> return tmpfile.read.unpack("m")[0] <add> return tmpfile.read.unpack1("m") <ide> end <ide> end <ide> end <ide><path>activesupport/test/key_generator_test.rb <ide> def setup <ide> # key would break. <ide> <ide> expected = "b129376f68f1ecae788d7433310249d65ceec090ecacd4c872a3a9e9ec78e055739be5cc6956345d5ae38e7e1daa66f1de587dc8da2bf9e8b965af4b3918a122" <del> assert_equal expected, ActiveSupport::KeyGenerator.new("0" * 64).generate_key("some_salt").unpack("H*").first <add> assert_equal expected, ActiveSupport::KeyGenerator.new("0" * 64).generate_key("some_salt").unpack1("H*") <ide> <ide> expected = "b129376f68f1ecae788d7433310249d65ceec090ecacd4c872a3a9e9ec78e055" <del> assert_equal expected, ActiveSupport::KeyGenerator.new("0" * 64).generate_key("some_salt", 32).unpack("H*").first <add> assert_equal expected, ActiveSupport::KeyGenerator.new("0" * 64).generate_key("some_salt", 32).unpack1("H*") <ide> <ide> expected = "cbea7f7f47df705967dc508f4e446fd99e7797b1d70011c6899cd39bbe62907b8508337d678505a7dc8184e037f1003ba3d19fc5d829454668e91d2518692eae" <del> assert_equal expected, ActiveSupport::KeyGenerator.new("0" * 64, iterations: 2).generate_key("some_salt").unpack("H*").first <add> assert_equal expected, ActiveSupport::KeyGenerator.new("0" * 64, iterations: 2).generate_key("some_salt").unpack1("H*") <ide> end <ide> end <ide>
7
Python
Python
add a function to get msvc version
a2c67987055400e49c056f6301317a36dca5a244
<ide><path>numpy/distutils/misc_util.py <ide> def show(): <ide> f.close() <ide> return target <ide> <add>def msvc_version(compiler): <add> """Return version major and minor of compiler instance if it is <add> MSVC, raise an exception otherwise.""" <add> if not compiler.compiler_type == "msvc": <add> raise ValueError("Compiler instance is not msvc (%s)"\ <add> % compiler.compiler_type) <add> return compiler._MSVCCompiler__version <add> <ide> if sys.version[:3] >= '2.5': <ide> def get_build_architecture(): <ide> from distutils.msvccompiler import get_build_architecture
1
Python
Python
add state details to emr container failure reason
480c333c45d31cdfdc63cdfceecd4ad8529eefd4
<ide><path>airflow/providers/amazon/aws/hooks/emr_containers.py <ide> def get_job_failure_reason(self, job_id: str) -> Optional[str]: <ide> virtualClusterId=self.virtual_cluster_id, <ide> id=job_id, <ide> ) <del> reason = response['jobRun']['failureReason'] <add> failure_reason = response['jobRun']['failureReason'] <add> state_details = response["jobRun"]["stateDetails"] <add> reason = f"{failure_reason} - {state_details}" <ide> except KeyError: <ide> self.log.error('Could not get status of the EMR on EKS job') <ide> except ClientError as ex: <ide><path>tests/providers/amazon/aws/operators/test_emr_containers.py <ide> def test_execute_with_failure( <ide> ): <ide> mock_submit_job.return_value = "jobid_123456" <ide> mock_check_query_status.return_value = 'FAILED' <del> mock_get_job_failure_reason.return_value = "CLUSTER_UNAVAILABLE" <add> mock_get_job_failure_reason.return_value = ( <add> "CLUSTER_UNAVAILABLE - Cluster EKS eks123456 does not exist." <add> ) <ide> with pytest.raises(AirflowException) as ctx: <ide> self.emr_container.execute(None) <ide> assert 'EMR Containers job failed' in str(ctx.value) <del> assert 'Error: CLUSTER_UNAVAILABLE' in str(ctx.value) <add> assert 'Error: CLUSTER_UNAVAILABLE - Cluster EKS eks123456 does not exist.' in str(ctx.value) <ide> <ide> @mock.patch.object( <ide> EMRContainerHook,
2
Javascript
Javascript
fix lint error
cff2a137f201604cbb3c4e54578b4ebfd20bcaf2
<ide><path>benchmark/misc/console.js <ide> function main(conf) { <ide> case 'restAndConcat': <ide> if (conf.concat) <ide> runUsingRestAndConcat(n); <del> break; <add> break; <ide> default: <ide> throw new Error('Unexpected method'); <ide> }
1
Python
Python
use 4 spaces per indentation level as per pep8
d7215411dab5aade2a70d2938adb4308c923b054
<ide><path>numpy/distutils/fcompiler/pathf95.py <ide> <ide> class PathScaleFCompiler(FCompiler): <ide> <del> compiler_type = 'pathf95' <del> description = 'PathScale Fortran Compiler' <del> version_pattern = r'PathScale\(TM\) Compiler Suite: Version (?P<version>[\d.]+)' <add> compiler_type = 'pathf95' <add> description = 'PathScale Fortran Compiler' <add> version_pattern = r'PathScale\(TM\) Compiler Suite: Version (?P<version>[\d.]+)' <ide> <del> executables = { <del> 'version_cmd' : ["pathf95", "-version"], <del> 'compiler_f77' : ["pathf95", "-fixedform"], <del> 'compiler_fix' : ["pathf95", "-fixedform"], <del> 'compiler_f90' : ["pathf95"], <del> 'linker_so' : ["pathf95", "-shared"], <del> 'archiver' : ["ar", "-cr"], <del> 'ranlib' : ["ranlib"] <del> } <del> pic_flags = ['-fPIC'] <del> module_dir_switch = '-module ' # Don't remove ending space! <del> module_include_switch = '-I' <add> executables = { <add> 'version_cmd' : ["pathf95", "-version"], <add> 'compiler_f77' : ["pathf95", "-fixedform"], <add> 'compiler_fix' : ["pathf95", "-fixedform"], <add> 'compiler_f90' : ["pathf95"], <add> 'linker_so' : ["pathf95", "-shared"], <add> 'archiver' : ["ar", "-cr"], <add> 'ranlib' : ["ranlib"] <add> } <add> pic_flags = ['-fPIC'] <add> module_dir_switch = '-module ' # Don't remove ending space! <add> module_include_switch = '-I' <ide> <del> def get_flags_opt(self): <del> return ['-O3'] <del> def get_flags_debug(self): <del> return ['-g'] <add> def get_flags_opt(self): <add> return ['-O3'] <add> def get_flags_debug(self): <add> return ['-g'] <ide> <ide> if __name__ == '__main__': <del> from distutils import log <del> log.set_verbosity(2) <del> #compiler = PathScaleFCompiler() <del> from numpy.distutils.fcompiler import new_fcompiler <del> compiler = new_fcompiler(compiler='pathf95') <del> compiler.customize() <del> print compiler.get_version() <add> from distutils import log <add> log.set_verbosity(2) <add> #compiler = PathScaleFCompiler() <add> from numpy.distutils.fcompiler import new_fcompiler <add> compiler = new_fcompiler(compiler='pathf95') <add> compiler.customize() <add> print compiler.get_version()
1
Javascript
Javascript
remove cruft that dealt with env parameter
e514f575f3461fb7d0d3c16918e36fbf83166f15
<ide><path>lib/child_process.js <ide> var spawn = exports.spawn = function (path, args /*, options OR env, customFds * <ide> exports.exec = function (command /*, options, callback */) { <ide> if (arguments.length < 3) { <ide> return exports.execFile("/bin/sh", ["-c", command], arguments[1]); <del> } else if (arguments.length < 4) { <del> return exports.execFile("/bin/sh", ["-c", command], arguments[1], arguments[2]); <ide> } else { <del> return exports.execFile("/bin/sh", ["-c", command], arguments[1], arguments[2], arguments[3]); <add> return exports.execFile("/bin/sh", ["-c", command], arguments[1], arguments[2]); <ide> } <ide> }; <ide>
1
Mixed
Text
use to_a to pre-buffer the collection
87899cfcf0ada140764acf4393eb862698449f54
<ide><path>actionview/CHANGELOG.md <ide> * Changed partial rendering with a collection to allow collections which <del> don't implement `to_ary`. <add> implement `to_a`. <ide> <del> Extracting the collection option has an optimization to avoid unnecessary <del> queries of ActiveRecord Relations by calling `to_ary` on the given <add> Extracting the collection option had an optimization to avoid unnecessary <add> queries of ActiveRecord Relations by calling `#to_ary` on the given <ide> collection. Instances of `Enumerator` or `Enumerable` are valid <del> collections, but they do not implement `#to_ary`. They will now be <del> extracted and rendered as expected. <add> collections, but they do not implement `#to_ary`. By changing this to <add> `#to_a`, they will now be extracted and rendered as expected. <ide> <ide> *Steven Harman* <ide> <ide><path>actionview/lib/action_view/renderer/partial_renderer.rb <ide> def setup(context, options, block) <ide> <ide> def collection_from_options <ide> if @options.key?(:collection) <del> collection = @options[:collection] || [] <del> collection = collection.to_ary if collection.respond_to?(:to_ary) <del> collection <add> collection = @options[:collection] <add> collection ? collection.to_a : [] <ide> end <ide> end <ide>
2
Ruby
Ruby
fix indentation in `display_items`
2918f92b89b83f1c730dbbd032fe32837add43dd
<ide><path>Library/Homebrew/linkage_checker.rb <ide> def display_items(label, things, puts_output: true) <ide> else <ide> things.sort.each do |item| <ide> output += if item.is_a? Regexp <del> "\n #{item.inspect}" <add> "\n #{item.inspect}" <ide> else <ide> "\n #{item}" <ide> end
1
PHP
PHP
fix securitycomponent using deprecated properties
823870ce53e7c83fd89fead815c1a2d67eaf6ad6
<ide><path>src/Controller/Component/SecurityComponent.php <ide> public function startup(Event $event) <ide> { <ide> /* @var \Cake\Controller\Controller $controller */ <ide> $controller = $event->getSubject(); <del> $this->session = $controller->request->getSession(); <del> $this->_action = $controller->request->getParam('action'); <del> $hasData = ($controller->request->getData() || $controller->request->is(['put', 'post', 'delete', 'patch'])); <add> $request = $controller->request; <add> $this->session = $request->getSession(); <add> $this->_action = $request->getParam('action'); <add> $hasData = ($request->getData() || $request->is(['put', 'post', 'delete', 'patch'])); <ide> try { <ide> $this->_secureRequired($controller); <ide> $this->_authRequired($controller); <ide> <del> $isNotRequestAction = !$controller->request->getParam('requested'); <add> $isNotRequestAction = !$request->getParam('requested'); <ide> <ide> if ($this->_action === $this->_config['blackHoleCallback']) { <ide> throw new AuthSecurityException(sprintf('Action %s is defined as the blackhole callback.', $this->_action)); <ide> public function startup(Event $event) <ide> if (!in_array($this->_action, (array)$this->_config['unlockedActions']) && <ide> $hasData && <ide> $isNotRequestAction && <del> $this->_config['validatePost']) { <add> $this->_config['validatePost'] <add> ) { <ide> $this->_validatePost($controller); <ide> } <ide> } catch (SecurityException $se) { <ide> $this->blackHole($controller, $se->getType(), $se); <ide> } <ide> <del> $this->generateToken($controller->request); <add> $request = $this->generateToken($request); <ide> if ($hasData && is_array($controller->request->getData())) { <del> unset($controller->request->data['_Token']); <add> $request = $request->withoutData('_Token'); <ide> } <add> $controller->request = $request; <ide> } <ide> <ide> /** <ide> protected function _debugCheckFields($dataFields, $expectedFields = [], $intKeyM <ide> * request object. <ide> * <ide> * @param \Cake\Http\ServerRequest $request The request object to add into. <del> * @return bool <add> * @return \Cake\Http\ServerRequest The modified request. <ide> */ <ide> public function generateToken(ServerRequest $request) <ide> { <ide> if ($request->is('requested')) { <ide> if ($this->session->check('_Token')) { <del> $request->params['_Token'] = $this->session->read('_Token'); <add> $request = $request->withParam('_Token', $this->session->read('_Token')); <ide> } <ide> <del> return false; <add> return $request; <ide> } <ide> $token = [ <ide> 'allowedControllers' => $this->_config['allowedControllers'], <ide> public function generateToken(ServerRequest $request) <ide> ]; <ide> <ide> $this->session->write('_Token', $token); <del> $request->params['_Token'] = [ <del> 'unlockedFields' => $token['unlockedFields'] <del> ]; <ide> <del> return true; <add> return $request->withParam('_Token', [ <add> 'unlockedFields' => $token['unlockedFields'] <add> ]); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Controller/Component/SecurityComponentTest.php <ide> public function testValidatePost() <ide> $unlocked = ''; <ide> $debug = ''; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => 'nate', 'password' => 'foo', 'valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $this->assertTrue($this->validatePost()); <ide> } <ide> <ide> public function testValidatePostNoSession() <ide> <ide> $fields = 'a5475372b40f6e3ccbf9f8af191f20e1642fd877%3AModel.valid'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => 'nate', 'password' => 'foo', 'valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $this->assertFalse($this->validatePost('AuthSecurityException', 'Unexpected field \'Model.password\' in POST data, Unexpected field \'Model.username\' in POST data')); <ide> } <ide> <ide> public function testValidatePostNoUnlockedInRequestData() <ide> <ide> $fields = 'a5475372b40f6e3ccbf9f8af191f20e1642fd877%3AModel.valid'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => 'nate', 'password' => 'foo', 'valid' => '0'], <ide> '_Token' => compact('fields') <del> ]; <add> ]); <ide> $this->assertFalse($this->validatePost('AuthSecurityException', '\'_Token.unlocked\' was not found in request data.')); <ide> } <ide> <ide> public function testValidatePostFormHacking() <ide> $this->Security->startup($event); <ide> $unlocked = ''; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => 'nate', 'password' => 'foo', 'valid' => '0'], <ide> '_Token' => compact('unlocked') <del> ]; <add> ]); <ide> $result = $this->validatePost('AuthSecurityException', '\'_Token.fields\' was not found in request data.'); <ide> $this->assertFalse($result, 'validatePost passed when fields were missing. %s'); <ide> } <ide> public function testValidatePostObjectDeserialize() <ide> $attack = 'O:3:"App":1:{s:5:"__map";a:1:{s:3:"foo";s:7:"Hacked!";s:1:"fail"}}'; <ide> $fields .= urlencode(':' . str_rot13($attack)); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => 'mark', 'password' => 'foo', 'valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $result = $this->validatePost('SecurityException', 'Bad Request'); <ide> $this->assertFalse($result, 'validatePost passed when key was missing. %s'); <ide> } <ide> public function testValidatePostIgnoresCsrfToken() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> '_csrfToken' => 'abc123', <ide> 'Model' => ['multi_field' => ['1', '3']], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $this->assertTrue($this->validatePost()); <ide> } <ide> <ide> public function testValidatePostArray() <ide> [] <ide> ])); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['multi_field' => ['1', '3']], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $this->assertTrue($this->validatePost()); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['multi_field' => [12 => '1', 20 => '3']], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $this->assertTrue($this->validatePost()); <ide> } <ide> <ide> public function testValidateIntFieldName() <ide> [] <ide> ])); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 1 => 'value,', <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $this->assertTrue($this->validatePost()); <ide> } <ide> <ide> public function testValidatePostNoModel() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'anything' => 'some_data', <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidatePostSimple() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => '', 'password' => ''], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidatePostComplex() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Addresses' => [ <ide> '0' => [ <ide> 'id' => '123456', 'title' => '', 'first_name' => '', 'last_name' => '', <ide> public function testValidatePostComplex() <ide> ] <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> } <ide> public function testValidatePostMultipleSelect() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Tag' => ['Tag' => [1, 2]], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Tag' => ['Tag' => [1, 2, 3]], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Tag' => ['Tag' => [1, 2, 3, 4]], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <ide> $fields = '1e4c9269b64756e9b141d364497c5f037b428a37%3A'; <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'User.password' => 'bar', 'User.name' => 'foo', 'User.is_valid' => '1', <ide> 'Tag' => ['Tag' => [1]], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> } <ide> public function testValidatePostCheckbox() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => '', 'password' => '', 'valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <ide> $fields = '3f368401f9a8610bcace7746039651066cdcdc38%3A'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => '', 'password' => '', 'valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <del> $this->Controller->request->data = []; <add> $this->Controller->request = $this->Controller->request->withParsedBody([]); <ide> $this->Security->startup($event); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => '', 'password' => '', 'valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidatePostHidden() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => '', 'password' => '', 'hidden' => '0', <ide> 'other_hidden' => 'some hidden value' <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> } <ide> public function testValidatePostWithDisabledFields() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => '', 'password' => '', 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidatePostDisabledFieldsInData() <ide> ); <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => 'mark', <ide> 'password' => 'sekret', <ide> 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidatePostFailNoDisabled() <ide> $fields = ['Model.hidden', 'Model.password', 'Model.username']; <ide> $fields = urlencode(Security::hash(serialize($fields) . Security::getSalt())); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => 'mark', <ide> 'password' => 'sekret', <ide> 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost('SecurityException', '\'_Token.unlocked\' was not found in request data.'); <ide> $this->assertFalse($result); <ide> public function testValidatePostFailNoDebug() <ide> $fields = urlencode(Security::hash(serialize($fields) . Security::getSalt())); <ide> $unlocked = ''; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => 'mark', <ide> 'password' => 'sekret', <ide> 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields', 'unlocked') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost('SecurityException', '\'_Token.debug\' was not found in request data.'); <ide> $this->assertFalse($result); <ide> public function testValidatePostFailNoDebugMode() <ide> $fields = urlencode(Security::hash(serialize($fields) . Security::getSalt())); <ide> $unlocked = ''; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => 'mark', <ide> 'password' => 'sekret', <ide> 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields', 'unlocked') <del> ]; <add> ]); <ide> Configure::write('debug', false); <ide> $result = $this->validatePost('SecurityException', 'The request has been black-holed'); <ide> } <ide> public function testValidatePostFailDisabledFieldTampering() <ide> // Tamper the values. <ide> $unlocked = 'Model.username|Model.password'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => 'mark', <ide> 'password' => 'sekret', <ide> 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost('SecurityException', 'Missing field \'Model.password\' in POST data, Unexpected unlocked field \'Model.password\' in POST data'); <ide> $this->assertFalse($result); <ide> public function testValidateHiddenMultipleModel() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => ['username' => '', 'password' => '', 'valid' => '0'], <ide> 'Model2' => ['valid' => '0'], <ide> 'Model3' => ['valid' => '0'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> } <ide> public function testValidateHasManyModel() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> [ <ide> 'username' => 'username', 'password' => 'password', <ide> public function testValidateHasManyModel() <ide> ] <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidateHasManyRecordsPass() <ide> $unlocked = ''; <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Address' => [ <ide> 0 => [ <ide> 'id' => '123', <ide> public function testValidateHasManyRecordsPass() <ide> ] <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidateNestedNumericSets() <ide> ); <ide> $debug = 'not used'; <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'TaxonomyData' => [ <ide> 1 => [[2]], <ide> 2 => [[3]] <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> } <ide> public function testValidateHasManyRecordsFail() <ide> [] <ide> ])); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Address' => [ <ide> 0 => [ <ide> 'id' => '123', <ide> public function testValidateHasManyRecordsFail() <ide> ] <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost('SecurityException', 'Bad Request'); <ide> $this->assertFalse($result); <ide> } <ide> public function testFormDisabledFields() <ide> [] <ide> ])); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'MyModel' => ['name' => 'some data'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost('SecurityException', 'Unexpected field \'MyModel.name\' in POST data'); <ide> $this->assertFalse($result); <ide> <ide> $this->Security->startup($event); <ide> $this->Security->setConfig('disabledFields', ['MyModel.name']); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'MyModel' => ['name' => 'some data'], <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> public function testValidatePostRadio() <ide> [] <ide> ])); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <del> ]; <add> ]); <ide> $result = $this->validatePost('SecurityException', 'Bad Request'); <ide> $this->assertFalse($result); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <ide> 'Test' => ['test' => ''] <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <ide> 'Test' => ['test' => '1'] <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> '_Token' => compact('fields', 'unlocked', 'debug'), <ide> 'Test' => ['test' => '2'] <del> ]; <add> ]); <ide> $result = $this->validatePost(); <ide> $this->assertTrue($result); <ide> } <ide> public function testBlackHoleNotDeletingSessionInformation() <ide> public function testGenerateToken() <ide> { <ide> $request = $this->Controller->request; <del> $this->Security->generateToken($request); <add> $request = $this->Security->generateToken($request); <ide> <del> $this->assertNotEmpty($request->params['_Token']); <del> $this->assertTrue(isset($request->params['_Token']['unlockedFields'])); <add> $this->assertNotEmpty($request->getParam('_Token')); <add> $this->assertSame([], $request->getParam('_Token.unlockedFields')); <ide> } <ide> <ide> /** <ide> public function testUnlockedActions() <ide> { <ide> $_SERVER['REQUEST_METHOD'] = 'POST'; <ide> $event = new Event('Controller.startup', $this->Controller); <del> $this->Controller->request->data = ['data']; <add> $this->Controller->request = $this->Controller->request->withParsedBody(['data']); <ide> $this->Security->unlockedActions = 'index'; <ide> $this->Security->blackHoleCallback = null; <ide> $result = $this->Controller->Security->startup($event); <ide> public function testValidatePostDebugFormat() <ide> ['not expected'] <ide> ])); <ide> <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'username' => 'mark', <ide> 'password' => 'sekret', <ide> 'hidden' => '0' <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost('SecurityException', 'Invalid security debug token.'); <ide> $this->assertFalse($result); <ide> public function testValidatePostFailTampering() <ide> ])); <ide> $fields = urlencode(Security::hash(serialize($fields) . $unlocked . Security::getSalt())); <ide> $fields .= urlencode(':Model.hidden|Model.id'); <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'hidden' => 'tampered', <ide> 'id' => '1', <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> <ide> $result = $this->validatePost('SecurityException', 'Tampered field \'Model.hidden\' in POST data (expected value \'value\' but found \'tampered\')'); <ide> $this->assertFalse($result); <ide> public function testValidatePostUnexpectedDebugToken() <ide> ])); <ide> $fields = urlencode(Security::hash(serialize($fields) . $unlocked . Security::getSalt())); <ide> $fields .= urlencode(':Model.hidden|Model.id'); <del> $this->Controller->request->data = [ <add> $this->Controller->request = $this->Controller->request->withParsedBody([ <ide> 'Model' => [ <ide> 'hidden' => ['some-key' => 'some-value'], <ide> 'id' => '1', <ide> ], <ide> '_Token' => compact('fields', 'unlocked', 'debug') <del> ]; <add> ]); <ide> Configure::write('debug', false); <ide> $result = $this->validatePost('SecurityException', 'Unexpected \'_Token.debug\' found in request data'); <ide> $this->assertFalse($result);
2
Javascript
Javascript
add an early invariant to debug a mystery crash
4ee592e95a5f78daed575a047d47f74f046940f3
<ide><path>packages/react-reconciler/src/ReactFiber.js <ide> import { <ide> enableUserTimingAPI, <ide> enableScopeAPI, <ide> enableBlocksAPI, <add> throwEarlyForMysteriousError, <ide> } from 'shared/ReactFeatureFlags'; <ide> import {NoEffect, Placement} from 'shared/ReactSideEffectTags'; <ide> import {ConcurrentRoot, BlockingRoot} from 'shared/ReactRootTags'; <ide> export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { <ide> } <ide> } <ide> <add> if (throwEarlyForMysteriousError) { <add> // Trying to debug a mysterious internal-only production failure. <add> // See D20130868 and t62461245. <add> // This is only on for RN FB builds. <add> if (current == null) { <add> throw Error('current is ' + current + " but it can't be"); <add> } <add> if (workInProgress == null) { <add> throw Error('workInProgress is ' + workInProgress + " but it can't be"); <add> } <add> } <add> <ide> workInProgress.childExpirationTime = current.childExpirationTime; <ide> workInProgress.expirationTime = current.expirationTime; <ide> <ide><path>packages/shared/ReactFeatureFlags.js <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> // a deprecated pattern we want to get rid of in the future <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // -------------------------- <ide> // Future APIs to be deprecated <ide> // -------------------------- <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = true; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.persistent.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.testing.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.testing.www.js <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide> export const enableModernEventSystem = false; <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide> invariant(false, 'Not implemented.'); <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> <ide> export const enableModernEventSystem = false; <ide> <add>// Internal-only attempt to debug a React Native issue. See D20130868. <add>export const throwEarlyForMysteriousError = false; <add> <ide> // Flow magic to verify the exports of this file match the original version. <ide> // eslint-disable-next-line no-unused-vars <ide> type Check<_X, Y: _X, X: Y = _X> = null;
10
Mixed
Ruby
apply suggestions from review
81f6a1f87f18bc097c7897dfaf363b5bae468ef6
<ide><path>activerecord/lib/active_record/internal_metadata.rb <ide> module ActiveRecord <ide> # This class is used to create a table that keeps track of values and keys such <ide> # as which environment migrations were run in. <ide> # <del> # It is possible to enable or disable this functionality by setting the <del> # adapter configuration option `use_metadata_table` to false <add> # This is enabled by default. To disable this functionality set <add> # `use_metadata_table` to false in your database configuration. <ide> class InternalMetadata < ActiveRecord::Base # :nodoc: <ide> class << self <ide> def enabled? <ide><path>activerecord/lib/active_record/migration.rb <ide> def initialize(current: nil, stored: nil) <ide> end <ide> end <ide> <del> class EnvironmentStorageError < ActiveRecordError #:nodoc: <add> class EnvironmentStorageError < ActiveRecordError # :nodoc: <ide> def initialize <ide> msg = +"You are attempting to store the environment in a database where metadata is disabled.\n" <del> msg << "Check your database configuration to see if this is inteded." <add> msg << "Check your database configuration to see if this is intended." <add> super(msg) <ide> end <ide> end <ide> <ide><path>activerecord/test/cases/migration_test.rb <ide> def test_internal_metadata_stores_environment_when_other_data_exists <ide> end <ide> <ide> def test_internal_metadata_not_used_when_not_enabled <del> ActiveRecord::InternalMetadata.stub(:enabled?, false) do <del> migrations_path = MIGRATIONS_ROOT + "/valid" <add> ActiveRecord::InternalMetadata.drop_table <add> original_config = ActiveRecord::Base.connection.instance_variable_get("@config") <ide> <del> migrator = ActiveRecord::MigrationContext.new(migrations_path, @schema_migration) <del> migrator.up <del> assert_not ActiveRecord::InternalMetadata[:environment] <del> end <add> modified_config = original_config.dup.merge(use_metadata_table: false) <add> <add> ActiveRecord::Base.connection <add> .instance_variable_set("@config", modified_config) <add> <add> assert_not ActiveRecord::InternalMetadata.enabled? <add> assert_not ActiveRecord::InternalMetadata.table_exists? <add> <add> migrations_path = MIGRATIONS_ROOT + "/valid" <add> migrator = ActiveRecord::MigrationContext.new(migrations_path, @schema_migration) <add> migrator.up <add> <add> assert_not ActiveRecord::InternalMetadata[:environment] <add> assert_not ActiveRecord::InternalMetadata.table_exists? <add> ensure <add> ActiveRecord::Base.connection.instance_variable_set("@config", original_config) <add> ActiveRecord::InternalMetadata.create_table <ide> end <ide> <ide> def test_proper_table_name_on_migration <ide><path>guides/source/configuring.md <ide> Change the username and password in the `development` section as appropriate. <ide> <ide> #### Configuring Metadata Storage <ide> <del>By default Rails will store information about your environment and schema in an internal table. If you do not want this table to be created, and are willing to give up the protections it provides (useful when working with a shared database and a database user that can not create tables). <add>By default Rails will store information about your Rails environment and schema <add>in an internal table named `ar_internal_metadata`. <add> <add>To turn this off per connection, set `use_metadata_table` in your database <add>configuration. This is useful when working with a shared database and/or <add>database user that cannot create tables. <ide> <ide> ```yaml <ide> development:
4
Ruby
Ruby
add path for 'libexec'
4c2d4c8560aff4011dde08a0585c72e2b9f8a2c1
<ide><path>Library/Homebrew/formula.rb <ide> def bin; prefix+'bin' end <ide> def sbin; prefix+'sbin' end <ide> def doc; prefix+'share'+'doc'+name end <ide> def lib; prefix+'lib' end <add> def libexec; prefix+'libexec' end <ide> def man; prefix+'share'+'man' end <ide> def man1; man+'man1' end <ide> def info; prefix+'share'+'info' end
1
Python
Python
prevent duplicates in limitedset
933d57d413263efa10cd00fb0e7c25e7a6604470
<ide><path>celery/tests/utils/test_datastructures.py <ide> def test_as_dict(self): <ide> s.add('foo') <ide> self.assertIsInstance(s.as_dict(), Mapping) <ide> <add> def test_no_duplicates(self): <add> s = LimitedSet(maxlen=2) <add> s.add('foo') <add> s.add('foo') <add> self.assertEqual(len(s), 1) <add> self.assertEqual(len(s._data), 1) <add> self.assertEqual(len(s._heap), 1) <ide> <ide> class test_AttributeDict(Case): <ide>
1
Python
Python
describe output from astype method
5bfd65a55517e7a0af60d31e8dba6dc2f6b87df1
<ide><path>numpy/add_newdocs.py <ide> def luf(lamdaexpr, *args, **kwargs): <ide> requirements are satisfied, the input array is returned instead <ide> of a copy. <ide> <add> Returns <add> ------- <add> arr_t : ndarray <add> Unless `copy` is False and the other conditions for returning the input <add> array are satisfied (see description for `copy` input paramter), `arr_t` <add> is a new array of the same shape as the input array, with dtype, order <add> given by `dtype`, `order`. <add> <ide> Raises <ide> ------ <ide> ComplexWarning :
1