### Run SequenceServer from Source
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Execute SequenceServer using bundler after installing dependencies. This command starts the application.
```bash
bundle exec bin/sequenceserver
```
--------------------------------
### String.includes, String.startsWith, and String.endsWith Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates using String.includes, String.startsWith, and String.endsWith for substring checks with optional starting positions.
```javascript
'foobarbaz'.includes('bar'); // => true
'foobarbaz'.includes('bar', 4); // => false
'foobarbaz'.startsWith('foo'); // => true
'foobarbaz'.startsWith('bar', 3); // => true
'foobarbaz'.endsWith('baz'); // => true
'foobarbaz'.endsWith('bar', 6); // => true
```
--------------------------------
### Install isarray using component
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/isarray@0.0.1/README.md
Install the isarray package using component for use in your component.io projects.
```bash
$ component install juliangruber/isarray
```
--------------------------------
### String.codePointAt and String.fromCodePoint Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Illustrates using String.codePointAt to get the code point of a character and String.fromCodePoint to create a string from code points.
```javascript
'𠮷'.codePointAt(0); // => 134071
String.fromCodePoint(97, 134071, 98); // => 'a𠮷b'
```
--------------------------------
### Live Configuration Options Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/cfgs/input-datetime-local.html
Illustrates how to dynamically set configuration properties for the datetime-local widget using JavaScript. This example shows setting min, max, and step attributes.
```javascript
// Example for setting min/max/step via $.prop/$.attr
$("#my-input").prop("min", "2014-01-01");
$("#my-input").prop("max", "2014-12-31");
$("#my-input").prop("step", "1800"); // 30 minutes in seconds
```
--------------------------------
### Install core-js using npm or bower
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Instructions for installing core-js using package managers.
```bash
npm i core-js
bower install core.js
```
--------------------------------
### Install isarray using npm
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/isarray@0.0.1/README.md
Install the isarray package using npm for use in your Node.js projects.
```bash
$ npm install isarray
```
--------------------------------
### Install Frontend Dependencies
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Install Node.js and npm dependencies required for building and managing frontend code.
```bash
npm install
```
--------------------------------
### Install Buffer Module
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/buffer@5.7.1/README.md
Install the buffer module using npm for direct use.
```bash
npm install buffer
```
--------------------------------
### core-js Map Usage Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates the basic usage of the core-js Map polyfill, including initialization, setting and getting values, checking for keys, iterating, and deleting entries. Note that object keys are compared by reference.
```javascript
var a = [1];
var map = new Map([['a', 1], [42, 2]]);
map.set(a, 3).set(true, 4);
log(map.size); // => 4
log(map.has(a)); // => true
log(map.has([1])); // => false
log(map.get(a)); // => 3
map.forEach(function(val, key){
log(val); // => 1, 2, 3, 4
log(key); // => 'a', 42, [1], true
});
map.delete(a);
log(map.size); // => 3
log(map.get(a)); // => undefined
log(Array.from(map)); // => [['a', 1], [42, 2], [true, 4]]
```
--------------------------------
### Install vm-browserify with npm
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/vm-browserify@0.0.4/readme.markdown
Install the vm-browserify module directly using npm if you need to use it independently of browserify.
```bash
npm install vm-browserify
```
--------------------------------
### Array.of Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how to use Array.of to create arrays with the provided arguments.
```javascript
Array.of(1); // => [1]
Array.of(1, 2, 3); // => [1, 2, 3]
```
--------------------------------
### Install util module via npm
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/util@0.10.3/README.md
Use this command to install the util module from npm.
```shell
npm install util
```
--------------------------------
### Install Development Dependencies
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/font-awesome@4.4.0/README.md
Install the necessary tools for developing Font Awesome, including Ruby gems and Node.js packages.
```bash
$ bundle install
$ npm install
```
--------------------------------
### Install React and React DOM
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/react-dom@18.0.0/README.md
Installs the necessary packages for React development, including the core React library and the DOM renderer.
```sh
npm install react react-dom
```
--------------------------------
### Install Ruby Dependencies
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Use bundler to install all necessary Ruby dependencies for running SequenceServer from source.
```bash
bundle install
```
--------------------------------
### Install CodeClimate engines
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Install the necessary CodeClimate engines for static code analysis.
```bash
codeclimate engines:install
```
--------------------------------
### Map and Set toJSON Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how Map#toJSON and Set#toJSON are serialized by JSON.stringify, converting them into arrays.
```javascript
JSON.stringify(new Map([['a', 'b'], ['c', 'd']])); // => '[["a","b"],["c","d"]]
JSON.stringify(new Set([1, 2, 3, 2, 1])); // => '[1,2,3]'
```
--------------------------------
### Install Font Awesome as a Component
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/font-awesome@4.4.0/README.md
Include Font Awesome as a component in your project by running the installation command or adding it to your component.json dependencies.
```bash
$ component install FortAwesome/Font-Awesome
```
```json
{
"FortAwesome/Font-Awesome": "*"
}
```
--------------------------------
### Customizing Mediaelement Controls with CSS and JavaScript
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Provides an example of how to apply custom styles to media elements and use Webshim's 'replaceUI' option to enable custom, styleable controls. This setup is useful for creating a consistent player appearance across different browsers.
```html
```
--------------------------------
### Install and Load Webshim with jQuery
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Shows how to include jQuery, the Webshim polyfiller, and request specific features. It's recommended to use this within a DOM-ready callback.
```html
```
--------------------------------
### String Padding Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Illustrates String.prototype.padLeft and String.prototype.padRight for adding padding to strings with specified lengths and fill characters.
```javascript
'hello'.padLeft(10); // => ' hello'
'hello'.padLeft(10, '1234'); // => '41234hello'
'hello'.padRight(10); // => 'hello '
'hello'.padRight(10, '1234'); // => 'hello12341'
```
--------------------------------
### URL Polyfill Usage Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Demonstrates how to use the URL polyfill for parsing and manipulating URL components and search parameters.
```javascript
var link = new URL('http://afarkas.github.io/webshim/demos/index.html?param1=value1');
link.protocol; // returns 'http:'
link.searchParams.get('param1'); // returns 'value1'
link.searchParams.append('param2', 'value2');
link.href // returns 'http://afarkas.github.io/webshim/demos/index.html?param1=value1¶m2=value2'
```
--------------------------------
### Install Bundler Gem
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Install the bundler gem, which is required to manage Ruby dependencies for SequenceServer.
```bash
gem install bundler
```
--------------------------------
### Array.from Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates using Array.from with iterables, array-like objects, and a mapping function.
```javascript
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
Array.from({0: 1, 1: 2, 2: 3, length: 3}); // => [1, 2, 3]
Array.from('123', Number); // => [1, 2, 3]
Array.from('123', function(it){
return it * it;
}); // => [1, 4, 9]
```
--------------------------------
### String Trimming Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates String.prototype.trimLeft and String.prototype.trimRight for removing whitespace from the beginning and end of strings.
```javascript
' hello '.trimLeft(); // => 'hello '
' hello '.trimRight(); // => ' hello'
```
--------------------------------
### Install base64-js with npm
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/base64-js@1.5.1/README.md
Install the base64-js package using npm and require it in your Node.js project.
```bash
npm install base64-js
```
```javascript
var base64js = require('base64-js')
```
--------------------------------
### Initialize Webshims with 'html5shiv'
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/tests/test-ext/base-tag-loading.html
Initializes Webshims and waits for the 'html5shiv' module to be ready before proceeding. This is a basic setup for testing polyfill functionality.
```javascript
$.webshims.ready('html5shiv', function(){ QUnit.reset = function(){ $("#main, #qunit-fixture").htmlPolyfill( QUnit.config.fixture ); }; });
```
--------------------------------
### Promise.all Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how Promise.all can be used to run multiple Promises concurrently and wait for all of them to resolve, returning an array of their results.
```javascript
Promise.all([
'foo',
sleepRandom(5),
sleepRandom(15),
sleepRandom(10) // after 15 sec:
]).then(log); // => ['foo', 956, 85, 382]
```
--------------------------------
### String.repeat Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how to use String.repeat to concatenate a string multiple times.
```javascript
'string'.repeat(3); // => 'stringstringstring'
```
--------------------------------
### Symbol.for and Symbol.keyFor Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Illustrates how Symbol.for() creates or retrieves a global symbol registry entry, and Symbol.keyFor() retrieves the key for a given symbol.
```javascript
var symbol = Symbol.for('key');
symbol === Symbol.for('key'); // true
Symbol.keyFor(symbol); // 'key'
```
--------------------------------
### Install stream-browserify with npm
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/stream-browserify@1.0.0/readme.markdown
Install the stream-browserify package using npm. If using browserify, this module is automatically available when requiring 'stream'.
```bash
npm install stream-browserify
```
--------------------------------
### Array.find and Array.findIndex Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Illustrates using Array.find and Array.findIndex with callback functions to search for elements.
```javascript
function isOdd(val){
return val % 2;
}
[4, 8, 15, 16, 23, 42].find(isOdd); // => 15
[4, 8, 15, 16, 23, 42].findIndex(isOdd); // => 2
[4, 8, 15, 16, 23, 42].find(isNaN); // => undefined
[4, 8, 15, 16, 23, 42].findIndex(isNaN); // => -1
```
--------------------------------
### Install Jest for Javascript testing
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Add Jest as a development dependency for frontend unit tests.
```bash
npm install --save-dev jest
```
--------------------------------
### Core-js Examples Without Global Namespace
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how to use core-js polyfills without polluting the global namespace by requiring the 'core-js/library' module.
```javascript
var core = require('core-js/library'); // With a modular system, otherwise use global `core`
core.Array.from(new core.Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
core.String.repeat('*', 10); // => '**********'
core.Promise.resolve(32).then(core.log); // => 32
core.setImmediate(core.log, 42); // => 42
```
--------------------------------
### Array.fill Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates using Array.fill to populate an array with a static value.
```javascript
Array(5).fill(42); // => [42, 42, 42, 42, 42]
```
--------------------------------
### Core-js Examples with Global Namespace
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates common core-js polyfills like Array.from, String.repeat, Promise, and setImmediate when used with global namespace pollution.
```javascript
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
'*'.repeat(10); // => '**********'
Promise.resolve(32).then(log); // => 32
setImmediate(log, 42); // => 42
```
--------------------------------
### Canvas Drawing Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Demonstrates how to use the getContext method to draw on a canvas element and apply styles.
```javascript
var ctx = $('#my-canvas').getContext('2d');
ctx.clearRect(10, 10, 100, 100);
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect(10, 10, 55, 50);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect(30, 30, 55, 50);
```
--------------------------------
### Run Frontend Watch Server
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Start a watch server that automatically rebuilds frontend code upon detecting changes. This streamlines frontend development.
```bash
npm run-script watch
```
--------------------------------
### Basic Promise Chaining Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates creating a Promise that resolves after a random delay and chaining .then() calls to handle sequential asynchronous operations.
```javascript
function sleepRandom(time){
return new Promise(function(resolve, reject){
setTimeout(resolve, time * 1e3, 0 | Math.random() * 1e3);
});
}
log('Run'); // => Run
sleepRandom(5).then(function(result){
log(result); // => 869, after 5 sec.
return sleepRandom(10);
}).then(function(result){
log(result); // => 202, after 10 sec.
}).then(function(){
log('immediately after'); // => immediately after
throw Error('Irror!');
}).then(function(){
log('will not be displayed');
}).catch(log); // => => Error: Irror!
```
--------------------------------
### Initialize jTree with HTML
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/github/vakata/jstree@3.3.8/demo/basic/index.html
Initializes jTree on an existing HTML element. This is the simplest way to get started.
```javascript
$('#html').jstree();
```
--------------------------------
### Object.values and Object.entries Examples
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how to use Object.values to get an array of an object's own enumerable property values and Object.entries to get an array of an object's own enumerable string-keyed property [key, value] pairs.
```javascript
Object.values({a: 1, b: 2, c: 3}); // => [1, 2, 3]
Object.entries({a: 1, b: 2, c: 3}); // => [['a', 1], ['b', 2], ['c', 3]]
```
--------------------------------
### Initialize Webshim with Form Polyfills
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/cfgs/input-time.html
Initializes Webshim with specific options for forms and loads the necessary polyfills. This is typically done once at the start of your application.
```javascript
webshim.setOptions('forms', { lazyCustomMessages: true, replaceValidationUI: true, addValidators: true, customDatalist: true });
webshim.setOptions('forms-ext', { replaceUI: true });
// load the forms polyfill
webshim.polyfill('forms forms-ext');
```
--------------------------------
### Webshim Configuration and Initialization
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/tests/test-ext/require-loading-6.html
Sets up the Webshim configuration for testing, including test data and polyfill modules. It then waits for the 'forms-ext' and 'geolocation' polyfills to be ready before signaling completion to the opener or parent window.
```javascript
window.asyncWebshims = {
cfg: {
testData: 'test6',
waitReady: false,
forms: {
customMessages: true
}
},
polyfill: "forms forms-ext geolocation"
};
(function(){
var webshimsReady = false;
webshimsReady = !!($.webshims);
webshims.ready('forms-ext geolocation', function(){
setTimeout(function(){
(window.opener || window.parent).loadingTest($.webshims.cfg.testData, $.webshims.cfg.extendNative);
}, 1);
});
})();
```
--------------------------------
### Enable Lazy Custom Messages and Replace Validation UI
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/forms.html
Configures the forms polyfill to load custom validation messages lazily and to replace the default validation UI with custom, styleable elements. This setup is then applied by starting the polyfill.
```javascript
webshim.setOptions('forms', {
//set lazyCustomMessages to true
lazyCustomMessages: true,
//show custom styleable validation bubble
replaceValidationUI: true
});
//start polyfilling
webshim.polyfill('forms');
```
--------------------------------
### core-js WeakMap Usage Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates the use of the core-js WeakMap polyfill for storing key-value pairs where keys are objects. It shows basic operations like setting, getting, checking for keys, and deleting. WeakMaps do not prevent garbage collection of their keys.
```javascript
var a = [1]
, b = [2]
, c = [3];
var wmap = new WeakMap([[a, 1], [b, 2]]);
wmap.set(c, 3).set(b, 4);
log(wmap.has(a)); // => true
log(wmap.has([1])); // => false
log(wmap.get(a)); // => 1
wmap.delete(a);
log(wmap.get(a)); // => undefined
// Private properties store:
var Person = (function(){
var names = new WeakMap;
function Person(name){
names.set(this, name);
}
Person.prototype.getName = function(){
return names.get(this);
};
return Person;
})();
var person = new Person('Vasya');
log(person.getName()); // => 'Vasya'
for(var key in person)log(key); // => only 'getName'
```
--------------------------------
### Creating and Using Dict Objects
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates how to create Dict objects from various inputs like objects, Maps, and iterables. Also shows instance properties and checks.
```javascript
var map = new Map([['a', 1], ['b', 2], ['c', 3]]);
Dict(); // => {__proto__: null}
Dict({a: 1, b: 2, c: 3}); // => {__proto__: null, a: 1, b: 2, c: 3}
Dict(map); // => {__proto__: null, a: 1, b: 2, c: 3}
Dict([1, 2, 3].entries()); // => {__proto__: null, 0: 1, 1: 2, 2: 3}
var dict = Dict({a: 42});
dict instanceof Object; // => false
dict.a; // => 42
dict.toString; // => undefined
'a' in dict; // => true
'hasOwnProperty' in dict; // => false
Dict.isDict({}); // => false
Dict.isDict(Dict()); // => true
```
--------------------------------
### Install ieee754 package
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/ieee754@1.2.1/README.md
Install the ieee754 package using npm. This command downloads and installs the package and its dependencies.
```bash
npm install ieee754
```
--------------------------------
### Setup Image Upload Module
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/filereader/index.html
Sets up the image upload functionality for elements with the 'show-upload' class. It handles file selection, image preview, and applies the filereader polyfill.
```javascript
function showUpload(){
var $image, reader;
var displaySel = '.upload-display';
var $module = $(this);
var $input = $(this).find('input[type="file"]');
var $display = $(displaySel, $module);
var showSelectedFile = function () {
var file = ($(this).prop('files') || [])[0];
//if there is no file or first file is not an image abort
if(!file || file.type.indexOf('image/')){
return;
}
if(!reader){
reader = new FileReader();
}
reader.onload = function (evt) {
var fileData = evt.target.result;
if(!$image){
$image = $("
").appendTo($display);
}
$image.attr('src', fileData);
};
//use $.prop to access files property
reader.readAsDataURL(file);
};
$input.on('change', showSelectedFile);
//polyfill if not already in markup
if(!$input.is('.ws-filereader')){
$input.addClass('ws-filereader').updatePolyfill();
}
showSelectedFile();
}
```
--------------------------------
### Install events module
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/events@1.0.2/Readme.md
Install the events module using npm. This command should be run in your project's terminal.
```bash
npm install events
```
--------------------------------
### Install CircosJS using Bower
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/github/nicgirault/circosJs@1.7.0/readme.md
Use this command to install the CircosJS library via the Bower package manager.
```bash
bower install circosjs
```
--------------------------------
### Build Docker Image
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Build the Docker image for SequenceServer. Ensure the Dockerfile is configured correctly for building.
```bash
docker build -t sequenceserver .
```
--------------------------------
### Load All Webshim Polyfills
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
This snippet demonstrates the basic initialization of Webshim to load all available polyfills.
```javascript
webshim.polyfill(); // load all available polyfills
```
--------------------------------
### Include Webshim Polyfiller and Initialize
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/readme.md
Include the jQuery library, the Webshim polyfiller script, and then call `webshims.polyfill()` to load all unsupported features. Alternatively, you can specify individual features to polyfill.
```html
```
--------------------------------
### Build Docker Image with Minified Frontend
Source: https://github.com/wurmlab/sequenceserver/blob/master/README.md
Build a Docker image that includes minified frontend code. Use the --target=minify flag for this purpose.
```bash
docker build . -t seqserv-with-customisations --target=minify
```
--------------------------------
### Geolocation API - Get Current Position
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Implements the navigator.geolocation API to get the user's current position. Supports success and error callbacks, as well as timeout options.
```javascript
navigator.getCurrentPosition: successCallback, errorCallback and options ({timeout: number}) are supported
```
--------------------------------
### jQuery to Get Background Color and Check Support
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/tests/jquery/data/support/bodyBackground.html
Uses jQuery to get the body's background color and check support properties, then calls a parent iframe callback.
```javascript
jQuery(function() { window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ), jQuery.support ); });
```
--------------------------------
### Get Current Locale
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/forms.html
Retrieves the currently set language locale for Webshim.
```javascript
webshim.activeLang();
```
--------------------------------
### Serve Font Awesome Locally
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/font-awesome@4.4.0/README.md
Serve the Font Awesome project on a local server for development and testing.
```bash
$ bundle exec jekyll -w serve
```
--------------------------------
### Build Font Awesome Project
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/font-awesome@4.4.0/README.md
Build the Font Awesome project and its documentation using Jekyll.
```bash
$ bundle exec jekyll build
```
--------------------------------
### Webshim Initialization and Configuration
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/cfgs/input-month.html
Initializes webshim with specific options for forms and forms-extended, then loads the forms polyfill. It also sets up event listeners for jQuery and loads demo/configuration scripts.
```javascript
webshim.setOptions('forms', { lazyCustomMessages: true, replaceValidationUI: true, addValidators: true, customDatalist: true });
webshim.setOptions('forms-ext', { replaceUI: true, "types": "month number" });
webshim.setOptions('debug', 'noCombo');
// load the forms polyfill
webshim.polyfill('forms forms-ext');
webshim.ready('jquery', function(){
webshim.loader.loadScript("../../demo-js/demo.js", false, false, true);
webshim.loader.loadScript("assets/cfg.js", false, false, true);
});
```
--------------------------------
### String.raw Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates using String.raw with template literals and with an object containing a 'raw' property.
```javascript
var name = 'Bob';
String.raw`Hi\n${name}!`; // => 'Hi\\nBob!' (ES6 template string syntax)
String.raw({raw: 'test'}, 0, 1, 2); // => 't0e1s2t'
```
--------------------------------
### Initialize Webshim Forms and Forms-Ext Polyfills
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/cfgs/input-date.html
Initializes the Webshim forms and forms-ext polyfills. This is a core setup step for enabling enhanced form element functionalities.
```javascript
webshim.polyfill('forms forms-ext');
```
--------------------------------
### Array.copyWithin Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how Array.copyWithin can be used to copy a sequence of array elements within the array.
```javascript
[1, 2, 3, 4, 5].copyWithin(0, 3); // => [4, 5, 3, 4, 5]
```
--------------------------------
### Basic Polyfill Initialization
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Call the polyfill method with a whitespace-separated list of features to enable. This should be done as early as possible in your application.
```javascript
webshim.polyfill( "canvas geolocation" );
```
--------------------------------
### Array.prototype.includes Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates the usage of Array.prototype.includes for checking element existence, including cases with NaN and undefined.
```javascript
[1, 2, 3].includes(2); // => true
[1, 2, 3].includes(4); // => false
[1, 2, 3].includes(2, 2); // => false
[NaN].indexOf(NaN); // => -1
[NaN].includes(NaN); // => true
Array(1).indexOf(undefined); // => -1
Array(1).includes(undefined); // => true
```
--------------------------------
### Core-JS Function.name Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates how to access the name property of a function, which returns the function's identifier.
```javascript
(function foo(){}).name // => 'foo'
```
--------------------------------
### Initialize Webshims Configuration
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/tests/test-ext/markup-loading-2.html
Sets up the configuration for Webshims, including disabling native extension and specifying test data for markup loading tests.
```javascript
window.asyncWebshims = window.asyncWebshims || {};
window.asyncWebshims.cfg = window.asyncWebshims.cfg || [];
window.asyncWebshims.cfg.push([{"extendNative": false, "testData": "markup2"}]);
```
--------------------------------
### Load Demo and Configuration Scripts
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/cfgs/input-color.html
Loads additional JavaScript files for the demo and configuration using Webshim's loader.
```javascript
webshim.ready('jquery', function() {
webshim.loader.loadScript("../../demo-js/demo.js", false, false, true);
webshim.loader.loadScript("assets/cfg.js", false, false, true);
});
```
--------------------------------
### RegExp.escape Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Demonstrates RegExp.escape for escaping special characters in a string to be used safely within a regular expression.
```javascript
RegExp.escape('Hello, []{}()*+?.\^$|!'); // => 'Hello, \[\{\}\]\(\)\*\+\?\.\\\^\$\|!'
```
--------------------------------
### Initialize Webshims and Mediaelement Support
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/tests/mediaelement-test.html
Initializes Webshims and waits for 'DOM mediaelement swfobject' to be ready. This is typically used to set up the testing environment.
```javascript
(function($){ $.webshims.ready('dom-support', function(){ QUnit.reset = function(){ $("#main, #qunit-fixture").htmlPolyfill( QUnit.config.fixture ); }; }); module("init"); asyncTest("init", function(){ $.webshims.ready('DOM mediaelement swfobject', start); }); })(jQuery); jQuery.noConflict();
```
--------------------------------
### Creating Objects with webshim.objectCreate
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/index.html
Illustrates how to create a new object 'myCar' using webshim.objectCreate, inheriting from 'carProto' and defining its own properties and methods, including a custom '_create' initialization method.
```javascript
var carProto = {
options: {
foo: 'bar',
baz: 'boom'
},
wheels: 4,
drive: function(){
this.isDriving = true;
}
};
var myCar = Object.create(carProto, {
_create: {
value: function(){
this.drive();
}
},
jumps: {
value: function(){
//implements jumping
}
},
{baz: 'jo'}
});
// myCar will look like this:
{
// own property:
options: {
foo: 'bar',
baz: 'jo'
},
// prototype:
wheels: 4,
// prototype
drive: function(){
this.isDriving = true;
},
// own property:
_create: function(){
this.drive();
},
// own property:
jumps: function(){
//implements jumping
},
// own property:
isDriving: true
}
```
--------------------------------
### String.prototype.at Example
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/core-js@1.1.2/README.md
Shows how to use String.prototype.at to access characters, including those outside the Basic Multilingual Plane (BMP).
```javascript
'a𠮷b'.at(1); // => '𠮷'
'a𠮷b'.at(1).length; // => 2
```
--------------------------------
### AJAX Validation Response (Invalid)
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/forms.html
Example of an invalid JSON response from an AJAX validation service, indicating an issue.
```json
{"valid": false}
```
--------------------------------
### Configure and Polyfill Mediaelement
Source: https://github.com/wurmlab/sequenceserver/blob/master/public/vendor/npm/webshim@1.15.8/demos/demos/mediaelement.html
Configures the mediaelement polyfill with custom options and then activates it. This is a foundational step before using mediaelement features.
```javascript
webshim.setOptions('mediaelement', {
replaceUI: 'auto',
plugins: ['plugin-name']
});
//start loading mediaelement including plugins
webshim.polyfill('mediaelement');
//wait until plugin-name is ready
webshim.ready('plugin-name', function(){
//call ``pluginMethod``
$('.mediaplayer').jmeFn('pluginMethod');
});
```