Skip to content

Instantly share code, notes, and snippets.

View BYK's full-sized avatar
🔦
Helping engineers help themselves help us all

Burak Yigit Kaya BYK

🔦
Helping engineers help themselves help us all
View GitHub Profile
@BYK
BYK / i18n.js
Created February 27, 2014 11:08
grunt.registerTask(
'translations.install',
'Installs Transifex client, tx for other translation tasks. Usually requires `sudo`.',
function () {
var done = this.async();
grunt.util.spawn({
cmd: 'easy_install',
args: ['transifex-client']
}, function (error, result, code) {
@BYK
BYK / djb2.js
Last active December 26, 2015 03:49 — forked from anonymous/djb2.sql
Compatible DJB2 Hash implementation in JS and SQL
function djb2Hash(str, seed) {
for (var counter = 0, len = str.length; counter < len; counter++) {
seed ^= (seed << 5);
seed ^= str.charCodeAt(counter);
}
// We discard the sign-bit for compatibility with the DB implementation
// and "always positive integers"
return seed & ~(1 << 31);
}
@BYK
BYK / GHAPILanguageStats.js
Created July 11, 2011 07:42
Get language stats of your GitHub
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)