Skip to content

Instantly share code, notes, and snippets.

@just-boris
Created November 20, 2015 23:59
Show Gist options
  • Save just-boris/2aece7063cbf27db8bd7 to your computer and use it in GitHub Desktop.
Save just-boris/2aece7063cbf27db8bd7 to your computer and use it in GitHub Desktop.
Rating
"use strict";
class Queue {
constructor() {
this.top = Promise.resolve();
}
push(operation) {
return this.top = this.top
.then(() => this.delay())
.then(() => operation());
}
delay() {
return new Promise((resolve) => {
setTimeout(resolve, 6000);
});
}
}
const got = require('got');
const fs = require('fs');
const langs = require('./list.json');
const result = {};
function writeResult() {
fs.writeFileSync('./result.json', JSON.stringify(result, null, ' '));
}
const queue = new Queue();
langs.reduce((promise, lang) => {
return queue.push(() => {
return got('https://api.github.com/search/repositories?q=language:' + encodeURIComponent(lang), {json: true})
.then(response => {
const count = response.body.total_count;
console.log(lang + ':\t' + count);
result[lang] = count;
}, (err) => {
console.error(err)
});
})
}, Promise.resolve()).then(writeResult);
[
"ABAP",
"AGS Script",
"AMPL",
"ANTLR",
"APL",
"ASP",
"ATS",
"ActionScript",
"Ada",
"Agda",
"Alloy",
"Apex",
"AppleScript",
"Arc",
"Arduino",
"AspectJ",
"Assembly",
"Augeas",
"AutoHotkey",
"AutoIt",
"Awk",
"Batchfile",
"Befunge",
"Bison",
"BitBake",
"BlitzBasic",
"BlitzMax",
"Bluespec",
"Boo",
"Brainfuck",
"Brightscript",
"Bro",
"C",
"C#",
"C++",
"C2hs Haskell",
"CLIPS",
"CMake",
"COBOL",
"Cap'n Proto",
"CartoCSS",
"Ceylon",
"Chapel",
"Charity",
"ChucK",
"Cirru",
"Clarion",
"Clean",
"Clojure",
"CoffeeScript",
"ColdFusion",
"ColdFusion CFC",
"Common Lisp",
"Component Pascal",
"Cool",
"Coq",
"Crystal",
"Cucumber",
"Cuda",
"Cycript",
"Cython",
"D",
"DIGITAL Command Language",
"DM",
"DTrace",
"Dart",
"Dogescript",
"Dylan",
"E",
"ECL",
"ECLiPSe",
"Eiffel",
"Elixir",
"Elm",
"Emacs Lisp",
"EmberScript",
"Erlang",
"F#",
"FLUX",
"FORTRAN",
"Factor",
"Fancy",
"Fantom",
"Filterscript",
"Forth",
"FreeMarker",
"Frege",
"GAMS",
"GAP",
"GAS",
"GDScript",
"GLSL",
"Game Maker Language",
"Genshi",
"Gentoo Ebuild",
"Gentoo Eclass",
"Glyph",
"Gnuplot",
"Go",
"Golo",
"Gosu",
"Grace",
"Grammatical Framework",
"Groovy",
"Groovy Server Pages",
"HCL",
"Hack",
"Harbour",
"Haskell",
"Haxe",
"Hy",
"HyPhy",
"IDL",
"IGOR Pro",
"Idris",
"Inform 7",
"Inno Setup",
"Io",
"Ioke",
"Isabelle",
"Isabelle ROOT",
"J",
"JFlex",
"JSONiq",
"JSX",
"Jasmin",
"Java",
"Java Server Pages",
"JavaScript",
"Julia",
"KRL",
"KiCad",
"Kotlin",
"LFE",
"LLVM",
"LOLCODE",
"LSL",
"LabVIEW",
"Lasso",
"Lean",
"Lex",
"LilyPond",
"Limbo",
"Literate Agda",
"Literate CoffeeScript",
"Literate Haskell",
"LiveScript",
"Logos",
"Logtalk",
"LookML",
"LoomScript",
"Lua",
"M",
"MUF",
"Makefile",
"Mako",
"Mathematica",
"Matlab",
"Max",
"Mercury",
"Metal",
"MiniD",
"Mirah",
"Modelica",
"Modula-2",
"Module Management System",
"Monkey",
"Moocode",
"MoonScript",
"Myghty",
"NCL",
"NSIS",
"Nemerle",
"NetLinx",
"NetLinx+ERB",
"NetLogo",
"NewLisp",
"Nimrod",
"Nit",
"Nix",
"Nu",
"NumPy",
"OCaml",
"Objective-C",
"Objective-C++",
"Objective-J",
"Omgrofl",
"Opa",
"Opal",
"OpenCL",
"OpenEdge ABL",
"OpenSCAD",
"Ox",
"Oxygene",
"Oz",
"PAWN",
"PHP",
"PLSQL",
"PLpgSQL",
"Pan",
"Papyrus",
"Parrot",
"Parrot Assembly",
"Parrot Internal Representation",
"Pascal",
"Perl",
"Perl6",
"PicoLisp",
"PigLatin",
"Pike",
"PogoScript",
"Pony",
"PowerShell",
"Processing",
"Prolog",
"Propeller Spin",
"Puppet",
"Pure Data",
"PureBasic",
"PureScript",
"Python",
"QML",
"QMake",
"R",
"REALbasic",
"Racket",
"Ragel in Ruby Host",
"Rebol",
"Red",
"Redcode",
"RenderScript",
"RobotFramework",
"Rouge",
"Ruby",
"Rust",
"SAS",
"SMT",
"SQF",
"SQLPL",
"Sage",
"SaltStack",
"Scala",
"Scheme",
"Scilab",
"Self",
"Shell",
"ShellSession",
"Shen",
"Slash",
"Smali",
"Smalltalk",
"Smarty",
"SourcePawn",
"Squirrel",
"Standard ML",
"Stata",
"SuperCollider",
"Swift",
"SystemVerilog",
"TXL",
"Tcl",
"Tcsh",
"Thrift",
"Turing",
"TypeScript",
"Unified Parallel C",
"UnrealScript",
"VCL",
"VHDL",
"Vala",
"Verilog",
"VimL",
"Visual Basic",
"Volt",
"WebIDL",
"X10",
"XC",
"XPages",
"XProc",
"XQuery",
"XS",
"XSLT",
"Xojo",
"Xtend",
"Yacc",
"Zephir",
"Zimpl",
"eC",
"fish",
"mupad",
"nesC",
"ooc",
"wisp",
"xBase"
]
1739631 JavaScript
1491344 Java
909808 Ruby
850832 Python
722031 PHP
458752 C++
401348 C
376363 C#
254340 Objective-C
108813 Perl
93726 Go
75699 Swift
57404 Scala
54757 CoffeeScript
41657 Haskell
33698 Clojure
22613 Groovy
14887 Erlang
12485 Rust
8854 Lisp
8430 TypeScript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment