Skip to content

Instantly share code, notes, and snippets.

ruby-1.9.2-p290 :019 > a.course_points
=> [{"x"=>-123.09956999999997, "y"=>43.99689, "t"=>"Left", "n"=>"Skarpt til venstre og inn på Willamette St", "d"=>1558.2270196996717, "i"=>45}, {"x"=>-123.09476000000001, "y"=>44.00251, "t"=>"Right", "n"=>"Sving til høyre og inn på Coachman Dr", "d"=>2319.6279202483624, "i"=>-1}, {"x"=>-123.0924, "y"=>44.00288, "t"=>"Right", "n"=>"Ta til høyre mot E 49th Ave", "d"=>2561.46875989974, "i"=>89}, {"x"=>-123.09163999999998, "y"=>44.00336, "t"=>"Right", "n"=>"Sving til høyre og inn på E 49th Ave", "d"=>2642.4525533428578, "i"=>92}, {"x"=>-123.08988999999997, "y"=>44.00312, "t"=>"Right", "n"=>"Sving til høyre og inn på Donald St", "d"=>2791.013780653592, "i"=>100}, {"x"=>-123.09055999999998, "y"=>44.00058000000001, "t"=>"Right", "n"=>"Sving til høyre og inn på Ventura Ave", "d"=>3084.1878589167495, "i"=>116}]
ruby-1.9.2-p290 :020 > new_cps = a.course_points.map{|cp| new_cp = cp.clone ; new_cp['n'] = 'probably gotta clone otherwise it modifies the original too'; new_cp} => [{
// example use: calculateMovingAverages('watts', [30, 60])
calculateMovingAverages: function(metric, windowDurations) {
var points = this._points;
// need at least a couple points to not throw an error..
if(points.length <= 2) return;
var baseMetric = 'watts';
for(var durI=0; durI < windowDurations.length; durI++) {
n = windowDurations[durI];
var avgMetric = baseMetric + '_ma_' + n;
var halfN = n/2;
class ScheduledReport
include Mongoid::Document
include Mongoid::Timestamps
field :key, :type => String
index :key
field :name, :type => String
field :query, :type => String
login: function() {
var email = $('.email').val(), password = $('.password').val();
rwgps.models.User.login(email, password)
.done(function(user) {
console.log('logged in as', user.get('email'));
})
.fail(function() {
console.log('invalid username or password, please try again');
});
}
/**
* Get currently logged in user
* @method getCurrent
* @static
* @return {Promise} A promise for the currently authenticated user
*/
User.getCurrent = function() {
if(this.currentDfd)
return this.currentDfd;
def route_translations
return {
"distance.meters" => t('units.distance_in_words.x_meters'),
"distance.feet" => t('units.distance_in_words.x_feet'),
"distance.km" => t('units.distance_in_words.x_km'),
"distance.miles" => t('units.distance_in_words.x_miles'),
:yes => t('generic.yes'),
:no => t('generic.no'),
:routes => t('resources.routes'),
:new => t('path_names.new'),
rwgps.models.User.login(email, password)
.done(function(user) {
$('.logged_in').show().html(T.t('logged_in_as') + ' ' + user.get('email'));
$('.login_form').hide();
$('.route_save_details').show();
})
.fail(function() {
$('.incorrect_password_message').show();
});
$ script/find_stale_asset_packages.rb /var/www/dev.lommekjent.no/current
Need to build these assets: {"js"=>["issues.show", "issues.index"], "css"=>["activities.index", "routes.new", "routes.new_planner", "trips.new", "trips.edit", "maintenances.index"]}
rake asset:packager:build_some BUILD_JS=issues.show,issues.index BUILD_CSS=activities.index,routes.new,routes.new_planner,trips.new,trips.edit,maintenances.index
QCNFClauseList propagate_literal(const QCNFLiteral& lit, const QCNFClause& c) {
LOG_PRINT(LOG_DEBUG) << "propagate_literal called with lit=" << lit.first->toString()
<< " and clause c=" << convertFromQCNFClause(c).toString() << std::endl;
boost::shared_ptr<Sentence> cnfLit = lit.first;
// first figure out what kind of literal we have here.
std::queue<QCNFClause> toProcess;
QCNFClauseList processed;
toProcess.push(c);
-- filesystem
type Name = String
type Data = String
data FSItem = File Name Data | Folder Name [FSItem] deriving (Show)
myDisk :: FSItem
myDisk =
Folder "root"
[ File "goat_yelling_like_man.wmv" "baaaaaa"