### Setup for Importing Executable Example Source: https://devdocs.io/cmake/guide/importing-exporting/index Steps to build and install a sample executable that will be imported into another CMake project. ```bash $ cd Help/guide/importing-exporting/MyExe $ mkdir build $ cd build $ cmake .. $ cmake --build . $ cmake --install . --prefix $ /myexe $ ls [...] main.cc [...] ``` -------------------------------- ### Basic Mocha Test Setup Source: https://devdocs.io/mocha Set up a basic test file (`test/test.js`) and install Mocha. This example demonstrates a simple assertion using Node.js's built-in `assert` module. ```bash $ npm install mocha $ mkdir test $ $EDITOR test/test.js # or open with your favorite editor ``` ```javascript var assert = require('assert'); describe('Array', function() { describe('#indexOf()', function() { it('should return -1 when the value is not present', function() { assert.equal([1, 2, 3].indexOf(4), -1); }); }); }); ``` -------------------------------- ### RIPEMD160 Start Function Example Source: https://devdocs.io/d/std_digest_ripemd Illustrates the `start` function for (re)initializing the RIPEMD160 digest. It notes that calling `start` after default construction is unnecessary but required to reset the digest. ```d RIPEMD160 digest; //digest.start(); //Not necessary digest.put(0); ``` -------------------------------- ### Root Hooks Setup Example (Serial Mode) Source: https://devdocs.io/mocha Example of root hooks defined in a setup file for serial mode execution. These hooks run before/after every test, even in other files. ```javascript // test/setup.js // root hook to run before every test (even in other files) beforeEach(function() { doMySetup(); }); // root hook to run after every test (even in other files) afterEach(function() { doMyTeardown(); }); ``` -------------------------------- ### Install and Start Selenium Standalone Source: https://devdocs.io/codeception/03-acceptancetests Install the selenium-standalone NodeJS package globally and then run the install command to get Selenium and its dependencies. Finally, start the Selenium server in a separate terminal. ```bash npm install selenium-standalone -g selenium-standalone install ``` ```bash selenium-standalone start ``` -------------------------------- ### i3 Startup Execution Examples Source: https://devdocs.io/i3 Examples demonstrating the use of `exec` and `exec_always` for starting applications and scripts on i3 startup. `--no-startup-id` is used for applications not supporting startup notifications. ```i3config exec chromium exec_always ~/my_script.sh # Execute the terminal emulator urxvt, which is not yet startup-notification aware. exec --no-startup-id urxvt ``` -------------------------------- ### Example CMakeLists.txt for a Library Source: https://devdocs.io/cmake/manual/cmake-toolchains.7 A basic CMakeLists.txt file to define a library named 'foo' from 'foo.cpp' and install it. ```cmake # CMakeLists.txt cmake_minimum_required(VERSION 3.14) project(foo) add_library(foo foo.cpp) install(TARGETS foo DESTINATION lib) ``` -------------------------------- ### Basic Example Source: https://devdocs.io/dom/orientationsensor Demonstrates how to instantiate an AbsoluteOrientationSensor, listen for reading and error events, and start the sensor. ```APIDOC ## Basic Example The following example, which is loosely based on Intel's Orientation Phone demo, instantiates an `AbsoluteOrientationSensor` with a frequency of 60 times a second. On each reading it uses `OrientationSensor.quaternion` to rotate a visual model of a phone. ```javascript const options = { frequency: 60, referenceFrame: "device" }; const sensor = new AbsoluteOrientationSensor(options); sensor.addEventListener("reading", () => { // model is a Three.js object instantiated elsewhere. model.quaternion.fromArray(sensor.quaternion).inverse(); }); sensor.addEventListener("error", (error) => { if (event.error.name === "NotReadableError") { console.log("Sensor is not available."); } }); sensor.start(); ``` ``` -------------------------------- ### Install Padrino Gem Source: https://devdocs.io/padrino Installs the Padrino framework using RubyGems. This command is used to get started with Padrino for new applications or to enhance existing Sinatra projects. ```bash $ gem install padrino ``` -------------------------------- ### Example Usage Source: https://devdocs.io/d/std_getopt Provides a complete example demonstrating how to use `getopt` with options, help text, and processing the `GetoptResult`. ```APIDOC ## Example Usage ### Example ```d auto args = ["prog", "--foo", "-b"]; bool foo; bool bar; auto rslt = getopt(args, "foo|f", "Some information about foo.", &foo, "bar|b", "Some help message about bar.", &bar); if (rslt.helpWanted) { defaultGetoptPrinter("Some information about the program.", rslt.options); } ``` ``` -------------------------------- ### Socket.IO Server Example Source: https://devdocs.io/socketio~3 Illustrates setting up a Socket.IO server and handling incoming connections and messages. Shows how to send and receive data using 'send' and 'emit'. ```javascript const io = require("socket.io")(3000); io.on("connection", socket => { // either with send() socket.send("Hello!"); // or with emit() and custom event names socket.emit("greetings", "Hey!", { "ms": "jane" }, Buffer.from([4, 3, 3, 1])); // handle the event sent with socket.send() socket.on("message", (data) => { console.log(data); }); // handle the event sent with socket.emit() socket.on("salutations", (elem1, elem2, elem3) => { console.log(elem1, elem2, elem3); }); }); ``` -------------------------------- ### i3 Configuration Comment Example Source: https://devdocs.io/i3 Comments in i3 configuration files are started with a # and can only be used at the beginning of a line. They are recommended for documenting your setup. ```i3config # This is a comment ``` -------------------------------- ### Serve Mode (Go) Source: https://devdocs.io/esbuild/api/index Set up a build context in Go and launch the development server. This enables serving built assets and handling requests with live updates. ```go ctx, err := api.Context(api.BuildOptions{ EntryPoints: []string{"app.ts"}, Bundle: true, Outdir: "dist", }) server, err2 := ctx.Serve(api.ServeOptions{}) ``` -------------------------------- ### Project and App Setup with Django Source: https://devdocs.io/django_rest_framework/tutorial/quickstart/index Sets up a new Django project and a REST framework app, including virtual environment creation and package installation. ```bash mkdir tutorial cd tutorial python3 -m venv env source env/bin/activate # On Windows use `env\Scripts\activate` pip install djangorestframework django-admin startproject tutorial . cd tutorial django-admin startapp quickstart cd .. ``` -------------------------------- ### Interactive React Native Example (Snack Player) Source: https://devdocs.io/react_native Use this interactive example to get started immediately in your browser. The Snack Player allows you to run and share React Native projects, and you can edit the code directly. ```javascript import React from 'react'; import { Text, View } from 'react-native'; const App = () => ( Try editing me! ); export default App; ``` -------------------------------- ### MD5 Template API: Finalizing with finish() Source: https://devdocs.io/d/std_digest_md An example of using the finish() method to get the MD5 hash. This method also implicitly calls start() to reset the internal state after computing the hash. ```d //Simple example MD5 hash; hash.start(); hash.put(cast(ubyte) 0); ubyte[16] result = hash.finish(); ``` -------------------------------- ### Basic Sequelize Setup and Usage Source: https://devdocs.io/sequelize~5 Demonstrates initializing Sequelize with an in-memory SQLite database, defining a User model, synchronizing the database, creating a user, and logging the created user. ```javascript const { Sequelize, Model, DataTypes } = require('sequelize'); const sequelize = new Sequelize('sqlite::memory:'); class User extends Model {} User.init({ username: DataTypes.STRING, birthday: DataTypes.DATE }, { sequelize, modelName: 'user' }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); }); ``` -------------------------------- ### Socket.IO Server Setup and Event Handling Source: https://devdocs.io/socketio~2 Sets up a Socket.IO server and demonstrates handling incoming connections, sending messages, and receiving events. ```javascript const io = require('socket.io')(3000); io.on('connection', socket => { // either with send() socket.send('Hello!'); // or with emit() and custom event names socket.emit('greetings', 'Hey!', { 'ms': 'jane' }, Buffer.from([4, 3, 3, 1])); // handle the event sent with socket.send() socket.on('message', (data) => { console.log(data); }); // handle the event sent with socket.emit() socket.on('salutations', (elem1, elem2, elem3) => { console.log(elem1, elem2, elem3); }); }); ``` -------------------------------- ### SHA1 Hashing with `start`, `put`, and `finish` Source: https://devdocs.io/d/std_digest_sha A simple example showing the complete process of hashing a single byte using SHA1. It involves initializing the digest, feeding a byte, and then finishing the operation to get the hash result. ```d //Simple example SHA1 hash; hash.start(); hash.put(cast(ubyte) 0); ubyte[20] result = hash.finish(); ``` -------------------------------- ### Example Configuration Files Source: https://devdocs.io/cypress/api/plugins/configuration-api These examples show the structure of different JSON configuration files for various environments. They define `baseUrl` and environment-specific variables. ```json // cypress/config/development.json { "baseUrl": "http://localhost:1234", "env": { "something": "development" } } ``` ```json // cypress/config/qa.json { "baseUrl": "https://qa.acme.com", "env": { "something": "qa" } } ``` ```json // cypress/config/staging.json { "baseUrl": "https://staging.acme.com", "env": { "something": "staging" } } ``` ```json // cypress/config/production.json { "baseUrl": "https://production.acme.com", "env": { "something": "production" } } ``` -------------------------------- ### Install Apache on Fedora/CentOS/RHEL Source: https://devdocs.io/apache_http_server/install Installs Apache HTTP Server using yum, enables it to start on boot, and starts the service. ```bash sudo yum install httpd sudo systemctl enable httpd sudo systemctl start httpd ``` -------------------------------- ### Cypress .parent() Example: Get parent of active LI Source: https://devdocs.io/cypress/api/commands/parent This example demonstrates how to get the parent DOM element of an element with the class 'active' within a list structure. It yields the '.sub-nav' element. ```javascript // yields .sub-nav cy.get('li.active').parent() ``` -------------------------------- ### Example Package Configuration and Version File Names Source: https://devdocs.io/cmake/manual/cmake-packages.7 Illustrates the naming convention for package configuration and version files. ```cmake /lib/cmake/foo-1.3/foo-config.cmake /lib/cmake/foo-1.3/foo-config-version.cmake ``` ```cmake /lib/cmake/bar-4.2/BarConfig.cmake /lib/cmake/bar-4.2/BarConfigVersion.cmake ``` -------------------------------- ### Bower Install and Search Commands Source: https://devdocs.io/bower Demonstrates how to use the `install` and `search` commands programmatically. The `install` command installs packages and can save them to configuration, while `search` finds packages. Both commands emit `end` events upon successful completion. ```APIDOC ## bower.commands.install ### Description Installs packages and optionally saves them to configuration. ### Method Signature `bower.commands.install(packages, options, config)` ### Parameters * `packages` (Array) - An array of package names to install. * `options` (Object) - Options such as `save: true` to save the dependency. * `config` (Object) - Custom configuration, e.g., `{ interactive: true }`. ### Events * `end` - Emitted when the command successfully ends. The payload contains information about installed packages. * `log` - Emitted to report the state/progress of the command. * `prompt` - Emitted whenever the user needs to be prompted (if `interactive: true`). * `error` - Emitted if something goes wrong. ### Request Example ```javascript var bower = require('bower'); bower.commands .install(['jquery'], { save: true }, { /* custom config */ }) .on('end', function (installed) { console.log(installed); }); ``` ## bower.commands.search ### Description Searches for packages. ### Method Signature `bower.commands.search(query, config)` ### Parameters * `query` (string) - The search term. * `config` (Object) - Configuration options. ### Events * `end` - Emitted when the command successfully ends. The payload contains search results. * `log` - Emitted to report the state/progress of the command. * `error` - Emitted if something goes wrong. ### Request Example ```javascript var bower = require('bower'); bower.commands .search('jquery', {}) .on('end', function (results) { console.log(results); }); ``` ``` -------------------------------- ### Example Usage Source: https://devdocs.io/dom/mediastreamaudiosourcenode Example of how to use the onaddstream event handler to get the MediaStream associated with the event. ```APIDOC ## Example ```javascript pc.onaddstream = (ev) => { alert(`A stream (id: '${ev.stream.id}') has been added to this connection.`); }; ``` ``` -------------------------------- ### Start a basic nginx pod Source: https://devdocs.io/kubectl~1.20 Use this to quickly start a pod with the nginx image. ```bash kubectl run nginx --image=nginx ``` -------------------------------- ### Install Apache on Ubuntu/Debian Source: https://devdocs.io/apache_http_server/install Installs Apache HTTP Server using apt and starts the service. ```bash sudo apt install apache2 sudo service apache2 start ``` -------------------------------- ### Example Usage Source: https://devdocs.io/dom/screen_capture_api This example demonstrates how to listen for an orientation change event and log the new screen orientation type and angle. ```javascript screen.orientation.addEventListener("change", (event) => { const type = event.target.type; const angle = event.target.angle; console.log(`ScreenOrientation change: ${type}, ${angle} degrees.`); }); ``` -------------------------------- ### Cypress .parents() Example: Get Parents of Active LI Source: https://devdocs.io/cypress/api/commands/parents This example demonstrates how to get all parent DOM elements of an element with the class 'active'. It yields the sub-navigation list, the list item, and the main navigation list. ```javascript // yields [.sub-nav, li, .main-nav] cy.get('li.active').parents() ``` -------------------------------- ### Cypress cy.request() GET Request in beforeEach Source: https://devdocs.io/cypress/api/commands/request Example of making a GET request to seed a database before each test. ```javascript beforeEach(() => { cy.request('http://localhost:8080/db/seed') }) ``` -------------------------------- ### HTML for start alignment example Source: https://devdocs.io/css/stroke-miterlimit HTML content used to demonstrate the 'start' value of the text-align property. ```html

Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula.

