Which names does GitHub recognize as README's? - github

I know there are several names that get recognized by GitHub as README's, e.g. README, README.md.
What is an exhaustive list of such names?

I found a searching rule
const PATTERN = /^readme\.(?:markdown|mdown|mkdn|md|textile|rdoc|org|creole|mediawiki|wiki|rst|asciidoc|adoc|asc|pod|txt)/i

Related

Search github repo for term with special characters using sourcegraph?

The top answer to How to search on GitHub to get exact string matches, including special characters shows a way to search GitHub for terms that include special characters using a tool called sourcegraph.
I got that working:
https://sourcegraph.com/search?q=context:global+.where%28&patternType=literal
but I'd like to narrow the search to a specific repo (not all of GitHub) - how can I do that?
Example
Here's the exact search I tried on GitHub:
https://github.com/sharetribe/sharetribe/search?q=.where%28
(it searches for where instead of .where(.
Here's the search on sourcegraph:
https://sourcegraph.com/search?q=context:global+.where%28&patternType=literal
It returns results for all of GitHub rather than the specific repo sharetribe/sharetribe.
How can I limit this search to one repo?
You can limit this search by using the repo filter:
https://sourcegraph.com/search?q=context:global+repo:sharetribe/sharetribe+.where%28&patternType=literal

Github incorrectly detects Languages of my project as "Roff"

In one of my repositories nearly all of my code is Python and some HTML.
However, Github thinks otherwise:
What causes that?
You were creating files through a script, with an unintended extension. That is, your script was inserting a dot in the file name.
Simply rename your file my_file_0.5ms to my_file_05ms.txt and it will display the correct languages:
What you could do to fix similar problems in the future is use a script to detect extensions and the total lines of code for each extension.
Solution
GitHub Linguist is the culprit in this situation, but luckily, it can be easily resolved in a number of ways.
Create a .gitattributes file and list patterns that match the files you want to ignore, and then append either linguist-vendored or linguist-documentation.
specific-file.5ms
*.5ms
specific-folder/*
This will remove the files from your GitHub repositories statistics on the next run of Linguist (it may take some time).
Notes
If you'd like to attribute these files to a specific language, you can do that using linguist-language={name}. Full documentation on overriding Linguist can be found here.
You can also run Linguist on your own computer, but note that any changes to .gitattributes will not take effect until you commit to your repository. Linguist will not see changes that exist only in the index.

GitHub: Search for String Inside of a File in a Repo

TLDR: I want to use the GitHub search API to find a list of all repos with a "search-string" inside of the top-level Jenkinsfile. Does GitHub allow that?
I've read numerous SO posts and GitHub search/API docs including:
How to search for code in GitHub with GitHub API?
How to search for code in github, with github API?
https://developer.github.com/v3/search/#search-code
And can't find the answer to my issue.
I'm first trying to use the GitHub code search API to search for a specific substring (only two words with a dash joining them: "search-string") in a specific file, but I can't figure out how to do it. I've tried numerous combinations of simple & advanced searches, but usually get zero results. I.e.
1 result (obvious): repo:repo/redacted
0 results: repo:repo/redacted search-string
0 results: search-string repo:repo/redacted filename:Jenkinsfile
0 results: search-string repo:repo/redacted in:Jenkinsfile
And quite a few more combos.
Once I get it working on the GitHub website, I'll convert it to an API call, which shouldn't be an issue.
Thanks in advance!
I was having a similar problem where I was trying to use the GitHub search web interface to find instances of a particular filename in my code, which had a name including underscore characters and a number, like my_image_asset_2.svg.
Searching on that string within my repository (or organization) unexpectedly returned zero results (in the "Code" results type), using a search term like:
repo:repo/redacted my_image_asset_2.svg
Even trimming out the number and extension from my search term still unexpectedly returned zero results:
repo:repo/redacted my_image_asset
A workaround that finally stumbled on that got GitHub to return the code I was looking for was to (1) drop all punctuation characters from my filename, and (2) enclose the filename in quotes:
repo:repo/redacted "my image asset 2 svg"
This might not be a perfect solution in all cases; I imagine it might also match filenames like my-image-asset-2.svg. But depending on your use case, it might be "good enough"?

how to search for gist by name

Is there a way to find a Gist from the name (or description)?
I was watching a YouTube video discussion and one of the participants brought up a Gist. It was too small to read on the video, but the name at the top was clear (dhh/test_induced_design_damage.rb); however, I wasn't able to use that name to find the Gist. (Eventually I found a raw link on a Twitter feed, with a 20-digit hex number. The Gist is public.) I later tried several different searches to see if there was a way I could find it by name, and I tried looking in Github's Help, but I couldn't find a way. Did I miss something, or is there just no way to do this?
If you know the username you can go to https://gist.github.com/username/ and then search through them, but that only works if it's not an anonymously posted or private gist. There's not a nice way to get to a Gist unless you've got the link if you don't know who posted it.
In your case, the Gist is available as the first one at the moment under https://gist.github.com/dhh.
prefixes are available eg filename:*design_damage.rb
top result: dhh / test_induced_design_damage.rb
filename:.bashrc Find all gists with a ".bashrc" file.
cat language:html Find all cat gists with HTML files.
join extension:coffee Find all instances of join in gists with a coffee
extension.
system size:>1000 Find all instances of system in gists
containing a file larger than 1000kbs.
cat stars:>100 Find cat gists with greater than 100 stars.
user:defunkt Get all gists from the user defunkt.
cat anon:true Include anonymous gists in your search for cat-related gists.
NOT cat Excludes all results containing cat.
cat fork:only Search all forked gists for results containing cat.

Perforce wildcard problem in branch specification

In a branch spec, I have the following view:
//depot/dev/t/a/g/... //depot/dev/t/r/g/...
-//depot/dev/t/a/g/p/o*/... //depot/dev/t/r/g/p/...
Perforce reports an "Incompatible wildcards" for the second rule there.
What I'd like to do is exclude all the directories beginning with "o".
What am I doing wrong, and how do I fix this?
I think you need to have matching wildcards on both sides of each mapping. Try:
//depot/dev/t/a/g/... //depot/dev/t/r/g/...
-//depot/dev/t/a/g/p/o*/... //depot/dev/t/r/g/p/o*/...
While not a direct answer to the question (answered above), I was stumped on the same message and found this post while trying to search for a solution.
In my case, it was because when copy-pasting the workspace mapping from another file, the ellipsis character was placed instead of the Perforce "..." wildcard. To fix this, I deleted the ellipsis and replaced it by typing in three periods.