GitHub showcases API - javascript

Can anyone tell me what GitHub APIs I should use for retrieving GitHub showcases? Thanks.
In order to get the list of GitHub showcases, what exact GitHub API should I use?
After I select a topic, to retrieve the repos under the topic (e.g. Made in Africa), what exact API should I use?

There's no API to list or GET a showcase.
I've taken a look and the closest you could get (which is still quite a bit far from your request) is to use the GitHub Search API. However, a list like the one you suggested, Made in Africa is completely curated and the parameters to get such results are not part of the search syntax, e.g. country of origin.
I'll keep an eye on this, and make sure to come back and correct the answer if anything changes.

While Github does not yet offer a showcase API, there is a node package available at https://www.npmjs.com/package/gh-explore that you can use to GET a showcase.
Get the module using npm
npm install --save gh-explore
Query for the showcase
const ghExplore = require('gh-explore');
ghExplore.showcases.get({ showcase: 'made-in-africa' }, function (err, showcase) {
console.log(showcase);
});
Although the question is marked with javascript and node tags specifically I thought it pertinent to mention that I am developing a similar library to achieve this in python 3. You can refer to the repo here https://github.com/victorbordo/gh-showcases

Related

How to get the current foreground application in electron(Javascript)

How can I detect if, for example, a browser is currently open?
I need this in my electron-application.
ty :)
I've found nothing like this online.
I've only found how I can check which window is open from the windows I have in my own application, but I need to know, what else is opened.
It should be something like this:
if(Application.isOpen('Google Chrome'){}
Unless someone has built a specific electron api to do this (which I can't find), then from electron...no. However, the beauty of electron being built with node.js, means that any node module should be able to do the job for you.
For example, ps-list should be able to get you all currently running processes.
psList().then(processes => {
console.log(processes)
})
Which gives a list for me, including:
Just be aware that you need node access from the electron thread attempting to use this lib.
This can easily be abstracted to do a name search in the list for you to get your desired functionality.
You can use find-process in case you need to search by given name, name pattern or pid.

Authenticate WooCommerce REST API in node.js

Okay so I'm VERRY VERRY VERRY new to the subject so please go easy on me. What I have done is to create a wordpress woocommerce website. What I want to do now is to get product-data from the wordpress site in node.js. If I have understood everything correctly i first have to Authenticate myself.
First i installed the WooCommerce package with:
npm install --save woocommerce-api
Then i tried to Authenticante like this:
var WooCommerce = require('woocommerce');
var wooCommerce = new WooCommerce({
consumerKey: 'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
consumerSecret: 'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
url: 'http://localhost/wordpress',
});
I realise It's an verry open question and i might be far of from on the right track. But I would appriciate some tips or guiding.
Thanks!
Well, you npm installed 'woocommerce-api', so you need to require that, not 'woocommerce'.
var WooCommerceAPI = require('woocommerce-api');
Refer to the documentation, but it looks like you instantiated mostly correctly. If you're using the WP REST API you'll need to include the keys wpAPI and version, as per the library's documentation: https://www.npmjs.com/package/woocommerce-api
Now, if you want to get products, you would do something like this:
wooCommerce.getAsync('products').then(function(result) {
return JSON.parse(result.toJSON().body);
});
Or you can use .get instead of .getAsync if you'd prefer to use callbacks over promises.

Anybody used capnproto js (capnp-js) library?

Is there anybody using (or plan to use) capnp-js-plugin and capnp-js modules for nodejs?
I cloned these repos and ran the tests, but they fail. Also when I just install capnp-js (via npm), the generated js code has syntax errors even for a simple schema:
#0xec2f2fe5874ad874;
using Uid=Int32;
struct User {
id #0 :Uid;
name #1 :Text;
}
Thanks
To anybody trying to use these modules, I would suggest to wait a bit, and avoid them for the moment. I have opened an issue (https://github.com/capnp-js/serialization/issues/17) and I got a reply from the owner of the module that I should better wait for the next major release, which will be a completely rewritten version.

How can I use github api to find most recent repositories?

I realize I can use the since parameter in my API call to determine which range of repos to download:
'https://api.github.com/repositories?since=0'
But is there a way to only pull the most recently updated repositories?
I checked out https://www.githubarchive.org/ but I could not find an easy to use command line interface associated with it. It seems like the only way to use it is to use Google's SDK. I am trying to get a list of all the most recently updated repos on Github using Node.js.
API init
self = None
assign = Null
'https://api.github.com/repositories?since=0'
'https://api.github.com/repositories?since=0'

Using Node.js to access azure tablestorage

I've been trying to write a typescript application in visual studio using node.js to store and access data in an azure table store.
I've been having some trouble with the tutorials I've found. I've yet to get one to work properly.
I have Node installed on my machine and a tablestore set up in azure.
I'm not exactly sure what needs to be done in visual studio to get all the necessary packages/modules/whatever installed correctly.
Many of the tutorials I've read have used express.js and or have "npm install"ed things and while I have no issue running the commands I don't really understand what I'm installing.
tl;dr I want to make an html page where I can submit and display items to/from azure table store using node.js, typescript, and visual studio
Also: I'd be willing to drop the typescript in favor of javascript if need be.
That tutorial looks like it might be based on the old Node storage package. We have recently posted a new storage library for node - which can be found here: https://www.npmjs.org/package/azure-storage. Also take a look at the following Getting Started to help get you up and running: Store structured data with Table storage.
I will follow up tomorrow to see what we can do to either remove the old tutorial or get it updated. Let me know if anyone wants to volunteer to update the old tutorial!
Jason
I followed this one (I'm assuming you probably tried this as well)
http://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-use-table-storage-web-site/
To boil it down to just what you need in javascript ...
1.Create the table in Azure portal with appropriate data/partition key.
2.NPM necessary packages: azure, async
3.Add the following to app.js (change table_Users to whatever you want to name your table):
var azure = require('azure');
var storageClient = azure.createTableService("<accountname>", "<accountkey>");
storageClient.createTableIfNotExists("table_Users", function tableCreated(error) {
if(error) {
throw error;
}
});
var query = azure.TableQuery
.select()
.from("<tablename>");
//.where('completed eq ?', false); put criteria here.
storageClient.queryEntities(query, function entitiesQueried(error, result) {
// do what you want with result
});

Categories