Example #1
0
  before(function(done){
    tour = new Tour({
      title: faker.lorem.sentence(),
      city: faker.address.city(),
      state: faker.address.state(),
      zip: parseInt(faker.address.zipCode()),
      coordinates: [[faker.address.longitude(), faker.address.latitude()],
      [faker.address.longitude(), faker.address.latitude()],
      [faker.address.longitude(), faker.address.latitude()]],
      video_id: faker.image.imageUrl(),
      photo_urls: [faker.image.imageUrl(), faker.image.imageUrl()],
      content: faker.lorem.paragraph(),
      trailer: {
        description: faker.lorem.sentence(),
        photo_url: faker.image.imageUrl()
      },
      tour_guide: {
        _id: user._id,
        username: user.username
      },
      comments: [],
      tour_votes: []
    });

    tour.save(done());
  });
Example #2
0
router.get('/new', function(req, res){
  console.time('getData');
  var newData = [];
  var i = 0;
  var limit = 30;
  while(i < limit){
    newData.push({
      name: faker.name.findName(),
      avatar: faker.image.avatar(),
      image: faker.image.image(),
      animal: faker.image.animals(),
      catchPhrase: faker.company.catchPhrase(),
      company: faker.company.companyName()
    });
    i++;
  }
  console.timeEnd('getData');
  // console.log('newData', newData); // only use this when limit < 20-ish, or you will be verrrrry sorrrrrry...
  jf.writeFile(path.resolve(file), newData, function(err){
    if(err){
      res.status(500);
      res.send(err);
    }
    else {
      res.status(200);
      res.send();
      // res.send(newData); // only use this when limit < 20-ish, or you will be verrrrry sorrrrrry...
    }
  });
});
module.exports = function() {
    var data = {
        users: [],
        albums: [],
        photos: []
    }


    // create 10 users
    for (var i = 0; i < 10; i++) {
        var albumIds = [];

        var r = Math.ceil(Math.random() * 10) + pid;
        r = r < 3 + pid ? 3 + pid : r;
        r = r > 20 + pid ? 20 + pid : r;

        for (var j = pid; j < r; j++) {
            var photoIds = [];

            var s = Math.ceil(Math.random() * 10);
            s = s < 3 ? 3 : s;
            s = s > 20 ? 20 : s;

            for (var k = 0; k < s; k++) {
                photoIds.push(pid);

                data.photos.push({
                    id: pid++,
                    albumId: aid,
                    photo: faker.image.imageUrl(),
                    tags : faker.lorem.words(),
                    description: faker.lorem.sentence()
                });

            }

            albumIds.push(aid);

            data.albums.push({
                id: aid++,
                userId: i,
                name: faker.lorem.words().join(' '),
                description: faker.lorem.paragraph(),
                photos: photoIds
            });
        }

        data.users.push({
            id: i,
            firstName: faker.name.firstName(),
            lastName: faker.name.lastName(),
            email: faker.internet.email(),
            company : faker.company.companyName(),
            avatar: faker.image.avatar(),
            albums: albumIds
        });

    }
    return data
}
Example #4
0
const App = () => {
    return (
        <div className="ui container comments">
            <ApprovalCard>
                <CommentDetail
                    author="Sam"
                    time="Today at 5PM"
                    text="Nice blog post"
                    avatar={faker.image.avatar()}
                />
            </ApprovalCard>
            <ApprovalCard>
                <CommentDetail
                    author="Alex"
                    time="Today at 6PM"
                    text="Nice blog"
                    avatar={faker.image.avatar()}
                />
            </ApprovalCard>
            <ApprovalCard>
                <CommentDetail
                    author="Time"
                    time="Today at 7PM"
                    text="Nice"
                    avatar={faker.image.avatar()}
                />
            </ApprovalCard>
        </div>
    );
};
Example #5
0
exports.getPhoto = (id) => {
  return {
    albumId: parseInt(id / 50) + 1,
    id: id + 1,
    title: faker.lorem.text(),
    url: faker.image.imageUrl(),
    thumbnailUrl: faker.image.imageUrl(250, 250),
  };
};
Example #6
0
 function photo(index) {
   var imageId = faker.random.number(9) + 1;
   return  {
     id: index +1,
     albumId: faker.random.number(data.albums.length),
     title: faker.lorem.sentence(),
     url: faker.image.imageUrl(640, 480, 'animals') + '/' + imageId,
     thumbnailUrl: faker.image.imageUrl(200, 200, 'animals') + '/' + imageId,
     takenAt: faker.date.past()
   };
 }
Example #7
0
 render() {
   const avatar1 = <Image className='avatar' src={faker.image.avatar()} />
   const avatar2 = <Image className='avatar' src={faker.image.avatar()} />
   const avatar3 = <Image className='avatar' src={faker.image.avatar()} />
   return (
     <List className='middle aligned divided'>
       <List.Item image={avatar1} header='Helen' />
       <List.Item image={avatar2} header='Christian' />
       <List.Item image={avatar3} header='Daniel' />
     </List>
   )
 }
