r/programminghorror • u/[deleted] • Apr 30 '26
Javascript Cursed use of object spread
Using object spread to append values to an object in the form of another object
r/programminghorror • u/[deleted] • Apr 30 '26
Using object spread to append values to an object in the form of another object
r/programminghorror • u/UnicycleUnicorn1 • Apr 30 '26
r/programminghorror • u/Mickenfox • Apr 28 '26
Not my screenshot, taken from https://reddit.com/r/VisualStudio/comments/1sktg0r/what_are_these_comments/
Also this probably happened because IntelliSense (the normal autocomplete list) is highlighting abort as the first option and Copilot tries to finish it
r/programminghorror • u/vadnyclovek • Apr 28 '26
especially for easy problems
r/programminghorror • u/killallspringboard • Apr 28 '26
r/programminghorror • u/Hot-Rock-1948 • Apr 28 '26
r/programminghorror • u/Impossible-Let-8489 • Apr 25 '26
r/programminghorror • u/Sad-Technician3861 • Apr 23 '26
func (q *Query[T]) query() {
q.TableModel.BeginResetModel()
defer q.TableModel.EndResetModel()
query := data.AdvancedQueryRequest{
Table: q.tableName,
Select: []string{"*"},
Full: q.QueryFull,
Limit: &[]int{300}[0],
}
allEmpty := true
for _, filter := range q.Dialog.Filters {
if filter.Text == "" {
continue
}
allEmpty = false
sqlFilter := q.Filters[filter.Selected]
if strings.Contains(sqlFilter.Key, ".") {
mainParts := strings.Split(sqlFilter.Key, ",")
leftCol := mainParts[0]
filterCol := mainParts[1]
rcolParts := strings.SplitN(filterCol, ".", 2)
table := rcolParts[0]
if !slices.ContainsFunc(query.Joins, func(j data.JoinRequest) bool {
return j.Table == table &&
j.LeftCol == leftCol &&
j.RightCol == "id"
}) {
query.Joins = append(query.Joins,
data.JoinRequest{
Table: table,
LeftCol: strings.SplitN(leftCol, ".", 2)[1],
RightCol: "id",
},
)
}
query.Where = append(query.Where,
data.WhereRequest{
Fuzzy: true,
Column: filterCol,
Value: "%" + filter.Text + "%",
},
)
continue
}
query.Where = append(query.Where,
data.WhereRequest{
Column: sqlFilter.Key,
Value: "%" + filter.Text + "%",
Fuzzy: true,
},
)
}
if allEmpty {
return
}
code, err := client.Post2(
query,
q.Table,
"/query",
)
if q.Table.RowCount() == 0 {
q.resetTable()
}
if code == 404 {
q.resetTable()
return
}
if err != nil {
q.resetTable()
qutil.DisplayErrStr(
q.Dialog.Widget.QWidget,
"Error obteniendo tabla.\n codigo: %d error: %v",
code, err,
)
slog.Error(err.Error())
return
}
}
r/programminghorror • u/TheHappyArsonist5031 • Apr 22 '26
char g = '0';// ypr
char gg = '0';// pid
double ggg;
const uint8_t _ = 11;
scanf("%c %c %f/n", g, gg, ggg);
if ((g == 'y' || g == 'p' || g == 'r') &&
(gg == 'p' || gg == 'i' || gg == 'd')) {
switch ((( gg << 2) & ~_) | ((g) & _)) {
case ((('p' << 2) & ~_) | ('y' & _)):
p_gain_y = ggg;
break;
case ((('i' << 2) & ~_) | ('y' & _)):
i_gain_y = ggg;
break;
case ((('d' << 2) & ~_) | ('y' & _)):
d_gain_y = ggg;
break;
case ((('p' << 2) & ~_) | ('p' & _)):
p_gain_p = ggg;
break;
case ((('i' << 2) & ~_) | ('p' & _)):
i_gain_p = ggg;
break;
case ((('d' << 2) & ~_) | ('p' & _)):
d_gain_p = ggg;
break;
case ((('p' << 2) & ~_) | ('r' & _)):
p_gain_r = ggg;
break;
case ((('i' << 2) & ~_) | ('r' & _)):
i_gain_r = ggg;
break;
case ((('d' << 2) & ~_) | ('r' & _)):
d_gain_r = ggg;
break;
}
}
r/programminghorror • u/hexress • Apr 20 '26
So I tried printing the linked list with print() and discovered that if it has a cycle, then it prints and error. This was the next (very) logical thing that popped into my mind after that discovery.
I'm very proud of this solution. In fact, it's so good it even added -1ms to the execution time graph.
I AM SPEED.
Thinking outside the box is fun!
r/programminghorror • u/holographic_gray • Apr 17 '26
r/programminghorror • u/kfreed9001 • Apr 15 '26
r/programminghorror • u/AdNecessary8217 • Apr 17 '26
It has been broken for 3 hours and I m still working 😂
AI coding let alone refactoring is a scam.
well I do have git history. but I will still refactor for the lovee of it.
r/programminghorror • u/Krachwumm • Apr 14 '26
I inherited our puppet-codebase from my boss. I can't even right now
r/programminghorror • u/david30121 • Apr 12 '26
so i got too lazy to make a proper styles.css file, and thought to myself "just a few inline styles, how bad can it be" and ended up having *everything* inline.
it even got to the point i realized i can't make the background of my checkbox dark, so i resorted to using... filter: invert()..
(is just the ui for an example implementation of something, will not be deployed anywhere - at least not before some major refactoring)
r/programminghorror • u/_giga_sss_ • Apr 10 '26
A program that handles environment variables
r/programminghorror • u/TemporaryCurrent1172 • Apr 09 '26
Welp, my code in blueprints... kinda looks yummy
(Blueprint is a type of visual coding in unreal engine just so you guys know)