PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 320
Good morning! Here's your coding interview problem for today.

This problem was asked by Amazon.

Given a string, find the length of the smallest window that contains every distinct character. Characters may appear more than once in the window.

For example, given `"jiujitsu"`, you should return `5`, corresponding to the final five letters.

Pull request:
Day320
Resolves #650.

Patch:
diff --git a/README.md b/README.md
index 3693706..ff0bd53 100644
--- a/README.md
+++ b/README.md
@@ -323,4 +323,5 @@ problems from
 * [Day 314](https://github.com/vaskoz/dailycodingproblem-go/issues/640)
 * [Day 315](https://github.com/vaskoz/dailycodingproblem-go/issues/642)
 * [Day 317](https://github.com/vaskoz/dailycodingproblem-go/issues/645)
+* [Day 320](https://github.com/vaskoz/dailycodingproblem-go/issues/650)
 * [Day 321](https://github.com/vaskoz/dailycodingproblem-go/issues/651)
diff --git a/day320/problem.go b/day320/problem.go
new file mode 100644
index 0000000..1773bc4
--- /dev/null
+++ b/day320/problem.go
@@ -0,0 +1,38 @@
+package day320
+
+// SmallestWindowEveryDistinctLength returns the length
+// of the smallest window that contains every distinct
+// character available.
+// Runs in O(N) time and O(k) extra space where k
+// is the number of distinct characters.
+func SmallestWindowEveryDistinctLength(str string) int {
+	distinct := make(map[rune]int)
+	for _, r := range str {
+		distinct[r]++
+	}
+	distinctCount := len(distinct)
+	distinct = make(map[rune]int, distinctCount)
+	var begin int
+	smallest := len(str)
+	for end, r := range str {
+		distinct[r]++
+		if len(distinct) == distinctCount {
+			for toRemove := rune(str[begin]); distinct[toRemove] > 1; toRemove = rune(str[begin]) {
+				distinct[toRemove]--
+				begin++
+			}
+			if length := end - begin + 1; length < smallest {
+				smallest = length
+			}
+		}
+		for len(distinct) == distinctCount {
+			toRemove := rune(str[begin])
+			distinct[toRemove]--
+			if count := distinct[toRemove]; count == 0 {
+				delete(distinct, toRemove)
+			}
+			begin++
+		}
+	}
+	return smallest
+}


Test patch:
diff --git a/day320/problem_test.go b/day320/problem_test.go
new file mode 100644
index 0000000..2aa483c
--- /dev/null
+++ b/day320/problem_test.go
@@ -0,0 +1,31 @@
+package day320
+
+import "testing"
+
+// nolint
+var testcases = []struct {
+	input        string
+	windowLength int
+}{
+	{"jiujitsu", 5},
+	{"", 0},
+	{"a", 1},
+	{"aabbccabaabbccc", 3},
+}
+
+func TestSmallestWindowEveryDistinctLength(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := SmallestWindowEveryDistinctLength(tc.input); result != tc.windowLength {
+			t.Errorf("Expected %v, got %v", tc.windowLength, result)
+		}
+	}
+}
+
+func BenchmarkSmallestWindowEveryDistinctLength(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			SmallestWindowEveryDistinctLength(tc.input)
+		}
+	}
+}
Repository: raviqqe/muffet (go)

Issue:
Feature: Support metadata URLs used for open graph/twitter cards
Websites can provide metadata like thumbnails/preview images using the `<meta>` tag. [Open Graph](https://ogp.me/) is used by most platforms and Twitter has its own format but they all use `<meta>` tags where the `content=` attribute can contain a URL.

My use case is that I crawl my website locally to make sure that I don't have any broken links in the meta URLs. So I would find this feature helpful.

I am happy to send a PR but wanted to check if there is interest in this feature first.

Pull request:
Support scraping opengraph/twitter meta tags
`<meta>` tags with specific `og:` and `twitter:` properties that map to URLs are now fetched.

Specific properties that are supported are:

- `og:image`
- `og:audio`
- `og:video`
- `og:image:url`
- `og:image:secure_url`
- `twitter:image`

Fixes #268 

Patch:
diff --git a/link_finder.go b/link_finder.go
index fcee4f8..edd7f68 100644
--- a/link_finder.go
+++ b/link_finder.go
@@ -25,6 +25,7 @@ var atomToAttributes = map[atom.Atom][]string{
 	atom.Script: {"src"},
 	atom.Source: {"src", "srcset"},
 	atom.Track:  {"src"},
+	atom.Meta:   {"content"},
 }
 
 var imageDescriptorPattern = regexp.MustCompile(" [^ ]*$")
@@ -81,6 +82,12 @@ func (linkFinder) parseLinks(n *html.Node, a string) []string {
 		for _, s := range strings.Split(s, ",") {
 			ss = append(ss, imageDescriptorPattern.ReplaceAllString(strings.TrimSpace(s), ""))
 		}
+	} else if a == "content" {
+		prop := scrape.Attr(n, "property")
+		switch prop {
+		case "og:image", "og:audio", "og:video", "og:image:url", "og:image:secure_url", "twitter:image":
+			ss = append(ss, s)
+		}
 	} else {
 		ss = append(ss, s)
 	}


Test patch:
diff --git a/link_finder_test.go b/link_finder_test.go
index 2054bc2..4da52e8 100644
--- a/link_finder_test.go
+++ b/link_finder_test.go
@@ -253,6 +253,40 @@ func TestLinkFinderFindMultipleLinksInSrcSetWithDescriptors(t *testing.T) {
 	assert.Nil(t, err)
 }
 
+func TestLinkFinderFindMetaTags(t *testing.T) {
+	b, err := url.Parse("http://foo.com")
+	assert.Nil(t, err)
+
+	n, err := html.Parse(strings.NewReader(
+		htmlWithHead(`<meta property="og:image" content="foo.png" />`)),
+	)
+	assert.Nil(t, err)
+
+	ls := newLinkFinder(nil, nil).Find(n, b)
+
+	err, ok := ls["http://foo.com/foo.png"]
+	assert.True(t, ok)
+	assert.Nil(t, err)
+}
+
+func TestLinkFinderIgnoreMetaTags(t *testing.T) {
+	b, err := url.Parse("http://foo.com")
+	assert.Nil(t, err)
+
+	n, err := html.Parse(strings.NewReader(
+		htmlWithHead(`<meta property="og:title" content="title" />`)),
+	)
+	assert.Nil(t, err)
+
+	ls := newLinkFinder(nil, nil).Find(n, b)
+
+	assert.Len(t, ls, 0)
+}
+
 func htmlWithBody(b string) string {
 	return fmt.Sprintf(`<html><body>%v</body></html>`, b)
 }
+
+func htmlWithHead(b string) string {
+	return fmt.Sprintf(`<html><head>%v</head><body><p>hi</p></body></html>`, b)
+}
Repository: FriendsOfPHP/PHP-CS-Fixer (php)

Issue:
Braces rule: Omitting "break" in switch incorrectly indents closing brace
## Bug report

Adding another test case for incorrect indentation, adding to #6470.

PHP CS Fixer 3.9.5 Grand Awaiting by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 7.4.30

Command:
php-cs-fixer fix -vvv --rules=braces testcase.php

### Code snippet that reproduces the problem

This code snippet should not be changed:

```php
<?php

function foo($var)
{
    switch ($var) {
        case 'one':
            break;
        case 'two':
            break;
        default:
    }
}

switch ($var) {
    case 'one':
        break;
    case 'two':
        break;
    default:
}
```

Version 3.9.5 is indenting the closing brace of the switch statement one level too far.

Pull request:
bug: Fix indentation for switch ending with empty case
Fixes #6523.

Patch:
diff --git a/src/Fixer/Whitespace/StatementIndentationFixer.php b/src/Fixer/Whitespace/StatementIndentationFixer.php
index 4cc8fc7e6..34ca8f984 100644
--- a/src/Fixer/Whitespace/StatementIndentationFixer.php
+++ b/src/Fixer/Whitespace/StatementIndentationFixer.php
@@ -124,6 +124,17 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
             0,
             $this->extractIndent($this->computeNewLineContent($tokens, 0)),
         );
+
+        /**
+         * @var list<array{
+         *     type: 'block'|'block_signature'|'statement',
+         *     skip: bool,
+         *     end_index: int,
+         *     end_index_inclusive: bool,
+         *     initial_indent: string,
+         *     is_indented_block: bool,
+         * }> $scopes
+         */
         $scopes = [
             [
                 'type' => 'block',
@@ -198,6 +209,13 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
                     'initial_indent' => $initialIndent,
                     'is_indented_block' => true,
                 ];
+                ++$currentScope;
+
+                while ($index >= $scopes[$currentScope]['end_index']) {
+                    array_pop($scopes);
+
+                    --$currentScope;
+                }
 
                 continue;
             }


Test patch:
diff --git a/tests/Fixer/Whitespace/StatementIndentationFixerTest.php b/tests/Fixer/Whitespace/StatementIndentationFixerTest.php
index f794935c6..e7f204718 100644
--- a/tests/Fixer/Whitespace/StatementIndentationFixerTest.php
+++ b/tests/Fixer/Whitespace/StatementIndentationFixerTest.php
@@ -760,6 +760,20 @@ public function foo() {
         break;
     default:
         // Nothing to do
+}',
+        ];
+
+        yield 'switch ending with empty case' => [
+            '<?php
+switch ($foo) {
+    case 1:
+}',
+        ];
+
+        yield 'switch ending with empty default' => [
+            '<?php
+switch ($foo) {
+    default:
 }',
         ];
     }