Example #8
0
 render() {
   const helenAvatar = <Image className='avatar' src={faker.image.avatar()} />
   const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
   const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
   return (
     <List className='mini horizontal divided'>
       <List.Item image={helenAvatar} header='Helen' />
       <List.Item image={christianAvatar} header='Christian' />
       <List.Item image={danielAvatar} header='Daniel' />
     </List>
   )
 }
Example #9
0
 render() {
   const image1 = <Image className='avatar' src={faker.image.city(100, 100)} />
   const image2 = <Image className='avatar' src={faker.image.city(100, 100)} />
   const image3 = <Image className='avatar' src={faker.image.city(100, 100)} />
   return (
     <List className='horizontal'>
       <List.Item image={image1} header='Chicago' description='This city is located in the state of Illinois' />
       <List.Item image={image2} header='Indianapolis' description='This city is located in the state of Indiana' />
       <List.Item image={image3} header='Nashville' description='This city is located in the state of Tennessee' />
     </List>
   )
 }
Example #10
0
var genUserData = function(){
    return {
        firstName : faker.name.firstName(),
        lastName : faker.name.lastName(),
        avatar: faker.image.avatar()
    }
}
Example #11
0
 profile: function () {
   return {
     name: this.name,
     email: faker.internet.email(),
     profilePictureUrl: faker.image.imageUrl()
   };
 },
exports.seed = function (req, res) {

	var stmt = db.prepare("INSERT INTO moves ( name, kills, image ) " +
		"VALUES ('Paper', 'Rock', 'http://blog.japandict.com/wp-content/plugins/wp-emoji-one/icons/1F590.png')," +
		" ('Rock', 'Scissors', 'http://blog.japandict.com/wp-content/plugins/wp-emoji-one/icons/270A.png')," +
		" ('Scissors', 'Paper', 'http://blog.japandict.com/wp-content/plugins/wp-emoji-one/icons/270C.png')" +
		";");
	stmt.run();

	stmt = db.prepare("INSERT INTO players ( name, image ) VALUES (?, ?)");

	var end = 0;
	for ( var c = 0; c < 20; c++) {
		stmt.run([
			faker.name.findName(),
			faker.image.avatar()
		], function(){
			end ++;
			if( end == 20 ) {
				stmt = db.prepare("INSERT INTO games ( winner_id, loser_id ) VALUES (?, ?)");
				for (var i = 0; i < 100; i++) {
					db.all("SELECT * FROM players ORDER BY RANDOM() LIMIT 2", function(err, rows) {
						stmt.run([
							rows[0].id,
							rows[1].id
						]);
					});
				}
			}
		});
	}

};
Example #13
0
router.get('/random-user', async (ctx, next) => {
  let user = faker.helpers.userCard()
  user.avatar = faker.image.avatar()

  ctx.response.body = user
  ctx.response.status = 200
})
    Category.create(newCategory, function(err, createdCategory){
      if(err) console.log(err);

      // Get the ID of the parent Category
      var categoryId = createdCategory.id;

      // Get random number between 1 and maxProducts number of Products
      var numOfProducts = Math.floor(Math.random() * maxProducts) + minProducts;

      // Create numOfProducts
      for(var j = 0; j < numOfProducts; j++) {

        // Define new Product
        var newProduct = {
          categoryId: categoryId,
          name: faker.company.catchPhrase(),
          description: faker.lorem.sentence(),
          company: faker.company.companyName(),
          price: faker.finance.amount(),
          image: faker.image.image()
        }

        // Create the Product
        Product.create(newProduct, function(err){
          if(err) console.log(err);
        });
      }

      // Log it
      console.log('Category', categoryId, 'has', numOfProducts, 'Products');

    });
module.exports = function(app) {

  // This helps us fake the data
  var faker = require('faker');

  // Load the models
  var Category = app.models.Category;
  var Product = app.models.Product;

  // Get max number of categories
  var maxCategories = process.env.MAX_CATEGORIES || 9;
  var maxProducts = process.env.MAX_PRODUCTS || 90;
  var minProducts = process.env.MIN_PRODUCTS || 10;

  // Create maxCategories number of Categories
  for(var i = 0; i < maxCategories; i++) {

    // Define new Category
    var newCategory = {
      name: faker.company.catchPhrase(),
      description: faker.lorem.sentence(),
      image: faker.image.image()
    }

    // Create the Category
    Category.create(newCategory, function(err, createdCategory){
      if(err) console.log(err);

      // Get the ID of the parent Category
      var categoryId = createdCategory.id;

      // Get random number between 1 and maxProducts number of Products
      var numOfProducts = Math.floor(Math.random() * maxProducts) + minProducts;

      // Create numOfProducts
      for(var j = 0; j < numOfProducts; j++) {

        // Define new Product
        var newProduct = {
          categoryId: categoryId,
          name: faker.company.catchPhrase(),
          description: faker.lorem.sentence(),
          company: faker.company.companyName(),
          price: faker.finance.amount(),
          image: faker.image.image()
        }

        // Create the Product
        Product.create(newProduct, function(err){
          if(err) console.log(err);
        });
      }

      // Log it
      console.log('Category', categoryId, 'has', numOfProducts, 'Products');

    });
  }

};
 .map(id => Map({
   firstName: faker.name.firstName(),
   lastName: faker.name.lastName(),
   email: faker.internet.email(),
   fullTime: faker.random.boolean(),
   img: faker.image.avatar(),
 }))
	randomUser: function(req, res){
     var user = faker.helpers.userCard();
     console.log("inside userscontroller");
     console.log(user);
     user.avatar = faker.image.avatar();
     res.json(user);
   },
    it('renders <img> with string', () => {
      const src = faker.image.imageUrl()
      const wrapper = shallow(<FeedLabel image={src} />)

      wrapper.should.have.descendants('img')
      wrapper.find('img').should.have.prop('src', src)
    })
