pomeh / sublime-FakeDataGenerator

Fake data generation within Sublime Text. This code is not mine, it's from https://github.com/SublimeText/FakeDataGenerator which is discontinued

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fake Data Generator

Description

This package will repeat the selected text N times, and also may generate Fake Data if you wish using the awesome external library Faker

CTRL+SHIFT+P to access to the command pallete and select Fake: it! .

Behind the escenes, this package calls Faker methods in short hand (without the need to write the class name faker.)

Usage

  • Enclose the data to fake with {{ and }} with the proper name of the function to call. See examples.

  • Select the text (The package is capable to handle multiple selections)

  • Done!

Installation

Download or clone the contents of this repository to a folder named exactly as the package name into the Packages/ folder of ST.

Example

  • Write, or copy and paste the following in a new ST tab/view:

  • { "{{index()}}": "{{name()}}", }

  • Then select the inner portion marked as code:

  • { "{{index()}}": "{{name()}}", }

  • CTRL+SHIFT+P

  • Type: Fake: It!

  • Repeat: 3

  • Press Enter

  • This is the current output:

  • { "1": "Trina Friesen","2": "Mack Koch","3": "Burney O'Kon",

}

Package Methods and Modifiers

  • index() # will keep an internal autoincrement counter [this is not provided by faker]

    • You may wish to keep aditionals autoincrement counters. You can keep separated counters by providing an argument as index such index(1) or index('goals')
  • Supports three basic modifiers: repeat, encode and escape.

    • For example

      • "{{index()|repeat(3)}}"
    • Will run the faker function three times and produce

      • "1,2,3"
    • For example

      • "{{index()|repeat(3, '-')}}"
    • Will produce

      • "1-2-3"
    • For example

      • "{{url()|encode()}}"
    • Will produce

      • "http%3A%2F%2Fcarroll.biz%2F"
    • For example

      • "{{name()|escape()}}"
    • Will produce

      • Dalibor Ma\u0161ek # for Dalibor Mašek

Handy List of Faker Methods (see complete list in Faker documentation)

BASIC METHODS

name() # Dalibor Mašek

first_name() # Vendula

last_name() # Dušková

safe_email() # ikucera@example.net

date_time_this_year() # 2013-07-12 12:07:09

url() # http://www.duskova.cz/

uri_path(deep=None) # app/categories/category

ipv4() # 97.154.116.193

random_int(min=0, max=9999) # 5018

boolean(chance_of_getting_true=50) # True

words(nb=3) # ducimus ex rerum

sentence(nb_words=6, variable_nb_words=True) # Et eos et adipisci sed suscipit maiores.

md5(raw_output=False) # 22b9f5010ee6434c5672af4f223f9c4e

random_element(array=('a', 'b', 'b')) # b

TEXT

random_letter() # i

sentence(nb_words=6, variable_nb_words=True) # Et eos et adipisci sed suscipit maiores.

sentences(nb=3) # Quis tempora nisi necessitatibus libero ipsum fugit eos ......

text(max_nb_chars=200) # Iusto deserunt rerum nostrum quia doloremque. Rem ...

word() # ut

words(nb=3) # ducimus ex rerum

paragraphs(nb=3) # Molestiae quae et placeat illum perferendis........

paragraph(nb_sentences=3, variable_nb_sentences=True) # Voluptate tenetur qui ......

DATE TIME

year() # 2009

month() # 06

day_of_month() # 23

month_name() # February

day_of_week() # Wednesday

timezone() # Asia/Yerevan

date(pattern="%Y-%m-%d") # 1995-12-23

time(pattern="%H:%M:%S") # 10:37:21

date_time() # 1989-11-02 09:28:43

date_time_this_decade() # 2014-01-16 12:06:02

date_time_this_year() # 2013-07-12 12:07:09

date_time_this_month() # 2014-03-07 20:03:09

iso8601() # 1993-12-04T02:47:48

am_pm() # AM

unix_time() # 1351615176

PERSON

name() # Dalibor Mašek

first_name() # Vendula

last_name() # Dušková

user_name() # zuzana.polakova

safe_email() # ikucera@example.net

email() # marketa06@seznam.cz

phone_number() # 733 971 899

job() # Physiological scientist

company() # Pospíšil o.s.

company_suffix() # a.s.

credit_card_number(card_type=None, validate=False, max_check=10) # 4486550681899265

LOCATION

address() # Za Křížem 71 191 02 Letovice

street_name() # Poslední

street_address() # Na Lázeňce 4/9

postcode() # 417 77

locale() # en_WS

country() # Samoa

country_code() # BN

language_code() # pt

city_name() # Bohušovice nad Ohří

city() # Spálené Poříčí

state() # Jihočeský kraj

latitude() # -68.8597715

longitude() # 56.371770

INTERNET

url() # http://www.duskova.cz/

uri() # http://zeman.cz/

domain_name() # horakova.cz

tld() # com

uri_path(deep=None) # app/categories/category

uri_page() # main

ipv4() # 97.154.116.193

ipv6() # 37cc:ff29:d8ee:bda4:24cb:76fc:7c7e:a130

user_agent() # Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.0; Trident/5.0)

COLOR

rgb_css_color() # rgb(241,137,244)

hex_color() # #f2e171

NUMBERS

random_int(min=0, max=9999) # 5018

random_digit() # 8

random_number(digits=None) # 610456427

numerify(text="###") # 607

MISCELANEA

password(length=10, special_chars=True, digits=True, upper_case=True, lower_case=True) # BAgRm)CTXJ

md5(raw_output=False) # 22b9f5010ee6434c5672af4f223f9c4e

sha1(raw_output=False) # c58d17a41060bbf38b5ce501c721d7114205c095

sha256(raw_output=False) # a2ce2b5a7288467d158880c113a04aa95b6e441173c6e4d4ac08a616bd4195ff

null_boolean() # None

[1] http://www.sublimetext.com/

[2] https://sublime.wbond.net/installation

[3] https://github.com/joke2k/faker

[4] https://github.com/joke2k/faker

About

Fake data generation within Sublime Text. This code is not mine, it's from https://github.com/SublimeText/FakeDataGenerator which is discontinued

License:Other


Languages

Language:Python 98.5%Language:Makefile 0.8%Language:Batchfile 0.7%