Get the current temperature in a specific place
Whether data is retrieved from http://openweathermap.org/
@param {String} where        For example 'rotterdam,nl'
@param {function} callback   Called as callback(err, temp)
175127
function getTemperatureIn(where, callback) {
  var options = {
    host: 'api.openweathermap.org',
    path: '/data/2.5/weather?q=' + where
  };

  // perform an asynchronous action inside a timeout
  http.get(options, function(res) {
    var body = '';
    res.on('data', function(chunk) {
      body += chunk;
    });
    res.on('end', function() {
      var data = JSON.parse(body);
      var tempK = data.main.temp;
      var tempC = tempK - 273.15;
      callback(null, Math.round(tempC * 100) / 100);
    });
  }).on('error', callback);
}
1147594
function orwhere($where)
    {
        $args = func_get_args();
        if (count($args) == 1)
        {
            $where = $args[0];
        }
        else
        {
            list($field, $expr, $value) = $args;
            $where = '`'.str_replace('`', '', $field).'`' . $this->db->quote($expr) . " '".$this->db->quote($value)."'";
        }

        if ($this->where == "")
        {
            $this->where = "where " . $where;
        }
        else
        {
            $this->where = $this->where . " or " . $where;
        }
    }
1292901
public function whereNested(Closure $callback)
    {
        // To handle nested queries we'll actually create a brand new query instance
        // and pass it off to the Closure that we have. The Closure can simply do
        // do whatever it wants to a query then we will store it for compiling.
        $query = $this->newQuery();

        call_user_func($callback, $query);

        return $this->addNestedWhereQuery($query);
    }
984464
public function groupWhere($callback)
    {
        $origQuery = $this->query; //get original raw of query
        $this->query = ''; //clear orig part in order to get only group part
        $qb = $callback($this); //get queryBuilder from call back
        $query = $qb->query.')'; //get group part of query from queryBuilder with )
        $query = preg_replace('/AND /', 'AND (', $query, 1); //add (
        $this->query = $origQuery.$query; //make full query
    }
580314
function getWeatherFromServer(city) {
      var deferred = $q.defer();
      var url = openweatherEndpoint;
      var params = {
        q: city,
        units: 'metric',
        APPID: Config.openweather.apikey || ''
      };
      $http({
        method: 'GET',
        url: url,
        params: params,
        withoutToken: true,
        cache: true
      }).success(function(data) {
        // Prepare the Weather object.
        var weatherData = prepareWeather(data);
        setCache(weatherData);

        // Start refresh automatic the weather, according the interval of time.
        options.refresh && startRefreshWeather();

        deferred.resolve(weatherData);
      });

      return deferred.promise;
    }
