Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | 1x 1x 1x 1x 1x 22x 22x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 16x 16x 16x 16x 12x 12x 16x 16x 16x 16x 16x 16x 16x 16x 16x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 21x 21x 21x 21x 21x 21x 4x 21x 8x 14x 8x 8x 8x 8x 8x 9x 1x 1x 21x 21x 21x 21x 21x 21x 1x 1x 49x 49x 1x 1x 2x 2x 2x 2x 2x 2x 2x 1x 1x 5x 5x 1x 1x 3x 3x 1x 1x 7x 7x 7x 1x 1x 7x 7x 7x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 8x 1x 1x 1x 1x 8x 8x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 1x 4x 3x 3x 4x 4x 4x 1x 1x 4x 4x 4x 4x 4x 1x 1x 1x 4x 3x 3x 3x 4x 4x 4x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 5x 5x 5x 5x 5x 5x 5x 2x 2x 5x 5x 60x 60x 25x 25x 60x 5x 5x 5x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 67x 67x 67x 67x 67x 67x 1x 1x 66x 66x 66x 49x 66x 17x 17x 66x 66x 66x 66x 66x 66x 66x 66x 66x 67x 51x 51x 15x 15x 2x 2x 2x 1x 1x 1x 15x 15x 1x 2x 2x 2x 1x | import RandExp from 'randexp';
import slugify from 'slugify';
export class Internet {
constructor(pure) {
this.pure = pure;
}
avatar(width) {
let opt = width;
let url = 'https://i.pravatar.cc';
if (typeof opt === 'undefined') {
opt = 200;
}
url += `/${opt}`;
return url;
}
email(options = {}) {
let { provider } = options;
const { firstName, lastName } = options;
if (typeof provider === 'undefined') {
provider = this.pure.random.arrayElement(this.pure.registeredModules.internet.freeEmail);
}
return `${this.pure.helpers.slugify(
this.pure.internet.userName({
firstName,
lastName
}),
{ lower: true }
)}@${provider}`;
}
exampleEmail(options = {}) {
const { firstName, lastName } = options;
const provider = this.pure.random.arrayElement(
this.pure.registeredModules.internet.exampleEmail
);
return this.pure.internet.email({ firstName, lastName, provider });
}
userName(options = {}) {
const { firstName = this.pure.name.firstName(), lastName = this.pure.name.lastName() } =
options;
const r = this.pure.random.number(2);
let result;
if (r === 0) {
result = firstName + this.pure.random.number(99);
} else if (r === 1) {
result = firstName + this.pure.random.arrayElement(['.', '_']) + lastName;
} else if (r === 2) {
result =
firstName +
this.pure.random.arrayElement(['.', '_']) +
lastName +
this.pure.random.number(99);
} else {
result = firstName + this.pure.random.number(99);
}
result = this.pure.helpers.slugify(result);
result = result.replace(/ /g, '');
return result;
}
protocol() {
return this.pure.random.arrayElement(['http', 'https']);
}
url(options = {}) {
const {
protocol = this.pure.internet.protocol(),
domainName = this.pure.internet.domainName()
} = options;
return `${protocol}://${domainName}`;
}
domainName() {
return `${this.pure.internet.domainWord()}.${this.pure.internet.domainSuffix()}`;
}
domainSuffix() {
return this.pure.random.arrayElement(this.pure.registeredModules.internet.domainSuffix);
}
domainWord() {
let name = this.pure.helpers.slugify(this.pure.name.firstName(), { lower: true, strict: true });
if (name.length === 0) {
name = slugify(this.pure.lorem.word(), { lower: true, strict: true });
}
return name;
}
ip() {
const digit1 = this.pure.random.number(255);
const digit2 = this.pure.random.number(255);
const digit3 = this.pure.random.number(255);
const digit4 = this.pure.random.number(255);
return `${digit1}.${digit2}.${digit3}.${digit4}`;
}
ipv6() {
const randHash = () => {
const template = this.pure.helpers.repeatString({ string: '#', num: 4 });
return this.pure.helpers.replaceSymbolWithHex({ string: template });
};
const result = [];
for (let i = 0; i < 8; i += 1) {
result[i] = randHash();
}
return result.join(':');
}
userAgent(options = {}) {
const { provider } = options;
let result = '';
if (provider) {
result = this.pure.registeredModules.internet.userAgent[provider];
} else {
result = this.pure.random.objectElement(this.pure.registeredModules.internet.userAgent);
}
return result;
}
botUserAgent(options = {}) {
const { provider } = options;
let result = '';
if (provider) {
result = this.pure.random.arrayElement(
this.pure.registeredModules.internet.botUserAgent[provider]
);
} else {
const arr = this.pure.random.objectElement(this.pure.registeredModules.internet.botUserAgent);
result = this.pure.random.arrayElement(arr);
}
return result;
}
color(options = {}) {
const { baseRed255 = 0, baseGreen255 = 0, baseBlue255 = 0 } = options;
// based on awesome response : http://stackoverflow.com/questions/43044/
// algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette
const red = Math.floor((this.pure.random.number(256) + baseRed255) / 2);
const green = Math.floor((this.pure.random.number(256) + baseGreen255) / 2);
const blue = Math.floor((this.pure.random.number(256) + baseBlue255) / 2);
const redStr = red.toString(16);
const greenStr = green.toString(16);
const blueStr = blue.toString(16);
return (
`#${redStr.length === 1 ? '0' : ''}${redStr}${greenStr.length === 1 ? '0' : ''}` +
`${greenStr}${blueStr.length === 1 ? '0' : ''}${blueStr}`
);
}
mac(sep) {
let i;
let mac = '';
let validSep = ':';
// if the client passed in a different separator than `:`,
// we will use it if it is in the list of acceptable separators (dash or no separator)
if (['-', ''].indexOf(sep) !== -1) {
validSep = sep;
}
for (i = 0; i < 12; i += 1) {
mac += this.pure.random.number(15).toString(16);
if (i % 2 === 1 && i !== 11) {
mac += validSep;
}
}
return mac;
}
password(options = {}) {
let { prefix = '' } = options;
const { len = 15, memorable = false, pattern = /\w/ } = options;
/*
* password-generator ( function )
* Copyright(c) 2011-2013 Bermi Ferrer <bermi@bermilabs.com>
* MIT Licensed
*/
const vowel = /[aeiouAEIOU]$/;
const consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/;
const password = (length, mem, pre) => {
let char;
const nlength = length;
let pat = /\w/;
const npre = pre || '';
if (npre.length >= nlength) {
return npre;
}
if (mem) {
if (npre.match(consonant)) {
pat = vowel;
} else {
pat = consonant;
}
}
const n = this.pure.random.number(94) + 33;
char = String.fromCharCode(n);
if (mem) {
char = char.toLowerCase();
}
if (!char.match(pat)) {
return password(nlength, mem, npre);
}
return password(nlength, mem, `${npre}${char}`);
};
if (memorable) {
prefix = password(len, memorable, prefix);
} else {
while (len > prefix.length) {
prefix += new RandExp(pattern).gen();
}
}
return prefix.substr(0, len);
}
}
|