``` -------------------------------- ### Example package.json Source: https://devdocs.io/cypress/api/plugins/writing-a-plugin Demonstrates a typical package.json file with dependencies that can be required in a plugins file. ```json { "name": "My Project", "dependencies": { "debug": "x.x.x" }, "devDependencies": { "lodash": "x.x.x" } } ``` -------------------------------- ### Create and Remove Directory Source: https://devdocs.io/d/std_file Demonstrates creating a directory, checking its existence, and then removing it. Ensure the directory does not exist before creation and verify its removal. ```d auto dir = deleteme ~ "dir"; dir.mkdir; assert(dir.exists); dir.rmdir; assert(!dir.exists); ``` -------------------------------- ### Sequelize Example Usage Source: https://devdocs.io/sequelize~4 Demonstrates how to initialize Sequelize, define a model, and perform basic database operations like syncing and creating a record. Ensure you have the necessary dialect package installed. ```javascript const Sequelize = require('sequelize'); const sequelize = new Sequelize('database', 'username', 'password', { host: 'localhost', dialect: 'mysql'|'sqlite'|'postgres'|'mssql', pool: { max: 5, min: 0, acquire: 30000, idle: 10000 }, // SQLite only storage: 'path/to/database.sqlite', // http://docs.sequelizejs.com/manual/tutorial/querying.html#operators operatorsAliases: false }); const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); }); ``` -------------------------------- ### Item API Example Source: https://devdocs.io/flask/views/index An example of an ItemAPI class that handles GET, PATCH, and DELETE requests for a single item. ```APIDOC ## GET / ### Description Retrieves a single item by its ID. ### Method GET ### Endpoint `/` ### Parameters #### Path Parameters - **id** (int) - Required - The unique identifier of the item. ### Response #### Success Response (200) - **item** (object) - A JSON representation of the item. ## PATCH / ### Description Updates an existing item identified by its ID. ### Method PATCH ### Endpoint `/` ### Parameters #### Path Parameters - **id** (int) - Required - The unique identifier of the item to update. #### Request Body - **item_data** (object) - Required - A JSON object containing the fields to update. ### Response #### Success Response (200) - **item** (object) - A JSON representation of the updated item. ## DELETE / ### Description Deletes a single item by its ID. ### Method DELETE ### Endpoint `/` ### Parameters #### Path Parameters - **id** (int) - Required - The unique identifier of the item to delete. ### Response #### Success Response (204) - No content. ``` -------------------------------- ### Check if Tag is a Start Tag Source: https://devdocs.io/d/std_xml Use the `isStart` property to determine if a tag is a starting tag. No specific setup is required. ```d if (tag.isStart) { } ``` -------------------------------- ### Custom Template Installer Implementation Source: https://devdocs.io/composer/articles/custom-installers.md Implement a custom installer by extending `LibraryInstaller` to define custom installation logic. This example shows how to support a specific package type and determine a custom installation path. ```php getPrettyName(), 0, 23); if ('phpdocumentor/template-' !== $prefix) { throw new \InvalidArgumentException( 'Unable to install template, phpdocumentor templates ' .'should always start their package name with '. '"phpdocumentor/template-"' ); } return 'data/templates/'.substr($package->getPrettyName(), 23); } /** * @inheritDoc */ public function supports($packageType) { return 'phpdocumentor-template' === $packageType; } } ``` -------------------------------- ### Install Socket.IO Server Source: https://devdocs.io/socketio~2 Installs the Socket.IO server library using npm. This is the first step for setting up a Socket.IO server. ```bash $ npm install socket.io ``` -------------------------------- ### Visit Example in `beforeEach` Source: https://devdocs.io/cypress/api/commands/visit An example of using cy.visit() within a `beforeEach` block to set up the test environment. ```APIDOC ## Example Usage in `beforeEach` ### Description This example shows how to use `cy.visit()` in a `beforeEach` block to navigate to a specific page before each test runs. ### Code Example ```javascript beforeEach(() => { cy.visit('https://example.cypress.io/commands/viewport') }) ``` ``` -------------------------------- ### Install Composer Locally (Linux/Unix/macOS) Source: https://devdocs.io/composer/00-intro.md Installs Composer locally within your project directory using the setup script. Specify the installation directory and filename for the Composer executable. ```bash php composer-setup.php --install-dir=bin --filename=composer ``` -------------------------------- ### Syntax examples for border-inline-start Source: https://devdocs.io/css/border-inline-color Demonstrates various ways to set the border-inline-start property, including width, style, color, and global values. ```css border-inline-start: 1px; border-inline-start: 2px dotted; border-inline-start: medium dashed green; /* Global values */ border-inline-start: inherit; border-inline-start: initial; border-inline-start: revert; border-inline-start: revert-layer; border-inline-start: unset; ``` -------------------------------- ### Notify Batch Request Body Example Source: https://devdocs.io/composer/05-repositories.md Example of the JSON request body sent to the notify-batch URL when a package is installed. ```json { "downloads": [ {"name": "monolog/monolog", "version": "1.2.1.0"} ] } ``` -------------------------------- ### i3 Include Directive Examples Source: https://devdocs.io/i3 Demonstrates various ways to use the 'include' directive, including tilde expansion for home directories, environment variable expansion, wildcard expansion, and command substitution. Note that i3 loads each path only once to prevent infinite loops. ```i3config # Tilde expands to the user’s home directory: include ~/.config/i3/assignments.conf ``` ```i3config # Environment variables are expanded: include $HOME/.config/i3/assignments.conf ``` ```i3config # Wildcards are expanded: include ~/.config/i3/config.d/*.conf ``` ```i3config # Command substitution: include ~/.config/i3/`hostname`.conf ``` ```i3config # i3 loads each path only once, so including the i3 config will not result # in an endless loop, but in an error: include ~/.config/i3/config ``` -------------------------------- ### Get Cookies After Login Source: https://devdocs.io/cypress/api/commands/getcookies This example demonstrates how to get cookies after a login action and assert the presence and name of a session cookie. ```javascript // assume we just logged in cy.contains('Login').click() cy.url().should('include', 'profile') cy.getCookies() .should('have.length', 1) .then((cookies) => { expect(cookies[0]).to.have.property('name', 'session_id') }) ``` -------------------------------- ### BlackHole Example Source: https://devdocs.io/d/std_typecons Demonstrates using BlackHole to create a subclass that implements abstract members with do-nothing functions. ```d import std.math : isNaN; static abstract class C { int m_value; this(int v) { m_value = v; } int value() @property { return m_value; } abstract real realValue() @property; abstract void doSomething(); } auto c = new BlackHole!C(42); writeln(c.value); // 42 // Returns real.init which is NaN assert(c.realValue.isNaN); // Abstract functions are implemented as do-nothing c.doSomething(); ``` -------------------------------- ### Group API Example Source: https://devdocs.io/flask/views/index An example of a GroupAPI class that handles GET (list) and POST (create) requests for a collection of items. ```APIDOC ## GET / ### Description Retrieves a list of all items in the group. ### Method GET ### Endpoint `/` ### Response #### Success Response (200) - **items** (array) - A JSON array of item objects. ## POST / ### Description Creates a new item within the group. ### Method POST ### Endpoint `/` ### Parameters #### Request Body - **item_data** (object) - Required - A JSON object containing the data for the new item. ### Response #### Success Response (200) - **item** (object) - A JSON representation of the newly created item. ``` -------------------------------- ### Start a hazelcast pod with labels Source: https://devdocs.io/kubectl~1.20 Set labels app=hazelcast and env=prod for the hazelcast container. ```bash kubectl run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod" ``` -------------------------------- ### Get Certificate Validity Start Time Source: https://devdocs.io/puppeteer Retrieve the Unix timestamp indicating the start of the certificate's validity period. ```javascript securityDetails.validFrom(); ``` -------------------------------- ### Image Fixture Examples Source: https://devdocs.io/cypress/api/commands/fixture Examples showing how to load image fixtures, including the default base64 encoding and how to read them as buffers. ```APIDOC ### Images #### Image fixtures are sent as `base64` by default ```javascript cy.fixture('images/logo.png').then((logo) => { // logo will be encoded as base64 // and should look something like this: // aIJKnwxydrB10NVWqhlmmC+ZiWs7otHotSAAAOw==... }) ``` #### Change encoding of Image fixture ```javascript cy.fixture('images/logo.png', null).then((logo) => { // logo will be read as a buffer // and should look something like this: // Buffer([0, 0, ...]) expect(Cypress.Buffer.isBuffer(logo)).to.be.true }) ``` ``` -------------------------------- ### Start Apache Service Source: https://devdocs.io/apache_http_server/platform/windows Starts an installed Apache service using command-line switches. Ensure the service name is correct. ```bash httpd.exe -k start -n "MyServiceName" ``` -------------------------------- ### Start Apache Server Source: https://devdocs.io/apache_http_server/install Starts the Apache HTTP Server using the apachectl control script, typically after installation from source. ```bash PREFIX/bin/apachectl -k start ``` -------------------------------- ### Basic CMake Build Process Source: https://devdocs.io/cmake/guide/user-interaction/index This sequence demonstrates a typical out-of-source build using the CMake command line. It involves creating a build directory, configuring the project with a specific install prefix, building the project, and then installing it. ```bash $ cd some_software-1.4.2 $ mkdir build $ cd build $ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/the/prefix $ cmake --build . $ cmake --build . --target install ``` -------------------------------- ### HTML Structure for PageTransitionEvent Example Source: https://devdocs.io/dom/pagetransitionevent Basic HTML structure required for the JavaScript example. No specific setup is needed for the PageTransitionEvent itself. ```html ``` -------------------------------- ### Example Collection Directory Layout Source: https://devdocs.io/ansible/network/dev_guide/developing_resource_modules_network This example illustrates the file structure generated for a network resource module when using the `collection` structure. It includes plugins, module_utils, and other necessary directories. ```bash ansible-playbook -e rm_dest=~/github/rm_example \ -e structure=collection \ -e collection_org=cidrblock \ -e collection_name=my_collection \ -e model=models/myos/interfaces/myos_interfaces.yml \ site.yml ``` ```tree ├── docs ├── LICENSE.txt ├── playbooks ├── plugins | ├── action | ├── filter | ├── inventory | ├── modules | | ├── __init__.py | | ├── myos_facts.py | | └── myos_interfaces.py | └── module_utils | ├── __init__.py | └── network | ├── __init__.py | └── myos | ├── argspec | | ├── facts | | | ├── facts.py | | | └── __init__.py | | ├── __init__.py | | └── interfaces | | ├── __init__.py | | └── interfaces.py | ├── config | | ├── __init__.py | | └── interfaces | | ├── __init__.py | | └── interfaces.py | ├── facts | | ├── facts.py | | ├── __init__.py | | └── interfaces | | ├── __init__.py | | └── interfaces.py | ├── __init__.py | └── utils | ├── __init__.py | └── utils.py ├── README.md └── roles ``` -------------------------------- ### vcenter_vm_tools_installer_info Source: https://devdocs.io/ansible-collection-vmware-vmware_rest Get information about the VMware Tools installer. ```APIDOC ## vcenter_vm_tools_installer_info ### Description Get information about the VMware Tools installer. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### startOfWeek Source: https://devdocs.io/date_fns-week-helpers Gets the start of a week for the given date. ```APIDOC ## startOfWeek ### Description Gets the start of a week for the given date. ### Parameters #### Path Parameters - **date** (Date) - Required - The date to get the start of the week for. ### Returns (Date) - The start of the week for the given date. ``` -------------------------------- ### Basic getopt Usage Source: https://devdocs.io/d/std_getopt Demonstrates the basic usage of getopt to parse command-line arguments into variables. Options are specified as string-pointer pairs. Parsed options are removed from the args array. ```d import std.getopt; string data = "file.dat"; int length = 24; bool verbose; enum Color { no, yes }; Color color; void main(string[] args) { auto helpInformation = getopt( args, "length", &length, // numeric "file", &data, // string "verbose", &verbose, // flag "color", "Information about this color", &color); // enum ... if (helpInformation.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInformation.options); } } ``` -------------------------------- ### Minimal Socket.IO Server Setup Source: https://devdocs.io/socketio~2 Sets up a basic Node.js HTTP server and attaches a Socket.IO server to it. Serves an index.html file and logs client connections. ```javascript const content = require('fs').readFileSync(__dirname + '/index.html', 'utf8'); const httpServer = require('http').createServer((req, res) => { // serve the index.html file res.setHeader('Content-Type', 'text/html'); res.setHeader('Content-Length', Buffer.byteLength(content)); res.end(content); }); const io = require('socket.io')(httpServer); io.on('connection', socket => { console.log('connect'); }); httpServer.listen(3000, () => { console.log('go to http://localhost:3000'); }); ``` -------------------------------- ### startOfMonth Source: https://devdocs.io/date_fns-month-helpers Gets the start of a month for the given date. ```APIDOC ## startOfMonth ### Description Gets the start of a month for the given date. The result is always at the beginning of the day (00:00:00.000). ### Parameters - **date** (Date) - The date to get the start of the month from ### Returns (Date) - The start of the month ``` -------------------------------- ### cy.get() Examples Source: https://devdocs.io/cypress/api/commands/get Illustrative examples of using cy.get() with various selectors and scenarios. ```APIDOC ## Examples ### Selector #### Get the input element ``` cy.get('input').should('be.disabled') ``` #### Find the first `li` descendent within a `ul` ``` cy.get('ul li:first').should('have.class', 'active') ``` #### Find the dropdown-menu and click it ``` cy.get('.dropdown-menu').click() ``` #### Find 5 elements with the given data attribute ``` cy.get('[data-test-id="test-example"]').should('have.length', 5) ``` #### Find the link with an href attribute containing the word "questions" and click it ``` cy.get('a[href*="questions"]').click() ``` #### Find the element with id that starts with "local-" ``` cy.get('[id^=local-]') ``` #### Find the element with id that ends with "-remote" ``` cy.get('[id$=-remote]') ``` #### Find the element with id that starts with "local-" and ends with "-remote" ``` cy.get('[id^=local-][id$=-remote]') ``` #### Find the element with id that has characters used in CSS like ".", ":". ``` cy.get('#id\\.\\.\\.\\1234') // escape the character with \\ ``` ### Get in `.within()` #### `cy.get()` in the `.within()` command Since `cy.get()` is chained off of `cy`, it always looks for the selector within the entire `document`. The only exception is when used inside a .within() command. ``` cy.get('form').within(() => { cy.get('input').type('Pamela') // Only yield inputs within form cy.get('textarea').type('is a developer') // Only yield textareas within form }) ``` ### Get vs Find The `cy.get` command always starts its search from the cy.root element. In most cases, it is the `document` element, unless used inside the .within() command. The .find command starts its search from the current subject. ```html
cy.get vs .find
Both are querying commands
``` ```javascript cy.get('#comparison') .get('div') // finds the div.test-title outside the #comparison // and the div.feature inside .should('have.class', 'test-title') .and('have.class', 'feature') cy.get('#comparison') .find('div') // the search is limited to the tree at #comparison element // so it finds div.feature only .should('have.length', 1) .and('have.class', 'feature') ``` ### Alias For a detailed explanation of aliasing, read more about aliasing here. #### Get the aliased 'todos' elements ``` cy.get('ul#todos').as('todos') //...hack hack hack... //later retrieve the todos cy.get('@todos') ``` #### Get the aliased 'submitBtn' element ``` beforeEach(() => { cy.get('button[type=submit]').as('submitBtn') }) it('disables on click', () => { cy.get('@submitBtn').should('be.disabled') }) ``` ``` -------------------------------- ### Install and Search Packages Programmatically Source: https://devdocs.io/bower Use the `bower.commands` object to install and search for packages. Listen for 'end' events to get results. ```javascript var bower = require('bower'); bower.commands .install(['jquery'], { save: true }, { /* custom config */ }) .on('end', function (installed) { console.log(installed); }); bower.commands .search('jquery', {}) .on('end', function (results) { console.log(results); }); ``` -------------------------------- ### CSS border-inline-start syntax examples Source: https://devdocs.io/css/border-image-source Demonstrates various ways to use the border-inline-start property, including width, style, color, and global values. ```css border-inline-start: 1px; border-inline-start: 2px dotted; border-inline-start: medium dashed green; /* Global values */ border-inline-start: inherit; border-inline-start: initial; border-inline-start: revert; border-inline-start: revert-layer; border-inline-start: unset; ``` -------------------------------- ### startOfISOWeek Source: https://devdocs.io/date_fns-iso-week-helpers Gets the start of an ISO week for the given date. ```APIDOC ## startOfISOWeek ### Description Gets the start of an ISO week for the given date. ### Signature `startOfISOWeek(date: Date): Date` ### Parameters #### Path Parameters - **date** (Date) - The date to get the start of the ISO week for ### Response #### Success Response (Date) - Returns the start of the ISO week for the given date. ``` -------------------------------- ### Basic OutBuffer Usage and Operations Source: https://devdocs.io/d/std_outbuffer Demonstrates creating an OutBuffer, writing various data types to it, and checking its content. Includes clearing the buffer and verifying its state. ```d import std.string : cmp; OutBuffer buf = new OutBuffer(); writeln(buf.offset); // 0 buf.write("hello"); buf.write(cast(byte) 0x20); buf.write("world"); buf.printf(" %d", 62665); writeln(cmp(buf.toString(), "hello world 62665")); // 0 buf.clear(); writeln(cmp(buf.toString(), "")); // 0 buf.write("New data"); writeln(cmp(buf.toString(), "New data")); // 0 ``` -------------------------------- ### Get Program Arguments Source: https://devdocs.io/d/core_runtime Returns the arguments supplied when the process was started. ```d static @property string[] args(); ``` -------------------------------- ### Bash Job Notification Example Source: https://devdocs.io/bash/job-control-basics This is an example of how Bash notifies the user when a job starts asynchronously. It indicates the job number and the process ID. ```bash [1] 25647 ``` -------------------------------- ### Example: Verifying Network Device Configuration Changes Source: https://devdocs.io/ansible/network/user_guide/network_resource_modules This example demonstrates how to verify that a network device configuration has not changed. It shows the 'before' and 'after' states of a resource, along with any commands executed. ```yaml ok: [nxos101] => result: after: contact: IT Support location: Room E, Building 6, Seattle, WA 98134 users: - algorithm: md5 group: network-admin localized_key: true password: '0x73fd9a2cc8c53ed3dd4ed8f4ff157e69' privacy_password: '0x73fd9a2cc8c53ed3dd4ed8f4ff157e69' username: admin before: contact: IT Support location: Room E, Building 5, Seattle HQ users: - algorithm: md5 group: network-admin localized_key: true password: '0x73fd9a2cc8c53ed3dd4ed8f4ff157e69' privacy_password: '0x73fd9a2cc8c53ed3dd4ed8f4ff157e69' username: admin changed: true commands: - snmp-server location Room E, Building 6, Seattle, WA 98134 failed: false ``` -------------------------------- ### Cypress .children() - Get Children of '.secondary-nav' Source: https://devdocs.io/cypress/api/commands/children This example demonstrates how to get all direct children of an element with the class '.secondary-nav'. It yields the child elements found. ```javascript // yields [ //
  • Web Design
  • , //
  • Logo Design
  • , //
  • Print Design
  • // ] cy.get('ul.secondary-nav').children() ``` -------------------------------- ### Socket.IO Client Example Source: https://devdocs.io/socketio~3 Demonstrates establishing a Socket.IO connection and handling events on the client-side. Includes sending and receiving messages using both 'send' and custom 'emit' methods. ```javascript const socket = io("ws://localhost:3000"); socket.on("connect", () => { // either with send() socket.send("Hello!"); // or with emit() and custom event names socket.emit("salutations", "Hello!", { "mr": "john" }, Uint8Array.from([1, 2, 3, 4])); }); // handle the event sent with socket.send() socket.on("message", data => { console.log(data); }); // handle the event sent with socket.emit() socket.on("greetings", (elem1, elem2, elem3) => { console.log(elem1, elem2, elem3); }); ```