Skip to content

Instantly share code, notes, and snippets.

@procload
Last active December 30, 2015 22:08
Show Gist options
  • Save procload/7891762 to your computer and use it in GitHub Desktop.
Save procload/7891762 to your computer and use it in GitHub Desktop.
[
'{{repeat(25)}}',
{
id: "{{index}}",
type: function(idx) {
return ['retailer', 'service'][this.numeric(0, 1)];
},
name: function(idx) {
var names = [
'Autozone',
'Napa Auto Parts',
'O’Reilly Auto Parts',
'Advanced Auto Parts',
'Pep Boys Auto Parts'
];
return names[this.numeric(0, names.length - 1)];
},
address1: "{{numeric(10,4000)}} {{street}}",
address2: "",
city: "Cincinnati",
state: "OH",
region: "US",
postalCode: function(idx) {
return this.numeric(45140, 45209).toString();
},
phone: "{{phone}}",
fax: "{{phone}}",
email: "{{email(random)}}",
authorizedDistributor: "{{bool}}",
onlineStore: "{{bool}}",
website: function(idx) {
return "http://" + this.company().toLowerCase() + ".com";
},
coords: {
lat: '{{numeric(-90.000001, 90)}}',
long: '{{numeric(-180.000001, 180)}}'
},
distance: "{{numeric(.25,15)}}",
promotions: function(idx) {
var promos = [],
yes = Math.round(Math.random()) === 1,
names = [
'Fourth of July sale',
'President’s Day sale'
];
if ( yes ) {
promos.push({
'name': names[this.numeric(0, names.length - 1)],
'description': this.lorem(2, 'sentences')
});
}
return promos;
},
products: {
motorOils: function(idx) {
var brand = [
'Mobil 1',
'Mobil 1 Advance Fuel Economy',
'Mobil 1 High Mileage',
'Mobil 1 Extended Performance',
'Mobil 1 ESP Formula /Formula M',
'Mobil 1 Turbo Diesel',
'Mobil Super',
'Mobil Super High Mileage',
'Mobil Super Synthetic',
'Mobil Delvac 1 LE',
'Mobil Delvac 1 ESP',
'Mobil Delvac 1300 Super',
'Mobil 1 Racing Oils'
],
viscosity = [
'5W20',
'5W30',
'0W40',
'10W30',
'10W40',
'15W50',
'20W50'
],
sizes = [
'1 Quart Bottle',
'5 Quart Jug',
'5 Gallon Jug'
],
amount = this.numeric(0,100),
oils = [];
while ( oils.length < amount ) {
var out = {
id: this.numeric(1000, 9999),
type: "motorOil",
name: brand[this.numeric(0, brand.length - 1)],
viscosity: viscosity[this.numeric(0, viscosity.length - 1)],
size: sizes[this.numeric(0, sizes.length - 1)]
};
oils.push( out );
}
return oils;
},
oilFilters: function(idx) {
var sizes = [
'M1-103',
'M1-108',
'M1-110',
'M1-104',
'M1-209',
'M1-113',
'M1-204',
'M1-206',
'M1-212'
],
amount = this.numeric(0,100),
oilfilters = [];
while ( oilfilters.length < amount ) {
var out = {
id: this.numeric(1000, 9999),
type: 'oilFilter',
name: 'Mobil 1 Extended Performance',
sizes: sizes[this.numeric(0, sizes.length - 1)],
pack: this.numeric(1,2)
};
oilfilters.push( out );
}
return oilfilters;
},
greases: function(idx) {
var yes = Math.round(Math.random()) === 1,
greases = [];
if ( yes ) {
greases.push({
id: this.numeric(1000, 9999),
name: 'Mobil 1 Synthetic Grease'
});
}
return greases;
},
transmissionFluids: function(idx) {
var brand = [
'Mobil 1 Synthetic ATF',
'Mobil Dexron-VI ATF',
'Mobil ATF D/M',
'Mobil Multi-Vehicle ATF',
'Mobil ATF 3309',
'Mobil Type F ATF'
],
sizes = [
'1 Bottle',
'6 Pack'
],
amount = this.numeric(0,100),
transmissionFluids = [];
while ( transmissionFluids.length < amount ) {
var out = {
id: this.numeric(1000, 9999),
type: 'transmissionFluid',
name: brand[this.numeric(0, brand.length - 1)],
size: sizes[this.numeric(0, sizes.length - 1)]
};
transmissionFluids.push( out );
}
return transmissionFluids;
},
lubricants: function(idx) {
var brand = ['Mobil 1 Synthetic Gear Lube LS',
'Mobil 1 Synthetic Gear Lube LS',
'Mobilube HD Plus'
],
viscosity = ['75W-140',
'75W-90',
'80W-90'
],
amount = this.numeric(0,100),
lubricants = [];
while ( lubricants.length < amount ) {
var out = {
id: this.numeric(1000, 9999),
type: 'lubricants',
name: brand[this.numeric(0, brand.length - 1)],
viscosity: viscosity[this.numeric(0, viscosity.length - 1)]
};
lubricants.push( out );
}
return lubricants;
},
motorcycleOils: function(idx) {
var brand = [
'Mobil 1 Racing 4T',
'Mobil 1 V-Twin'
],
viscosity = [
'10W-40',
'20W-50'
],
sizes = [
'1 Quart Bottle',
'5 Quart Jug',
'5 Gallon Jug'
],
amount = this.numeric(0,100),
motorcycleOils = [];
while ( motorcycleOils.length < amount ) {
var out = {
id: this.numeric(1000, 9999),
type: 'motorcycleOils',
name: brand[this.numeric(0, brand.length - 1)],
viscosity: viscosity[this.numeric(0, viscosity.length - 1)],
size: sizes[this.numeric(0, sizes.length - 1)]
};
motorcycleOils.push( out );
}
return motorcycleOils;
}
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment