Search code in the repositories whose name contains a keyword - github

In github search, the following string allows me to search JavaScript code that contain Acode in all the repositories of the user NameOfUser:
user:NameOfUser language:JavaScript ACode
Now, I would like to add another condition: i am only interested in the code containing ACode in the repositories whose name contains repokey.
Does anyone know how to write the request?

The search API already does this. You can just use the search that you've posted above to search for repositories containing the text you've specified.
For example...
user:mrdoob language:JavaScript Three Extension
returns this...
https://github.com/search?utf8=%E2%9C%93&q=user%3Amrdoob+language%3AJavaScript+Three+Extension&type=Repositories&ref=searchresults

As above answer I also tried with type=Code and added a "WebGLBufferRenderer" keyword, See if it helps:
https://github.com/search?utf8=%E2%9C%93&q=user%3Amrdoob+language%3AThree+Extension+WebGLBufferRenderer&type=Code&ref=searchresults

Related

VS Code Regex search to remove references based on containing text in string

I am attempting to remove all references of a managed package that is going to be uninstalled that spans throughout code base in VS Code
I have using a query to find the field permissions but am wondering if there is a way to search for the reference outside of specifying the exact field name compared to the field containing only "agf" since they are all using it.
Below is the search query:
<fieldPermissions>
<editable>false</editable>
<field>User.agf_Certified_Product_Owner__c</field>
<readable>false</readable>
</fieldPermissions>
In the field, I want to be able to find and delete the 5 associated lines from multiple files if they match "agf" in any combination. Something like the below:
<fieldPermissions>
<editable>false</editable>
<field>agf</field>
<readable>false</readable>
</fieldPermissions>
With any combination of agf in the field, delete all from any file it appears in.
Not an answer but too long for a comment
You don't have to? Profiles/perm sets don't block package's delete. Probably neither do reports.
You'd use your time better by searching for all instances of agf__ (that's with double underscore), should find fields, objects... used in classes, flows, page layouts etc. And search for agf. (with dot) should find all instances where your Apex code calls their classes marked as global.
Alternatively Apex / VF pages with dependencies on package will have it listed in their "meta.xml", for example
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>54.0</apiVersion>
<packageVersions>
<majorNumber>236</majorNumber>
<minorNumber>1</minorNumber>
<namespace>SBQQ</namespace>
</packageVersions>
<status>Active</status>
</ApexClass>
Last but not least - why not just spawn a dev sandbox and attempt the delete there? If it succeeds - great. If not - it'll list the dependencies that blocked the delete. It'll be "the real thing", it'll smite you even if your VSCode project doesn't contain all flows, layouts and thus could lull you into false sense of security. I'd seriously do it in sandbox and then run all tests for good measure, just in case there are some dynamic soql queries that don't count as hard, delete-blocking references.
After delete's done - fetch Profiles / Permsets from this org and the field references will be gone from the xml.

How to exclude header files when i search repositories in github?

Sorry for rookie question, I want to search a specific API in Github, but want to exclude every file match that has a .h at the end, how to do this? I set the filter to only C files, but that doesn't exclude .h files.
If you are using Github Search Code API, and you want to remove a specific extension, add:
-extension:[your_extension]
Example: -extension:h to exclude all header files in your case
References:
documentation about the extension param
documentation about param exclusion
API example:
https://api.github.com/search/code?q=org:google%20language:c%20-extension:h
This also works on Github Search UI: https://github.com/search?q=org%3Agoogle+language%3Ac+-extension%3Ah

Search string formatting in Elouqa API

I'm using the Elouqa Rest API in an integration with another product and I want to implement a file browser. As part of this I want to get a list of the folders inside another folder. Theapi documents here say that a search string can be appended but don't give any clues as to the format of the search string. I've tried various things but so far I'm just getting empty results. An example is here:
/API/rest/1.0/assets/email/folders?search=folderId+%3D+250
I've tried with and without +'s and with and without url encoding the = sign, also various combinations of quote marks but so far nothing.
I believe what you want is a slightly different endpoint e.g.:
/API/rest/1.0/assets/email/folder/250/contents
Which would provide a list of folders contained with folder 250
If you wanted to search for a given folder name then you would use
/API/rest/1.0/assets/email/folders?search=foldername
Hope that helps!

how to find path of a node under /etc/tags in AEM?

I want to search a tag under /etc/tags in AEM programmatically.
for ex:
folder structure is like
/etc/tags/
uder tags there are multiple tags
1.20101/ate2
2.73883
3.44qqiw
4.222
if i want to search ate2 i should get /etc/tags/20101/ate2.
You can use QueryBuilder API to query it.
Sample Query would be
type=cq:Tag
path=/etc/tags
nodename=ate2
Sample SQL2 Query for the same would be
select * from [cq:Tag] as s where ISDESCENDANTNODE('/etc/tags') AND NAME(s)='ate2'
One solution is write the query as suggested by rakhi, other is to utilize TagManager API that provides you lot of methods to search tags and once you get Tag instance you could get path from it. Javadocs for TagManager can be found here and for Tag here
For reference you could look at the code here. One thing to keep in mind in case you end up using this approach you will need to work by creating a system user to get ResourceResolver instead of calling resolverFactory.getAdministrativeResourceResolver(null), refer to article here

GitHub Repository search using partial or begins-with

I would like to do a code search in a collection of repositories. I would like to restrict my search using a pattern or naming convention in the repository name.
1) I can limit my search by the organization.
Example: "user:google"
2) I can search a single repository directly.
Example: "repo:google/devtoolsExtended test"
So, is it possible to search all repositories that begin with a pattern?
Equivalent to: "repo:google/dev* test"
In order to search for repositories all you need to do is just type in your query, like the following:
https://github.com/search?q=foo
This finds repos such as FooTable and foodme as well, as if we searched for foo*. If you want to limit your search to the repository name only, use in:name, which results in:
https://github.com/search?q=foo+in%3Aname&type=Repositories
There's no explicit method of searching by begins with or using wildcards, but results for those kinds of searches appear as well.
Sources:
GitHub Help: Searching repositories