This file contains hidden or 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
| 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) { |
This file contains hidden or 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
| 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() |
This file contains hidden or 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
| 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(); |
This file contains hidden or 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
| var flatSteps = []; | |
| flatMetrics.forEach(function(flatMetric) { | |
| flatMetric.forEach(function(step) { | |
| flatSteps.push(step); | |
| }); | |
| }); | |
| =========================================================== | |
| var flatSteps = flatMetrics.concatMap(function(metric) { |
This file contains hidden or 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
| import foo from "./foo.js"; | |
| foo(1); |
This file contains hidden or 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
| 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 } : |
This file contains hidden or 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
| 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 } : |
This file contains hidden or 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
| def get(bucket, key) do | |
| Agent.get(bucket, &HashDict.get(&1, key)) | |
| end |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
OlderNewer