Created
March 12, 2017 22:07
-
-
Save mathiasrw/94bfb25799caa76e7e5dda2c3179a98e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- https://bigquery.cloud.google.com/ | |
SELECT | |
s.stars, | |
f.repo_name, | |
f.path | |
FROM | |
(SELECT | |
id | |
FROM | |
[bigquery-public-data:github_repos.contents] | |
WHERE | |
REGEXP_MATCH( content , r'^\#\!\/usr\/bin\/env iojs') | |
) c | |
JOIN | |
[bigquery-public-data:github_repos.files] f | |
ON | |
f.id = c.id | |
JOIN | |
( SELECT repo.name as repo_name, COUNT(*) as stars | |
FROM TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('2015-01-01'), TIMESTAMP('2016-12-31')) | |
WHERE type = "WatchEvent" | |
GROUP BY repo_name | |
) s | |
ON | |
s.repo_name = f.repo_name | |
where | |
REGEXP_MATCH(path, r'src/.+?\.js$') | |
AND | |
NOT REGEXP_MATCH(path, r'min\.js|libs?|jquery|node_modules' | |
) | |
order by s.stars DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment