Last active
August 29, 2015 13:57
-
-
Save pascalchevrel/9623606 to your computer and use it in GitHub Desktop.
String Distribution for Firefox Aurora, based on data from Transvision
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
<?php | |
function cleanEntity($entity) | |
{ | |
$component = explode('/', $entity); | |
array_pop($component); // suppress entity | |
$component = array_filter( | |
$component, | |
function($val) { return $val != 'chrome'; } | |
); | |
return implode('/', $component); | |
} | |
function excludeProducts($entity) | |
{ | |
$component = explode('/', $entity); | |
if (in_array($component[0], ['chat', 'calendar', 'suite', | |
'mail', 'editor', 'extensions'] )) | |
{ | |
return false; | |
} | |
return true; | |
} | |
include __DIR__ . '/TMX/aurora/en-US/cache_en-US.php'; | |
$tmx = array_keys($tmx); | |
$tmx = array_map('cleanEntity', $tmx); | |
$tmx = array_filter($tmx, 'excludeProducts'); | |
$results = []; | |
$devtools = 0; | |
foreach ($tmx as $val) { | |
$component = explode('/', $val); | |
$main_component = $component[0]; | |
if (in_array('devtools', $component)) { | |
$devtools++; | |
} | |
if (! isset($results[$main_component])) { | |
$results[$main_component] = 1; | |
} else { | |
$results[$main_component] += 1; | |
} | |
} | |
foreach ($results as $component => $number) { | |
print $component . ' : ' . $number . '<br>'; | |
} | |
print "(of which devtools: $devtools )<br>"; | |
print 'Total: ' . count($tmx) . '<br>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment