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'
Related
Is there a way to instantiate sails.io inside the zone of a service provider in Angular2 so that websocket events trigger change detection?
A sub-question: how to RXJS to subscribe to sails.io data streams.
I'm using Angular2 RC4, and the latest version of SailsJS.
Related question: Angular2 View Not Changing After Data Is Updated
UPDATE
It annoyed me that I couldn't give a full example of how to use Sails with Angular 2 with just plunker, so I created a github repo, that provides the full picture on how this can work.
I can see how the related question you linked, would lead you down the zone path. However, you can plug all of this together without having to manually tinker with zones. Here is an example of how you could implement sails.io with Angular2 in a plunker. This leverages using RxJS to create a type of observable. You also have to implement a different version of Angular2 change detection(all of this is implemented in the plunker).
I go into a little more detail in my answer to your linked question.
As for your sub question I'm not sure if there is a way to integrate the stream, I believe one of the intentions of RxJS was to reduce the use of callbacks, which sails.io appears to still do.
Excerpt of implementing sails.io in a service from the plunker.
constructor() {
this._ioMessage$ = <Subject<{}>>new Subject();
//self is the window object in the browser, the 'io' object is actually on global scope
self.io.sails.connect('https://localhost:1337');//This fails as no sails server is listening and plunker requires https
this.listenForIOSubmission();
}
get ioMessage$(){
return this._ioMessage$.asObservable();
}
private listenForIOSubmission():void{
if(self.io.socket){//since the connect method failed in the constructor the socket object doesn't exist
//if there is a need to call emit or any other steps to prep Sails on node.js, do it here.
self.io.socket.on('success', (data) => {//guessing 'success' would be the eventIdentity
//note - you data object coming back from node.js, won't look like what I am using in this example, you should adjust your code to reflect that.
this._ioMessage$.next(data);//now IO is setup to submit data to the subscribbables of the observer
});
}
}
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
I am working on developing a module for Titanium project. Now I need to call the migration.up and migration.down call backs from my own function. Is it possible to do ? I tried migration.down(AnyObject) and migration.up(AnyObject), but both didn't work.
Also I tried to log the object migration, it is NULL. So any other options to get the call back implementations ?
I did it by adding the following code to the migration javascript file.
Alloy.Globals.migration = migration;
And was able to call Alloy.Globals.migration.up() from alloy.js.
Let me know, if any alternatives available.
I'm trying to use AWS cloudSearch on my site, and I'm missing something fundamental. I've had no luck finding a working example.
In my HTML head I've included the SDK. per: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/browser-intro.html
<script type="text/javascript" src="https://sdk.amazonaws.com/js/aws-sdk-2.0.31.min.js"></script>
Then in my script tag I have this snippet (with my creds, not the ones shown here). I used hard coded creds for my testing per: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/browser-configuring.html
var s3 = new AWS.S3({region: 'ap-southeast-2', maxRetries: 15});
AWS.config.update({accessKeyId: 'akid', secretAccessKey: 'secret'});
console.log(AWS);
//
var cloudsearch = new AWS.CloudSearch();
When it tries to execute the last line javaScript tells me: Uncaught TypeError: undefined is not a function
I've been unable to find a demo, example or tutorial. The docs don't even have working examples.
Can you help?
Thank you for your time.
That error is saying it doesn't find reference to cloudsearch when you are calling the new AWS.Cloudsearch().
The script you reference doesn't appear to have a reference to cloudsearch api. I think you need to build it out like they specify in Building the SDK for Use in the Browser.
For kicks I replicated the error you received, then did a browser build as specified by the link above. It worked.
Upon further investigation after looking through the libraries. I think you probably want to use CloudSearchDomain to issue searches to a given domain setup within cloudsearch.
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudSearchDomain.html
The other cloudsearch library is all administrative/setup related to Search domain creation and other administrative types of objects. Looks like there are some issues with CORS/setup for cloudsearch in general so if you want to issue this straight from the browser might be a bit tricky.
The most common way to get around the CORS issue is to use a proxy.
The easiest way to play around with search from the browser\local is using a form, as suggested here.
Amazon CloudSearch query
<form action="https://$YOURSEARCHDOMAIN/2013-01-01/search" method="get">
<label>Search: <input name="q" /></label>
<input type="hidden" name="q.parser" value="simple" />
<button type="submit">Search</button>
</form>
above solution is pretty much cut and paste\play, works like the AWS cloudsearch console, and returns the json to the browser. Not sure if you can incorporate suggests without the api directly. You will need to open up your access policy to work, I believe.
I tried a variety of access policies and various tricks to get around the CORS issue, all no dice.
You actually need the CORS plugin for chrome to make this work properly.
Created an angularjs project that demos this and added to git hub. You need CORS-anywhere to route properly to the domain.
https://github.com/tkntobfrk/amazon-cloudsearch-angular
project uses suggesters to search domain data and populate the input field with autocomplete data. Uses bootstrap.ui typeahead.
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
});