1052748
function getSysInfo(callback) {
	if (process.platform === 'windows') return;
  var reData = getBasicInfo();
  exec('iostat ', function(err, output) {
		if (!!err) {
			console.error('getSysInfo failed! ' + err.stack);
		} else {
			reData.iostat = format(output);
		}
		callback(reData);
  });
}
68760
public final void mWHERE() throws RecognitionException {
		try {
			int _type = WHERE;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// druidG.g:629:8: ( ( 'WHERE' | 'where' ) )
			// druidG.g:629:10: ( 'WHERE' | 'where' )
			{
			// druidG.g:629:10: ( 'WHERE' | 'where' )
			int alt18=2;
			int LA18_0 = input.LA(1);
			if ( (LA18_0=='W') ) {
				alt18=1;
			}
			else if ( (LA18_0=='w') ) {
				alt18=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 18, 0, input);
				throw nvae;
			}

			switch (alt18) {
				case 1 :
					// druidG.g:629:11: 'WHERE'
					{
					match("WHERE"); 

					}
					break;
				case 2 :
					// druidG.g:629:19: 'where'
					{
					match("where"); 

					}
					break;

			}

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
359102
function runRecordRoute(callback) {
  var argv = parseArgs(process.argv, {
    string: 'db_path'
  });
  fs.readFile(path.resolve(argv.db_path), function(err, data) {
    if (err) {
      callback(err);
      return;
    }
    // Transform the loaded features to Feature objects
    var feature_list = _.map(JSON.parse(data), function(value) {
      var feature = new messages.Feature();
      feature.setName(value.name);
      var location = new messages.Point();
      location.setLatitude(value.location.latitude);
      location.setLongitude(value.location.longitude);
      feature.setLocation(location);
      return feature;
    });

    var num_points = 10;
    var call = client.recordRoute(function(error, stats) {
      if (error) {
        callback(error);
        return;
      }
      console.log('Finished trip with', stats.getPointCount(), 'points');
      console.log('Passed', stats.getFeatureCount(), 'features');
      console.log('Travelled', stats.getDistance(), 'meters');
      console.log('It took', stats.getElapsedTime(), 'seconds');
      callback();
    });
    /**
     * Constructs a function that asynchronously sends the given point and then
     * delays sending its callback
     * @param {messages.Point} location The point to send
     * @return {function(function)} The function that sends the point
     */
    function pointSender(location) {
      /**
       * Sends the point, then calls the callback after a delay
       * @param {function} callback Called when complete
       */
      return function(callback) {
        console.log('Visiting point ' + location.getLatitude()/COORD_FACTOR +
            ', ' + location.getLongitude()/COORD_FACTOR);
        call.write(location);
        _.delay(callback, _.random(500, 1500));
      };
    }
    var point_senders = [];
    for (var i = 0; i < num_points; i++) {
      var rand_point = feature_list[_.random(0, feature_list.length - 1)];
      point_senders[i] = pointSender(rand_point.getLocation());
    }
    async.series(point_senders, function() {
      call.end();
    });
  });
}
1028112
function f_temp_sil() {
    return db.redis.dbQ.keys("temp:tahta:*")
        .then(function (_keys) {
            if (_keys && _keys.length > 0) {
                console.log("-----------------------------**********************----- silinecek");
                console.log("keys: ", JSON.stringify(_keys));

                return db.redis.dbQ.del(_keys);
            }
            return null;
        });
}
647048
function (query, callback) {
    if (!callback) {
      callback = query;
      query = null;
    }

    if (typeof query === 'string') {
      query = { aggregateId: query };
    }

    var self = this;

    this.store.getLastEvent(query, function (err, evt) {
      if (err) return callback(err);

      callback(null, new EventStream(self, query, evt ? [evt] : []));
    });
  }
169508
function( key, info, callback ){
    this.log.debug('Updating info %s %s', key, info.status);
    this._query("update " + this.infoTable + " set info = '" + JSON.stringify(info) + "' where id = '"+key+":info'", function(err, result){
      if ( err || !result ){
        callback('Key Not Found ' + key, null);
      } else {
        callback(null, true);
      }
    });
  }
265621
function reverseGeocode(location, callback) {
  var latlng = util.format("%s,%s", location.lat, location.lng)
    , query = qs.stringify({ latlng: latlng, sensor: false })
    , reqtmpl = "http://maps.googleapis.com/maps/api/geocode/json?%s"
    , req = util.format(reqtmpl, query)
    , geo
    ;
  
  request(req, function(err, res, body) {
    if (err) {
      console.log('ERROR: ' + err);
      return callback(err);
    }

    console.log(body);

    geo = parseGoogleGeocodes(JSON.parse(body));

    if (!geo) {
      return callback("can't determine address");
    } else {
      return callback(null, geo);
    }
  });
}
605973
function(callback) {
        if (res.parsedHeader.payload.mode === 'handshake') {
          res.session = {
            sid: reqSid,
            cert: senderCert,
            token: reqToken
          };
          callback(null);
        } else {
          var querySid;
          if (sessionStore instanceof Store || 'undefined' !== typeof window) {
            querySid = my.config.urlBase;
          } else {
            querySid = reqSid;
          }
          // load the session if exists
          sessionStore.load(querySid, function(err, session){
            if (err) {
              callback(err);
            } else if (session) {
              log.debug('%s loaded session', app.name);
              log.debug(session);
              res.session = session;
              callback(null);
            } else {
              callback('session expired');
            }
          });
        }
      }
905974
function query(queryString, args, callback) {
  getClient(function (err, client) {
    if (err) { callback(err); }

    if (!client) {
      callback('Could not connect to the database');
    }
    else {
      runQuery(client, queryString, args, callback);
    }
  });
}
149607
function (options, callback) {

			fs.stat(options.file_path, function (err, stats) {

				if (err) {
					callback(err);
				}
				else {
					var local_date = new Date(stats.mtime).getTime();
					var server_date = new Date(options.server_date).getTime();

					if (options.compare_date === 'newer') {
						callback(null, local_date > server_date);
					}
					else {
						callback(null, local_date < server_date);
					}
				}
			});
		}
412576
function(callback) {
                var ret,
                    isFunc  = Util.type.function(callback),
                    args    = [].slice.call(arguments, 1);
               
                if (isFunc)
                    ret     = callback.apply(null, args);
                
                return ret;
            }
1230927
function( key, callback ){
    this._query('select info from "'+this.infoTable+'" where id=\''+key+":info\'", function(err, rows){
      if ( err || !rows || !rows.length ){
        callback('Key Not Found ' + key, null);
      } else {
        var info = rows[0].info;
        callback(null, info);
      }
    });
  }