Posts

How to write rspec tests for ruby Script that works with Git -

i have ruby script checks changes between git repo , files @ url endpoints. if changes exist, commits them , pushes them repo. i'd write rspec tests script, i'm having trouble understanding how so, since don't want tests push actual git repo. i'm thinking need set sort of mock repository i'm not entirely sure. suggestions how best write unit tests such script appreciated. i think can make use of fact it's legal push local "bare" repository, i.e. need following steps: create "bare" repository repo1 (i.e. repository, doesn't have working copy, consists entirely of contents of .git folder) clone regular repository repo2 repo1 . make changes in repo2 (add, commit, push). check push successful. check data available in repo1 too. here's sample console session in /tmp directory: ruby-2.2.0 in /tmp ♥ mkdir repo1 ruby-2.2.0 in /tmp ♥ cd repo1 ruby-2.2.0 in /tmp/repo1 ♥ git init --bare initialized empty git reposi...

javascript - What does getBackgroundPage() function return exactly? (Google Chrome) -

i'm trying return first* image displayed on webpage code: img.src = chrome.extension.getbackgroundpage().imagesrc[0] 0 represents first image. seems work. however, getbackgroundpage() functional tab opened. want work if user using different webpage. in discovering how find first image of website isn't runnning, first have understand chrome.extension.getbackgroundpage() returns. string? or url? i've tried replacing with, [document.getelementid("hi").getsrc.]imagesrc[0]...hi represented in htm as div src of url want...but not work. solutions? why trying use extension this? try this; document.getelementsbytagname('img')[0]; this vanilla javascript , needs no plugins, extensions or particular browsers. edit to answer question; returns javascript 'window' object background page running inside current extension. returns null if extension has no background page. thats according the docs . edit 2 ok, so, chrom...

How to generate canvas component server side and send it to client side in Node.js? -

i want create canvas component server side convert in image , send client side. want perform in node.js facing problem in creating canvas component server side. node.js not have kind of dom default , can't operate on elements such canvas . can here: https://github.com/automattic/node-canvas that package allows manipulate canvas-like object server-side.

javascript - Mongoose query hangs after callback -

this must user error, have reduced example far can, , can't spot it. here make simple query, calls callback result , no error. however, program hangs afterwards; never exits. import mongoose "mongoose"; const someschema = new mongoose.schema({ name: string }); const m = mongoose.model("someschema", someschema); mongoose.connect("mongodb://localhost", err => { console.error("connection error", err); m.find({}, (queryerror, result) => console.log("result:", result, "error:", queryerror)); }); result: connection error undefined result: [ { _id: 55ffada74fb9958d13ec7c4b, name: 'asdf', __v: 0 } ] error: null (program hangs instead of exiting) i'm sure i've overlooked basic, can't spot in guide, , juggling things around isn't helping. weird, have bunch of more complex mongoose models working elsewhere. mongoose: ^4.0.5 babel-node: 5.8.20 your program stay...

Cannot read property 'children' of null at object.Iscroll -

i know question asked before answers not helpful me.here i'm using iscroll, console error "cannot read property 'children' of null @ object.iscroll" when reloading page. can me. function iscroll (el, options) { this.wrapper = typeof el == 'string' ? document.queryselector(el) : el; this.scroller = this.wrapper.children[0]; this.scrollerstyle = this.scroller.style; // cache style better performance this.options = { resizescrollbars: true, mousewheelspeed: 20, snapthreshold: 0.334, // insert point: options startx: 0, starty: 0, scrolly: true, directionlockthreshold: 5, momentum: true, bounce: true, bouncetime: 600, bounceeasing: '', preventdefault: true, preventdefaultexception: { tagname: /^(input|textarea|button|select)$/ }, hwcompositing: true, usetransition: true, usetransform: true ...

node.js - How to install mocha js for Nodejs? -

on ubuntu system nodejs verison v0.10.25 , nop version 1.3.10 . when tried install mochajs testing getting following error user@ubuntu:~/mochatest$ sudo npm install -g mocha npm err! error: cannot find module 'fstream' npm err! @ function.module._resolvefilename (module.js:338:15) npm err! @ function.module._load (module.js:280:25) npm err! @ module.require (module.js:364:17) npm err! @ require (module.js:380:17) npm err! @ object.<anonymous> (/usr/lib/nodejs/tar/lib/entry.js:14:15) npm err! @ module._compile (module.js:456:26) npm err! @ object.module._extensions..js (module.js:474:10) npm err! @ module.load (module.js:356:32) npm err! @ function.module._load (module.js:312:12) npm err! @ module.require (module.js:364:17) npm err! if need help, may report log at: npm err! <http://github.com/isaacs/npm/issues> npm err! or email to: npm err! <npm-@googlegroups.com> npm err! system linux 3.13.0-36-generic np...

android - SKMap (Skobbler) convert map data -

how can convert map data navitel .skm , use offline in android app? currently cannot on own. an intermediary step convert data .osm (something our map conversion tool understands) , create .skm file. note: currently, tool allows 1 convert custom .osm file .skm not public (depending on project scale, might able convert under enterprise agreement - send email dev@skobbler.com).