Skip to content

Instantly share code, notes, and snippets.

var queue = async.queue(function(task, callback) {
var ObjectId = mongoose.Types.ObjectId
var query = task.query
var update = task.update
var defer = task.defer
query._id['$in'] = _.map(query._id['$in'], ObjectId)
var queryStream = scenarios.find(query).stream()
queryStream.pipe(streamWorker).on('end', function(foo) {
var streamWorker = new Transform({ objectMode: true, decodeStrings: false });
var queue = async.queue(function(task, callback) {
var ObjectId = mongoose.Types.ObjectId
var query = task.query
var update = task.update
var defer = task.defer
query._id['$in'] = _.map(query._id['$in'], ObjectId)
var queryStream = scenarios.find(query).stream()
var util = require('util');
var debug = require('debug')('app');
var _ = require('lodash');
//var async = require('async');
var MongoClient = require('mongodb').MongoClient;
var $ = require('cheerio');
var request = require("request");
request = request.defaults({ jar: true });
var j = request.jar();
var flatSteps = [];
flatMetrics.forEach(function(flatMetric) {
flatMetric.forEach(function(step) {
flatSteps.push(step);
});
});
===========================================================
var flatSteps = flatMetrics.concatMap(function(metric) {
import foo from "./foo.js";
foo(1);
var obj = { foo: "bar", wut: "what" };
var arr = [1,2,3,4,5];
obj[Symbol.iterator] = function() {
let keys = Object.keys(this);
let nextIndex = 0;
return {
next() {
return nextIndex < keys.length ?
{ value: keys[nextIndex++], done: false } :
var obj = { foo: "bar", wut: "what" };
var arr = [1,2,3,4,5];
obj[Symbol.iterator] = function() {
let keys = Object.keys(this);
let nextIndex = 0;
return {
next() {
return nextIndex < keys.length ?
{ value: keys[nextIndex++], done: false } :
def get(bucket, key) do
Agent.get(bucket, &HashDict.get(&1, key))
end
def create
begin
@todo_list = TodoList.find(params[:todo_list_id])
@todo_item = @todo_list.todo_items.new(todo_item_params)
if @todo_item.save
flash[:success] = "Added todo list item."
redirect_to todo_list_todo_items_path
else
flash[:error] = "There was a problem adding that todo list item."
render action: :new
finiteBounds = (bounds) ->
ne = bounds.northeast
sw = bounds.southwest
return (isFinite(ne.lat) && isFinite(ne.lng) && isFinite(sw.lat) && isFinite(sw.lng))
getBoundsZoomLevel = (bounds, size) ->
latRad = (lat) ->
sin = Math.sin(lat * Math.PI / 180)
radX2 = Math.log((1 + sin) / (1 - sin)) / 2
Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2