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 file is based on the code from https://github.com/JustAMan/pyWinClobber/blob/master/win32elevate.py | |
Copyright (c) 2013 by JustAMan at GitHub | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, |
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
let locks = []; | |
const fn = async () => { | |
let resolve; | |
locks.push(new Promise(r => (resolve=r))); | |
let lock; | |
while (locks.length > 1 && (lock = locks.shift())) | |
await lock; | |
console.log(new Date()); | |
setTimeout(resolve, 1000); |
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
window.getLangStats = function getLangStats(repos) { | |
var mapper = function(ent){return ent.language}, | |
reducer = function(stats, lang) {stats[lang] = (stats[lang] || 0) + 1; return stats}, | |
langStats = repos.map(mapper).reduce(reducer, {}); | |
delete langStats['null']; | |
return Object.keys(langStats).sort(function(a,b){return langStats[b] - langStats[a]}); | |
}; | |
window.ghApiCallHandler = function(result) { | |
if (Math.floor(result.meta.status/100) == 2) |
OlderNewer