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
function duplicate(value, count) { | |
var output = []; | |
var duplicator = [value]; | |
var base = 1; | |
while (count > 0) { | |
if ((base & count) > 0) { | |
output = output.concat(duplicator); | |
count -= base; | |
} |
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
diff --git a/extensions/tools/commands/creepClone.js b/extensions/tools/commands/creepClone.js | |
index 3a02c7f..908da15 100644 | |
--- a/extensions/tools/commands/creepClone.js | |
+++ b/extensions/tools/commands/creepClone.js | |
@@ -7,11 +7,11 @@ var duplicateCreep = function (creep, priority, silence) { | |
silence = silence === true; | |
// Find and add to queue | |
- if (typeof creep.memory.spawn === "string") { | |
- spawn = Game.getObjectById(creep.memory.spawn).name; |
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
. ~/.nvm/nvm.sh | |
npm install uglify-js | |
wget "https://code.jquery.com/jquery-2.1.4.js" -Ojquery.js | |
nvm install 0.10 | |
time node node_modules/.bin/uglifyjs jquery.js > jquery.min.js | |
nvm install 0.12 | |
time node node_modules/.bin/uglifyjs jquery.js > jquery.min.js |
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
#!/usr/bin/php | |
<?php | |
function find_person($array, $key, $search_term) | |
{ | |
// We are given 1 element | |
if (isset($array['name']) { | |
return find_person_helper($array, $key, $search_term); | |
} |
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
#!/usr/bin/php | |
<?php | |
function find_person($value, $key, $search_term) | |
{ | |
if($value == $search_term){ | |
print "Found $search_term in $key\n"; | |
return $the_person_id_in_the_same_array_as_this_term; | |
} | |
} |
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 | |
$dranken = array('cola', 'fanta', 'bier', 'koffie', 'thee'); | |
$prijzen = array(2, 2, 1.80, 2.20, 2.20); | |
$max = min(count($dranken), count($prijzen)); | |
for ($i = 0; $i < $max; $i++) { | |
echo $dranken[$i] . ': ' . $prijzen[$i] . '<br />'; | |
} |
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 | |
static function getCache($p_mOptions = null) { | |
switch(true) { | |
case is_array($p_mOptions): | |
$options = $p_mOptions; | |
break; | |
case is_string($p_mOptions): |
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 | |
static function getCache($p_mOptions = null) | |
{ | |
if (!is_array($p_mOptions)) { | |
$config = self::getConfig(); | |
$options = isset($config->cache) ? $config->cache->toArray() : array(); | |
if (is_string($p_mOptions)) { | |
$options['handler'] = $p_mOptions; | |
} | |
$p_mOptions = $options; |
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 | |
static function getCache($p_mOptions = null) { | |
if (!is_array($p_mOptions)) { | |
$config = self::getConfig(); | |
$options = isset($config->cache) ? $config->cache->toArray() : array(); | |
if (is_string($p_mOptions) && $p_mOptions !== '') { | |
$options['handler'] = $p_mOptions; | |
} | |
$p_mOptions = $options; | |
} |
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
db cache.db | |
table namespace1 | |
key | |
value | |
expire | |
table namespace2 | |
key | |
value | |
expire | |
table namespace3 |