function createCourses(students, teachers) {
	var courses = [];

	for ( var i = 0; i < faker.random.number(50) + 15; i++ ) {
		var likes = faker.random.number(100);
		var liked = ( likes > 0 ) ? faker.random.boolean() : false;

		var enrolls = faker.random.number(100);
		var enrolled = ( enrolls > 0 ) ? faker.random.boolean() : false;

		var course = {
			id: faker.random.uuid(),
			title: faker.lorem.sentence(2),
			subtitle: faker.lorem.sentence(),
			content: truncate(faker.lorem.paragraphs(faker.random.number(2) + 1), 65),
			author: faker.fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'), //todo: deprecate in favor of teacher
			image: faker.image.image(340, 150, true),
			likes: likes, //todo: link with students faker data
			liked: liked,
			enrolls: enrolls, //todo: link with students faker data
			enrolled: enrolled
		};

		courses.push(course);
	}

	return courses;
}
    function* addProduct(productData) {
        // const causes an error! don't know why
        let defaultProductData = {
            reference: uuid.v1(),
            width: 60,
            height: 40,
            price: faker.random.number(),
            thumbnail: faker.image.imageUrl(60, 60),
            image: faker.image.imageUrl(400, 400),
            description: faker.lorem.sentence(),
            stock: faker.random.number(),
        };

        // ES7, in Babel it is experimental stage 2 and enabled by default
        return yield productQueries.insertOne({ ...defaultProductData, ...productData });
    }
Example #21
0
 _.times(5000, () => {
     const {name, email, phone} = helpers.createCard();
     Employees.insert({
         name, email, phone,
         avatar: image.avatar()
     });
 });
Example #22
0
 const goods = _.times(1302, () => new Good(
   {
     name: faker.commerce.productName(),
     price: faker.commerce.price(),
     code: faker.random.number(),
     image: faker.image.abstract(120, 120),
   }
   )
const message = (props) => Object.assign({
  from: `${faker.name.firstName()} ${faker.name.lastName()}`,
  fromAvatar: faker.image.avatar(),
  subject: faker.company.catchPhrase(),
  body: fakeBody(),
  flagged: faker.random.boolean(),
  sent: faker.date.past(1).toISOString(),
}, props);
let generateNewData = () => {
  return {
    title: faker.lorem.text(),
    content: faker.lorem.text(),
    imageUrl: faker.image.imageUrl(),
    category: faker.lorem.word()
  }
};
Example #25
0
 render() {
   const photo = <Image className='circular' src={faker.image.city(120, 120)} />
   return (
     <Header.H2 image={photo}>
       Welcome to Our City!
     </Header.H2>
   )
 }
Example #26
0
 var newPortfolio = function(){
   return new Portfolio({
     name:     Faker.company.companyName(),
     info:     Faker.company.catchPhrase(),
     summary:  Faker.company.catchPhraseDescriptor(),
     image:    Faker.image.imageUrl()
   });
 };
    it('renders node', () => {
      const src = faker.image.imageUrl()
      const img = <img src={src} />
      const wrapper = shallow(<FeedLabel image={img} />)

      wrapper.should.have.descendants('img')
      wrapper.find('img').should.have.prop('src', src)
    })
Example #28
0
const buildFile = function buildFile (parentFolderId, filesColleciton) {
  const doc = {
    name: faker.hacker.noun(),
    folder: parentFolderId,
    created: new Date().toString(),
    url: faker.image.imageUrl()
  }
  return filesColleciton.create(doc)
}
Example #29
0
function feedPost() {
  var base = {
    datetime: moment().subtract(randInt(50), 'days').toISOString(),
    poster: users[randInt(users.length)]._id
  };
  return _.merge(base, [{
    photo: faker.image.city()
  }, {
    text: faker.lorem.sentences(3)
  }, {
    embed: {
      type: 'rich',
      thumbnail_url: faker.image.nightlife(),
      title: faker.company.catchPhrase(),
      description: faker.lorem.paragraphs(1)
    }
  }][randInt(3)]);
}
Example #30
0
function createImage() {
  return {
    "caption": null,
    "url": `${faker.image.imageUrl()}?r=${faker.random.uuid()}`,
    "height": 640,
    "width": 480,
    "colors": [createColor()],
    "entropy": 1.2698034041000001
  };
}