Skip to content

Instantly share code, notes, and snippets.

View itaditya's full-sized avatar
🎯
Focusing

Aditya Agarwal itaditya

🎯
Focusing
View GitHub Profile
@itaditya
itaditya / gsoc-new-orgs.txt
Last active February 14, 2018 12:56
All the *new* orgs which participate in GSOC 2018
0 - 3DTK
1 - 52° North Initiative for Geospatial Open Source Software GmbH
2 - Berkman Klein Center for Internet & Society at Harvard University
3 - Canadian Centre for Computational Genomics
4 - Center for Research In Open Source Software (CROSS) at UC Santa Cruz
5 - CGAL Project
6 - CHAOSS: Community Health Analytics Open Source Software
7 - CiviCRM LLC
8 - Cuneiform Digital Library Initiative
9 - Debian Project
const features = await getFeatures();
/*
{
showNewStyle: false,
allowNewsFeedAccess: true
}
*/
if (features.showNewStyle) {
context.github.issues.create({
owner: 'org-name',
repo: 'maintainers-discussion',
title: `${username}-discussion`,
body: `@${username} has been found out to be hostile in the past.
This issue is opened so that maintainers can discuss about it.`
})
userComments = comments
.filter(comment => comment.user.login === username)
context.github.issues.getComments({
owner,
repo,
number: issueNum
})
context.github.search.issues({
q: `commenter:${username}`
})
module.exports = robot => {
const remindUserToCode = async() => {
robot.log('remindUserToCode')
const installation_id = 116342
const github = await robot.auth(installation_id);
const yesterdayDate = getYesterdayDate();
const { data:{ total_count:total_commits }} = await github.search.commits({
q: `author:itaditya author-date:>${yesterdayDate}`
});
console.log('total_commits', total_commits)
@itaditya
itaditya / README.md
Last active April 12, 2018 08:08
Workflow to test changes in Probot app locally without needing to push to production

Note - I use heroku for deploying prod app and for local I use smee for proxying webhook payload to localhost.

Instructions -

  • Deploy the probot app code to heroku.
  • Create two github apps say my-app and my-app-dev.
  • For my-app put the heroku url like http://my-app.herokuapp.com/ in Webhook URL.
  • For my-app-dev put the smee url like https://smee.io/aldnhksfh in Webhook URL.
  • For both apps use appropriate Webhook Secrets and download the private keys.
  • Rename the private keys to private-key.pem and private-key-dev.pem respectively.
@itaditya
itaditya / comments.module.js
Last active March 26, 2018 23:17
Example implementation for test driven development
const getIssues = require('./getIssues')
module.exports = (context) => {
const issues = await getIssues(context.github)
// do other things with this
}
// This is the comments module and will use utils like getIssues to perform the whole task
@itaditya
itaditya / baduse-example-1.js
Last active November 20, 2019 12:12
Snippet for Avoiding the async/await hell medium article
(async () => {
const pizzaData = await getPizzaData() // async call
const drinkData = await getDrinkData() // async call
const chosenPizza = choosePizza() // sync call
const chosenDrink = chooseDrink() // sync call
await addPizzaToCart(chosenPizza) // async call
await addDrinkToCart(chosenDrink) // async call
orderItems() // async call
})()