text:
# Litespeed

[![Build Status](https://travis-ci.org/jsonmaur/litespeed.svg?branch=master)](https://travis-ci.org/jsonmaur/litespeed)
[![Coverage Status](https://coveralls.io/repos/github/jsonmaur/litespeed/badge.svg?branch=master)](https://coveralls.io/github/jsonmaur/litespeed?branch=master)
[![Code Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![Chat Room](https://badges.gitter.im/jsonmaur/litespeed.svg)](https://gitter.im/jsonmaur/litespeed?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

- [Installation](#installation)
- [Example](#example)
- [Configuration](#configuration)
- [Routes Config](#routesconfig)
- [Handlers](#handlers)
- [PreHandlers](#prehandlers)
- [Router](#router)
- [Validation](#validation)
- [Errors](#errors)
- [Logging](#logging)
- [Server API](#serverapi)
- [Plugins](#plugins)

Litespeed is a micro web framework for building APIs in Node.js. Based on configuration and promises, it keeps things fast, simple, predictable, and is a breeze to get started. It comes with built-in input validation, a routing library, an error library, support for pre-handlers (aka middleware), and more. A perfect solution for [microservices](https://en.wikipedia.org/wiki/Microservices)!

#### Why another Node framework?

There are a lot of great frameworks out there such as [Express](http://expressjs.com), [Restify](http://restify.com), [Koa](http://koajs.com), and [Hapi](http://hapijs.com). They have been around for awhile, and each have their place in the Javascript ecosystem. But a lot of the time, they can be overkill for your app, especially if you need something simple but extendable for a microservice API. Litespeed is a lightweight approach that takes ideas from other frameworks and brings them together in a compact and easy to understand way. It's also nice to have built-in validation, error handling, and logging ;)

## Installation

```bash
$ npm install litespeed --save
# or to use the CLI
$ npm install litespeed -g
```

## Example

```javascript
const Litespeed = require('litespeed')

new Litespeed({/* configuration */}).route({
  method: 'GET',
  url: '/hello/:name',
  handler: (req) => {
    return { message: `Hello, ${req.params.name}!` }
  }
}).start()
```

That's it! Run this code and go to `http://localhost:8000/hello/jason`. You should be greeted with `{"message":"Hello, jason!"}`.

## Configuration

There are several config options, all of which have optimal values by default. But they can be easily changed by passing an object to the Litespeed instance (see the example above).

- `name` The name of the server, set in the `Server` response header. Can be set to `false` to omit the header entirely.

  > Type: string, boolean
  > Default: `Litespeed`

- `host` The host to run the server on. Uses the `HOST` environment variable if it exists.

  > Type: string
  > Default: `process.env.HOST || '<IP_ADDRESS>'`

- `port` The port to run the server on. Uses the `PORT` environment variable if it exists.

  > Type: number
  > Default: `process.env.PORT || 8000`

- `trailingSlash` Whether to accept a URL both with and without a trailing slash. If `true`, the trailing slash is ignored and the route is still found. If `false`, the route will return a 404 with a trailing slash.

  > Type: boolean
  > Default: `true`

- `pretty` Whether to prettify the response JSON.

  > Type: boolean
  > Default: `false` or `true if NODE_ENV starts with "dev"`

- `timeout` The amount of time in milliseconds to wait before a request is timed out, returning a 408 error to the client.

  > Type: number
  > Default: `5000` (5s)

- `payloadLimit` The max size (in bytes) a request payload can be. This helps prevents malicious use by client's sending giant payloads to your API. Will return a 413 error if exceeded.

  > Type: number
  > Default: `1048576` (1mb)

- `stripUnknown` Whether to take out unknown values from the request payload and URL query data. This only takes effect if [validation](#validation) is running on the endpoint, and will throw away any value not included in the validation object.

  > Type: boolean
  > Default: `true`

- `protective` Whether to add basic security headers on the response and require a user-agent. Will currently add `X-Content-Type-Options: nosniff` and `X-Frame-Options: deny`, and send a 403 error if no `User-Agent` header is present on the request.

  > Type: boolean
  > Default: `true`

- `realIp` Whether to check for an IP address in the `X-Forwarded-For` header, taking the first address from the comma-separated list. This helps get the client's real IP address if the request is coming through a proxy server. Will fallback to the actual IP address if the header is not found.

  > Type: boolean
  > Default: `true`

- `logs` Tag names of the loggers to enable. See [Logging](#logging) for more info on the tags available. Can also be set to `false` to disable all logging.

  > Type: array, boolean
  > Default: all

- `logTimestamp` Whether to log the current timestamp with each message.

  > Type: boolean
  > Default: `true`

- `logColors` Whether to use CLI logColors when logging.

  > Type: boolean
  > Default: `true`

- `preHandlers` Global functions to run for every route in the app. See [PreHandlers](#prehandlers) for more info.

  > Type: array
  > Default: `[]`

## Routes Config

A route is defined by a simple object with the following configuration.

- `method` The method to use for the route. This is usually one of `HEAD, GET, POST, PUT, PATCH, DELETE` if using the HTTP protocol, but can be set to anything if you're using a custom protocol.

  > Type: string
  > Required

- `url` The endpoint of the route. This can include segments or be a regular expression. See [Router](#router) for details.

  > Type: string, regexp
  > Required

- `statusCode` The HTTP status code to return on a **successful** response.

  > Type: number
  > Default: `200`

- `validate` The validations to run against the request. See [Validation](#validation) for more info.

  > Type: object

- `preHandlers` The preHandler functions to run before the route's handler. See [PreHandlers](#prehandlers) for more info.

  > Type: array

- `handler` The request handler function. See [Handlers](#handlers) for more info.

  > Type: function
  > Required

- `onError` A custom function to run when an error occurs (overwrites default error handling). See [Errors](#errors) for more info. *Note: if this is being used, you are responsible for your own error logging!*

  > Type: function

#### HTTP OPTIONS

The HTTP OPTIONS request is handled automatically for each URL. If requested, the server will respond with an empty body and the `Allow` header with each method supported for that particular URL.

## Handlers

Route handlers are functions on the route config that handle sending responses to the client. To respond from the handler, you can either return a value or return a Promise. The function has two parameters passed to it: the [request](#request) object and the [response](#response) object.

```javascript
server.route({
  // ...
  handler: (request, response) => {
    return 'welcome!'
  }
})
```

#### request

The request parameter is an object that contains information about the client request.

- `body` The payload data from the request body.
- `query` The query data from the request URL.
- `params` The param data from the request URL. See [Router](#router) for more info.
- `headers` The request headers.
- `context` The context data passed through the preHandlers. See [Plugins](#plugins) for more info.
- `info` Metadata about the request.
  - `remoteAddress` The client's IP address

#### response

Unlike other Node web frameworks, the response parameter is not used to actually send the response itself--that is done by returning from the handler (with the exception of `.redirect`). Instead, this object contains helper methods to mutate the response *before it is sent*.

- `.pass(name, value)` Passes context between preHandlers (see [PreHandlers](#prehandlers) for more info). Context data is accessed in the handler with `request.context.*`.
- `.setHeader(name, value)` Sets a response header.
- `.redirect(url, code)` Sends a redirect response to the client. `code` defaults to `301` if not set. There is no need to return anything from the handler after this is called.

#### Async/Await

Since handlers are based on Promises, you can easily use ES7's async/await feature. Any errors thrown within the handler are caught by Litespeed's error handler and outputted correctly. This removes the need to have a bunch of try/catch blocks (though you can still have them if you need to). Errors within sub-promises (such as the `createUser` function in the example below) will bubble up to the handler and outputted the same way.

```javascript
server.route({
  method: 'POST',
  url: '/signup',
  statusCode: 201,
  handler: async (req) => {
    const user = await createUser(req.body)
    return { user }
  }
})
```

*Note: If using Node >=6, all you need for async/await support is [transform-async-to-generator](https://babeljs.io/docs/plugins/transform-async-to-generator) rather than an entire preset.*

## PreHandlers

Route preHandlers follow the exact same structure as [Handlers](#handlers), but you can pass an array of them to the [routes config](#route-prehandler) as well as the [server config](#global-prehandler).
*Note: they are guaranteed to run in order, making it possible to rely on context from other preHandlers!*

## Router

Litespeed comes with a built-in router that supports segment parameters and regular expressions. This provides a quick and flexible way to define your endpoints.
*Note: You cannot have two routes defined with the same method and URL or a startup error will be thrown.*

#### Segments

Segments are named sections of the URL prefixed with `:`, and they can pass values to the handler. You can have as many segments as you want in your URL.

```javascript
server.route({
  // ...
  url: '/welcome/:name',
  handler: (request) => {
    // if requested with /welcome/jason
    // expect request.params.name to equal 'jason'
  }
})
```

#### Regular Expressions

The router also supports regular expressions, including their capture groups for getting data. If you define a URL as a regex with a capture group (a piece wrapped in parentheses), you can access that data by its regex index (`$1`, `$2`, etc.)
*Note: if using a regex as a URL, make sure you either use a regular expression literal or `new RegExp()`. Read [this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) if you're new to regular expressions in Javascript.*

```javascript
server.route({
  // ...
  url: /^\/welcome\/(.*)$/,
  handler: (request) => {
    // if requested with /welcome/jason
    // expect request.params.$1 to equal 'jason'
  }
})
```

## Validation

A `validate` object can be used on the [routes config](#routesconfig) to run validations against the request body, query, and params. Litespeed comes with a list of predefined validations, which can be chained together. See the example below on how to use. If `stripUnknown` is enabled on the server, any values not in the `validate` object will be throw away.

The response is not sent after one failed validation. Litespeed will continue through the validations and display *all* errors in the response rather than just the first one. However, only one error from each validation chain is thrown at a time.

```javascript
const { Validator } = require('litespeed')

server.route({
  url: '/resource/:id'
  validate: {
    params: {
      id: new Validator().isUUID()
    },
    body: {
      name: new Validator().required(),
      email: new Validator().required().isEmail()
    }
  }
})
```

Validation errors will look like this in the response:

```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "A validation error occurred",
  "validation": [
    { "field": "id", "message": "...", "where": "params" },
    { "field": "name", "message": "...", "where": "body" }
  ]
}
```

#### Predefined Validations

- `.required()`
- `.contains(string)`
- `.equals(compare)`
- `.isAfter(date)`
- `.isAlpha(locale)`
- `.isAlphanumeric(locale)`
- `.isAscii()`
- `.isBase64()`
- `.isBefore(date)`
- `.isBoolean()`
- `.isCurrency(opts)`
- `.isDataURI()`
- `.isDate()`
- `.isDivisibleBy(num)`
- `.isEmail(opts)`
- `.isFQDN(opts)`
- `.isIpAddress(ver)`
- `.isEnum(values)`
- `.isNumber(opts = {})`
- `.isJSON()`
- `.isLength(opts)`
- `.isLowercase()`
- `.isMACAddress()`
- `.isPhoneNumber(locale)`
- `.isMongoId()`
- `.isURL(opts)`
- `.isUUID(ver)`
- `.isUppercase()`
- `.isWhitelisted(chars)`
- `.matches(pattern, mods)`

Most of these validations use [validator.js](https://github.com/chriso/validator.js), so visit the Readme in that repo for further details.

## Errors

Any errors occurring throughout the application or in an [async/await](#asyncawait) function will be automatically logged and formatted for the response. Errors can occur in a few different ways:

- By `throw`ing anywhere in the app
- Runtime code errors
- Returning an error from a handler
- An unhandled promise rejection

Error responses are simply objects with the following structure:

- `statusCode` The status code of the error (uses `500` for unknown errors)
- `error` The error type that occurred
- `message` A descriptive error message for the client

If a [Javascript Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) is thrown, a `500 Internal Server Error` will be returned, and **if in dev mode** (meaning `NODE_ENV` starts with `dev`), the error message will be sent to the response as well for easy debugging. All server errors (meaning statusCode is >= 500) will be logged to the console with a description and a stack trace.

Litespeed comes with a list of predefined errors that accept custom messages (set as the `message` key in the response). See the example below on how to use them.

```javascript
const { Errors } = require('litespeed')

server.route({
  //...
  handler: async () => {
    const resource = getNonExistantResource()
    if (!resource) {
      throw new Errors().notFound('resource does not exist')
    }
    return resource
  }
})
```

```json
{
  "statusCode": 404,
  "error":"Not Found",
  "message":"resource does not exist"
}
```

#### Predefined Errors

- `400` `.badRequest()`
- `401` `.unauthorized()`
- `402` `.paymentRequired()`
- `403` `.forbidden()`
- `404` `.notFound()`
- `405` `.methodNotAllowed()`
- `406` `.notAcceptable()`
- `407` `.proxyAuthRequired()`
- `408` `.requestTimeout()`
- `409` `.conflict()`
- `410` `.gone()`
- `411` `.lengthRequired()`
- `412` `.preconditionFailed()`
- `413` `.payloadTooLarge()`
- `414` `.uriTooLong()`
- `415` `.unsupportedMediaType()`
- `416` `.rangeNotSatisfiable()`
- `417` `.expectationFailed()`
- `422` `.unprocessableEntity()`
- `423` `.locked()`
- `424` `.failedDependency()`
- `426` `.upgradeRequired()`
- `428` `.preconditionRequired()`
- `429` `.tooManyRequests()`
- `431` `.headersTooLarge()`
- `500` `.internal()`
- `501` `.notImplemented()`
- `502` `.badGateway()`
- `503` `.serviceUnavailable()`
- `504` `.gatewayTimeout()`
- `505` `.httpVersionNotSupported()`
- `507` `.insufficientStorage()`
- `508` `.loopDetected()`
- `509` `.bandwidthLimitExceeded()`
- `510` `.notExtended()`
- `511` `.networkAuthRequired()`

## Logging

By default, all Litespeed logging is turned on. This can be modified by specifying [log tags](#logtags) in the server config. Each line outputted to the console includes the server name, a timestamp, and the message. Here are the available log tags:

- `server` Outputs a message when the server starts with its URL.
- `request` Outputs the method, URL, IP address, and response code when a client makes a request.
- `error` Outputs any server errors, meaning any error with a statusCode >= 500 (which includes runtime errors). Logged errors will include a message, and a stack trace.

Colors in the output can be turned off if they are causing problems by specifying `logColors: false` in the [server config](#logcolors). *Note: if you specify any log tags, the default tags will be overwritten. So whatever you specify will be the only active tags.*

## Server API

The Litespeed server is a class that must be instantiated with the `new` keyword, and can be passed an optional object of configuration options.

```javascript
const server = new Litespeed({/* configuration */})
```

##### server.start(callback)

Starts the server on the host and port defined in the instantiation. This will return a promise or you can use a callback, both of which pass the URL of the server.

```javascript
/* with a callback */
server.start((url) => console.log(`Running at ${url}`))

/* or with a promise */
server.start().then((url) => console.log(`Running at ${url}`))
```

##### server.route(config)

Creates a new route. Can be a single route config, or an array of configs for creating multiple routes at once. See [Routes Config](#routesconfig) for structure.

```javascript
/* for a single route */
server.route({/* route config */})

/* for many routes */
server.route([
  {/* route config */},
  {/* route config */}
])
```

##### server.routes(config)

You can use this to scan a directory and pull in routes from many files. Prevents having to manually require and create all your routes. Takes a config object with the following structure.

- `dir` A [glob](https://en.wikipedia.org/wiki/Glob_(programming)) pattern to search for.

  > Type: string
  > Default: `routes/**/*.js`

- `cwd` The current working directory to use.

  > Type: string
  > Default: `process.cwd()`

```javascript
server.routes({
  dir: 'routes/**/*.js',
  cwd: __dirname
})
```

##### server.inject(config)

Lets you inject API requests without the overhead of starting the server. This works great for running integration tests on your endpoints. Takes an object with a `method` and `url`, as well as optional `headers` and `body`. Returns a Promise resolving with the response.

```javascript
/* define the route */
server.route({
  method: 'POST',
  url: '/test',
  handler: (req) => req.body.name
})

/* test the route */
server.inject({
  method: 'POST',
  url: '/test',
  body: { name: 'Jason' }
}).then((res) => {
  // expect res to equal 'Jason'
})
```

## Plugins

Litespeed easily supports third-party plugins through the use of [PreHandlers](#prehandlers). To create a plugin, simply create a preHandler that exports a function returning a Promise (if async). Then it can be set as a [global preHandler](#global-prehandler) in the app using it.

You can also pass context from your plugin to other plugins or to the route handler by using `response.pass(name, value)` (see [response](#response)). These values are then accessed with `request.context.*`.

#### Popular Plugins

- [litespeed-jwt](https://github.com/tannerlinsley/litespeed-jwt)
- [litespeed-limiter](https://github.com/jsonmaur/litespeed-limiter)

## Contributing

If you come across an issue or have a feature idea, don't hesitate to create a pull request/issue to discuss it.

![Just do it.](http://i.giphy.com/ACcXRXwUqJ6Ok.gif)

## License

[MIT](LICENSE)

repository: tannerlinsley/litespeed

repo_name: tannerlinsley/litespeed


text:
---
layout: page
title: Bad Design
subtitle: The Williams College Alumni - Eph Network
---
### Why the Eph Network?
The Eph Network is a highly under-utilized resource offered by the school for current students and alumni in order to connect with each other. Despite being a service pushed by the Career Center, it is still only used by a small margin of the current Williams student body. I think this is partially due to its poor design.

![](../img/bad-design-0.png)

 **Issues:**
  - Actual process of finding the Eph Network on the Alumni page is not intuitive
  - Despite having to log in to access the network anyway, link seems to be almost hidden and is amongst similarly titled links, which adds to confusion

![](../img/bad-design-1.png)

 - First click on 'ALUMNI/CAREER DIRECTORY'

![](../img/bad-design-2.png)

 - Then click on the text 'Search the Alumni/Career Directory' ('Click Here' was recently added due to complaints of not being able to find the network directory, but the text itself doesn't actually do anything. Another design flaw and point of confusion)

The directory itself is not a bad design. It is very minimalist in its design and is pretty intuitive. However even if the product works well, if you can't get to it, the purpose is defeated.

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
##What features have you accomplished in the past week?
Image uploader now uploads and stores name only in db. Image is also now displaying on pages.

##Did you achieve the previous week’s goals?
Yes, I have an image uploader working.

##What are your goals for this week?
Further Validation and code cleanup. Also to get the sort by diff. 'categories' to work.

##What concepts or techniques did you learn?
How to use image uploaders.

##What parts of the application, in the past week, were enjoyable?
Seeing the image uploader working finally.

##What parts of the application, in the past week, were frustrating?
getting the image uploader to save name properly in DB.

##Did you have to radically alter something you’d finished previously?
no. removed some fields from dashboard for less clutter.


text:
# Hyperparameter Optimization of Machine Learning Algorithms
(Thanks to Li Yang Hart)
To fit a machine learning model into different problems, its hyper-parameters must be tuned. Selecting the best hyper-parameter configuration for machine learning models has a direct impact on the model's performance.

### Quick Navigation
**Section 3**: Important hyper-parameters of common machine learning algorithms
**Section 4**: Hyper-parameter optimization techniques introduction
**Section 5**: How to choose optimization techniques for different machine learning models
**Section 6**: Common Python libraries/tools for hyper-parameter optimization
**Section 7**: Experimental results (sample code in "HPO_Regression.ipynb" and "HPO_Classification.ipynb")
**Section 8**: Open challenges and future research directions
**Summary table for Sections 3-6**: Table 2:  A comprehensive overview of common ML models, their hyper-parameters, suitable optimization techniques, and available Python libraries
**Summary table for Sections 8**: Table 10:  The open challenges and future directions of HPO research

## Implementation
Sample code for hyper-parameter optimization implementation for machine learning algorithms is provided in this repository.

### Sample code for Regression problems
[HPO_Regression.ipynb](https://github.com/LiYangHart/Hyperparameter-Optimization-of-Machine-Learning-Algorithms/blob/master/HPO_Regression.ipynb)
**Dataset used:** [Boston-Housing](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_boston.html)
### Sample code for Classification problems
[HPO_Classification.ipynb](https://github.com/LiYangHart/Hyperparameter-Optimization-of-Machine-Learning-Algorithms/blob/master/HPO_Classification.ipynb)
**Dataset used:** [MNIST](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_digits.html#sklearn.datasets.load_digits)

### Machine Learning & Deep Learning Algorithms
* Random forest (RF)
* Support vector machine (SVM)
* K-nearest neighbor (KNN)
* Artificial Neural Networks (ANN)

### Hyperparameter Configuration Space
|     ML Model          |     Hyper-parameter      |     Type           |     Search Space                            |
|-----------------------|--------------------------|--------------------|---------------------------------------------|
|     RF Classifier     |     n_estimators         |     Discrete       |     [10,100]                                |
|                       |     max_depth            |     Discrete       |     [5,50]                                  |
|                       |     min_samples_split    |     Discrete       |     [2,11]                                  |
|                       |     min_samples_leaf     |     Discrete       |     [1,11]                                  |
|                       |     criterion            |     Categorical    |     'gini', 'entropy'                     |
|                       |     max_features         |     Discrete       |     [1,64]                                  |
|     SVM Classifier    |     C                    |     Continuous     |     [0.1,50]                                |
|                       |     kernel               |     Categorical    |     'linear', 'poly', 'rbf', 'sigmoid'    |
|     KNN Classifier    |     n_neighbors          |     Discrete       |     [1,20]                                  |
|     ANN Classifier    |     optimizer         |     Categorical       |     'adam', 'rmsprop', 'sgd'                                |
|                       |     activation            |     Categorical       |     'relu', 'tanh'                                  |
|                       |     batch_size    |     Discrete       |     [16,64]                                  |
|                       |     neurons     |     Discrete       |     [10,100]                                  |
|                       |     epochs            |     Discrete    |     [20,50]                     |
|                       |     patience         |     Discrete       |     [3,20]                                  |
|     RF Regressor      |     n_estimators         |     Discrete       |     [10,100]                                |
|                       |     max_depth            |     Discrete       |     [5,50]                                  |
|                       |     min_samples_split    |     Discrete       |     [2,11]                                  |
|                       |     min_samples_leaf     |     Discrete       |     [1,11]                                  |
|                       |     criterion            |     Categorical    |     'mse', 'mae'                          |
|                       |     max_features         |     Discrete       |     [1,13]                                  |
|     SVM Regressor     |     C                    |     Continuous     |     [0.1,50]                                |
|                       |     kernel               |     Categorical    |     'linear', 'poly', 'rbf', 'sigmoid'    |
|                       |     epsilon              |     Continuous     |     [0.001,1]                               |
|     KNN Regressor     |     n_neighbors          |     Discrete       |     [1,20]                                  |
|     ANN Regressor     |     optimizer         |     Categorical       |     'adam', 'rmsprop'                              |
|                       |     activation            |     Categorical       |     'relu', 'tanh'                                  |
|                       |     loss            |     Categorical       |     'mse', 'mae'                                  |
|                       |     batch_size    |     Discrete       |     [16,64]                                  |
|                       |     neurons     |     Discrete       |     [10,100]                                  |
|                       |     epochs            |     Discrete    |     [20,50]                     |
|                       |     patience         |     Discrete       |     [3,20]                                  |

### HPO Algorithms
* Grid search
* Random search
* Hyperband
* Bayesian Optimization with Gaussian Processes (BO-GP)
* Bayesian Optimization with Tree-structured Parzen Estimator (BO-TPE)
* Particle swarm optimization (PSO)
* Genetic algorithm (GA)

### Requirements
* Python 3.5+
* [Keras](https://keras.io/)
* [scikit-learn](https://scikit-learn.org/stable/)
* [hyperband](https://github.com/thuijskens/scikit-hyperband)
* [scikit-optimize](https://github.com/scikit-optimize/scikit-optimize)
* [hyperopt](https://github.com/hyperopt/hyperopt)
* [optunity](https://github.com/claesenm/optunity)
* [DEAP](https://github.com/rsteca/sklearn-deap)
* [TPOT](https://github.com/EpistasisLab/tpot)

## Contact-Info
Please feel free to contact me for any questions.
* Email: [praveen.kumar<EMAIL_ADDRESS>* LinkedIn: [Praveen Kumar](https://www.linkedin.com/in/praveen-zummit/)


text:
---
title: How to Create Dynamic NFTs Using Unlock Protocol
subTitle: How Tales of Elatora is making dynamic NFT images
authorName: Julien Genestoux
publishDate: May 9, 2022
description: By leveraging some of the important features of the Unlock contracts, it is possible to create dynamic NFTs and make the visual NFT evolve over time using on-chain data characteristics.
image: /images/blog/dynamic-nft/tales-of-elatora.gif
---

[Tales of Elatora](https://talesofelatora.com/) is a game where players need an avatar to play. The Avatars are non-fungible tokens using the Unlock protocol contract. There are two factions: the Buntai and the Gundan.

Players also need weapons to play. Weapons are also NFTs, and a Buntai avatar can only use a Buntai weapon and a Gundan avatar can only use a Gundan weapon. Anyone who buys an avatar automatically receives a matching weapon, as you can see on [this transaction](https://etherscan.io/tx/0x0f61fd3cdfb520804f59bc5de2ab70c131313a55d3e692bbec4c2a66777e03b7) for example.

![2 NFT](/images/blog/dynamic-nft/transaction-2-nft.png)

# The `OnKeyPurchase` hook

The PublicLock contract is highly programmable through the use of [hooks](https://github.com/unlock-protocol/docs/tree/master/developers/smart-contracts/lock-api/hooks). These hooks are external contracts that are used to alter the behavior of a PublicLock contract or trigger actions in other contracts. Any lock manager can configure hooks on a lock using the `setEventHooks` function. Each hook needs to implement a few functions and you can also use a single hook contract with all functions.

`onKeyPurchaseHook` is one of the hooks. This hook is called when the `purchase` function of a lock is called. It needs to implement 2 distinct functions:

- `keyPurchasePrice`: this first function is called with the address of the sender of the purchase transaction, the address of the recipient of the NFT membership, as well as the `referrer` and `data` parameters of the `purchase` function. The return value is the price paid for this specific membership. If your contract wants to offer discounts to a list of addresses or change the price based on how much time has passed since the last purchase, this function is a great way to achieve that!

- `onKeyPurchase`: this second function is called with the same arguments as `keyPurchasePrice` (from, recipient, referrer and data), but also with the minimum price this user has to pay as well as the price they actually paid (this would be different in the context of tips for example). This function is called at the tail end of the `purchase` function as a way to trigger other actions.

Tales of Elatora's avatar contract uses a hook to airdrop a weapon to anyone who buys an avatar automatically! Here is the code:

```solidity
function onKeyPurchase(
  address /*from*/,
  address recipient,
  address /*referrer*/,
  bytes calldata /*data*/,
  uint256 /*minKeyPrice*/,
  uint256 /*pricePaid*/
) external {
  if (msg.sender == _avatarLock) {
    // If the sender is the avatar lock
    IPublicLock avatar = IPublicLock(_avatarLock);
    uint id = avatar.totalSupply();

    address[] memory recipients = new address[](1);
    recipients[0] = recipient;

    uint[] memory expirations = new uint[](1);
    expirations[0] = type(uint256).max; // Not expiring!

    address[] memory managers = new address[](1);
    managers[0] = recipient;

    if (id % 2 == 0) {
      IPublicLock(_buntaiLock).grantKeys(recipients, expirations, managers);
    } else {
      IPublicLock(_gundanLock).grantKeys(recipients, expirations, managers);
    }
  }
}
```

The Avatars are such that every even number is a Buntai and every odd is a Gundan. The hook calls the `grantKeys` function on the right contract based on that.
Of course, that means that the Hook contract has been previously set to be a `keyGranter` on both locks ([see more info on the roles](https://docs.unlock-protocol.com/unlock/developers/smart-contracts/lock-api/access-control)).

# The `onTokenUri` Hook

An even more exciting hook that the PublicLock contract includes is the `onTokenUri` hook. This hook alters how the `tokenUri` method behaves. This method is the one in charge of yielding the URI that itself renders the JSON blob that includes the image, and other metadata for each individual Non Fungible Token.

The URI that the contract yields can in fact be a [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs). Data URLs, URLs prefixed with the `data:` scheme, are self-referrential: the URL itself contains the data that's represented by the browser. Here is an example: `data://text,hello%20unlock` is a URL which opens as a new page whose content is just "hello unlock".

By using a data URL as the `tokenUri` return, we can render metadata dynamically. The Tales of Elatora avatars are using this technique to render the image differently based on 2 things:

- whether the owner of the avatar also owns a weapon, and in which case, render the avatar along with the weapon
- whether the avatar is rendered during the day, at night, or during sunset.

Once configured, the `onTokenUri` hook will let the Public Lock contract call a 3rd party contract to generate the JSON. Given an `image` string (see below for more details), this is what the Tales of Elatora Public lock does:

```solidity
// Create the json that includes the image
// It is also possible to add more properties to the JSON object
string memory json = string(
    abi.encodePacked('{ "image": "', image, '"')
);

// render the base64 encoded json metadata
return
    string(
        abi.encodePacked(
            "data:application/json;base64,",
            Base64.encode(bytes(abi.encodePacked(json)))
        )
    );
```

We now only have to generate the `image` itself. Using the same technique, it would be perfectly possible create an SVG (or another image type!) on the fly, but Tales of Elatora used another approach: dynamically generating URLs pointing to files pre-uploaded on IPFS. Then, they use the contract's state to generate the URL that it needs to point to.

Caroline and David, leads on the Tales of Elatora project, generated images of all the possible combinations of avatars, weapons and backgrounds (including the absence of a weapon), and then uploaded all of the images to IPFS using the following pattern: `{avatar-id}-{weapon-id}-{background}.svg`.

The hook implements its own `tokenURI` method.

```solidity
function tokenURI(
  address lockAddress,
  address operator, // We could alter the rendering based on _who_ is viewing!
  address owner,
  uint256 keyId,
  uint256 expirationTimestamp // a cool trick could be to render based on how far the expiration is
) external view returns (string memory) {
  // ...
  // custom implementation
  /// ...
}
```

Specificaly, Tales of Elatora implements the hook by first checking if the `owner` of the Avatar also owns a corresponding weapon. If so, the final URL will include point to it (the `{weapon-id}` part), if not, it will use `0` for the `{weapon-id}`.

Similarly, the background of the image is dynamic and changes based on the time of the day! If the contract's `tokenUri` is called between 8am and 5pm GMT, it will render the _day_ background, if it is queried between 5pm and 9pm GMT, it will render the _sunset_ background, and if it is queried between 9pm and 8am GMT, it will render the _night_ background.

Using etherscan, you can easily [retrieve the metadata](https://etherscan.io/address/0x39aecbe181d94d721ef80924f10b77c785299397#readProxyContract). Here is what token `1` renders as I am writing this post:

```
data:application/json;base64,eyAiaW1hZ2UiOiAiaXBmczovL1FtUGVDQmNtV0ZpTXJMTkx0QlVqYVo2eUJ0cDFMaG1EcUFWWG1qWFJIeDdxTFovVGFsZXNPZkVsYXRvcmFDb2xsZWN0aW9uX0ZpbmFsXzIvLzEtMS0yLnN2ZyIsICJhdHRyaWJ1dGVzIjogWyB7InRyYWl0X3R5cGUiOiAiZmFjdGlvbiIsICJ2YWx1ZSI6ICJndW5kYW4ifSwgIHsidHJhaXRfdHlwZSI6ICJtb21lbnRPZkRheSIsICJ2YWx1ZSI6ICJzdW5zZXQifSwgIHsidHJhaXRfdHlwZSI6ICJjbGFzcyIsICJ2YWx1ZSI6ICJSb2d1ZSJ9XSwgImRlc2NyaXB0aW9uIjogIlRhbGVzIG9mIEVsYXRvcmEgaXMgYSBjb21tdW5pdHktZHJpdmVuIGZhbnRhc3kgd29ybGQsIHdyaXR0ZW4gbm92ZWwgYW5kIGFuIFJQRy4gVGhpcyBUb0UgTkZUIGdyYW50cyBhY2Nlc3MgdG8gdGhlIHN0b3J5LCB0aGUgZ2FtZSwgdGhlIGNvbW11bml0eSBhbmQgZ2l2ZXMgdGhlIGhvbGRlciB2b3RpbmcgcmlnaHRzLiBodHRwczovL3RhbGVzb2ZlbGF0b3JhLmNvbS8iLCAiZXh0ZXJuYWxfdXJsIjoiaHR0cHM6Ly90YWxlc29mZWxhdG9yYS5jb20vIiwgIm5hbWUiOiAiVGFsZXMgb2YgRWxhdG9yYSBBdmF0YXIgMSJ9
```

Opening this data URI in a new tab will yield the following JSON:

```js
{
  "image": "ipfs://QmPeCBcmWFiMrLNLtBUjaZ6yBtp1LhmDqAVXmjXRHx7qLZ/TalesOfElatoraCollection_Final_2/1-1-2.svg",
  "attributes": [
    { "trait_type": "faction", "value": "gundan" },
    { "trait_type": "momentOfDay", "value": "sunset" },
    { "trait_type": "class", "value": "Rogue" }
  ],
  "description": "Tales of Elatora is a community-driven fantasy world, written novel and an RPG. This ToE NFT grants access to the story, the game, the community and gives the holder voting rights. https://talesofelatora.com/",
  "external_url": "https://talesofelatora.com/",
  "name": "Tales of Elatora Avatar 1"
}
```

And of course the image can easily be rendered using the following. It was rendered at sunset, and the owner currently owns [this weapon](https://opensea.io/assets/0x93a9f5fa632224117802dcfbf4aa9377fb7448ab/1).

![Tales of Elatora](/images/blog/dynamic-nft/tales-of-elatora.gif)

## Dynamic contracts

The core goal of the Unlock Protocol is to build a standard for memberships, where all memberships, from Amazon Prime, to Medium's member program, or the Tales of Elatora game work the same, in the same way that every website is made of the same core protocols: HTML, HTTP and others! However, exactly like every website can also be different, we believe memberships can also look and behave differently on some aspects.

Are you interested in deploying your own custom membership? Get in touch!

repository: unlock-protocol/unlock

gha_language: TypeScript

gha_license_id: MIT

repo_name: unlock-protocol/unlock


text:
# autoresponsive-react-native-sample

Auto responsive grid layout library for [ReactNative](https://facebook.github.io/react-native/).

## Run

```shell
$ react-native run-android
```

## ScreenShot

iOS

![iOS](./screenshot/ios.gif)

Android

![Android](./screenshot/android.png)

## License

MIT Licensed. Copyright (c) xdf 2015.


text:
# 9.0.0

### License Terms

Since 9.0, OneDev introduces [enterprise edition](https://onedev.io/pricing) which requires a paid subscription to use,
and now it is distributed under [new license](https://onedev.io/license-agreement). In short, the _server-ee_ folder is
licensed separately with a source available license, while other parts remain MIT licensed.

It is promised that all existing features prior to 9.0 will never be moved into enterprise edition, and new features
will be added to MIT licensed part continuously.

### Helm Chart

1. OneDev only supports to run as statefulsets now. Refer to the [upgrade guide](https://docs.onedev.io/upgrade-guide/deploy-to-k8s) to migrate the persistent volume
2. Various database settings are changed to remove the _db_ prefix. For instance, _.Values.database.dbType_ was changed to _.Values.database.type_. Refer to [values.yaml](https://code.onedev.io/onedev/server/~files/main/server-product/helm/values.yaml) for details

### RESTful api

The operation to [get issue fields](/~help/api/io.onedev.server.rest.IssueResource/getFields) now return a map of field name to value

# 8.6.0

### Database

Oracle support is removed as it is hard to test with latest version. If you happen to use this database, please back up data and restore to a supported database following [this guide]((https://docs.onedev.io/administration-guide/backup-restore))

# 8.5.0

### Helm Chart

Helm chart has been completely rewritten to be flexible, and it is not compatible with earlier versions. Follow [upgrade guide](https://docs.onedev.io/upgrade-guide/deploy-to-k8s) to upgrade your chart from version <= 8.4.2

# 8.4.0

### Executor

Kubernetes executor no longer supports to execute step of type `Run Docker Container` to avoid mounting container sock into sidecar container. Put your step logic in a command step instead

# 8.3.4

### Executor

Kubernetes executor no longer supports to execute build image step even with docker runtime. A kaniko step is added to build image in Kubernetes cluster

### Build Spec

The `publish` option of `build docker image` step is removed, and now the step always tries to publish the built image

# 8.2.0

Branch/tag protection rules are changed to apply first matching instead of apply all matching

# 8.1.0

**[Agent]**

A particular agent token can only be used by one agent now. If you have multiple agents using same token, only the first one can connect to server, and others will be rejected. To fix this, open detail page of each rejected agent and copy the newly generated token to agent side

**[RESTful api]**

1. The endpoint path to list agents in agent token resource has been changed from `/agents` to `/agent`
1. The endpoint to create agent token now do not require any request body. It will generate new token value at OneDev side

# 8.0.7

Various resource update operations now require resource id to be specified in url path instead of request body. Refer to RESTful api help for details

# 8.0.5

Create tag step and close milestone step in build spec now uses access token to authenticate to server for flexibility and consistence reason. Please edit relevant build specs to specify appropriate access tokens for these two steps, otherwise they will fail

# 8.0.0

Project site published via public site step in build spec now can be publicly accessible. Previously it is only accessible to users able to access the project

# 7.9.12

All access tokens of users are re-generated with cryto strong random string. As a result of this, all places using previous access token should be replaced with the new access token. This may include restful api authentication, CI/CD checkout step using access token etc.

# 7.8.0

To use consistent project url for web and git access, OneDev now uses project path instead of project id to access projects via web UI, for instance `https://code.onedev.io/projects/160` has been changed to `https://code.onedev.io/onedev/server`. To avoid conflicting with this url scheme,
some service urls have been changed and this causes some incompatibitlities:

1. The RESTful api url now starts with `~api` instead of `api`, for instance url to access project information is now `/~api/projects/{projectId}`
2. SSO callback url now takes the form `https://<onedev root url>/~sso/callback/<Provider Name>` (use `~sso` instead of `sso`)
3. If you are using OAuth based Office365 or Gmail mail service, make sure to change redirect url as `https://<onedev root url>/~oauth/callback` (use `~oauth` instead of `oauth`)
4. Agents can not upgrade itself for this version, as url connecting to server has been changed. You will need to re-download
agent package from server if running in bare-metal mode, or re-pull the agent image if running in docker mode
5. If you are setting up reverse proxy using Apache or Nginx, make sure to change proxied path `/server` to `/~server`. Check [the docs](https://docs.onedev.io/administration-guide/reverse-proxy-setup) for details

# 7.7.0

OneDev server and agent now requires Java 11 or higher. Follow below steps to upgrade agent manually:

1. If agent is running as bare metal mode with Java 8, re-download agent package from server and run it
with Java 11 or higher following the instructions
1. If agent is running as bare metal mode with Java 11 or higher, it will be updated automatically
1. If agent is running in container mode, re-pull the image and start the container

# 7.4.0

### RESTful api

1. A boolean property "confidential" must be added to create endpoint of [issue resource](/~help/api/io.onedev.server.rest.IssueResource/create) to indicate whether or not the issue is confidential

# 7.3.5
1. [RESTful api] Service desk name property of [project resource](/~help/api/io.onedev.server.rest.ProjectResource) moved from basic info endpoint to setting endpoint

# 7.3.0
1. [CI/CD] Docker sock is NOT mounted by default for server docker executor, remote docker executor and Kubernetes
executor for security reasons. If your CI job performs docker operation, the build may fail. You may enable
the mount docker sock option in related executors, but make sure to configure authorized jobs of the executor
to only allow trusted jobs to use the executors

# 7.0.0

1. [RESTful api] Email addresses of a user should now be retrieved via [UserResource.getEmailAddresses](/~help/api/io.onedev.server.rest.UserResource/getEmailAddresses), and should be operated via [EmailAddressResource](/~help/api/io.onedev.server.rest.EmailAddressResource)
2. [RESTful api] Access token of a user should now be retrieved via [UserResource.getAccessToken](/~help/api/io.onedev.server.rest.UserResource/getAccessToken)
3. [RESTful api] User query by login name, full name and email should now be done via [UserResource.queryProfile](/~help/api/io.onedev.server.rest.UserResource/queryProfile)

# 6.2.1

1. [build spec] Registry login setting is removed from build image step (introduced in 6.2.0). Specify registry logins
in job executor if necessary

# 6.2.0

1. A new property `Run In Container` is added and enabled for all command steps in build spec. If you have steps intended to
be executed by shell executor, edit them to disable this property, otherwise the build will be failed with error `This step should be executed by server docker executor, remote docker executor, or kubernetes executor`
1. Using cache path "." (to cache workspace itself) in job cache definition is no longer supported

# 5.4.0

1. In case install OneDev into a Kubernetes cluster, Kustomization based deployment is replaced by helm based deployment for flexibility reason

# 5.2.1

1. User by default is not able to create/fork projects now. To allow it, specify default login group with appropriate project create permissions in security setting.
2. URL of project is changed from *http(s)://\<onedev-server\>/projects/\<project name\>* to *http(s)://\<onedev-server\>/projects/\<project id\>*. This only affects web UI, clone url and REStful api url is not changed.
3. Job variable *@project_name@* should be replaced by *@project_path@*.
4. Job match condition in job executor is renamed as job requirement, and the criteria to match job name is no longer valid. Executor can now be specified when define the job.

# 4.3.0

1. Service definition is separated from job definition. Previous service defined in job will be moved out of job and take the name _\<job name\>-\<service name\>_ to avoid possible name conflicts. You either need to change it back to use original name in case there is no conflicts, or change your build script to use the new service name.
2. Job match condition of job executor no longer accepts image criteria. You need to remove it manually if there is any; otherwise the job matching will fail.

# 4.1.3

1. Html report is removed from build spec due to possible XSS vulnerabilities. Check issue #230 for details
2. Setting _Default Fixed Issues Filter_ in build spec has been moved to be under project build setting, in order to facilitate issue query auto-updating upon custom field/state change

# 4.1.0

1. Backslash in job commands should not be escaped now. And literal '@' should be written as '@@'
2. Various query operator _is before_ and _is after_ is substituted with _is until_ and _is since_. For instance issue query _"Submit Date" is before "yesterday"_ should be written as _"Submit Date" is until "yesterday"_

# 4.0.5

1. Renamed build variables:

  |old name|new name|
  |---|---|
  |updated_ref|ref|
  |updated_branch|branch|
  |updated_tag|tag|
  |pull_request_ids|pull_request_number|

1. Removed build variables: _on_branches_, _commit_tags_,

# 3.2

Version 3.2 uses token authentication instead of password authentication in build spec for security
consideration. As a result of this, password authentication specified previously will be cleared:

1. Submodule authentication

  You will need to use custom http/ssh clone credential with permission to access submodule projects to retrieve source. Refer to [tutorial](https://docs.onedev.io/tutorials/cicd/clone-submodules-ssh/) for an example.

2. Project dependency authentication

  You will need to define a job secret containing an access token in project build setting page, and then use that secret in project dependency definition. The access token should have permission to download dependency project artifacts of course.

repository: theonedev/onedev

branch_name: refs/heads/main

gha_language: Java

repo_name: theonedev/onedev


text:
# Impulse Responses

Good sources for impulse responses:

1. Google "impulse responses" :)
2. There are lotsa open licensed IRs [here](http://www.openairlib.net/auralizationdb)


text:
# [v1.0.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.18.0...authentication-v1.0.0) (2021-03-15)
## Feature
## Refactor
## Bugfix

# [v0.18.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.14.1...authentication-v0.18.0) (2021-02-15)
## Feature
## Refactor
## Bugfix
 - Removed lecturer and student from seeding

# [v0.14.1](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.13.1...authentication-v0.14.1) (2020-12-14)
## Feature
## Refactor
- Renamed "versionNumber" into "serviceVersion"
## Bugfix

# [v0.13.1](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.13.0...authentication-v0.13.1) (2020-11-26)
## Feature
## Refactor
 - Rebuilt to be compatible with new user-service API
## Bugfix

# [v0.13.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.12.0...authentication-v0.13.0) (2020-11-23)
## Feature
 - Added configurable timeouts in application config
## Refactor
## Bugfix

# [v0.12.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.11.0...authentication-v0.12.0) (2020-11-10)
## Feature
 - Added support for ETags
## Refactor
 - Bumped Version of Lagom to 1.6.4
## Bugfix
 - Added all messages to serialization registry

# [v0.11.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.10.0...authentication-v0.11.0) (2020-10-26)
## Feature
 - Changed Circuit Breaker to ignore UC4NonCriticalExceptions
 - Added encrypted Kafka topics
## Refactor
 - Moved configurations to shared
## Bugfix
 - Added minimum size to gzip (512 Byte)

# [v0.10.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.9.0...authentication-v0.10.0) (2020-10-12)
## Feature
 - Wrapped Validation in Future to enable timeouts
## Refactor
## Bugfix

# [v0.9.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.8.2...authentication-v0.9.0) (2020-09-28)
## Feature
## Refactor
 - Refactored tests to Unit-Tests
## Bugfix
 - Fixed bug that prevented authentication users being deleted from the tables
 - Fixed bug that lead to a wrong error being shown when the refresh token was missing for machine users

# [v0.8.2](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.8.1...authentication-v0.8.2) (2020-09-22)
## Feature
 - Added Gzipping in Options Header
## Refactor
 - Created more precise error code for missing refresh token
## Bugfix

# [v0.8.1](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.7.1...authentication-v0.8.1) (2020-09-15)
## Feature
 - Enabled Machine User Login with Bearer Authentication
 - Enabled Gzipping
## Refactor
## Bugfix
 - Fixed hard coded HTTP Secret

# [v0.7.1](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.7.0...authentication-v0.7.1) (2020-09-01)
## Feature
 - Changed JWT Tokens to Strict Same Site restriction again
## Refactor
## Bugfix

# [v0.7.0](https://github.com/upb-uc4/University-Credits-4.0/compare/authentication-v0.6.0...authentication-v0.7.0) (2020-09-01)
## Feature
 - Added custom deserialization exceptions
 - Switched to JWT Token
    - Added login endpoint which uses basic to create a refresh and a login token
    - Added refresh endpoint to create a new login token with the refresh token
## Refactor
 - Refactored authentication service to only be necessary for the first login
 - Added ServiceStub for testing to reduce code duplication
 - Added default AuthenticationUsers for easier maintainability in testing
## Bugfix

# [v0.6.0](https://github.com/upb-uc4/University-Credits-4.0/compare/v0.5.0...authentication-v0.6.0) (2020-08-17)
## Feature
 - Added predefined standard exceptions to CustomException
## Refactor
 - Changed exceptions to use these standard exceptions whereever possible
## Bugfix

branch_name: refs/heads/develop

gha_language: Scala


text:
# ninejs/core

Contains core modules.
Modules inside ninejs/core can be used either in client-side (browser) or server-side (Node.js)

## Folders

- **ext**: Mixins used to augment classes. For example, `Properties` mixin allows your classes to have a get, set and watch methods (just like Dojo's Stateless).
- **logic**: Modules used to build and evaluate boolean expressions.

## ninejs/core/extend

extend allows your to build classes in an OOP style. It is heavily inspired in [Kris Zyp's compose](https://github.com/kriszyp/compose "kris zyp's compose") features.

### Creating a class with extend:

```javascript
define(['ninejs/core/extend'], function(extend) {
	'use strict';
	extend = extend.default;
	var MyClass = extend();
	var obj = new MyClass();
});
```

Of course, there is no fun in just creating an empty class. Lets create one that has a few methods and properties.

```javascript
define(['ninejs/core/extend'], function(extend) {
	'use strict';
	extend = extend.default;
	var MyClass = extend({
		prop1: 'test ',
		action: function(val) {
			console.log(this.prop1 + val);
		}
	});
	var obj = new MyClass();
	obj.action('123');
	//'test 123'
});
```
At the moment, methods you create within a class get defined in that class's prototype. Other fields you define get set in your instance after all the constructors are set.

### Using extend in Node.js

Want to create and/or extend classes in your server side Node.js? No problem!

ninejs/core/extend works in AMD environments as well as Node.js cjs because it detects your environment (for other environments it just sets an `extend` variable in your global).

```javascript
'use strict';
var extend = require('ninejs/core/extend').default;
var MyClass = extend({
	prop1: 'test ',
	action: function(val) {
		console.log(this.prop1 + val);
	}
});
var obj = new MyClass();
obj.action('123');
//'test 123'
```

### Mixing in some functions

With extend you may also use other functions (even ones not created with extend).

```javascript
define(['ninejs/core/extend'], function(extend) {
	'use strict';
	extend = extend.default;
	function Type1() {
		this.myVar = 3;
	}
	Type1.prototype.test = function() {
		return this.myVar;
	};
	var MyClass = extend(Type1, {
		prop1: 'test ',
		action: function(val) {
			console.log(this.prop1 + val + this.test());
		}
	});
	var obj = new MyClass();
	obj.action('123');
});
```

This effectively tells extend that you want to create a class based on Type1 (which is a function we just previously defined) and also want it to have the functionality described in the other json parameter (prop1 field and action method).
extend can have any number of parameters, each one describing either a function or an object. If it's a function then it is considered a constructor and will execute call it as a constructor at runtime time. On the other hand, if it's an object then all its functions get merged on the prototype and its other fields get assigned at runtime too.

### Overriding methods on a class

Lets say you want to extend a class in a way that you provide custom behaviour as well as the usual expected logic. Extend allows you to run your customization before, after or around executing the superclass method. Let's try it:

```javascript
define(['ninejs/core/extend'], function(extend) {
	'use strict';
	extend = extend.default;
	var SuperClass = extend({
		x: 3,
		update: function() {
			console.log(this.x);
		}
	});
	var MyClassBefore = extend(SuperClass, {
		update: extend.before(function() {
			console.log('Executing before superclass');
		})
	});
	var obj = new MyClassBefore();
	obj.update();

	var MyClassAfter = extend(SuperClass, {
		update: extend.after(function() {
			console.log('Executing after superclass');
		})
	});
	obj = new MyClassAfter();
	obj.update();

	var MyClassAround = extend(SuperClass, {
		update: extend.around(function(original) {
			return function() {
				console.log('This is before');
				original.apply(this, arguments);
				console.log('This is after');
			};
		})
	});
	obj = new MyClassAround();
	obj.update();

	var MyClassShadow = extend(SuperClass, {
		update: function() {
			console.log('This method is shadowing SuperClass\' update method');
		}
	});
	obj = new MyClassShadow();
	obj.update();
});
```

In the 4 previous examples we used extend.before, extend.after, extend.around and in the last one we just shadowed the update function (by only redefining it in the child class);

### Using extend as an object mixin

You can also call extend within an instance to have it mix in objects:

```javascript
'use strict';
var extend = require('extend');
var obj = { a:1, b:2, c:3 };
var otherObj = { b:4, d:4, e:5};
extend.mixin(obj, otherObj);
//obj = { a:1, b:4, c:3, d:4, e:5 };
```

repository: ninejs/ninejs

gha_language: JavaScript

repo_name: ninejs/ninejs


text:
---
layout: news
title: Information about registration
snippet: Registration will be available soon
---

We know that you are all excited to join us at ACL2018 and are hoping to register soon! ACL will welcome registration from anyone who is interested, whether or not you are presenting a paper at the conference.

Work is underway to finalise the registration pages, but due to factors beyond the control of the organising committee, the registration site is not yet available. We ask you for your patience and will have it open soon. It will of course be announced here when it opens.

In the meantime, you can already book your [accommodation]({{ site.github.url }}/attendees/accommodation).

gha_language: HTML


text:
[//]: # (title: Plugin Configuration File)

<!-- Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->

The following is a sample plugin configuration file.
This sample showcases and describes all elements that can be used in the <path>plugin.xml</path> file.
Additional information about configuring `<actions>` is available in the [Actions](basic_action_system.md#registering-actions) section in Part II.

Limited HTML elements are allowed within `<description>` and `<change-notes>` elements.
However, content containing HTML elements must be surrounded by `<![CDATA[  ]]>` tags.
Allowed HTML elements include text formatting, paragraphs, and lists.

When using Gradle, a number of metadata elements will be provided at build time by [`patchPluginXml` task](gradle_guide.md#patching-the-plugin-configuration-file).

> Please make sure to follow the guidelines from [Plugin Overview page](https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html) for an optimal presentation of your plugin on JetBrains Marketplace.
>
> This webinar also discusses _5 tips for optimizing JetBrains Marketplace plugin page_
> <video href="oB1GA9JeeiY" title="Busy plugin developers series. Episode 2" width="300"/>
>
> See also [](marketing.md) about widgets and badges.
>
{type="tip"}

```xml
<!--
An optional "url" attribute specifies the link to the plugin homepage.
It is displayed on the plugin page in the Marketplace.
-->
<idea-plugin url="https://example.com/my-plugin-site">

  <!--
  Unique identifier of the plugin. It should be a fully qualified name
  including namespace to not collide with existing plugins. It cannot be
  changed between the plugin versions. If not specified, <name> will be
  used (not recommended).
  -->
  <id>com.example.myplugin</id>

  <!-- Public plugin name. It should use Title Cases. Guidelines:
  https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name
  -->
  <name>My Framework Support</name>

  <!--
  Plugin version. Plugins uploaded to the Marketplace must follow
  the semantic versioning: https://plugins.jetbrains.com/docs/marketplace/semver.html.
  It is displayed in the "Plugins" settings dialog and in the Marketplace
  plugin page.
  -->
  <version>1.0.0</version>

  <!--
  Vendor name or Organization ID (if you have one created).
  Attributes:
   - "url" (optional) - specifies the link to the vendor's homepage
   - "email" (optional) - specifies the vendor's email address
  Displayed on the Plugins Page.
  -->
  <vendor
      url="https://plugins.jetbrains.com/my-company"
<EMAIL_ADDRESS>Company</vendor>

  <!--
  IMPORTANT: This tag should not be used in free plugins.
  If you decide to make your plugin paid, you will need to define
  the parameters in the <product-descriptor> tag.
  You can also enable free functionality in a paid plugin. Learn more in
  a guide to selling plugin: https://plugins.jetbrains.com/build-and-market
  -->
  <product-descriptor
      code="PMYPLUGIN"
      release-date="20210901"
      release-version="20211"
      optional="true"/>

  <!-- Minimum and maximum IDE build versions compatible with the plugin. -->
  <idea-version since-build="193" until-build="193.*"/>

  <!--
  Plugin description displayed on the Marketplace plugin page and in
  the IDE Plugin Manager.
  Simple HTML elements (text formatting, paragraphs, lists, etc.) can be
  added inside of <![CDATA[ ]]> tag. Guidelines:
  https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-description
  -->
  <description>
  <![CDATA[
    Provides support for <a href="https://example.com/my-framework">My
    Framework</a>.
    <p>Includes support for:
    <ul>
      <li>code completion</li>
      <li>references</li>
      <li>refactoring</li>
    </ul>
    </p>
  ]]>
  </description>

  <!--
  Short summary of new features and bugfixes in the latest plugin version.
  Displayed on the Marketplace plugin page and in the IDE Plugin Manager.
  Simple HTML elements can be included between <![CDATA[  ]]> tags.
  -->
  <change-notes>Initial release of the plugin.</change-notes>

  <!--
  Product and plugin compatibility requirements. Read more:
  https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html
  -->
  <depends>com.intellij.modules.platform</depends>
  <depends>com.example.third-party-plugin</depends>

  <!--
  Optional dependency on another plugin. If the plugin with the
  "com.example.my-second-plugin" ID is installed, the contents
  of "mysecondplugin.xml" (the format of this file conforms to
  the format of plugin.xml) will be loaded.
  -->
  <depends
      optional="true"
      config-file="mysecondplugin.xml">com.example.my-second-plugin</depends>

  <!--
  Resource bundle (/messages/MyPluginBundle.properties) to be used with
  "key" attributes in extension points and implicit keys like
  "action.[ActionID].text|description".
  -->
  <resource-bundle>messages.MyPluginBundle</resource-bundle>

  <!--
  Extension points defined by the plugin. Extension points are registered
  by a plugin so that other plugins can provide this plugin with certain
  data. Read more:
  https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html
  -->
  <extensionPoints>
    <extensionPoint
        name="testExtensionPoint"
        beanClass="com.example.impl.MyExtensionBean"/>
    <applicationService
        serviceImplementation="com.example.impl.MyApplicationService"/>
    <projectService
        serviceImplementation="com.example.impl.MyProjectService"/>
  </extensionPoints>

  <!--
  Application-level listeners. For more information, see:
  https://plugins.jetbrains.com/docs/intellij/plugin-listeners.html#defining-application-level-listeners
  -->
  <applicationListeners>
    <listener
        class="com.example.impl.MyListener"
        topic="com.intellij.openapi.vfs.newvfs.BulkFileListener"/>
  </applicationListeners>

  <!--
  Project-level listeners. For more information, see:
  https://plugins.jetbrains.com/docs/intellij/plugin-listeners.html#defining-project-level-listeners
  -->
  <projectListeners>
    <listener
        class="com.example.impl.MyToolwindowListener"
        topic="com.intellij.openapi.wm.ex.ToolWindowManagerListener"/>
  </projectListeners>

  <!--
  Actions.  Custom extensions declaration. For more information, see:
  https://plugins.jetbrains.com/docs/intellij/plugin-extensions.html#declaring-extensions
  -->
  <extensions defaultExtensionNs="VssIntegration">
    <myExtensionPoint implementation="com.example.impl.MyExtensionImpl"/>
  </extensions>

  <!--
  DEPRECATED: Do not use in new plugins!
  Plugin's application components.
  See https://plugins.jetbrains.com/docs/intellij/plugin-components.html
  for migration steps.
  -->
  <application-components>
    <component>
      <!-- Component's interface class -->
      <interface-class>com.example.Component1Interface</interface-class>
      <!-- Component's implementation class -->
      <implementation-class>com.example.impl.Component1Impl</implementation-class>
    </component>
  </application-components>

  <!--
  DEPRECATED: Do not use in new plugins!
  Plugin's project components.
  See https://plugins.jetbrains.com/docs/intellij/plugin-components.html
  for migration steps.
  -->
  <project-components>
    <component>
      <!-- Interface and implementation classes are the same -->
      <implementation-class>com.example.Component2</implementation-class>

      <!--
      If the "workspace" option is set "true", the component saves its state
      to the .iws file instead of the .ipr file. Note that the <option>
      element is used only if the component implements the
      JDOMExternalizable interface. Otherwise, the use of the <option>
      element takes no effect.
      -->
      <option name="workspace" value="true"/>

      <!--
      If the "loadForDefaultProject" tag is present, the project component
      is instantiated also for the default project.
      -->
      <loadForDefaultProject/>
    </component>
  </project-components>

  <!--
  DEPRECATED: Do not use in new plugins!
  Plugin's module components.
  See https://plugins.jetbrains.com/docs/intellij/plugin-components.html
  for migration steps.
  -->
  <module-components>
    <component>
      <implementation-class>com.example.Component3</implementation-class>
    </component>
  </module-components>
</idea-plugin>
```

repository: SevenAMan/intellij-sdk-docs

repo_name: SevenAMan/intellij-sdk-docs


text:
# OSGi integration for Camunda Platform 7

[![Build Status](https://travis-ci.org/camunda/camunda-bpm-platform-osgi.svg?branch=master)](https://travis-ci.org/camunda/camunda-bpm-platform-osgi)
[![Community Extension Badge](https://img.shields.io/badge/Community%20Extension-An%20open%20source%20community%20maintained%20project-FF4700)](https://github.com/camunda-community-hub/community)
[![Lifecycle: Abandoned Badge](https://img.shields.io/badge/Lifecycle-Abandoned-lightgrey)](https://github.com/Camunda-Community-Hub/community/blob/main/extension-lifecycle.md#abandoned-)
[![Lifecycle: Needs Maintainer](https://img.shields.io/badge/Lifecycle-Needs%20Maintainer%20-ff69b4)](https://github.com/Camunda-Community-Hub/community/blob/main/extension-lifecycle.md#abandoned-)
![Compatible with: Camunda Platform 7](https://img.shields.io/badge/Compatible%20with-Camunda%20Platform%207-26d07c)

Camunda Platform community extension providing support for Camunda Platform inside OSGi containers

```
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: camunda BPM Platform OSGi
Bundle-SymbolicName: org.camunda.bpm.extension.osgi
Bundle-Version:
Export-Package: [...]
Import-Package: [...]
```

## Project structure

Every module is supposed to fullfil a single purpose and to be used independently of the others.
Three modules are an exception from this rule, namely
- camunda-bpm-karaf-assembly, which is used to provide a Karaf distribution that you can download [here](https://github.com/camunda/camunda-bpm-platform-osgi/releases)
- camunda-bpm-osgi-itest, which contains all the integration tests
- camunda-bpm-osgi, which contains some core components and is the only one required by all the modules

## Compatability Matrix

This matrix shows the compatibilities of the different camunda OSGi version and camunda BPM platform versions.
 Like the 1.x.0 version, an update of the camunda BPM platform is back to being a minor version increase.
Additionally, as long as there are no binary incompatibilities camunda OSGi is kept backwards compatible as much as possible.

For more detailed descriptions please check the release notes of the individual releases.

## Get started

### Part 1 starting the camunda BPM OSGi bundle

Before you start you have to install all the required bundles into your OSGi runtime.
To see a list of the required bundles you can take a look at the Apache Karaf feature.xml.
It contains a list of the required dependencies and a list containing all the optional dependencies, too.

After you've done that you can drop the camunda-bpm-osgi bundle into the runtime.
It should then move to the resolved state and you could start it.

If you prefer to use Apache Karaf as your runtime you can use the feature.xml directly. The guide can be found [here](https://github.com/camunda/camunda-bpm-platform-osgi/blob/master/camunda-bpm-karaf-feature/README.md).

### Part 2 creating a process engine

After you successfully deployed the camunda BPM OSGi bundle your next step is to create a ProcessEngine.

#### Using the ProcessEngineFactory

To help a little bit with the creating of a process engine you can use the `ProcessEngineFactory` class. You'll have to pass a `ProcessEngineConfiguration` object and the current bundle to it by calling the setBundle() and setProcessEngineConfiguration() methods. Finally you'll have to call init(). After that you may call getObject() to get a reference to the process engine.
Please be aware that the order is mandatory or else getObject() will return null.

Please note also, that the process engine won't be exported automatically. If you want to share it, you can do that by yourself.

If you want to use a special ELResolver (see part 4) you'll have to use the `ProcessEngineFactoryWithELResolver`.

#### Using Blueprint

See [camunda BPM OSGi - Blueprint Wrapper](camunda-bpm-blueprint-wrapper)

#### Old school

If you wanna stay old school and use core OSGi you can do that, too.
Import the package `org.camunda.bpm.engine` and `org.camunda.bpm.engine.impl.cfg` and instantiate your own `StandaloneProcessEngineConfiguration`.

#### Using the ProcessApplication API

See [camunda BPMN OSGi - Process Application Integration](camunda-bpm-osgi-processapplication)

#### Using the ConfigurationAdmin service

See [camunda BPM OSGi ConfigAdmin](camunda-bpm-osgi-configadmin).

### Part 3 Deploying process definitions

After you created a `ProcessEngine` you can start to deploy process definitions.
The following steps only work when you exported a `ProcessEngine` as OSGi service.

#### Inside a bundle

When you deploy a bundle containing a process definition the process can be automatically added to the ProcessEngine.
For the process definition to be found, you'll have to do one of the following things:
- place it in the OSGI-INF/processes/ directory
- set the "Process-Definitions" header in the MANIFEST.MF and let it point to a file or directory

If you reference any `JavaDelegate`s or `ActivityBehavior`s from within your process defniition please take a look at Part 4

#### ProcessApplication API

See [camunda BPMN OSGi - Process Application Integration](camunda-bpm-osgi-processapplication)

### Part 4 Referencing inside processes

#### With the BlueprintELResolver

See [camunda BPM OSGi - Blueprint Wrapper](camunda-bpm-blueprint-wrapper)

#### With the OSGiELResolver

The `OSGiELResolver` uses a three step resolution to match expressions with classes

##### Step 1

The first step uses the LDAP filter property. You have to export a service with the filter property "processExpression=". The OSGiELResolver then matches the expression with the filter.

##### Step 2

If the LDAP search doesn't suceed the ELResolver will search the Service Registry for JavaDelegates. Then the class name will be compared to the expression. The comparison is similiar to the default CDI bean names. That means the expression has to match the class name starting with a lowercase character, e.g. org.foo.bar.MyClass would match "${myClass}".

##### Step 3

The third steps works likes the second one, only that it searches for exported ActivityBehaviours.

#### ProcessApplication API

See [camunda BPMN OSGi - Process Application Integration](camunda-bpm-osgi-processapplication)

## OSGi Event Bridge

See [camunda BPM OSGi - Eventing API](https://github.com/camunda/camunda-bpm-platform-osgi/tree/messaging/camunda-bpm-osgi-eventing-api).

## Resources

* [Issue Tracker](https://github.com/camunda/camunda-bpm-platform-osgi/issues)
* [Contributing](CONTRIBUTING.md)

## Roadmap

_a short list of things that yet need to be done (until we organize it elsewhere ;) )_

**todo**
- camunda webapp WAB (cockpit, tasklist, admin)
- create example for configuring engine using PAX-CDI

**done**
- QA, integration tests (resolve engine-bundle)
- example for configuring engine using Blueprint

## Maintainers:

* [@rbraeunlich ](https://github.com/rbraeunlich)

## License

Apache License, Version 2.0


text:
# Typehero
### A 2D side-scrolling gmae made with pygame module, which you can fight with a giant monster.

Try not to hit by the floating word, and typing words to fire up!

**Use your *TYPE POWER* to beat the game!**

-----------------------------------------

# How to play
Key           | Action |
------------  | ----   |
Arrorw Up    | Move up  |
Arrow Down   | Move down  |
Arrow Left  | Move left  |
Arrow Right  | Move right  |
Backspace  | Delete word  |
Esc  | Clear buffer  |
Enter  | Commit and Shoot  |


text:
HSK-colors
========

My own style guide for HSK colors. Using the ROYGBIV. Red has the least amount of enery, so it will be HSK 1. Since they are only 6 levels, violet will not be used. So indigo will be HSK 6.

Red HSK 1

Orange HSK 2

Yellow HSK 3

Green HSK 4

Blue HSK 5

Indigo HSK 6

repository: LeafDragon/Mandarin

repo_name: LeafDragon/Mandarin


text:
| Testing | Coverage | Documentation |
| :-----: | :------: | :-----------: |
| [![Build Status](https://travis-ci.org/sisl/PGFMapPlots.jl.svg?branch=master)](https://travis-ci.org/sisl/PGFMapPlots.jl) | [![Coverage Status](https://coveralls.io/repos/github/sisl/PGFMapPlots.jl/badge.svg?branch=master)](https://coveralls.io/github/sisl/PGFMapPlots.jl?branch=master) | [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://sisl.github.io/PGFMapPlots.jl/latest) |

# PGFMapPlots.jl

PGFMapPlots uses PGFPlots and WorldMapData libraries to creation of world map
plots in Julia.


text:
bb
==

Brian's Playground

This repository contains stuff I've tinkered with, some of it may be interesting, some of it may be incomplete.  The contents are provided "as is".

----------

## `xhtml.dyalog` namespace

Contains utilities to:
- convert HTML to XHTML which is subsequently able to be parsed by `⎕XML`
- search and extract elements from the result of `⎕XML`

### `HTMLtoXHTML`
`xhtml ← xhtml.HTMLtoXHTML html`
`html` is a character vector containing HTML
`xhtml` is a matrix form of the XHTML

`HTMLtoXHTML` assumes that the HTML is reasonably formed (e.g. open tags have corresponding closing tags). It handles most, but probably not all, HTMLisms of some elements not requiring a closing tag.

### `Xfind`
`boolvec ← xml xhtml.Xfind spec`
`xml` is an XML matrix (could be XHTML, but doesn't have to be)
`spec` is a delimited-string search specification (first character is the delimiter) in the form `/levels/elements/content/attribute/value` where:
- `levels`, if non-empty, specifies the level(s) to consider in the search.  For example:
    - `3` specifies level 3 elements only, `3-` level 3 and lower (to 0), `3+` level 3 and higher, `3-5` levels 3 through 5
- `elements` is a space-delimited list of elements to select
- `content` is case-insensitive content to search for using `⍷`
- `attribute` is a case-sensitive attribute name to exactly search for
- `value` is a case-insensitive attribute value to search for using `⍷`, if no `attribute` is specified, all attributes will be searched.

`boolvec` is a Boolean vector marking matching elements

Examples:
```

      xml xhtml.Xfind '//table//class/results' ⍝ find all <table> elements with a class attribute containing 'results'

      xml xhtml.Xfind '/2////foobar' ⍝ find all level 2 elements with any attribute containing 'foobar'

      xml xhtml.Xfind '/3+/th td/bloof' ⍝ find all level 3 or higher <th> or <td> elements containing 'bloof'
```
### `Xsel`
`elements ← xml Xsel boolvec`
`xml` is an XML matrix (could be XHTML, but doesn't have to be)
`boolvec` is a Boolean vector with as many elements as rows in `xml`
`elements` is a nested vector of elements marked by `boolvec` and their descendants

### Typical Use Case
In general, you'll convert some HTML to XHTML and then search for and extract element of interest to you.  For example:

```

      resp ← HttpCommand.Get 'someurl.com/somefile.html' ⍝ make a request
      'request failed' ⎕SIGNAL (0 200≢resp.(rc HttpStatus))/777 ⍝ check that it succeeded
      h ← resp.Data ⍝ grab the response data
      x ← xhtml.HTMLtoXHTML h ⍝ convert to XHTML
      mytables ← x xhtml.Xsel x xhtml.Xfind '//table//class/results' ⍝ extract all the <table> elements with a class attribute containing "results"

repository: Dyalog/bb

repo_name: Dyalog/bb


text:
---
layout: post
title: Add or Update Tags on Existing Elastic Beanstalk Environments
permalink: add-or-update-tags-on-existing-elastic-beanstalk-environments
date: '2014-07-12 21:33:00'
tags: [AWS, Tagging, Elastic Beanstalk]
cover: http://assets.boringgeek.com/imacSceneryReduced.jpg
comments: true
---

Back in May, Amazon introduced the ability to tag your Beanstalk environments. This is great for anyone that properly uses tags to monitor, track and account for the resources they are using.  One challenge that I've run into recently, though, is that this is only during the creation of an environment; AWS currently doesnt offer the ability to add, remove or update tags to existing environments.

For those of you that want to make that happen, here are some simple, albeit long, instructions on how to rotate environments out with new, properly tagged ones.

1. From the AWS Console, select Elastic Beanstalk from the Services Menu.
2. Click the name of the application you wish to tag. This will take you to the “Environments” view for this particular app.
3. From the “Actions” menu at the top right of the console, choose “Launch New Environment”.
4. Follow the wizard to spin up a new “B” environment for the specific environment you wish to update.
	- For example, if this were for a "NODE-APP-PRD" environment, create an environment titled “NODE-APP-PRD-B”.
	- Ensure the configurations matche that of the desired environment. (One thing you could do is save a configuration of the base environment.)
	- Ensure that the correct version of the code is deployed to this environment.
	- For this environment, do not worry about putting any tags in; this is simply a temporary space and you will terminate it once you're done.
5. Have the development team for the App test the environment and confirm functionality.
6. If everything is working as expected, click on the title of the new “B” environment to view that specific environment.
7. From the “Actions” menu on the top right, select “Save Configuration” to save a copy of the configuration. Name the configuration after the environment it is for.
8. From the “Environments” view for the application, click the “Swap URLs” button from the top right.
9. Select the correct two environments that you would like to swap and click the “Swap” button.
10. Once the URL swap is complete, have the development team test the app again and confirm functionality.
11. From the “Environments” view for the application, click the title of the original environment.
12. From the “Actions” menu on the top right and select “Terminate the original environment.
	- This will warn that the URL “NODE-APP-PRD-B.elasticbeanstalk.com” will be deleted.  This is ok; it's a temp URL anyway.  The real URL is currently assigned to the “B” environment.
13. Once the environment has been terminated, return to the “Environments” view for the application and click “Launch New environment” from the actions menu.
14. Follow the wizard to recreate the original environment.
	* Be sure to select the configuration you just saved.
	* Enter in the correct tags following the format that works for your organization.
15. Launch the new environment.
16. Once the environment is launched, confirm the configuration settings are correct and that the tags are showing up properly.
17. Have the development team confirm that the new environment is functioning properly.
18. From the “Environments” view for this application, select “Swap URLs” from the top right and swap the A and B URLS. This will point the original URL to the new, properly tagged environment.
19. Have the development team confirm that the environment is functioning properly
20. Terminate the “B” environment.

Thats pretty much it.  While there are a lot of steps, its pretty straight forward for an interim option while we wait for updated AWS functionality.  Another benefit of following this process is that it allows you to make the swap without any downtime for your end users.

If you have any suggestions or thougths on this, let me know in the comments!


text:
# Super3 video catalog and collector

This program aims at providing the tools to collect and catalog
a private collection of videos based on those published on the
Club Super3 (Catalan TV channel for children) web page.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

### Prerequisites

This has been developed and tested on a macOS computer running python3

### Installing

(optional) Create a virtualenv

```bash
$ virtualenv -p python3 ~/.virtualenvs/super3
$ . ~/.virtualenvs/super3/bin/activate(.fish|.csh)
```

Install the dependencies

```bash
(super3) $ pip install -r requirements.txt
```

## Deployment

This runs locally ATM.

## Usage

Foreseen invocation:

create new catalog
```
$ super3 init
```

add series to catalog with title containing 'Kratt'
```
$ super3 add-series -name 'Kratt'
```

update available episodes
```
$ super3 update
```

list available episodes
```
$ super3 list -name 'Kratt'
```

download available
```
$ super3 download -name 'Kratt'
```

## Built With

* [Requests](http://docs.python-requests.org) - Used to make http calls
* [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup) - HTTP parser
* [SQLAlchemy](https://www.sqlalchemy.org) - DB ORM

## Contributing

Feel free to contribute

## Versioning

We use [SemVer](http://semver.org/) for versioning.

## Authors

* **Roger Firpo** - *Initial work* - [rogerfc](https://github.com/rogerfc)

See also the list of [contributors](https://github.com/rogerfc/super3/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

* Hat tip to anyone who's code was used


text:
[![CI Status](https://img.shields.io/travis/eshwavin/SETabView.svg?style=flat)](https://travis-ci.org/eshwavin/SETabView)
[![Version](https://img.shields.io/cocoapods/v/SETabView.svg?style=flat)](https://cocoapods.org/pods/SETabView)
[![License](https://img.shields.io/cocoapods/l/SETabView.svg?style=flat)](https://cocoapods.org/pods/SETabView)
[![Platform](https://img.shields.io/cocoapods/p/SETabView.svg?style=flat)](https://cocoapods.org/pods/SETabView)

## Animations

.holeBall1 | .holeBall2 | .holeBall3
---------| --------------|---------|
 |  |

## What's New?

#### The API has been changed to resemble `UITabBarController`
- Colors have been renamed to conform to colors specified by `UITabBar`
- Colors can be set collectively as before (function parameter names have been changed to reflect the changed color names) or individually
- Colors can now be changed at any point in time
- The view controllers at any time
- The animation type can be changed at any time to switch between available animations by setting the `animationType` property!
- `animationDuration` can no longer be changed

#### Bug fixes
- A bug that caused holeBall3 to behave weirdly in larger screen sizes has been squashed
- Glitchy landscape mode behaviour has been fixed

A whole lot of performance optimizations have been added so that our library does not slow down your app. Hurray!

## Requirements

- Swift 5+
- iOS 11.0+
- Swift tools version 5.0+ (For Swift Package Manager)

## Integration

### CocoaPods

SETabView is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'SETabView'
```

In case the latest version (2.0.0) is not the one being installed, update the pod.

```
pod update 'SETabView'
```

### Swift Package Manager

The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.

Once you have your Swift package set up, adding SETabView as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.

```swift
dependencies: [
.package(url: "https://github.com/eshwavin/SETabView.git", .upToNextMajor(from: "2.0.0"))
]
```

### Directly include source files

Download and add the files in the [Source](https://github.com/eshwavin/SETabView/tree/master/Source) folder directly into your Xcode Project. In this case you should **skip**

```swift
import SETabView
```

in the usage instructions.

## Usage and Customization

Import `SETabView` into the parent view controller and any child view controllers

```swift
import SETabView
```

Inherit from the `SETabViewController` class in your tab view controller
```swift
class MyCustomTabViewController: SETabViewController {

   override func viewDidLoad() {
    super.viewDidLoad()

  }
}
```

### Setting the view controllers and colors

Set the view controllers using `setViewControllers(_:)` method or by directly setting the `viewControllers` property

Customise the look by calling `setTabColors(backgroundColor:ballColor:tintColor:unselectedItemTintColor:barTintColor:)` method or simply setting the respective colors

```swift
class ViewController: SEViewController {

    override func viewDidLoad() {
      super.viewDidLoad()

      // set tab bar look collectively
      setTabColors(backgroundColor: UIColor.white, ballColor: UIColor.white, tintColor: UIColor.black, unselectedItemTintColor: UIColor.red, barTintColor: .clear)

      // set the view controllers
      setViewControllers(getViewControllers(), initialSelectedTabIndex: 0, animationType: .holeBall3)

    }

    private func getViewControllers() -> [UIViewController] {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        return [
            storyboard.instantiateViewController(withIdentifier: "firstVC"),
            storyboard.instantiateViewController(withIdentifier: "secondVC"),
            storyboard.instantiateViewController(withIdentifier: "thirdVC"),
            storyboard.instantiateViewController(withIdentifier: "fourthVC"),
            storyboard.instantiateViewController(withIdentifier: "fifthVC")
        ]
    }
}
```

### Providing the image for the tab bar

The child view controllers can conform to the `SETabItemProvider` protocol. Using `seTabImage` return a `UITabBarItem` for the view controller.

Alternatively you can set the `tabBarItem` property for the view controllers as you would do when using `UITabBarController`

```swift
class FirstViewController: UIViewController, SETabItemProvider {

    var seTabBarItem: UITabBarItem? {
        return UITabBarItem(title: "", image: UIImage(named: "first"), tag: 0)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}
```

### Setting the selected index programmatically

```swift
selectedTabIndex = 3
```

## Restrictions

- Max 5 Tabs

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Planned Improvements

- More `UITabBarController` behaviours
- Increasing support for number of tabs by introducing a **More** tab
- Badges
- Performance improvements

## Author

Srivinayak Chaitanya Eshwa<EMAIL_ADDRESS>
## License

SETabView is available under the MIT license. See the LICENSE file for more info.
SETabView uses the complete OrderedCollections code from [swift-collections](https://github.com/apple/swift-collections)

## Acknowledgement

[Animation Inspiration](https://www.behance.net/gallery/79473185/25-Animated-Tab-Bar-Designs-for-Inspiration)

[Icons](https://www.flaticon.com/authors/nikita-golubev)

repository: eshwavin/SETabView

repo_name: eshwavin/SETabView


text:
#Spatial Panner

##Description
Spatial Panner.

##Inputs
###source
An audio source to spatialize.

###position
Position.

###orientation
Orientation.

###coneInnerAngle
The **angle**, in **degrees**, of a cone _inside of which_ there will be no **volume reduction**.

###coneOuterAngle
The **angle**, in **degrees**, of a cone _outside of which_ the volume will be reduced by a **constant value**, defined by the **coneOuterGain** attribute.

###coneOuterGain
The amount of **volume reduction** _outside the cone_ defined by the **coneOuterAngle** attribute. Its default value is **0**, meaning that no sound can be heard.

###refDistance
The **reference distance** for reducing volume as the audio source moves further from the listener.

###maxDistance
A **value** representing the **maximum distance** between the audio source and the listener, after which the volume is not reduced any further.

###rolloff
A **value** describing how quickly the volume is reduced as the source moves away from the listener.

##Outputs
###source
A spatialized audio source

##Detail

repository: vizorvr/patches

repo_name: vizorvr/patches


text:
![](https://img.shields.io/badge/Microverse-blueviolet)

## Api-back
This is a REST API for managing database resources, in this case, there are 3 tables in the database - in this project, there are Users, Activs (a choice of dates for creating a track), and Tracks (tracked parameters such as duration, distance, repeаts of training exercises).
For security in the API token-based authentication is used
For the correct and structured display of JSON data, used the serializers.
This rails API is deployed to Heroku and assigned to work with the React mobile app where the UI will be.

### 'api-back' API documentation
I have added a new documentary for the API as the nice-to-have feature for my Final Capstone project.
This documentation is available here:
[Publish Documentation / POSTMAN](https://documenter.getpostman.com/view/13821409/TzRSgnE8#f2e32b87-f733-4bc0-a600-213056730823)

### Live Demo

[Live Demo](https://final-api-backend.herokuapp.com/) it only accessible for the [app-front](https://app-front.netlify.app/) Frontend

- ![User info JSON](./assets/images/user.png)
- ![Access-Token info JSON](./assets/images/user-login.png)
- ![Activ info JSON](./assets/images/activs.png)
- ![Track info JSON](./assets/images/tracks.png)

### Prerequisites

- Ruby v2.7.2
- Ruby on Rails v<IP_ADDRESS>
- Postgres: >=9.5
- Rspec
- Heroku

### Getting Started

To get a local copy up and running follow these simple example steps.
- `git clone https://github.com/Laguna1/api-back/tree/development`
- `cd api-back`

### Setup

Instal gems with:

- `bundle install`

Setup database with:
 - `rails db:create`
 - `rails db:migrate`

### Usage

Start server with:

- `rails s`

Open `http://localhost:3000/` in your browser.

### Run tests

- `rspec`

### Author

👤 **Oksana Petrova**

- GitHub: [@github/Laguna1](https://github.com/Laguna1)
- Linkedin: [linkedin/OksanaPetrova](https://www.linkedin.com/in/oksana-petrova/)
- Twitter: [@OksanaP48303303](https://twitter.com/OksanaP48303303)

### 🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the [issues page](https://github.com/Laguna1/api-back/issues)

### Show your support

Give a ⭐ if you like this project!

### Acknowledgments

You can access all the design info - color, typography, layouts - at this link:

### 📝 License
This project is [MIT](https://github.com/Laguna1/api-back/LICENSE) licensed.

branch_name: refs/heads/development


text:
## Oracle Analytics Cloud Workshop

Welcome to the Oracle Analytics Cloud workshop. This workshop will introduce you to the data visualization capabilities included in OAC. Data Visualization allows you to analyze data coming directly from a wide variety of sources. These can include Oracle SaaS applications (e.g. ERP Cloud), databases, local files, and 3rd party applications (e.g. Salesforce), amongst others. For the purpose of this workshop, we will be using Excel files.

## Acquire an Oracle Cloud Trial or Workshop Account

If you already have an account or an active trial, you may skip this section.

- Bookmark this page for future reference.

- Please click on the following link to create your Free Account and complete all the required steps to get your free Oracle Cloud Trial Account. When you complete the registration process you'll receive a $300 credit that will enable you to complete the lab for free. Additionally, you'll have 1000s of hours left over to continue to explore the Oracle Cloud.
    - Soon after requesting your trial, you will receive the following email. You will not be able to start Lab 100 until you have received it.

    ![](images/introduction/img_intro_1_1.png)

## Navigate to Lab 100

- You can see a list of Lab Guides by clicking on the Menu Icon in the upper left corner of the browser window. You are now ready to continue with Lab 100.

![](images/introduction/img_intro_2_1.png)

![](images/introduction/img_intro_2_2.png)

gha_language: PLSQL


text:
# NTC Templates

## Overview

Repository of TextFSM Templates for Network Devices, and Python wrapper for TextFSM's CliTable. TextFSM is a tool to help make parsing cli commands more manageable.

## Documentation

Full web-based HTML documentation for this library can be found over on the [NTC Templates Docs](https://ntc-templates.readthedocs.io) website:

- [User Guide](https://ntc-templates.readthedocs.io/en/latest/user/lib_overview/) - Overview, Using the library, Getting Started.
- [Administrator Guide](https://ntc-templates.readthedocs.io/en/latest/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the library.
- [Developer Guide](https://ntc-templates.readthedocs.io/en/latest/dev/contributing/) - Extending the library, Code Reference, Contribution Guide.
- [Release Notes / Changelog](https://ntc-templates.readthedocs.io/en/latest/admin/release_notes/).
- [Frequently Asked Questions](https://ntc-templates.readthedocs.io/en/latest/user/faq/).

### Contributing to the Docs

All the Markdown source for the library documentation can be found under the [docs](https://github.com/networktocode/ntc-templates/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient - clone the repository and edit away.

If you need to view the fully generated documentation site, you can build it with [mkdocs](https://www.mkdocs.org/). A container hosting the docs will be started using the invoke commands (details in the [Development Environment Guide](https://ntc-templates.readthedocs.io/en/latest/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). As your changes are saved, the live docs will be automatically reloaded.

Any PRs with fixes or improvements are very welcome!

## Questions

For any questions or comments, please check the [FAQ](https://ntc-templates.readthedocs.io/en/latest/user/faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#networktocode`), sign up [here](http://slack.networktocode.com/) if you don't have an account.

repository: networktocode/ntc-templates

gha_language: Python

gha_license_id: NOASSERTION

repo_name: networktocode/ntc-templates