Repository: remarkablemark/html-react-parser (ts)

Issue:
TypeError: htmlToDOM is not a function
<!--
Is this a bug report?

* Yes: Continue filling out the template.
* No: Delete the template and write in free form. (Apply a label to the issue if applicable.)
-->

## Expected Behavior

 import parser from 'html-react-parser';
Use the parser normally and render the html 

## Actual Behavior

Cause a type error
![image](https://user-images.githubusercontent.com/25417060/152686436-614c9c28-72d7-432b-8767-2a2d5579d5cd.png)


## Steps to Reproduce

1- Install the latest version of package 1.4.7
2- Use it normally like this
import parse from 'html-react-parser';
parse('<p>Hello, World!</p>');



## Environment

- Version: html-react-parser@1.4.7, react-dom@17.0.2, next@10.0.7
- Platform: ReactJS, NextJS
- Browser: Google Chrome


Pull request:
fix: ensure backwards compatibility for html-dom-parser's ES Module
Fixes #445

## What is the motivation for this pull request?

fix: support backwards compatibility for `html-dom-parser`'s ES Module

Regression was caused in [1.4.7](https://github.com/remarkablemark/html-react-parser/releases/tag/v1.4.7). Related to https://github.com/remarkablemark/html-dom-parser/pull/202

## What is the current behavior?

next@10 throws an error:

```
TypeError: htmlToDOM is not a function
```

Note: next@11 and 12 did not have this error

## What is the new behavior?

No error in next@10

## Checklist:

- [x] [Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests

Patch:
diff --git a/index.js b/index.js
index 4f3a169..3830dfb 100644
--- a/index.js
+++ b/index.js
@@ -2,6 +2,11 @@ var domToReact = require('./lib/dom-to-react');
 var attributesToProps = require('./lib/attributes-to-props');
 var htmlToDOM = require('html-dom-parser');
 
+// support backwards compatibility for ES Module
+htmlToDOM =
+  /* istanbul ignore next */
+  typeof htmlToDOM.default === 'function' ? htmlToDOM.default : htmlToDOM;
+
 var domParserOptions = { lowerCaseAttributeNames: false };
 
 /**


Test patch:
diff --git a/test/index.test.js b/test/index.test.js
index a0cb28a..0b3bec5 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -6,18 +6,23 @@ const { render } = require('./helpers');
 describe('module', () => {
   it('exports default', () => {
     expect(parse.default).toBe(parse);
+    expect(parse.default).toBeInstanceOf(Function);
   });
 
   it('exports domToReact', () => {
     expect(parse.domToReact).toBe(require('../lib/dom-to-react'));
+    expect(parse.domToReact).toBeInstanceOf(Function);
   });
 
   it('exports htmlToDOM', () => {
     expect(parse.htmlToDOM).toBe(require('html-dom-parser'));
+    expect(parse.htmlToDOM).toBeInstanceOf(Function);
+    expect(parse.htmlToDOM.default).toBe(undefined);
   });
 
   it('exports attributesToProps', () => {
     expect(parse.attributesToProps).toBe(require('../lib/attributes-to-props'));
+    expect(parse.attributesToProps).toBeInstanceOf(Function);
   });
 });