GithubHelp home page GithubHelp logo

querkmachine / nova-randomize-everything Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 261 KB

Nova.app extension to generate random content for demos, prototypes and testing.

Home Page: https://extensions.panic.com/extensions/querkmachine/querkmachine.RandomizeEverything/

License: MIT License

JavaScript 100.00%
nova nova-extension placeholder random

nova-randomize-everything's Introduction

A white, green and black robot bat looks at and waves at you

Hello world, I'm beeps, a Bristol-based frontend developer currently working on the GOV.UK Design System, a product of the Government Digital Service.

Some things to know:

The government's views are not my own, or vice versa.

Follow me on Mastodon

nova-randomize-everything's People

Contributors

querkmachine avatar

Watchers

 avatar  avatar

nova-randomize-everything's Issues

Consider adding location generators

An early feature that was planned but not implemented was the creation of location-related generators.

This included technical generators, such as coordinate systems, and postal address generators.

Generators highly considered for implementation:

  • Latitude and longitude, using the decimal coordinate notation used by many online services and APIs (e.g. Google Maps)
  • Street addresses
  • Town and region names

Generators that are lower priority but may be useful:

  • Latitude and longitude, using the degree-minute-second (DMS) coordinate notation
  • US ZIP codes
  • UK postcodes

Although generation of postal addresses may be difficult to do satisfyingly well, coordinate systems may be simpler.

Consider renaming some of the generators

Some generators have non-obvious or arguably 'overly technical' names. For example, the number generators. These could be renamed to more human-sensible names.

  • Random integer โ†’ Random whole number
  • Random float โ†’ Random decimal number
  • Random binary integer โ†’ Random binary number

