Last active
July 12, 2021 08:48
-
-
Save ykaragol/c63965c624bd0f9d8e3e2e51c05d1798 to your computer and use it in GitHub Desktop.
social-github
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This project was aimed to use GraphQL api of Github to find repositories I might interest | |
(by checking common starred projects or common followers) | |
*/ | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('starred-route'); | |
this.route('follower-route'); | |
this.route('gql'); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model(){ | |
return new Ember.RSVP.Promise(function(resolve){ | |
Ember.$.get('https://api.github.com/users/ykaragol/following').done(function(list){ | |
let promises = list.map(function(item){ | |
return Ember.$.get("https://api.github.com/users/"+ item.login +"/followers"); | |
}); | |
promises = promises.compact(); | |
var users = []; | |
Ember.RSVP.all(promises).then(function(p_followers){ | |
p_followers.forEach(function(followers){ | |
followers.forEach(function(follower){ | |
users.pushObject(follower.login); | |
}); | |
}); | |
users = users.reduce((prev, curr) => (prev[curr] = ++prev[curr] || 1, prev), {}); | |
users=Object.entries(users); | |
users=users.filter(function(item){ | |
return item['1'] > 1; | |
}); | |
resolve(users); | |
}); | |
}); | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
let q=`query { viewer { login, starredRepositories(first:10, orderBy:{field:STARRED_AT, direction:DESC}, ownedByViewer:false) { edges { node { stargazers(first:20, orderBy:{field:STARRED_AT, direction:DESC}) { edges { node { starredRepositories(first:10, orderBy:{field:STARRED_AT, direction:DESC}, ownedByViewer:false) { edges { node { isFork name, description, url, viewerHasStarred } } } } } } }}}}}`; | |
let query = `{"query": "${q}"}`; | |
export default Ember.Route.extend({ | |
model(){ | |
return new Ember.RSVP.Promise(function(resolve, reject){ | |
Ember.$.ajax( | |
{ | |
type:"POST", | |
url:"https://api.github.com/graphql", | |
headers:{ | |
"Authorization":"Bearer " | |
}, | |
data:query | |
}) | |
.done(function(result){ | |
resolve(result); | |
}).fail(function(){ | |
reject(); | |
}); | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model(){ | |
return new Ember.RSVP.Promise(function(resolve){ | |
Ember.$.get('https://api.github.com/users/ykaragol/starred').done(function(list){ | |
let promises = list.map(function(item){ | |
if(item.full_name==='facebook/react'){ | |
return undefined; | |
} | |
return Ember.$.get("https://api.github.com/repos/"+ item.full_name +"/stargazers"); | |
}); | |
promises = promises.compact(); | |
var users = []; | |
Ember.RSVP.all(promises).then(function(repos){ | |
repos.forEach(function(stargazers){ | |
stargazers.forEach(function(stargazer){ | |
users.pushObject(stargazer.login); | |
}); | |
}); | |
users = users.reduce((prev, curr) => (prev[curr] = ++prev[curr] || 1, prev), {}); | |
users=Object.entries(users); | |
users=users.filter(function(item){ | |
return item['1'] > 1; | |
}); | |
resolve(users); | |
}); | |
}); | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
ol { | |
counter-reset: section; /* Creates a new instance of the | |
section counter with each ol | |
element */ | |
list-style-type: none; | |
} | |
li::before { | |
counter-increment: section; /* Increments only this instance | |
of the section counter */ | |
content: counters(section,".") " - "; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.6", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment