All Projects → glorious-codes → Glorious Demo

glorious-codes / Glorious Demo

Licence: mit
The easiest way to demonstrate your code in action.

Programming Languages

javascript
184084 projects - #8 most used programming language
stylus
462 projects
HTML
75241 projects

Projects that are alternatives of or similar to Glorious Demo

Pervane
Plain text file based note taking and knowledge base building tool, markdown editor, simple browser IDE.
Stars: ✭ 159 (-95.17%)
Mutual labels:  demo, editor, code
Navi
An interactive cheatsheet tool for the command-line
Stars: ✭ 10,055 (+205.62%)
Mutual labels:  terminal, snippet
Reminders Cli
Command-line interface to interact with the Reminders.app
Stars: ✭ 67 (-97.96%)
Mutual labels:  terminal, mac
Simplec
C/C++ develop tool for android.
Stars: ✭ 105 (-96.81%)
Mutual labels:  terminal, editor
Langterm
🕹️ WebGL-based VT220 emulator, made as a learning example and frontend for a text adventure
Stars: ✭ 35 (-98.94%)
Mutual labels:  terminal, demo
Ed
A modern UNIX ed (line editor) clone written in Go
Stars: ✭ 44 (-98.66%)
Mutual labels:  terminal, editor
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-97.02%)
Mutual labels:  terminal, editor
Mle
Flexible terminal-based text editor (C)
Stars: ✭ 378 (-88.51%)
Mutual labels:  terminal, editor
Pythonvscode
This extension is now maintained in the Microsoft fork.
Stars: ✭ 2,013 (-38.81%)
Mutual labels:  terminal, editor
Mac Keyboard Brightness
🔆 Programmatically get & set the keyboard & display backlight brightness on Macs. Flash your keyboard to the music! (only works on <2015 Macs)
Stars: ✭ 185 (-94.38%)
Mutual labels:  terminal, mac
Ox
An independent Rust text editor that runs in your terminal!
Stars: ✭ 2,634 (-19.94%)
Mutual labels:  terminal, editor
Suplemon
🍋 Console (CLI) text editor with multi cursor support. Suplemon replicates Sublime Text like functionality in the terminal. Try it out, give feedback, fork it!
Stars: ✭ 734 (-77.69%)
Mutual labels:  terminal, editor
Nord Iterm2
An arctic, north-bluish clean and elegant iTerm2 color scheme.
Stars: ✭ 651 (-80.21%)
Mutual labels:  terminal, mac
Blightmud
A terminal mud client written in Rust
Stars: ✭ 61 (-98.15%)
Mutual labels:  terminal, mac
Wechatcmd
提供微信终端版本、微信命令行版本聊天功能、微信机器人
Stars: ✭ 628 (-80.91%)
Mutual labels:  terminal, mac
Mac Zsh Completions
macOS specific additional completion definitions for Zsh.
Stars: ✭ 79 (-97.6%)
Mutual labels:  terminal, mac
Demos
demos 一个简洁的web开发编辑器
Stars: ✭ 138 (-95.81%)
Mutual labels:  demo, editor
Micro
A modern and intuitive terminal-based text editor
Stars: ✭ 18,526 (+463.1%)
Mutual labels:  terminal, editor
Aura Theme
💅 A beautiful dark theme for your favorite apps.
Stars: ✭ 159 (-95.17%)
Mutual labels:  terminal, code
Mac Setup
🛠️ Front end web development setup for macOS.
Stars: ✭ 265 (-91.95%)
Mutual labels:  terminal, mac

Glorious Demo

The easiest way to demonstrate your code in action.

CircleCI Coverage Status

Installation

npm install @glorious/demo --save

Basic Usage

<link rel="stylesheet" href="node_modules/@glorious/demo/dist/gdemo.min.css">
<script src="node_modules/@glorious/demo/dist/gdemo.min.js"></script>

Note: If you're not into package management, load it from a third-party CDN provider.

// Constructor receives a selector that indicates
// where to inject the demonstration in your page.
const demo = new GDemo('#container');

const code = `
function greet(){
  console.log("Hello World!");
}

greet();
`

demo
  .openApp('editor', {minHeight: '350px', windowTitle: 'demo.js'})
  .write(code, {onCompleteDelay: 1500})
  .openApp('terminal', {minHeight: '350px', promptString: '$'})
  .command('node ./demo', {onCompleteDelay: 500})
  .respond('Hello World!')
  .command('')
  .end();

NOTE: Check here to know how to use Prism to get your code highlighted.

API

openApp

Opens or maximizes an open application.

/*
** @applicationType: String [required]
** @options: Object [optional]
*/

// Possible values are 'editor' or 'terminal'
const applicationType = 'terminal';

const openAppOptions = {
  minHeight: '350px',
  windowTitle: 'bash',
  promptString: '~/my-project $', // for 'terminal' applications only
  initialContent: 'Some text', // for 'editor' applications only
  inanimate: true // Turns off application's window animation
  onCompleteDelay: 1000 // Delay before executing the next method
}

demo.openApp(applicationType, openAppOptions).end();

write

Writes some code in the open Editor application.

/*
** @codeSample: String [required]
** @options: Object [optional]
*/

// Tabs and line breaks will be preserved
const codeSample = `
function sum(a, b) {
  return a + b;
}

sum();
`;

const writeOptions = {
  onCompleteDelay: 500 // Delay before executing the next method
}

demo.openApp('editor').write(codeSample, writeOptions).end();

command

Writes some command in the open Terminal application.

/*
** @command: String [required]
** @options: Object [optional]
*/

const command = 'npm install @glorious/demo --save';

// Redefines prompt string for this and following commands
const promptString = '$'

// Can optionally be an HTML string:
const promptString = '<span class="my-custom-class">$</span>'

const commandOptions = {
  promptString,
  onCompleteDelay: 500 // Delay before executing the next method
}

demo.openApp('terminal').command(command, commandOptions).end();

respond

Shows some response on the open Terminal application.

/*
** @response: String [required]
** @options: Object [optional]
*/

// Line breaks will be preserved
const response = `
+ @glorious/demo successfully installed!
+ v0.1.0
`;

// Can optionally be an HTML string:
const response = `
<div><span class="my-custom-class">+</span> @glorious/demo successfully installed!</div>
<div><span class="my-custom-class">+</span> v0.6.0</div>
`;

const respondOptions = {
  onCompleteDelay: 500 // Delay before executing the next method
}

demo.openApp('terminal').respond(response, respondOptions).end();

end

Indicates the end of the demonstration. The method returns a promise in case you want to perform some action at the end of the demonstration.

demo.openApp('terminal')
    .command('node demo')
    .respond('Hello World!')
    .end()
    .then(() => {
      // Custom code to be performed at the end of the demostration goes here.
    });

IMPORTANT: Do not forget to invoke it at the end of your demo. Otherwise, the demo won't be played.

Contributing

  1. Install Node. Download the "Recommend for Most Users" version.

  2. Clone the repo:

git clone [email protected]:glorious-codes/glorious-demo.git
  1. Go to the project directory:
cd glorious-demo
  1. Install the project dependencies:
npm install
  1. Build the project:
npm run build

Tests

Ensure that all code that you have added is covered with unit tests:

npm run test -- --coverage
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].