Copied from examples/count.js
332404
function App() {
    return hg.state({
        count: hg.value(0),
        _hotVersion: hg.value(0), // This is new - see below
        channels: {
            clicks: incrementCount
        }
    });
}
431583
function countChildren(pipelineId) {
  var current = STATUS_MAP.pipelines[pipelineId];
  if (!current) {
    return [0, 0];
  }
  var total = 1;
  var done = 0;
  if (current.status == 'done') {
    done += 1;
  }
  for (var i = 0, n = current.children.length; i < n; i++) {
    var parts = countChildren(current.children[i]);
    total += parts[0];
    done += parts[1];
  }
  return [total, done];
}
231984
function createCountUp() {
    establishOptionsFromInputs();
    demo = new CountUp('myTargetElement', endVal, options);
    if (!demo.error) {
      errorSection.style.display = 'none';
      if (input('useOnComplete').checked) {
        demo.start(methodToCallOnComplete);
      }
      else {
        demo.start();
      }
      updateCodeVisualizer();
    }
    else {
      errorSection.style.display = 'block';
      document.getElementById('error').innerHTML = demo.error;
      console.error(demo.error);
    }
  }
354848
function getTabs(count) {
            var tabs = [];

            for (var i = 0; i < count; i++) {
                tabs.push("    ");
            }

            return tabs.join('');
        }
502729
public static List<List<List<Writable>>> sampleSequence(int count, JavaRDD<List<List<Writable>>> data) {
        return data.takeSample(false, count);
    }
939897
function (count) {
            for (var i = 0; i < ~~count; i++) {
                // Add particle to the container
                var particle = me.pool.pull("me.Particle", this);
                this.container.addChild(particle);
            }
        }
33771
function(count) {
      count = count || this.INIT_COUNT;
      jsl.status(this.name + ' x ' + count);
      this.running = true;
      var me = this;
      setTimeout(function() {me._run(count);}, 200);
    }
384245
function(parent, count)
	{
		count = count || 1;
		var br = null;
		
		for (var i = 0; i < count; i++)
		{
			if (parent != null)
			{
				br = parent.ownerDocument.createElement('br');
				parent.appendChild(br);
			}
		}
		
		return br;
	}
1051970
function(job, done) {
                var MAX_COUNT = 5;
                var count = 0;
                
                Async.whilst(
                    // Loop for N times
                    function() { return MAX_COUNT > count; },
                    // Every second, ask for preview results
                    function(iterationDone) {
                        Async.sleep(1000, function() {
                            job.preview({}, function(err, results) {
                                if (err) {
                                    iterationDone(err);
                                    return;
                                }
                                
                                // Only do something if we have results
                                if (results && results.rows) {
                                    // Up the iteration counter
                                    count++;
                                    
                                    console.log("========== Iteration " + count + " ==========");
                                    var sourcetypeIndex = results.fields.indexOf("sourcetype");
                                    var countIndex = results.fields.indexOf("count");
                                    
                                    for(var i = 0; i < results.rows.length; i++) {
                                        var row = results.rows[i];
                                        
                                        // This is a hacky "padding" solution
                                        var stat = ("  " + row[sourcetypeIndex] + "                         ").slice(0, 30);
                                        
                                        // Print out the sourcetype and the count of the sourcetype so far
                                        console.log(stat + row[countIndex]);   
                                    }
                                    
                                    console.log("=================================");
                                }
                                    
                                // And we're done with this iteration
                                iterationDone();
                            });
                        });
                    },
                    // When we're done looping, just cancel the job
                    function(err) {
                        job.cancel(done);
                    }
                );
            }
642537
@Override
	public <S extends T> long count(final Example<S> example) {
		final Map<String, Object> bindVars = new HashMap<>();
		final String predicate = exampleConverter.convertExampleToPredicate(example, bindVars);
		final String filter = predicate.length() == 0 ? "" : " FILTER " + predicate;
		final String query = String.format("FOR e IN %s%s COLLECT WITH COUNT INTO length RETURN length",
			getCollectionName(), filter);
		final ArangoCursor<Long> cursor = arangoOperations.query(query, bindVars, null, Long.class);
		return cursor.next();
	}