Some generators list which ISO spec they comply with. Other than these being formatted incorrectly (ISO standard aren't hyphenated), it's questionable how useful including this information is when compared to giving an example of the output format.

  • Random date (ISO-8601) โ†’ Random date (YYYY-MM-DD)
  • Random time (ISO-8601) โ†’ Random time (HH:MM:SS)

However, keeping the ISO designation on some others is probably useful, as it indicates that the values are being generated or chosen in a specification-compliant format rather than being arbitrary combinations of letters/numbers.

In the case of ISO 3166, technically the codes belong to the child-standard ISO 3166-1

  • Random date and time (ISO-8601) โ†’ Random date and time (ISO 8601)
  • Random country code (ISO-3166 alpha-2) โ†’ Random country code (ISO 3166-1 alpha-2)
  • Random country code (ISO-3166 alpha-3) โ†’ Random country code (ISO 3166-1 alpha-3)
  • Random country code (ISO-3166 numeric) โ†’ Random country code (ISO 3166-1 numeric)

Changing hex colour to hexadecimal colour may make this option less ambiguous.

  • Random hex color โ†’ Random hexadecimal color

If possible, dynamically updating the labels for RGB and HSL colors according to the user's formatting settings might be nice.

For example:

  • Random RGB color โ†’ Random RGB color (R, G, B) or Random RGB color (rgb(R, G, B))
  • Random HSL color โ†’ Random HSL color (H, S, L) or Random HSL color (hsl(H, S%, L%))

The concept of 'first' and 'last' names is a bit weird, as not all languages format names in the first-then-last manner. Renaming these to more generic terms may be useful.

  • Random first name โ†’ Random given name
  • Random last name โ†’ Random surname

Improve domain name, web address, and email address generators

Each of these currently has their own minor failings and annoyances.

Domain name:

  • Domains are always single words. Actual domain names often include numbers and dashes.
  • Cannot generate subdomains (including the common, if usually unnecessary, www. prefix).
  • A greater range of default TLDs might be nice to have.

Web address:

  • Always generates a 'full' address featuring the protocol, (optional) subdomain, domain name, directory and file path, query string and hash. Making some of these optional (either configurable, or through randomness) might be nice.
  • File paths cannot be generated with file extensions (e.g. .html, .php)

Email address:

  • The name part often generates with trailing punctuation which, whilst valid, isn't commonly done (e.g. [email protected]).
  • Cannot generate addresses using the full gamut of allowed punctuation in the name part.
  • A greater range of 'real email providers' might be nice to have.

Username:

  • The name part of the email address generator could potentially be reused as a username generator.

Text placement from contextual menu removes line feed

When using Randomize Everything from the contextual-menu, the editor automatically selects (at a minimum) the line-feed of the current line. When the chosen random-text is placed, it replaces the line feed (which is unexpected because it brings the text of the following line up to the current line).

There might be a more elegant solution but: You could check editor.selectedText to see if the last character is "\n" and if it is add a line-feed to the placed text? e.g.,

function insertAtPosition(editor, cb) {
  var line_feed = ( editor.selectedText.slice(-1) === "\n" ) ? "\n" : "";
  
  editor.edit((textEditor) => {
    editor.selectedRanges.reverse().forEach((range) => {
      textEditor.replace(range, cb() + line_feed);
    });
  });
}

Consider adding more formatting options for color generators

Consider adding more formatting options for color generators.

Note
CSS Colors Level 4 no longer requires commas in CSS color functions, and implements a slash syntax for alpha channels: rgba(123, 45, 67, .8) in old is equivalent to rgb(123 45 67 / .8) in new.

New color functions introduced by Level 4, hwb, lch and lab, only support the new syntax. Of these, as of writing, only hwb has widespread support in browsers.

Possible settings changes

  • Add a setting option for which generators to include in menus, so that not all of them are listed all the time (not sure if this is possible?)
  • Add a setting to toggle including alpha channel values
  • Remove CSS compliant format setting (superceded by selectable format options)

Possible formats

Format Example w/o alpha Example w/ alpha
Hexadecimal #bada55 #bada5547
RGB 123, 45, 67 โ€”
HSL 123, 45%, 67% โ€”
CSS RGB rgb(123, 45, 67)
or rgb(123 45 67)
rgba(123, 45, 67, 0.8)
or rgb(123 45 67 / 0.8)
CSS HSL hsl(123, 45%, 67%)
or hsl(123 45% 67%)
hsla(123, 45%, 67%, 0.8)
or hsl(123 45% 67% / 0.8)
CSS HWB hwb(123 45% 67%) hwb(123 45% 67% / 0.8)
CSS LCH lch(12.3% 45% 67) lch(12.3% 45% 67 / 0.8)
CSS Lab lab(12.34% -56 78) lab(12.34% -56 78 / 0.9)
NSColor RGB โ€” NSColor(red: 0.123, green: 0.45, blue: 0.67, alpha: 0.8)
NSColor HSB โ€” NSColor(hue: 0.123, saturation: 0.45, brightness: 0.67, alpha: 0.8)
UIColor RGB โ€” UIColor(red: 0.123, green: 0.45, blue: 0.67, alpha: 0.8)
UIColor HSB โ€” UIColor(hue: 0.123, saturation: 0.45, brightness: 0.67, alpha: 0.8)
SwiftUI RGB โ€” Color(red: 0.123, green: 0.45, blue: 0.67, alpha: 0.8)
SwiftUI HSB โ€” Color(hue: 0.123, saturation: 0.45, brightness: 0.67, alpha: 0.8)
SwiftUI Literal โ€” #colorLiteral(red: 0.123, green: 0.45, blue: 0.67, alpha: 0.8)
Obj-C NSColor RGB โ€” [NSColor colorWithCalibratedRed:0.123 green:0.45 blue:0.67 alpha:0.8]
Obj-C UIColor RGB โ€” [UIColor colorWithRed:0.123 green:0.45 blue:0.67 alpha:0.8]
.net RGB Color.FromRgb(123, 45, 67) Color.FromArgb(204, 123, 45, 67)
Java RGB new Color(123, 45, 67) new Color(123, 45, 67, 204)
Android RGB Color.rgb(123, 45, 67) Color.argb(204, 123, 45, 67)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.