PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: sql-formatter-org/sql-formatter (ts)

Issue:
First comment in file gets indented by single space
**Describe the Feature**
It would be  nice to have an option which configures the amount of whitespace inserted before comments.

**Why do you want this feature?**
Certain tools rely on comments for metadata. I'm using `dbmate`, which uses [comments](https://github.com/amacneil/dbmate#creating-migrations) to annotate where `up` and `down` migrations start and end. It currently breaks while parsing SQL formatted by this tool.

Pull request:
Fix indentation of first comment in file
Fixes #481 

Patch:
diff --git a/src/formatter/ExpressionFormatter.ts b/src/formatter/ExpressionFormatter.ts
index 610d38b6..67188464 100644
--- a/src/formatter/ExpressionFormatter.ts
+++ b/src/formatter/ExpressionFormatter.ts
@@ -306,8 +306,11 @@ export default class ExpressionFormatter {
   private formatLineComment(node: LineCommentNode) {
     if (isMultiline(node.precedingWhitespace || '')) {
       this.layout.add(WS.NEWLINE, WS.INDENT, node.text, WS.MANDATORY_NEWLINE, WS.INDENT);
-    } else {
+    } else if (this.layout.getLayoutItems().length > 0) {
       this.layout.add(WS.NO_NEWLINE, WS.SPACE, node.text, WS.MANDATORY_NEWLINE, WS.INDENT);
+    } else {
+      // comment is the first item in code - no need to add preceding spaces
+      this.layout.add(node.text, WS.MANDATORY_NEWLINE, WS.INDENT);
     }
   }
 


Test patch:
diff --git a/test/features/comments.ts b/test/features/comments.ts
index 9f269f9f..a5064290 100644
--- a/test/features/comments.ts
+++ b/test/features/comments.ts
@@ -116,6 +116,20 @@ export default function supportsComments(format: FormatFn, opts: CommentsConfig
     `);
   });
 
+  // Regression test for #481
+  it('formats first line comment in a file', () => {
+    expect(format('-- comment1\n-- comment2\n')).toBe(dedent`
+      -- comment1
+      -- comment2
+    `);
+  });
+  it('formats first block comment in a file', () => {
+    expect(format('/*comment1*/\n/*comment2*/\n')).toBe(dedent`
+      /*comment1*/
+      /*comment2*/
+    `);
+  });
+
   it('preserves single-line comments at the end of lines', () => {
     expect(
       format(`
Repository: vgteam/sequenceTubeMap (js)

Issue:
CopyLink: Use window.location.origin instead of window.location.host
CopyLink does not work if HTTPS is used for the the app. The protocol is missing.

I created a pull request #184

Pull request:
Support protocol in copied links
This is on top of #184 and will fix #186.

Patch:
diff --git a/src/components/CopyLink.js b/src/components/CopyLink.js
index 72ce775..91be277 100644
--- a/src/components/CopyLink.js
+++ b/src/components/CopyLink.js
@@ -23,7 +23,7 @@ export function CopyLink(props) {
     const viewTarget = props.getCurrentViewTarget();
 
     const params = new URLSearchParams(viewTarget).toString();
-    const full = window.location.host + "?" + params;
+    const full = window.location.origin + "?" + params;
     copyCallback(full);
 
     // Write link to clipboard


Test patch:
diff --git a/src/end-to-end.test.js b/src/end-to-end.test.js
index 9c0ce7c..04bc96e 100644
--- a/src/end-to-end.test.js
+++ b/src/end-to-end.test.js
@@ -256,7 +256,7 @@ describe("When we wait for it to load", () => {
 it("produces correct link for view before & after go is pressed", async () => {
   // First test that after pressing go, the link reflects the dat form
   const expectedLinkBRCA1 =
-    "localhost?name=snp1kg-BRCA1&xgFile=snp1kg-BRCA1.vg.xg&gamFile=NA12878-BRCA1.sorted.gam&dataPath=default&region=17%3A1-100&bedFile=snp1kg-BRCA1.bed&dataType=built-in";
+    "http://localhost?name=snp1kg-BRCA1&xgFile=snp1kg-BRCA1.vg.xg&gamFile=NA12878-BRCA1.sorted.gam&dataPath=default&region=17%3A1-100&bedFile=snp1kg-BRCA1.bed&dataType=built-in";
   // Set up dropdown
   await act(async () => {
     let dropdown = document.getElementById("dataSourceSelect");
@@ -290,7 +290,7 @@ it("produces correct link for view before & after go is pressed", async () => {
   await clickCopyLink();
 
   const expectedLinkCactus =
-    "localhost?name=cactus&region=ref%3A1-100&xgFile=cactus.vg.xg&gamFile=cactus-NA12879.sorted.gam&bedFile=cactus.bed&dataPath=mounted&dataType=built-in";
+    "http://localhost?name=cactus&region=ref%3A1-100&xgFile=cactus.vg.xg&gamFile=cactus-NA12879.sorted.gam&bedFile=cactus.bed&dataPath=mounted&dataType=built-in";
   // Make sure link has changed after pressing go
   expect(fakeClipboard).toEqual(expectedLinkCactus);
 });
Repository: caarlos0/env (go)

Issue:
[bug] []byte conversion
@caarlos0 I have a custom func for `[]bytes`, after this [PR](https://github.com/caarlos0/env/pull/223) I got the following error:
```bash
panic: env: parse error on field "Abc" of type "[]uint8": strconv.ParseUint: parsing "asdasd": invalid syntax
```
my mapping
```
Abc       []byte `env:"ABC" envDefault:"asdasd"`
```
my custom func
```go
func parseSliceOfBytes(c *Config) {
	if err := env.ParseWithFuncs(c, map[reflect.Type]env.ParserFunc{
		reflect.TypeOf([]byte{0}): func(v string) (interface{}, error) {
			return []byte(v), nil
		},
	}); err != nil {
		panic(err)
	}
}
```

Pull request:
fix: custom parsers with anon inner structs
fixes #226 

it was not passing down the funcmap to the children anon structs, which was causing a weird error in this particular case.

Patch:
diff --git a/env.go b/env.go
index e9ea4c6..f5401d6 100644
--- a/env.go
+++ b/env.go
@@ -218,7 +218,7 @@ func doParse(ref reflect.Value, funcMap map[reflect.Type]ParserFunc, opts []Opti
 			continue
 		}
 		if reflect.Struct == refField.Kind() && refField.CanAddr() && refField.Type().Name() == "" {
-			if err := Parse(refField.Addr().Interface(), optsWithPrefix(refType.Field(i), opts)...); err != nil {
+			if err := ParseWithFuncs(refField.Addr().Interface(), funcMap, optsWithPrefix(refType.Field(i), opts)...); err != nil {
 				return err
 			}
 			continue


Test patch:
diff --git a/env_test.go b/env_test.go
index 23a105f..7b33059 100644
--- a/env_test.go
+++ b/env_test.go
@@ -799,6 +799,34 @@ func TestCustomParser(t *testing.T) {
 	}
 }
 
+func TestIssue226(t *testing.T) {
+	type config struct {
+		Inner struct {
+			Abc []byte `env:"ABC" envDefault:"asdasd"`
+			Def []byte `env:"DEF" envDefault:"a"`
+		}
+		Hij []byte `env:"HIJ"`
+		Lmn []byte `env:"LMN"`
+	}
+
+	setEnv(t, "HIJ", "a")
+	setEnv(t, "LMN", "b")
+
+	cfg := &config{}
+	isNoErr(t, ParseWithFuncs(cfg, map[reflect.Type]ParserFunc{
+		reflect.TypeOf([]byte{0}): func(v string) (interface{}, error) {
+			if v == "a" {
+				return []byte("nope"), nil
+			}
+			return []byte(v), nil
+		},
+	}))
+	isEqual(t, cfg.Inner.Abc, []byte("asdasd"))
+	isEqual(t, cfg.Inner.Def, []byte("nope"))
+	isEqual(t, cfg.Hij, []byte("nope"))
+	isEqual(t, cfg.Lmn, []byte("b"))
+}
+
 func TestParseWithFuncsNoPtr(t *testing.T) {
 	type foo struct{}
 	isErrorWithMessage(t, ParseWithFuncs(foo{}, nil), "env: expected a pointer to a Struct")
Repository: ant-design/ant-design-mobile (ts)

Issue:
DatePicker选择周日期Bug
### Version of antd-mobile

5.38.1

### Operating system and its version

Others

### Browser and its version

官网

### Sandbox to reproduce

https://mobile.ant.design/zh/components/picker#datepicker

### What happened?


https://github.com/user-attachments/assets/80f2f2e4-5e27-43ec-9c6b-14ac4982d5f3

日期处理从2024年开始就对不上了，选中的和展示的对不上

### Relevant log output

_No response_

Pull request:
fix(DatePicker): week select with year edge week not working as expect
fix #6807

Patch:
diff --git a/src/components/date-picker/date-picker-week-utils.ts b/src/components/date-picker/date-picker-week-utils.ts
index e6022018c..8100b266a 100644
--- a/src/components/date-picker/date-picker-week-utils.ts
+++ b/src/components/date-picker/date-picker-week-utils.ts
@@ -1,8 +1,8 @@
-import type { ReactNode } from 'react'
 import dayjs from 'dayjs'
+import isLeapYear from 'dayjs/plugin/isLeapYear'
 import isoWeek from 'dayjs/plugin/isoWeek'
 import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear'
-import isLeapYear from 'dayjs/plugin/isLeapYear'
+import type { ReactNode } from 'react'
 import { PickerColumn } from '../picker'
 import type { DatePickerFilter } from './date-picker-utils'
 
@@ -123,13 +123,12 @@ export function convertDateToStringArray(
 }
 
 export function convertStringArrayToDate<
-  T extends string | number | null | undefined
+  T extends string | number | null | undefined,
 >(value: T[]): Date {
   const yearString = value[0] ?? '1900'
   const weekString = value[1] ?? '1'
   const weekdayString = value[2] ?? '1'
-  const day = dayjs()
-    .year(parseInt(yearString as string))
+  const day = dayjs(`${parseInt(yearString as string)}-01-01`)
     .isoWeek(parseInt(weekString as string))
     .isoWeekday(parseInt(weekdayString as string))
     .hour(0)


Test patch:
diff --git a/src/components/date-picker/tests/date-picker.test.tsx b/src/components/date-picker/tests/date-picker.test.tsx
index 8fc0527c5..398098845 100644
--- a/src/components/date-picker/tests/date-picker.test.tsx
+++ b/src/components/date-picker/tests/date-picker.test.tsx
@@ -1,17 +1,18 @@
+import dayjs from 'dayjs'
+import * as React from 'react'
 import {
-  render,
-  testA11y,
+  act,
   fireEvent,
-  waitFor,
+  render,
   screen,
   sleep,
-  act,
+  testA11y,
+  waitFor,
   waitForElementToBeRemoved,
 } from 'testing'
-import * as React from 'react'
 import DatePicker from '../'
-import dayjs from 'dayjs'
 import Button from '../../button'
+import { convertStringArrayToDate } from '../date-picker-week-utils'
 
 const classPrefix = `adm-picker`
 
@@ -205,4 +206,16 @@ describe('DatePicker', () => {
     expect(res.toDateString()).toEqual(now.toDateString())
     expect(res.tillNow).toBeTruthy()
   })
+
+  test('convertStringArrayToDate of week should correct', () => {
+    // jest mock today is `2024-12-30`
+    jest.useFakeTimers({
+      now: new Date('2024-12-30'),
+    })
+
+    const date = convertStringArrayToDate(['2024', '1', '1'])
+    expect(date.getFullYear()).toBe(2024)
+    expect(date.getMonth()).toBe(0)
+    expect(date.getDate()).toBe(1)
+  })
 })
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 233
Good morning! Here's your coding interview problem for today.

This problem was asked by Apple.

Implement the function `fib(n)`, which returns the nth number in the Fibonacci sequence, using only `O(1)` space.

Pull request:
Day233
Resolves #479.

Patch:
diff --git a/README.md b/README.md
index 05a4d52..72fdbc9 100644
--- a/README.md
+++ b/README.md
@@ -241,3 +241,4 @@ problems from
 * [Day 230](https://github.com/vaskoz/dailycodingproblem-go/issues/473)
 * [Day 231](https://github.com/vaskoz/dailycodingproblem-go/issues/475)
 * [Day 232](https://github.com/vaskoz/dailycodingproblem-go/issues/477)
+* [Day 233](https://github.com/vaskoz/dailycodingproblem-go/issues/479)
diff --git a/day233/problem.go b/day233/problem.go
new file mode 100644
index 0000000..528e223
--- /dev/null
+++ b/day233/problem.go
@@ -0,0 +1,27 @@
+package day233
+
+import "errors"
+
+var errOverflow = errors.New("overflow occurred")
+
+// ErrOverflow represents an overflow error.
+func ErrOverflow() error {
+	return errOverflow
+}
+
+// FastFibonnaci runs in O(N) time with O(1) space.
+// Returns an error if overflow occurs.
+func FastFibonnaci(n uint) (uint, error) {
+	if n < 2 {
+		return n, nil
+	}
+	first, second := uint(0), uint(1)
+	var err error
+	for i := uint(1); i < n; i++ {
+		first, second = second, first+second
+		if second < first {
+			return 0, errOverflow
+		}
+	}
+	return second, err
+}


Test patch:
diff --git a/day233/problem_test.go b/day233/problem_test.go
new file mode 100644
index 0000000..9d05d0f
--- /dev/null
+++ b/day233/problem_test.go
@@ -0,0 +1,34 @@
+package day233
+
+import "testing"
+
+var testcases = []struct {
+	n, fib uint
+	err    error
+}{
+	{0, 0, nil},
+	{1, 1, nil},
+	{2, 1, nil},
+	{12, 144, nil},
+	{28, 317811, nil},
+	{44, 701408733, nil},
+	{87, 679891637638612258, nil},
+	{100, 0, ErrOverflow()},
+}
+
+func TestFastFibonnaci(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result, err := FastFibonnaci(tc.n); result != tc.fib || err != tc.err {
+			t.Errorf("Given n=%d, expected (%d,%v), got (%d,%v)", tc.n, tc.fib, tc.err, result, err)
+		}
+	}
+}
+
+func BenchmarkFastFibonnaci(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			FastFibonnaci(tc.n) //nolint
+		}
+	}
+}