699422
function sample(test, asap, minDuration, sampleSize, done) {
    var count = 0;
    var totalDuration = 0;
    var sampleDurations = [];
    next();
    function next() {
        measure(function (done) {
            test(asap, done);
        }, function (error, results, duration) {
            if (error) {
                done(error);
            }
            if (sampleDurations.length < sampleSize) {
                sampleDurations.push(duration);
            } else if (Math.random() < 1 / count) {
                sampleDurations.splice(Math.floor(Math.random() * sampleDurations.length), 1);
                sampleDurations.push(duration);
            }
            totalDuration += duration;
            count++;
            if (totalDuration >= minDuration) {
                done(null, {
                    name: test.name,
                    subjectName: asap.name,
                    count: count,
                    totalDuration: totalDuration,
                    averageFrequency: count / totalDuration,
                    averageDuration: totalDuration / count,
                    averageOpsHz: count / totalDuration,
                    sampleDurations: sampleDurations
                });
            } else {
                next();
            }
        });
    }
}
1108067
function cloneCounterValues(counters) {
        const result = {};
        Object.keys(counters).forEach(name => {
            result[name] = Array.from(counters[name]);
        });
        return result;
    }
355962
function List(runner) {
  Base.call(this, runner);

  var self = this;
  var stats = this.stats;
  var total = runner.total;

  runner.on('start', function(){
    // console.log(JSON.stringify( ['start', { total: total }] ));
  });

  runner.on('suite', function(suite){
    if (suite.id != undefined) {
      // console.log(JSON.stringify( ['suite', suite_info(suite)] ));
      console.log(suite.title + ':')
    }
  });

  runner.on('test', function(test){
    // console.log(JSON.stringify( ['test', info(test)] ));
  });

  runner.on('pass', function(test){
    //console.log(JSON.stringify( ['pass', pass(test)] ));
    console.log(':-) ' + test.title)
    //process.stdout.write('.')
  });

  runner.on('fail', function(test, err){
    
    //test = fail(test, err);
    //console.log(JSON.stringify( ['fail', test] ));
    console.log(':-( ' + test.title)
    console.log('\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv FAIL vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n');
    console.log('Title: ' + test.title + '\n');
    console.log(err.stack);
    console.log('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAIL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n');  
    
  });

  runner.on('test end', function(test){
    //console.log(JSON.stringify( ['test end', {id: test.id}] ));
  });

  runner.on('suite end', function(suite){
    if (suite.id != undefined) {
      //console.log(JSON.stringify( ['suite end', {id: suite.id}] ));
    }
  });

  runner.on('end', function(){
    //console.log(JSON.stringify( ['end', self.stats] ));
    console.log('\nSummary:')
    pluralized = '';
    if (self.stats.passes != 1) {
      pluralized = 'es';
    }  
    console.log(self.stats.passes + ' pass' + pluralized)
    
    pluralized = '';
    if (self.stats.failures != 1) {
      pluralized = 's';
    }      
    console.log(self.stats.failures + ' failure' + pluralized) 
    console.log('--------------------------')    

    pluralized = '';
    if (self.stats.tests != 1) {
      pluralized = 's';
    }
    console.log(self.stats.tests + ' test' + pluralized + ' (' + self.stats.duration + 'ms)\n')
    
  });
}
189880
function summarize(value, counts) {
  const min = counts.min;
  const max = counts.max;
  const num = counts.values.length;
  if (value < min) {
    // do nothing
  } else if (value >= max) {
    counts.values[num - 1] += 1;
  } else {
    const index = Math.floor((value - min) / counts.delta);
    counts.values[index] += 1;
  }
}
241964
function stringRepeat (str, count) {
  var rest = '' + str
  if (str.repeat) {
    return str.repeat(count)
  }
  var list = isNaN(count) ? [] : new Array(parseInt(count))
  return list.join(rest) + (list.length > 0 ? rest : '')
}
917067
function () {
			this.writeDebug('countFilters');
			var filterCount = 0;

			if (!this.isEmptyObject(filters)) {
				for (var key in filters) {
					if (filters.hasOwnProperty(key)) {
						filterCount += filters[key].length;
					}
				}
			}

			return filterCount;
		}
31257
function repeat(ch, count)
{
    var s = '';
    for(var i = 0; i < count; i++)
        s += ch;
    return s;
}