All Questions
24,199,223
questions
6107
votes
45
answers
2.7m
views
How to disable text selection highlighting
For anchors that act like buttons (for example, the buttons on the sidebar of this Stack Overflow page titled Questions, Tags, and Users) or tabs, is there a CSS standard way to disable the ...
5776
votes
27
answers
6.5m
views
Reset local repository branch to be just like remote repository HEAD
How do I reset my local branch to be just like the branch on the remote repository?
I tried:
git reset --hard HEAD
But git status claims I have modified files:
On branch master
Changes to be ...
5767
votes
37
answers
3.1m
views
How can I reset or revert a file to a specific revision?
How can I revert a modified file to its previous revision at a specific commit hash (which I determined via git log and git diff)?
5759
votes
19
answers
1.7m
views
What is the maximum length of a URL in different browsers?
What is the maximum length of a URL for each browser?
Is a maximum URL length part of the HTTP specification?
5726
votes
41
answers
5.4m
views
Loop (for each) over an array in JavaScript
How can I loop through all the entries in an array using JavaScript?
5704
votes
27
answers
3.8m
views
How do I create a directory, and any missing parent directories?
How do I create a directory at a given path, and also create any missing parent directories along that path? For example, the Bash command mkdir -p /path/to/nested/directory does this.
5697
votes
20
answers
6.2m
views
How do I push a new local branch to a remote Git repository and track it too?
How do I:
Create a local branch from another branch (via git branch or git checkout -b).
Push the local branch
to the remote repository (i.e. publish), but make it
trackable so that git pull and git ...
5645
votes
47
answers
2.2m
views
Which equals operator (== vs ===) should be used in JavaScript comparisons?
I'm using JSLint to go through JavaScript, and it's returning many suggestions to replace == (two equals signs) with === (three equals signs) when doing things like comparing idSele_UNVEHtype.value....
5548
votes
26
answers
4.8m
views
How to determine the URL that a local Git repository was originally cloned from
I pulled a project with several forks on GitHub, but forgot which fork it was. How do I determine which fork I pulled?
5518
votes
46
answers
4.0m
views
How do I squash my last N commits together?
How do I squash my last N commits together into one commit?
5511
votes
11
answers
690k
views
The definitive guide to form-based website authentication [closed]
Moderator note:
This question is not a good fit for our question and answer format with the topicality rules which currently apply for Stack Overflow. We normally use a "historical lock" for ...
5499
votes
28
answers
4.6m
views
How to access the index value in a 'for' loop?
How do I access the index while iterating over a sequence with a for loop?
xs = [8, 23, 45]
for x in xs:
print("item #{} = {}".format(index, x))
Desired output:
item #1 = 8
item #2 = ...
5479
votes
50
answers
4.6m
views
How do I replace all occurrences of a string in JavaScript?
Given a string:
string = "Test abc test test abc test test test abc test test abc";
This seems to only remove the first occurrence of abc in the string above:
string = string.replace('abc', ...
5471
votes
79
answers
4.8m
views
How can I validate an email address in JavaScript?
I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?...
5413
votes
75
answers
3.1m
views
How do I create a GUID / UUID?
How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.
I'm ...