text:
---
heading: Revel
seo: API Provider Setup | API provider setup | Revel | Cloud Elements API Docs
title: API Provider Setup
description: Setup tasks required to authenticate an element instance
layout: sidebarelementdoc
breadcrumbs: /docs/elements.html
elementId: 5125
elementKey: revel
apiKey: API Key #In OAuth2 this is what the provider calls the apiKey, like Client ID, Consumer Key, API Key, or just Key
apiSecret: API Secret #In OAuth2 this is what the provider calls the apiSecret, like Client Secret, Consumer Secret, API Secret, or just Secret
callbackURL: Callback #In OAuth2 this is what the provider calls the callbackURL, like Redirect URL, App URL, or just Callback URL
parent: Back to Element Guides
order: 5
---

# API Provider Setup

To authenticate a {{page.heading}} element instance you must register an app with {{page.heading}}. When you authenticate, use the **{{page.apiKey}}**, **{{page.apiSecret}}**, and **{{page.callbackURL}}** as the **API Key**, **API Secret**, and **Callback URL**.

To get your **{{page.apiKey}}** and **{{page.apiSecret}}**, contact the Revel Support team.

Next [authenticate an element instance with {{page.heading}}](authenticate.html).

repository: cloud-elements/devportal

repo_name: cloud-elements/devportal


text:
# Day 22 - 13 Oct 2020

* New instructor: Vasily

### Entity Relations Diagrams (ERD)

* Entity: an object that the data belongs to e.g. users
* Relation: a link showing how the data for two or more objects is related to each other

### Naming Conventions

* *snake_case* is used for tables and fields
* tables are generally named in plural form (this is a big debate among devs, but LHL goes with plural)

### Data Types

* VARCHAR
* TEXT
* INTEGER
* FLOAT
* BOOLEAN

### Vasily's Tips

* Use "SERIAL" Postgres data type to auto-increment IDs for primary keys
* For currency, use BIGINT and multiply by 100

### Relationship Types

* One-to-one: one record in table A related to one record in table B
* One-to-many: one record in Table A related to many records in table B
* Many-to-many: multiple records in Table A related to multiple records in Table B
  * In this case, we normally don't actually link two tables in a many-to-many relatinoship; we'll have a *bridge table* C that has one-to-many relationships with both A and B

### Normalization

* Way of defining databases so as to reduce data duplication and ensure integrity
* Based on the work of Edgar Cobb, it is done in stages e.g. First Normal Form (1NF), Second Normal Form (2NF), etc.

repository: sherwin-kwan/lighthouse-web-notes

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: sherwin-kwan/lighthouse-web-notes


text:
project_path: /web/_project.yaml
book_path: /web/shows/_book.yaml
description: Alex Sexton extolls the virtues of building your own components, David DeSandro teaches physics in 5 minutes, a crash course in Angular 2 forms, Notifications get an update, and inline JS debugging hits the Chrome DevTools.

{# wf_updated_on: 2015-06-16 #}
{# wf_published_on: 2015-06-01 #}
{# wf_youtube_id: u1RjWga2ks4 #}

# Episode 8 {: .page-title }

<div class="video-wrapper">
  <iframe class="devsite-embedded-youtube-video" data-video-id="u1RjWga2ks4"
          data-autohide="1" data-showinfo="0" frameborder="0" allowfullscreen>
  </iframe>
</div>

## In this Week's Episode

Alex Sexton extolls the virtues of building your own components, David DeSandro teaches physics in 5 minutes, a crash course in Angular 2 forms, Notifications get an update, and inline JS debugging hits the Chrome DevTools.

### YOUR OWN BOOTSTRAP
<http://rizzo.lonelyplanet.com/styleguide/ui-components/buttons>
<https://www.youtube.com/watch?v=Cs0n4YdMGac>
<https://www.youtube.com/watch?v=zSYo7m5kGHQ>
<http://getbootstrap.com/>
<https://github.com/reworkcss/rework>
<https://suitcss.github.io/>

### 5 MINUTE PHYSICS
<https://www.youtube.com/watch?v=n6FKT-KafRk>

## ANGULAR 2 FORMS
<https://www.youtube.com/watch?v=fRJIJU-K6o8>

### UPDATES TO NOTIFICATIONS
<http://updates.html5rocks.com/2015/05/Notifying-you-of-notificiation-changes>

### INLINE JS DEBUGGING
<https://umaar.com/dev-tips/41-inline-js-values/>
<https://umaar.com/dev-tips/>

### Demos
Silk
<http://weavesilk.com/>

Rainbow Rafia by Bailh
<http://codepen.io/cathbailh/full/MwbwYa>

Tile Adder by Ana Tudor
<http://codepen.io/thebabydino/full/waoGBO>

Loopy Loop by simon
<http://codepen.io/echosimon/full/gpwoRe>

## Thanks!

Let us know what you think on Twitter [#LazyWebShow](https://twitter.com/search?q=%23lazywebshow)

For more news on the Web, check out these resources:
- [JavaScript Weekly](http://javascriptweekly.com/){: .external }
- [Open Web Platform Daily](http://webplatformdaily.org/){: .external }
- [HTML5 Weekly](http://html5weekly.com/){: .external }

[Subscribe](https://goo.gl/mQyv5L) to the Google Developers Channel

repository: shanselman/WebFundamentals

repo_name: shanselman/WebFundamentals


text:
---
layout: article
title: "Weekly Word: Effusive"
date: 2009-02-23 19:31
cats: [english]
---
The adjective effusive means "overflowing", "extravagantly demonstrative", or "unrestrained or excessive in emotional expression". The verb form to effuse means "to pour out" or "to radiate".

Wikipedia, of course, has a page about effusion. In chemistry, it's "the process where individual molecules flow through a hole without collisions between molecules" (think of a deflating balloon).

The most common use of effusive would probably be to describe "effusive praise", either from expert critics or from effusive fanboys. The word also comes up a lot in articles about the Academy Awards, what with all those gushy actors sobbing over their Oscars.

license: MIT


text:
# Highlights

## changes with 0.7

- major refactor of geometry hierarchy
    - adds Multiline and Multipolygon classes
    - polygon vertices are double-nested in order to represent sub-polygons
    - only multipart geometries now contain a data attribute
- GeoJSON now attempts to project all data to geographical WGS84 coordinates as
  per https://datatracker.ietf.org/doc/draft-ietf-geojson/
    - `force_wgs84=False` can be set to avoid this behaviour
- multivertex geometries now use CoordString as a data backend, which should
  permit faster operations on the C side
- rename `Line.subsection` -> `Line.to_npoints`
- new R-tree implementation in C
- `projected` keyword argument added to `Point.distance`, `Point.azimuth`, and
  `Point.walk` to control whether geodetic or planar algorithms are used with
  the CRS is not geographical
- replaced polygon membership testing algorithm with a winding number-based test
- implemented fallback algorithm for polygon membership testing in polar regions

## changes with 0.6

- implement raster bands
- redesign raster interface and introduce [:,:] array syntax rather than values
  attribute
- replace pyshp with OGR
- deprecate some CRS classes in favour of Proj4-backed CRS
- nodata improvements for raster grids

## changes with 0.5.3

- R-tree implementation for indexing multipoint geometries
- bounding box caching for performance

## changes with 0.5

- python implementation of geodetic solutions on spheres and ellipsoids
- geodetically-correct area calculations with GeographicalCRS
- more complete geojson interface supporting nested GeometryCollections
- no longer supporting pure-Python mode (C-extensions required)
- `RegularGrid.clip` performance improvements
- added `Multipoint.convex_hull()`, returning a Polygon
- CRS objects can often report WKT and proj.4 strings (mostly depends on osgeo)
- continuing to improve CRS support in GeoJSON driver
- automatic CRS support for shapefiles
- Multipoint now uses quadtree internally for certain methods

## Changes with 0.4

- renamed `vector.guppy` -> `vector.geometry`
- `NODATA` support for raster grids
- raster grid clipping
- `gtiffread` based on GDAL
- refactor `karta.crs` with a simpler interface
- affine transforms of vector geometries

## Changes with 0.3

- `GeoJSONReader` simplifications
- implement `__geo_interface__`

## Changes with 0.2 series

- quadtrees for point data
- implemented `karta.crs` to handle coordinate reference systems
- shapefile IO improvements

repository: MachineAi/karta

repo_name: MachineAi/karta


text:
# Password Generator
This is a password generator made in Html, CSS and JavaScript.

## Contents

The password generator in JavaScript is composed of 3 pages, index.html, style.css and script.js.

## User Story

A user needs to create a password between 8 and 128 characters. These characters can be Upper or lower case, numbers & symbols, adding complexity to the password. The password should be random every time the generate password button is pressed.

## Built With

* [VScode](https://code.visualstudio.com/) - The editor of choice
* [Notepad++](https://notepad-plus-plus.org/) - My second editor
* [Gitbash](https://gitforwindows.org/) - What would we do without our bash?

#### Initial interface

![image](/app_default.JPG)

#### Password Generated

![image](/password_generated.JPG)

### Licence

This project is licensed under the MIT License - see the Link to the LICENCE file for details

### Link to the App
Link to the Password Generator

## Authors

* **John Merchan** - *completed all work*

## Acknowledgments

* To KiteRunner2, childovhurin and a few others.
* either their approach to the task or the clean code, were very valuable.

repository: johnnyboysydney/PasswordGenerator

repo_name: johnnyboysydney/PasswordGenerator


text:
# Bot Example

Example for Trustnote chatbot.

## Requirements

* node.js 6+

## Install
```
npm install
```
## Run
```
node start.js
```
Note the line that it prints on start-up might like this one:
```
====== my pairing code<EMAIL_ADDRESS>```

Copy the pairing code to your Trustnote wallet: Chat tab, Add a new device, Accept invitation, paste the code, ready to chat.

repository: ianhhhhhhhhe/trustnote-bot-example

repo_name: ianhhhhhhhhe/trustnote-bot-example


text:
# Scala.js typings for ml-classify-text

Typings are for version 2.0

## Library description:
Text classification using n-grams and cosine similarity

|                    |                 |
| ------------------ | :-------------: |
| Full name          | ml-classify-text |
| Keywords           | text classification, classification, classify, classifier, machine learning, machine, learning, ai, artificial intelligence, artificial, intelligence, n-gram, n-grams, cosine similarity, cosine, similarity, confidence, predict, prediction, model, train |
| # releases         | 4 |
| # dependents       | 0.0 |
| # downloads        | 237.0 |
| # stars            | 78.0 |

## Links
- [Homepage](https://github.com/andreekeberg/ml-classify-text-js)
- [Bugs](https://github.com/andreekeberg/ml-classify-text-js/issues)
- [Repository](https://github.com/andreekeberg/ml-classify-text-js)
- [Npm](https://www.npmjs.com/package/ml-classify-text)

## Note
This library has been generated from typescript code from [DefinitelyTyped](https://definitelytyped.org).

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.

repository: ScalablyTyped/Distribution

gha_license_id: MIT

repo_name: ScalablyTyped/Distribution


text:
z## Week 02: More Advanced Python

### Readings
 1. Handout (by Monday)
 2. Chapter 4, _Physical Modeling_ (by Monday)
 3. Sections 6.1 – 6.4, _Physical Modeling_ (by Wednesday)

### Weekly Problem 01: HIV Lab

Read the handout prior to class on Friday. Try to understand the derivation
of Equation 4. Before you begin, derive Equation 4 from the reading and
explain in detail your reasoning for each step of the derivation.

Next, complete Problem 5.1 (First Computer Lab: HIV Example) in Physical
Modeling. In addition, answer the following questions:

 1. What were the key assumptions made in the derivation and in your
    approach to solving the problem that made the problem tractable?
 2. What would be the consequences of relaxing the assumptions listed
    in question 1? How might your approach to solving the problem change?
 3. How did the two limiting cases help simplify the problem?

Please upload your answers to these questions and your code to GitHub
by Friday, 30 August 2019.

~~**_Challenge_**: Write a function to compute the viral load for a given set
of parameters (`A`, `B`, `alpha`, `beta`). Produce figures for assignment
part b using your function.~~

### Exercise 04: Make Your (Coding) Life Easier

Write a function to compute the viral load for HIV after administering
an antiretroviral drug (Problem 5.1 in text; Week 1, Problem 1). The
function should accept values for `A`, `B`, `alpha`, `beta`, and `time`
as input and return the viral load, V(t).

Using your function, plot the function for a different combinations of
`A` and `alpha` (fix `B` and `beta` as you did in Problem 5.1). Add axis
labels, a plot title, and a legend with unique labels for each plotted
curve. Save the figure as a PDF or other image file, add it to a Word
document, and describe how adjusting `A` and `alpha` change the function's
properties. Be sure to reference your figure and describe each change
in detail.

Upload your write up and code to GitHub.

### Weekly Problem 02: Projectile Motion
Imagine launching a ball with some device (a cannon, a spring, your arm)
that gives the ball an initial velocity, **_v_**, at some angle with respect
to the ground. Write a function that integrates the 2D equations of motion
to compute the ball's trajectory and its velocity over time. Assume that
air exerts a drag force on the ball along a given direction of motion that
is proportional to the object's velocity squared, i.e.,

![equation](https://latex.codecogs.com/gif.latex?%5Clarge%20F_%7BD%2C%5Chat%7B%5Cj%7D%7D%20%3D%20c%5Ccdot%20v_%7B%5Chat%7B%5Cj%7D%7D%5E2)

Your function should accept the ball's mass, initial position, velocity, and launch
angle as input. The drag coefficient, time step size, and acceleration
due to gravity are optional inputs. After computing the trajectory, the
function should return the _x_ and _y_ positions, the _x_ and _y_ velocities,
and the time.

With your function, you should
 1. Verify your code works properly by computing the trajectory for some
    initial launch velocity and angle, but without air resistance. Find
    the total distance travelled and total time of flight and compare with
    an analytical solution (i.e., pencil & paper).
 2. Predict what will happen when you add air resistance.
 3. Compare your results without drag to those with drag (i.e., air
    resistance). A reasonble value for the drag coefficient in the above
    equation for a sphere moving through air is 2 x 10<sup>–3</sup>
    kg/m. Plot the ball's height vs distance travelled for each case.
 4. Write up your results and describe the effect of air resistance.
 5. Find the terminal velocity of the ball [hint: you may need to change
    your initial launch conditions].
 6. Play around with the inputs. Change the acceleration due to gravity.
    Explore your simulation and perform an experiment that you find interesting.
 7. Try to break your code and describe what you had to do to break it
    (i.e., without changing your code, give it input that you think will
    return a non-physical answer).

Write up your results (including plots) and push your code and paper to
to GitHub.

path: /Week 02/README.md


text:
# svelte hitch tracker app

This is a frontend that may or may not eventually turn into a full application for tracking charity hitchhikes.

## Get started

Install the dependencies...

```bash
npm install
```

...then start the [Rollup dev server](https://rollupjs.org):

```bash
npm run dev
```

By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host <IP_ADDRESS>`.

## Deployment :rocket:
(we'll get there eventually)

## License
[MIT](https://choosealicense.com/licenses/mit/)


text:
# 0.6.0 - 2016-11-29

- Upgrade to Mateo 0.6.0, which supports more accurate sourcemaps and action schema handling.
- Tweaks to the `response-error-body` rule to prevent false positives.

# 0.5.0 - 2016-11-17

- Expose parser annotations as linter issues.
- Use the new Mateo promise interface to simplify test utilities.

# 0.4.0 - 2016-11-16

- Consume new Mateo source maps. Adds support for [Hercule](https://github.com/jamesramsay/hercule)-style
  transclusion when using API Blueprint.
- Ensure tags with no name get ignored. These are artifacts of the input
  serialization format (API Elements, currently).

# 0.3.0 - 2016-11-12

- Add tests for remaining rules and get better coverage for a few cases,
  such as URI template capitalization for actions which override the URI.
- Fix a bug in the URI template capitalization rule where the current and
  expected values where incorrectly compared, causing erroneous issues to be
  returned.

# 0.2.0 - 2016-11-10

- Add test coverage for most rules.
- Fixed a couple minor issues with rule edge cases.

# 0.1.0 - 2016-11-05

- Initial release.

repository: jwalsh/apilint

gha_language: JavaScript

repo_name: jwalsh/apilint


text:
# coc-highlight

Provide filetype irrelevant highlights to [coc.nvim](https://github.com/neoclide/coc.nvim),
including document highlight (highlight of current document symbol) and color
highlights.

<img width="480" alt="Screen Shot 2019-07-01 at 9 11 33 AM" src="https://user-images.githubusercontent.com/251450/60405074-979ae080-9be0-11e9-8039-b9a48fd8b5ad.png">

**Important** the implementation from version 2.0.0 have changed from language
server to worker threads, and only changed lines are calculated for colors.

## Install

In your vim/neovim, run command:

```
:CocInstall coc-highlight
```

## Features

- Highlight the same word symbols of word under cursor.
- Add color highlights to buffers when enabled.

## Usage

To enable highlight current symbol on `CursorHold`, add:

```vim
autocmd CursorHold * silent call CocActionAsync('highlight')
```

to your `.vimrc` or use the [coc_current_word plugin](https://github.com/IngoMeyer441/coc_current_word) which provides
configurable delayed highlighting independently from the user's `updatetime` setting.

To add colors support for all filetypes, use:

```json
"colors.enable": true,
```

to your `settings.json`.

To pick a different color, use command:

```
:call CocAction('pickColor')
```

**Note:** only works on Mac or have python gtk module installed.

To pick a different color presentation, use command:

```
:call CocAction('colorPresentation')
```

## Options

- `highlight.trace`: Trace level for colors highlight. default: `"messages"`
  Valid options: ["off","messages","verbose"]
- `highlight.disableLanguages`: List of filetypes to ignore. default: `[]`
- `highlight.document.enable`: Set to false disable document highlight of current symbol, reload coc.nvim required on change, default: `true`
- `highlight.colors.enable`: Set to false to disable color highlight, reload coc.nvim required on change, default: `true`
- `highlight.colorNames.enable`: Set to false to disable highlight of color names, default: `true`

## F.A.Q

**Q:** Why color highlight is not shown on my vim?

**A:** For terminal vim, you have to enable 24-bit RGB color by `set termguicolors` and make sure your terminal support true colors. To make sure the
highlight is not disabled, enable verbose output by `"highlight.trace": "verbose"` in configuration file and checkout the output by `:CocCommand workspace.showOutput highlight`.

**Q:** How to change highlight of the current symbol.

**A:** All you need is overwrite the highlight group, checkout `:h coc-highlights`

## License

MIT

repository: neoclide/coc-highlight

gha_language: TypeScript

repo_name: neoclide/coc-highlight


text:
---
name: Program request
about: Suggest an idea for a new program
title: "[New Program Title]"
labels: new program
assignees: RARM

---

**Is the program you are requesting related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the program you'd like**
A clear and concise description of what you want the program to do.

**Additional context**
Add any other context or screenshots about the program request here.

license: Unlicense

repository: RARM/Codes-Collection

repo_name: RARM/Codes-Collection


text:
# Verdant
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

🌱🌿🌱 Verdant is a JupyterLab extension that automatically records history of all experiments you run in a Jupyter notebook, and stores them in a tidy .ipyhistory JSON file designed to be work alongside and compliment any other version control you use, like SVN or Git. Verdant also visualizes history of individual cells, code snippets, markdown, and outputs for you, for quick checks and references as you work.

[[Demo preview video]](https://www.youtube.com/watch?v=4v_mHIJdZq0&t=4s) [![Verdant demo](https://github.com/mkery/Verdant/blob/master/design/verdant_run.jpg?raw=true)](https://www.youtube.com/watch?v=4v_mHIJdZq0&t=4s)
Figure description:
> The history tab opens the sidebar for Verdant containing three tabs: Activity (A), Artifacts (B), and Search
(C). The Activity tab, shown open here, displays a list of events. A date (D) can be opened or collapsed to see what
happened that day. Each row shows a version of the notebook (e.g. version #53) with a text description and visual minimap.
Thee minimap shows cells added in green (see G) and deleted in red (F). In (E), a cell was edited and run (in blue), and the
following cells were run but remained the same (in grey). The user can open any version (e.g., #53, H) in a ghost
notebook tab for quick reference.

For design discussion and the research behind this check out our [paper](https://marybethkery.com/projects/Verdant/Towards_effective_foraging_by_data_scientists.pdf):

> Mary Beth Kery, Bonnie E. John, Patrick O’Flaherty, Amber Horvath, and
> Brad A. Myers. 2019. Towards Effective Foraging by Data Scientists to Find
> Past Analysis Choices. In Proceedings of ACM SIGCHI, Glasgow, UK, May
> 2019 (CHI’19), 11 pages. DOI: 10.475/123 4

## Prerequisites

* JupyterLab

## Install

For a development install, do the following in the repository directory:

(_These first server extension steps are optional because AST parsing is currently (temporarily!) disabled in Verdant_)
```bash
pip install lilgit-parser
jupyter serverextension enable --py lilgit_parser
jupyter serverextension list
```
This should ensure that the server-extension parser part of Verdant is installed.

Next:

```bash
yarn
yarn build
yarn start
```

The last line installs Verdant as an extension and builds JupyterLab. It may take a minute. Upon a successful build, Jupyter Lab will launch in your browser window.

If you make modifications to the Verdant source code, you'll need to rebuild the package and the JupyterLab app:

```bash
yarn build
yarn start
```

If you plan on making lots of edits to Verdant, extension building is easier if you use:

```bash
jupyter lab --watch
```

and then each time you make a change, you'll only have to re-run:

```bash
yarn build
```

## Acknowledgements
This research has been funded by Bloomberg L.P. and has been conducted at the Bloomberg L.P. and at the [Natural Programming Group](https://www.cs.cmu.edu/~NatProg/) at the [Human-Computer Interaction Institute](https://hcii.cmu.edu/) at Carnegie Mellon University. Thank you to the [JupyterLab project](https://github.com/jupyterlab/jupyterlab) and also to all our awesome study participants for volunteering early design feedback!


text:
# Non-embedded

This implementation is used for testing on the PC.
It contains some basic example-programs to get you started.

It defines basic syscalls for enabling (code 0) and disabling (code 1) interactive execution of the program.
This can be used as a basic example of an implementation.

repository: Piill/pico-machine

repo_name: Piill/pico-machine


text:
Social App
==========

[![Build Status](https://github.com/rafaeltoledo/social-app/workflows/CI/badge.svg)](https://github.com/rafaeltoledo/social-app/actions)
[![Coverage Status](https://coveralls.io/repos/github/rafaeltoledo/social-app/badge.svg?branch=develop)](https://coveralls.io/github/rafaeltoledo/social-app?branch=develop)
[![Codebeat Badge](https://codebeat.co/badges/8a7ab7b6-a345-4029-bc9c-206c6b8c31ed)](https://codebeat.co/projects/github-com-rafaeltoledo-social-app-develop)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3d45f0b680d74b1bba5be7c0af3b45f3)](https://www.codacy.com/app/rafaeltoledo/social-app)

License
=======

    Copyright 2021 Rafael Toledo

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

repository: rafaeltoledo/social-app

branch_name: refs/heads/develop

gha_language: Kotlin

repo_name: rafaeltoledo/social-app


text:
## Registering provider

Make sure to register the provider before you can make use of throttle
middleware. The providers are registered inside `start/app.js` file.

```js
const providers = [
  'adonis-throttle/providers/ThrottleProvider'
]
```

You can register the Throttle facade in the aliases key of `start/app.js` file
if you like.

```js
const aliases = {
  Throttle: 'Adonis/Addons/Throttle'
}
```

## Registering middleware

The next thing you should do is register the global middleware inside
`start/kernel.js` file.

```js
const nameMiddleware = {
  throttle: 'Adonis/Middleware/Throttle'
}
```

## Using throttle

Use the middleware to limit request for a given route.

```js
Route.post('login', 'Auth/LoginController.postLogin').middleware('throttle')
```

To limit number of requests per minute, specify the maximum limit like below.

```js
// Limit to 10 requests per minute
Route.post('login', 'Auth/LoginController.postLogin').middleware('throttle:10')
```

To limit number of requests per specified timeframe, specify number of seconds
after the request limit.

```js
// Limit to 10 requests per 120 seconds
Route.post('login', 'Auth/LoginController.postLogin').middleware('throttle:10,120')
```

If the number of requests exceeds the maximum limit, it will return 429
TOO MANY REQUESTS error.

### Advanced usage

You can also use Throttle class directly from inside your controllers.

```js
const Throttle = use('Throttle')

class TestController {
  run({request, response}) {
    const currentUser = request.auth.getCurrentUser()

    // Throttle requests to 10 per minute by each user
    Throttle.resource(currentUser.id, 10, 60)

    if(!Throttle.attempt()) {
      return response.send('too many requests')
    }

    response.send('secret')
  }
}
```

## Config

You can find the configuration inside `config/throttle.js` file. Feel free to
tweak it as per your needs.

## Environment Variables

The config file `config/throttle.js` reference an environment variable called
`THROTTLE_DRIVER` defined in `.env` file.

Make sure to set the value for production and development.

```text
THROTTLE_DRIVER=memory
```


text:
# The T1 PHP SDK Cookbook

The SDK Cookbook is a continuously growing collection of specific recipes that explain how to correctly solve the most recurrent problems that developers face against the T1 API.

## Management

## Reporting

- [How to get combined reports for event & data pixels for a collection of pixel IDs](reporting-combined-reports-event-data-pixels-collection-pixel-ids.md)


text:
# Cloudant/Heroku Example

An example of using Heroku and Cloudant. It collects tweets for the "couchdb"
search term using Twitter"s API, storing them in the "heroku-example" database.

## Getting Started

These are the install instructions.

1. Clone this repo onto your computer:

`git clone https://github.com/cloudant/cloudantHerokuExample.git`

2. Make sure you have set up Heroku properly. See
https://devcenter.heroku.com/articles/quickstart

3. Install the Cloudant add-on, specifying the free version (basic):

`heroku addons:add cloudant:oxygen`

4. Create the app on your Heroku account - you will be using the provided
Procfile:

`heroku create`

5. Deploy your code to Heroku:

`git push heroku master`

6. Scale up the worker process:

`heroku ps:scale worker=1`

7. Log into the Cloudant dashboard and view the "heroku-example" database. You
will see the stored tweets (may take a few minutes to show up depending on the
Twitter Search API and latency) and can write views against them.

## Contributing

This project uses grunt (https://github.com/cowboy/grunt) for development. It
will make sure that any modifications you make are lint free and pass any
tests.

## License
Copyright (c) 2012 Cloudant
Licensed under the APACHE-2.0 license.

repository: nayefmuhiar/cloudantHerokuExample

repo_name: nayefmuhiar/cloudantHerokuExample


text:
# ODUACM.github.io
---
The splash page for ODUACM. Describes the club, introduces the officers,
provides links to social media pages.

### Author(s) of the README
#### [Sarah Dudley](https://github.com/SarahDudley)

gha_language: CSS


text:
# Gatsby Project

api_endpoint = http://nikeplus.nike.com/nikeplus/v1/services;
(not working)

npm_repo = https://www.npmjs.com/package/node-nikerunclub;

## Building a Blog With Gatsby js
1. Install the Gatsby CLI
    `npm install -g gatsby-cli`
1. Create a new site
    `gatsby new gatsby-site`
1. Change directories into site folder
    `cd gatsby-site`
1. Start the development server
    `gatsby develop`
    Your gatsby site will be ready, you can access the gatsby development environment at localhost:8000 by default.
    GraphiQL will serve on http://localhost:8000/___graphql
    You can edit JavaScript pages in the src/pages and the changes will be reloaded automatically in the browser.

1. Create a production build
    `gatsby build`
    With the build command, Gatsby will perform production build for your site,
    which in other words means generating static HTML pages.

1. Serve the production build locally
    `gatsby serve`
    Lastly, with the shell command, Gatsby will start local HTML server for testing your build site

---
## Project Steps
1. To run the project
`gatsby develop`

2. To add sass
`npm install --save node-sass gatsby-plugin-sass`
change layout.css to layout.scss and all related imports

3. To read data from markdowmn files
    1. (if not already present in config)
       `npm install --save gatsby-source-filesystem`
    1. Make related changes in plugin options.
    1. We use remark to transform markdown files
       `npm install --save gatsby-transformer-remark`

---

## Notes

#### gatsby-transformer-remark
* This Plugin recognizes files with the following extensions as Markdown. md, markdown
* Each Markdown file is parsed into a node of type MarkdownRemark.
* All frontmatter fields are converted into GraphQL fields.
* A sample GraphQL query to get MarkdownRemark nodes
`
{
  allMarkdownRemark {
    edges {
      node {
        html
        headings {
          depth
          value
        }
        frontmatter {
          # Assumes you're using title in your frontmatter.
          title
        }
      }
    }
  }
}
`
* Graphql query to get markdown files in graphiql
    `
    query MyQuery {
    allMarkdownRemark {
        edges {
        node {
            html
            frontmatter {
            path
            title
            }
        }
        }
    }
    }
    `

#### Example of markdown file with frontmatter
    ---
    path: '/first-post'
    title: 'My First Blog Post'
    ---

    # First Blog Post

    content of the first blog post

#### Set inner HTML in react
`<div dangerouslySetInnerHTML= {{__html:data.markdownRemark.html}}/>`

repository: Poojavpatel/nrc-profile-site

repo_name: Poojavpatel/nrc-profile-site


text:
readme.md
# IoT Edge Configuration Management

This project provides an approach to configure workloads on a fleet of IoT Edge. A workload is one or more Docker containers running as IoT Edge Modules.

The goal is to provide both guidance as well as a sample implementation for deploying workloads to IoT Edge. There are few issues with the way the deployment is getting submitted and needs to be remediated, as well the integration with the database for PowerApps currently is manual.But the code provides a general idea that can be improved and built on.

## Table of contents
* [Engage and contribute](#engage-and-contribute)
* [Solution goals](#solution-goals)
* [Solution architecture and components](#solution-architecture-and-components)
* [PowerApps sample](#powerapps-sample)

## Engage and contribute
* Ask questions about developing for Azure IoT Edge on [Stack Overflow](https://stackoverflow.com/questions/tagged/azure-iot-edge) using the **azure-iot-edge** tag.

* Search for [known issues](https://github.com/AzureIoTGBB/iot-edge-configuration-manager/issues) or file a [new issue](https://github.com/AzureIoTGBB/iot-edge-configuration-manager/issues/new) if you find something broken in this project.

* Learn how you can contribute to this project [here](./documentation/contributing.md).

* This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode<EMAIL_ADDRESS>with any additional questions or comments.

## Solution goals

The idea for this solution stems from a customer need to deploy varying workloads to a fleet of IoT Edge at various locations (retail stores/factories/oil wells/etc.). Each IoT Edge runs workloads specific to the location.

For example, consider a retail store with multiple IoT devices such as Chillers, Refrigerators, HVAC, Cameras, Safe and other devices connected to IoT Edge. Each of these IoT devices has one or more modules in IoT Edge with location specific configurations such as IP address of the device, environment variables and desired properties.

As the number of locations increases and the variability in number of devices per location, such as number of camera, configuration for each camera (IP address, camera type, etc.), the management and deployment of the workloads will tend to get complex and does not readily fit into IoT edge [Automatic Deployment for single devices or at scale](https://docs.microsoft.com/en-us/azure/iot-edge/module-deployment-monitoring). Considering each IoT Edge is different and has variability in configurations by workload, a single deployment manifest for the entire fleet will not meet the needs of all Edges.

This solution demonstrates the ability to configure heterogeneous edge workloads for needs of the kind illustrated in the following picture:![Multi Module Deployment](./media/multimodulesetup.png)
As described in the picture above, while each of the four IoT Edge is connected to the same IoT hub, each Edge has varying workloads and location specific information.

This solution uses a configuration store to apply the appropriate location specific configuration and generates an IoT Edge manifest for each of the workload and keep it specific to the location.

## Solution architecture and components

![REST API Deployment](./media/restapiflow.png)
The solution is implemented as a REST API in Azure Functions, and accepts a JSON document that defines the modules, desired properties and routes [MDR] for each of the modules that constitutes the workload. The REST API uses [Azure IoT Hub Service .NET SDK](https://github.com/Azure/azure-iot-sdk-csharp) to interact with Azure IoT Hub for deployment to IoT Edge. [CosmosDB](https://docs.microsoft.com/en-us/azure/cosmos-db/introduction) is used as the data store for Edge Manifest & Module definition.

The REST API is the backend interface that can be fronted with any type of UX. In this repo we have a sample PowerApps App as the UX interface to define modules, desired properties and Routes [MDR].
![PowerApps Sample](./media/powerappsflow.png)

## Solution architecture

The solution consists of the following components:

1. CosmosDB Database as the configuraton store
2. Azure Functions for hosting REST API
3. PowerApps as a sample UX

## Understanding the Solution
At the core, an IoT Edge workload is represented as an IoT Edge manifest. The Manifest includes the following sections
1. Modules
2. Desired Properties
3. Routes

This solution assembles the sections to generate an IoT Edge Manifest specific to the workload and deploy it to IoT Edge.

Here is an example walk-thru of a solution.

Scenario:
Consider a retail location with
1. A chiller accessible over IP @ <IP_ADDRESS>
2. A freezer accessible over IP @ <IP_ADDRESS>
3. A temp analyzer that reacts to temp readings from Chiller, Freezer

![A Sample Deployment](./media/SampleDeployment.png)

The workload comprises of the following 3 IoT Edge Modules (docker containers) namely:
1. Chiller (acrcontainers.azurecr.io/chiller:v1)
2. Freezer (acrcontainers.azurecr.io/freezer:v2)
3. Temp Analyzer (acrcontainers.azurecr.io/tempanalyzer:v1)

Each of these Modules has a set of Desired Properties and Routes that define the workload configuration on IoTEdge.

The input to REST API to generate IoT Edge manifest for this workload is as follows:

```json
[
  {
    "ModuleInstanceName": "BackroomChiller",
    "Module": "chiller",
    "DesiredProperties": "{\"endPoint\": \"<IP_ADDRESS>\",\"armEndpoint\": \"https://chiller.azurewebsites.net/\",\"diagnosticsEventsOutputName\": \"chillerDiagnostics\",\"operationalEventsOutputName\": \"chillerOperational\",\"logLevel\": \"Information\",\"logCategories\": \"Application,Events\",\"telemetryOptOut\": false}",
    "Routes": [
      {
        "RouteInstanceName": "BackroomChillerToTempAnalyzer",
        "FromModule": "BackroomChiller",
        "FromChannel": "tempreadings",
        "ToModule": "TempAnalyzer",
        "ToChannel": "chillertemp",
        "ToIoThub": false
      },
      {
        "RouteInstanceName": "BackroomChillerToIoTHub",
        "FromModule": "BackroomChiller",
        "FromChannel": "tempdiagnostics",
        "ToModule": "",
        "ToChannel": "",
        "ToIoThub": true
      }
    ]
  },
  {
    "ModuleInstanceName": "frontfreezer",
    "Module": "freezer",
    "DesiredProperties": "{\"endPoint\":\"<IP_ADDRESS>\"}",
    "Routes": [
      {
        "RouteInstanceName": "frontfreezerToTempAnalyzer",
        "FromModule": "frontfreezer",
        "FromChannel": "tempreadings",
        "ToModule": "TempAnalyzer",
        "ToChannel": "freezertemp",
        "ToIoThub": false
      }
    ]
  },
  {
    "ModuleInstanceName": "tempAnalyzer",
    "Module": "tempAnalyzer",
    "DesiredProperties": "{\"chillerThreshold\":\"43\", \"freezerThreshold\":\"32\"}",
    "Routes": [
      {
        "RouteInstanceName": "tempAnalyzerToIoTHub",
        "FromModule": "tempanalyzer",
        "FromChannel": "*",
        "ToModule": "",
        "ToChannel": "",
        "ToIoThub": true
      }
    ]
  }
]
```

As you can see in this workload definition, there is workload specific configuration applied as desired properties. Imagine having a core configuration management database across the organization that houses all the location specific information that can be applied at the time of IoT Edge manifest generation, thereby supporting the need for location specific configurations for IoT Edge workloads.

## PowerApps sample
As an example in this repository we have put together a sample PowerApp that assists the operator in assembling the workload and deploying it to IoTedge. In this case a PowerApps collects the configuration and integrates using PowerAutomate with the REST api to deploy the workload.

![PowerApps UX](./media/powerappsux.png)

## Deploying the Solution
The solution is deployed in 2 parts
1. REST API - An installation bash script [setup.sh](./Install/setup.sh) creates all the resources required for depeloying Azure services frequired for the solution. The Azure resources created include
    - Resource Group
    - Function App
    - CosmosDB Account, Database and Containers

The install script expects a local file with the name "install.settings.json". This file contains the various input values to create the Azure resources. Please update this file with appropriate values prior to executing the script.
  ```
  {
    "RESOURCE_GROUP":"<NAME OF RESOURCE GROUP>",
    "FUNCTIONAPP_NAME":"<NAME OF FUNCTION APP>",
    "FUNCTIONAPP_STORAGE_ACCOUNT_NAME":"<NAME OF STORAGE ACCT FOR FUNCTION APP>",
    "LOCATION":"<LOCATION>",
    "APPINSIGHTS_NAME":"<NAME OF APPINSIGHT FOR FUNCTIONAPP",
    "IOTHUB_NAME":"<NAME OF IOT HUB>",
    "IOTHUB_CONN_STRING_CSHARP":"<IOTHUBOWNER CONNECTION STRING>",
    "ACR":"<NAME OF AZURE CONTAINER REGISTRY>",
    "ACRUSER":"<AZURE CONTAINER REGISTRY USER NAME>",
    "ACRPASSWORD":"<AZURE CONTAINER REGISTRY USER PASSWORD>",
    "COSMOSACCOUNTNAME":"<NAME OF COSMOS ACCOUNT>",
    "COSMOSDBNAME":"<NAME COSMOS DATABASE>",
    "COSMOSCONTAINER_ALLMODULES":"allmodules",
    "COSMOSCONTAINER_MANIFEST":"manifest"
}
  ```
The install script can be eexecuted from Azure Cloud Shell or from any BASH shell. The installation script requires the following files
* setup.sh
* install.settings.json (the inputs)
* idxpolicy.json (cosmosdb index policy)
* manifest.json (IoT Edge manifest template)
* SimulatedTempSensor.json (Sample IoTEdge Module definition)

2. PowerApp solution installation - Steps to [install](./Install/PowerAppInstallationSteps.pptx)
    - [PowerApp Install Solution Package](./Install/PowerTools4IoTEdge_1_0_0_11.zip)

## Using the PowerApp
After successful deployment of Azure Function (IoTEdgeCTL), PowerAppOperator4IoTEdge and PowerAutomate2IoTEdgeCTL, its time to use the PowerApp.

In the PowerApp, we need to setup the following item
a. Edge
b. Modules
c. Edge Modules
d. Edge Routes

### Edge Definition
In PowerApp

branch_name: refs/heads/main


text:
#Barcode JS: Shopify Order Printer App

* [Before you get started](#before-you-get-started)
* [Setup instructions](#setup-instructions)
* [Options](#options)
* [Acknowledgments](#acknowledgments)

This is a JavaScript solution to have Shopify's [Order Printer app](https://apps.shopify.com/order-printer)
display product variant barcodes in the following formats:

* [CODE39](http://en.wikipedia.org/wiki/Code_39)
* [CODE128](http://en.wikipedia.org/wiki/Code_128)
* [EAN/UPC](http://en.wikipedia.org/wiki/International_Article_Number)

Below is a screenshot of a basic template using this barcode solution:

![Barcode JS in action](http://snapify.shopify.com/12-14-sbn1g-fftu5.png)

##Before you get started

These instructions assume you have already entered barcodes for your product variants.  Its not
necessary that all your products have this field filled out, but that is the piece of data these
instructions will target.  To assign a barcode to a variant, head to that product's page from your store's
dashboard and Edit the individual variants.

![Variant editing screenshot](http://snapify.shopify.com/11-56-8bsrm-3mpqq.png)

###Considerations

This javascript solution can turn a barcode string into a scannable format, provided that the string you
are converting can create a **valid barcode**.

Strings can be converted into the CODE128 fairly easily.
However, CODE39 will not accept lowercase letters - so if you want to use this format, you will have to enter the
variant's barcode appropriately.  EAN/UPC format will only accept numbers, and the string must follow a certain
convention.

###Other uses
You aren't limited to using this javascript solution on just variant barcodes, but there are limitations
as to what strings can be turned into different barcode formats.

##Setup instructions

###Get the barcode.js file

Download this [barcode.js](https://rawgit.com/NathanPJF/shopify-barcode-js/master/barcode.js.zip) file and upload it to your Shopify store's *Files directory*.  It is strongly recommended that
it is uploaded in the store Files directory as opposed to an individual theme's Assets directory.

Make note of the file's URL as you will need to copy/paste this later.

![File URL screenshot](http://snapify.shopify.com/11-37-um2o2-g46yz.png)

###Create a new template in Order Printer

*Note*: The following will only present the HTML and liquid text needed to display barcodes.  If you would like more information
on your template, such as shipping information or product photos, I recommend you copy and paste the code from a template
you already like.

Add a template to your Order Printer app and title it.  In the first couple lines, add the following lines of code:

```
<script>
[
 '//code.jquery.com/jquery-1.11.2.min.js',
 'url-of-uploaded-barcode.js'
].forEach(function(src) {
  var script = document.createElement('script');
  script.src = src;
  script.async = false;
  document.head.appendChild(script);
});

</script>
```

Replace the text "url-of-uploaded-barcode.js" with the URL of the barcode.js file you uploaded to your Files directory.  The
URL must remain within the single-quotes.

Later in your template, make a liquid reference to the product variant barcode within a [line_item](http://docs.shopify.com/themes/liquid-documentation/objects/line_item) forloop.  Below is the basic mark-up:

```
{% for line_item in line_items %}
  <p>{{ line_item.name }}</p>
  {% unless line_item.variant.barcode == blank %}
    <p class="barcode-section"> <canvas class="item_barcode" data-barcode="{{ line_item.variant.barcode }}"></canvas></p>
  {% else %}
    <em>No barcode for this item</em>
  {% endunless %}
<hr>
{% endfor %}
```

###Required markup

The barcode must have the attributes `class="item_barcode" data-barcode="{{ line_item.variant.barcode }}"` within the element in order for
the barcode.js functions to work.

The attributes can be within a `<canvas>` tag or an `<img>` tag.  Those are your only options for HTML elements.

##Options

You can add a number of attributes which will change the look of the barcode:

* *data-format: string* - Scannable format of barcode. Options: CODE39, CODE128, EAN. Default: CODE128
* *data-width: integer* - Width of scannable bars. Default: 1
* *data-height: integer* - Height (in pixels) of scannable bars. Default: 50
* *data-display: boolean* - Display barcode string under the scannable area. Default: false
* *data-font: string* - Websafe font-family of displayed barcode string. Default: Monospaced
* *data-fontsize: integer* - Font size (in pixels) of barcode string. Default: 16

###Examples

####Minimum markup:

```
<canvas class="item_barcode" data-barcode="{{ line_item.variant.barcode }}"></canvas>
```
![Basic barcode markup output](http://snapify.shopify.com/12-23-a4oma-bm307.png)

####Specified height and width; display barcode string
```
<canvas class="item_barcode" data-barcode="{{ line_item.variant.barcode }}" data-height="100" data-width="2" data-display="true"></canvas>
```
![Tailored barcode output](http://snapify.shopify.com/12-22-h43f9-9d64p.png)

####Change format; barcode string font-family, font-size
```
<canvas class="item_barcode" data-barcode="{{ line_item.variant.barcode }}" data-format="CODE39" data-font="sans-serif" data-fontsize="22" data-display="true"></canvas>
```
![CODE39 example](http://snapify.shopify.com/12-28-hyi5x-0tkqq.png)

##Acknowledgments

This solution is based heavily on the work done by [lindell's JsBarcode repo](https://github.com/lindell/JsBarcode)

As per [lindell's Read Me instructions](https://github.com/lindell/JsBarcode/blob/master/MIT-LICENSE.txt):

Copyright (c) 2012 Johan Lindell<EMAIL_ADDRESS>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
---
full-title: The All You Can Learn Library from UIE
title: Web App Case Study
layout: portfolio-page
category: case-study
nav-title: Web App Product
---

In 2013 UIE decided to extend their online professional designer education offerings from live webinars (called “Virtual Seminars”) to an always available subscription streaming service of UX-specific videos. We dubbed the project All You Can Learn, and started planning. We’ve evolved the product and in 2017 launched a v2 with many improvements.

## What were Brian’s roles?

Concept through v1: research, lead design studio sessions, visual design, sketching and low-fi prototyping UI and layout, information architecture. Observed and analyzed data from rounds of remotely moderated usability testing. Development management (until a full-time backend developer was hired after v1 launch). v2: visual & design consultation (partnered on creation of the Pattern & Style Library the design is based upon), critique, usability testing, QA and browser testing.

## Who else was involved?

Product owner, contract visual designer, contract information architect, contract copywriters, full-stack developer (CSS, CMS), a contract backend developer (CMS, PHP), and a full-time backend developer.

## What’s the customer problem?

Training budgets are always the first professional resource to be cut. Designers need low-cost options for in-office training, to reduce the monetary and time-away costs of attending conferences and workshops. Many are turning to web-based materials. UIE has the best presenters and topics, but at the time only offered live webinars, and on-off recording availability for attendees.

## What were the business considerations?

UIE had a significant number of recordings, but no way to monetize them. Sources like Lynda.com were growing in popularity. The time was right for UIE to step into this market.
Aside from shopping cart functionality, UIE had never before built a web app internally. I needed to bring in experienced contractors to build a critical element of UIE’s future revenue on a tight budget. A fully-custom solution was cost-prohibitive, so I assembled a team to create a custom app atop of the Expression Engine platform. That reduced our functionality capabilities out of the gate, and I began the design from within those constraints.

## Examples
![3 local, 1 remote participants in a timed sketching exercise](/assets/img/aycl-timed-sketching-design-studio-and-remote.jpg)

Above: A design studio sketching session with a remote participant.

![img](/assets/img/aycl-v1-remote-usability-testing-2.png)

Above: the team observing a remotely moderated usability test of the All You Can Learn service.

![Collage of whiteboarding and paper sketching](/assets/img/aycl-lo-fi-collage.png)

Above: Early user flows and layout sketches.

![Screenshot of v1 homepage at launch](/assets/img/aycl-v1-home-crop.png)

v1 homepage at launch.

![Screenshot of v1.5 homepage](/assets/img/aycl-v1_5-home-crop.png)

Above: v1.5 homepage revision.

![Screenshot of v2 homepage](/assets/img/aycl-v2-home-crop.png)

Above: v2 launched mid-2017 included big type, RWD, and color improvements via our Pattern & Style Library.

![Screenshot of v1.5 interior gallery page](/assets/img/aycl-v1-process-gallery-crop.png)

Above: a v1.5 Design Process topic gallery page.

![Screenshot of v2 interior gallery page](/assets/img/aycl-v2-design-process-crop.png)

Above: v2 Design Process Gallery page.

![Screenshot of a v2 Seminar Player page](/assets/img/aycl-v2-player-page-crop.png)

Above: a v2 Seminar Player page.

![Screenshot of a design critique session](/assets/img/aycl-v2-design-critique.jpg)

Above: v2 template design critique session.


text:
# Code Editors

- [Atom](https://atom.io/) Free and Open Source editor (Linux, Mac, Win)
- [Sublime Text](https://www.sublimetext.com/) Free to use (Linux, Mac, Win)
- [Webstorm](https://www.jetbrains.com/webstorm/) Commercial (Linux, Mac, Win)

repository: lucamezzalira/workshop

repo_name: lucamezzalira/workshop


text:
# Backend - Moon

---

## Basics

The **Chat** example:

```rust
use moon::*;
use shared::{DownMsg, UpMsg};

async fn frontend() -> Frontend {
    Frontend::new().title("Chat example").append_to_head(
        "
        <style>
            html {
                background-color: black;
            }
        </style>",
    )
}

async fn up_msg_handler(req: UpMsgRequest<UpMsg>) {
    println!("{:#?}", req);

    let UpMsgRequest { up_msg, cor_id, .. } = req;
    let UpMsg::SendMessage(message) = up_msg;

    sessions::broadcast_down_msg(&DownMsg::MessageReceived(message), cor_id).await;
}

#[moon::main]
async fn main() -> std::io::Result<()> {
    start(frontend, up_msg_handler, |_| {}).await
}
```

### 1. The App Initialization

1. The function `main` is invoked.

1. The function `frontend` is invoked on the the web browser request (if the path doesn't start with `_api`). The response is HTML that starts the Zoon (the frontend part).

1. The function `up_msg_handler` handles message requests from the Zoon. Zoon sends in the `UpMsgRequest`:
   - Your `UpMsg`.
   - New `CorId` (aka [_correlation id_](https://www.rapid7.com/blog/post/2016/12/23/the-value-of-correlation-ids/)) generated for each request.
   - `SessionId` generated in the Zoon app before it connects to the Moon.
   - `Option<AuthToken>` containing `String` defined in your Zoon app.

### 2. Calling Actor functions

`sessions` are [_virtual actors_](https://www.microsoft.com/en-us/research/publication/orleans-distributed-virtual-actors-for-programmability-and-scalability/) managed by the Moon. Each `SessionActor` represents a live connection between Zoon and Moon apps.

You can send your `DownMsg` to all connected Zoon apps by calling `sessions::broadcast_down_msg` (demonstrated in the code snippet above).

If you want to send the message to only one `session` (e.g. to simulate a standard request-response mechanism):
```rust
let UpMsgRequest { up_msg, cor_id, session_id, .. } = req;
let UpMsg::SendMessage(message) = up_msg;

sessions::by_session_id()
    .get(session_id)
    .unwrap()
    .send_down_msg(&DownMsg::MessageReceived(message), cor_id).await;
```

Where `by_session_id()` returns an _actor index_. Then we try to find the actor and calls its method `send_down_msg`.

_Notes_:

- All actor methods are asynchronous because the requested actor may live in another server or it doesn't live at all - then the Moon app has to start it and load its state into the main memory before it can process your call. And all those operations and the business logic processing take some time, so asynchronicity allows you to spend the time in better ways than just waiting.

- Index API will change a bit during the future development to support server clusters (e.g. `get` will be probably `async`).

---

## Moonlight

`moonlight` is the crate that connects Zoon and Moon worlds. It contains things like `CorId`, `SessionId` and `AuthToken` that are used on the both sides.

You need it to define your `UpMsg` and `DownMsg`. See the content of `/examples/chat/shared/src/lib.rs` below.

```rust
use moonlight::serde_lite::{self, Deserialize, Serialize};

// ------ UpMsg ------

#[derive(Serialize, Deserialize, Debug)]
pub enum UpMsg {
    SendMessage(Message),
}

// ------ DownMsg ------

#[derive(Serialize, Deserialize, Debug)]
pub enum DownMsg {
    MessageReceived(Message),
}

// ------ Message ------

#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Message {
    pub username: String,
    pub text: String,
}
```

---

## Actix

Moon is based on [Actix](https://actix.rs/). And there is a way to use Actix directly:

```rust
use moon::*;
use moon::actix_web::{get, Responder};

async fn frontend() -> Frontend {
    Frontend::new().title("Actix example")
}

async fn up_msg_handler(_: UpMsgRequest<()>) {}

#[get("hello")]
async fn hello() -> impl Responder {
    "Hello!"
}

#[moon::main]
async fn main() -> std::io::Result<()> {
    start(frontend, up_msg_handler, |cfg|{
        cfg.service(hello);
    }).await
}
```

![Hello](images/hello.png)

- `cfg` in the example is [actix_web::web::ServiceConfig](https://docs.rs/actix-web/4.0.0-beta.8/actix_web/web/struct.ServiceConfig.html)

- You can also replace default middlewares and create an Actix `App` instance by yourself. It's often useful when you are migrating your Actix app to MoonZoon. See the example `start_with_app` for more info.

---

## Actors

_WARNING_: The Actor API will be changed to reduce the number of used macros and to cover more real-world cases. However the main goals and principles explained below won't change.

We'll use the **Time Tracker** example parts to demonstrate how to define an _actor_ and create its instances.

1. Each actor should be placed in a standalone module / file - e.g. `backend/src/invoice.rs`.

1. Let's add the "actor skeleton" into the file (we'll talk about individual parts later):

    ```rust
    use shared::{InvoiceId, TimeBlockId};

    actor!{
        #[args]
        struct InvoiceArgs {
            time_block: TimeBlockId,
            id: InvoiceId,
        }

        // ------ Indices ------

        // ------ PVars ------

        // ------ Actor ------

        #[actor]
        struct InvoiceActor;
        impl InvoiceActor {

        }
    }
    ```

1. We need to register the actor:

    ```rust
    fn main() {
        start!(init, frontend, up_msg_handler, actors![
            client,
            invoice,
            ...
        ]);
    }
    ```

1. And we can already create actor instances as needed:

    ```rust
    use invoice::{self, InvoiceArgs};
    ...
    async fn up_msg_handler(req: UpMsgRequest) {
        let down_msg = match req.up_msg {
            ...
            // ------ Invoice ------
            UpMsg::AddInvoice(time_block, id) => {
                check_access!(req);
                new_actor(InvoiceArgs { time_block, id }).await;
                DownMsg::InvoiceAdded
            },
            ...
        }
    }
    ```

    - `new_actor` is Moon's async function. In this case, it creates a new `invoice` actor and returns `InvoiceActor`.

    - `InvoiceActor` represents a copyable reference to the `invoice` actor instance. The instance is either _active_ (loaded in the main memory) or only stored in a persistent storage.

1. Let's add `PVar`s to our actor:

    ```rust
        // ------ PVars ------

        #[p_var]
        fn id() -> PVar<InvoiceId> {
            p_var("id", |_| args().map(|args| args.id))
        }

        #[p_var]
        fn custom_id() -> PVar<String> {
            p_var("custom_id", |_| String::new())
        }

        #[p_var]
        fn url() -> PVar<String> {
            p_var("url", |_| String::new())
        }

        #[p_var]
        fn time_block() -> PVar<ClientId> {
            p_var("time_block", |_| args().map(|args| args.time_block))
        }
    ```
    - `PVar` is a _**P**ersistent **Var**iable_. It represents a copyable reference to the Moon app's internal persistent storage. (The file system and PostgreSQL would probably be the first supported storages.)

    - Most `PVar` methods are async because they may need to communicate with the storage. Read operations are fast when the actor is active and the needed `PVar` value has been cached in memory by Moon.

    - The Moon function `p_var` loads the value according to the _identifier_ from the storage and deserializes it to the required Rust type. Or it creates a new record in the storage with the serialized default value provided by its second argument.

    - The first `p_var` parameter is the _identifier_ - e.g. `"url"`. The _identifier_ should be unique among other actor's `PVar`s.

    - The second `p_var` parameter is a callback that is invoked when:
       - A new record will be created. Then the callback's only argument is `None`.
       - The deserialization fails. Then the callback's argument contains `PVarError` with the serialized old value. It allows you to convert the data to a new type.

    - The Moon function `args` returns a wrapper for an `InvoiceArgs` instance.

1. Now we can define accessors and other helpers for `InvoiceActor`:

    ```rust
        // ------ Actor ------

        #[actor]
        struct InvoiceActor;
        impl InvoiceActor {
            async fn remove(&self) {
                self.remove_actor().await
            }

            async fn set_custom_id(&self, custom_id: String) {
                custom_id().set(custom_id).await
            }

            async fn set_url(&self, url: String) {
                url().set(url).await
            }

            async fn id(&self) -> InvoiceId {
                id().inner().await
            }

            async fn custom_id(&self) -> String {
                custom_id().inner().await
            }

            async fn url(&self) -> String {
                url().inner().await
            }
        }

    ```

    - The `InvoiceActor` struct also implements some predefined methods. E.g. `remove_actor()` allows you to remove the instance and delete the associated data.

1. And the last part - indices:

    ```rust
        // ------ Indices ------

        #[index]
        fn by_id() -> Index<InvoiceId, InvoiceActor> {
            index("invoice_by_id", |_| id())
        }

        #[index]
        fn by_time_block() -> Index<TimeBlockId, InvoiceActor> {
            index("invoice_by_time_block", |_| time_block())
        }
    ```

    - Indices allow us to get actor instance references (e.g. `InvoiceActor`). They are basically key-value stores, where the value is an array of actor references. Example (an API draft):

        ```rust
        invoice::by_time_block().actors(time_block_id).first();
        ```

    - The Moon function `index` returns the requested index reference `Index` by the _identifier_. Or it creates a new index in the persistent storage with the serialized key provided by its second argument.

    - The first `index` parameter is _identifier_ - e.g. `"invoice_by_id"`. It should be unique among all indices.

    - The second `index` parameter is a callback that is invoked when:
       - A new index will be created. Then the callback's only argument is `None`.
       - Serialized old keys have different type than the required one. Then the callback's argument contains `IndexError`. It allows you to convert the keys to a new type.

    - The callback provided in the second `index` argument has to return `PVar`. Index keys will be automatically synchronized with the associated `PVar` value.

---

## Auth

Authentication and Authorization are:
- Probably the most reinvented wheels.
- Very difficult to implement without introducing security holes.
- Painful to integrate into your product because of regulations like _GDPR_ or _Cookie Law_.
- Annoying for your users.

_

Defining the basic auth behavior is a really tough task:

- Should we use _LocalStorage_ or _Cookies_ to store tokens? (I'm sure you can find many articles and people which claim that only _LocalStorage_ or only _Cookies_ is the right choice).
   - I would generally prefer _LocalStorage_ because it's much easier to work with and once the _XSS_ attack is successful, not even correctly set _Cookies_ can save you. But with MoonZoon, both client and server will be probably attached to the same domain so we can take full advantage of cookie security features. So it depends.

- Can we assume all apps communicate over HTTPS?

- There are also ways to register and log in without sending passwords to the server (see [Seed's E2E encryption example](https://github.com/seed-rs/seed/tree/master/examples/e2e_encryption) for more info.) Do we need it?

- Is _E2E encryption_ required?

- We need to take into account legal requirements:
  - Do we need the user's email? Is the user's nick a real name? It has to be compatible with GDPR and we need to mention it in our _Terms and Policies_ and other documents.
  - The user has to agree with the usage of their data before the registration and he has to be able to delete the data.
  - etc.

- What about account recovery, log in on multiple devices, testing, ...

_

Also there are some passwordless auth methods:
- Through SMS or email.
- _WebAuthn_. It could be a good way to eliminate passwords and usernames.
  1. https://webauthn.guide/
  1. https://webauthn.io/
  1. https://webauthn.me/
  1. https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API
  1. https://www.w3.org/TR/webauthn/
  1. https://github.com/herrjemand/awesome-webauthn
  1. https://crates.io/crates/webauthn-rs + related articles on https://fy.blackhats.net.au
  1. https://medium.com/webauthnworks/introduction-to-webauthn-api-5fd1fb46c285
  1. https://sec.okta.com/articles/2020/04/webauthn-great-and-it-sucks
  1. https://levelup.gitconnected.com/what-is-webauthn-logging-in-with-touch-id-and-windows-hello-on-the-web-c886b58f99c3

_

Or can we use something from the crypto/blockchain world?

![Discord wallet-connect metamask](./images/discord_wallet-connect_metamask.png)

- https://digibyte.org/en-us/#digi-id
- https://walletconnect.org/
- https://metamask.io/
- lnurl-auth
   - https://xn--57h.bigsun.xyz/lnurl-auth.html
   - https://github.com/fiatjaf/lnurl-rfc/blob/master/lnurl-auth.md
   - https://crates.io/crates/lnurl
   - https://github.com/fiatjaf/awesome-lnurl
   - https://lnurl.fiatjaf.com/

_

So let's wait a bit until we see clear requirements and how technologies like _WebAuthn_ work in practice before we try to design special auth libraries and finalize MoonZoon API.

MoonZoon already allows you to send a token in the request's header so you have at least a basic foundation to integrate, for instance, _JWT_ auth.

Your opinions on the [chat](https://discord.gg/eGduTxK2Es) are very welcome!

Other related articles:
 - [Authentication in SPA (ReactJS and VueJS) the right way - Part 1](https://jcbaey.com/authentication-in-spa-reactjs-and-vuejs-the-right-way)

---

## FAQ

1. _"Why another backend framework? Are you mad??"_
   - In the context of my goal to remove all accidental complexity, I treat most popular backend frameworks as low-level building blocks. You are able to write everything with them, but you still have to think about REST API endpoints, choose and connect a database, manage actors manually, setup servers, somehow test serverless functions, etc. Moon will be based on one of those frameworks - this way you don't have to care about low-level things, however you can when you need more control.

1. _"Those are pretty weird actors! (And.. what is it an _actor_?)"_
    - Yeah, actually, they are called _Virtual Actors_.

    - _Actor Model_: An actor is an object that interacts with the world and other actors using asynchronous messages.

    - _Standard Actors_: The actor has to be explicitly created and removed by a developer or by the actor's parent (aka supervisor) by predefined rules.

    - _Virtual Actors_: A runtime system manages actors. It creates, removes or moves actors between servers. All actors are always active and cannot fail from the developer point of view. In the case of hardware failure, the lost actors are automatically recreated on another server and messages forwarded to them.

    - I recommend to read [Orleans – Virtual Actors](https://www.microsoft.com/en-us/research/project/orleans-virtual-actors/).

1. _"Why virtual actors and not microservices / event sourcing / standard actors / CRDTs / blockchain / orthogonal persistence / ..?"_

   - You can combine virtual actors with other concepts - why don't leverage event sourcing to manage the actor state?
   - There is a chance the architecture and security will be improved by implementing actors as isolated single-threaded _Wasm_ modules.
   - There are open-source virtual actor frameworks battle-tested in production. And there are also related research papers - especially for Orleans.

1. _"What about transactions, backups, autoscaling, deploying, storage configuration, ..?"_
   - I try to respect Gall’s Law - "A complex system that works is invariably found to have evolved from a simple system that worked."
   - So let's start with a single server, simple implementation and minimum features.
   - There are research papers about virtual actors and things like transactions. It will take time but the architecture will allow to add many new features when needed.


text:
---
title: "Docker \"Development\" on OSX: out of space!"
author: steve-nolen
date: 2016-01-21
template: article.jade
---

Using docker-machine/docker-toolbox to do some hefty container lifting? Constantly running out of disk space? A quick resolution to your problem!

---

If you're anything like me, you've been creating and toying with docker containers (and maybe docker-compose and the enormous ecosystem of docker tools) in a development environment (hopefully in production too!).   The quickest way to regain some space is to remove those pesky dangling images (courtesy of [this](http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images) stackoverflow q):

```bash
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
```

or one even better (as the helpful VonC mentions) is to make an alias to do this (name it however you want, i used the keyword 'docker' so I could remind myself with tab completion):

```bash
Steves-MacBook-Pro:~ steve$ cat ~/.bash_profile | grep none
alias docker-rm-dangling='docker rmi $(docker images --filter "dangling=true" -q --no-trunc)'
```

At some point, you'll still end up hitting a wall.  Bloated container sizes or just *many, many* containers -- you're going to need some more space. Thankfully docker-machine makes that exceedingly simple.  I'll assume you don't need to save any data (it's just dev, afterall). You can quickly swap from 20G to 50G with this:

```bash
docker-machine rm default
docker-machine create --driver virtualbox --virtualbox-disk-size "50000" --virtualbox-memory "2048" default
```

This should get me out of that bind for a good long while!


text:
---
title: Delay
description: A dummy action that completes after a set duration of time.
---

# Delay

`delay(duration <Number>, onComplete <Function>)`

Delay is a dummy action that fires `onComplete` after a set duration of time. This is useful in composing with other actions.

## Example

```javascript
import { delay, chain, physics } from 'popmotion';

chain([
  delay(200),
  physics({
    velocity: 100,
    onUpdate: console.log
  })
]).start();
```

repository: mars/popmotion

repo_name: mars/popmotion


text:
[![Build Status](https://github.com/leroy-merlin-br/mongolid-laravel/workflows/Tests/badge.svg)](https://github.com/leroy-merlin-br/mongolid-laravel/actions?query=workflow%3ATests)
[![Coverage Status](https://app.codacy.com/project/badge/Coverage/1ed42ceb8f994627b9887a97d296d11f)](https://www.codacy.com/gh/leroy-merlin-br/mongolid-laravel/dashboard?utm_source=github.com&utm_medium=referral&utm_content=leroy-merlin-br/mongolid-laravel&utm_campaign=Badge_Coverage)
[![Latest Stable Version](https://poser.pugx.org/leroy-merlin-br/mongolid-laravel/v/stable.png)](https://packagist.org/packages/leroy-merlin-br/mongolid-laravel)
[![Monthly Downloads](https://poser.pugx.org/leroy-merlin-br/mongolid-laravel/d/monthly.png)](https://packagist.org/packages/leroy-merlin-br/mongolid-laravel)
[![Latest Unstable Version](https://poser.pugx.org/leroy-merlin-br/mongolid-laravel/v/unstable.png)](https://packagist.org/packages/leroy-merlin-br/mongolid-laravel)
[![License](https://poser.pugx.org/leroy-merlin-br/mongolid-laravel/license.png)](https://packagist.org/packages/leroy-merlin-br/mongolid-laravel)

![MongoLid](https://user-images.githubusercontent.com/1991286/28967747-fe5c258a-78f2-11e7-91c7-8850ffb32004.png)

# MongoLid (Laravel Package)

- [Introduction](#introduction)
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Authentication](#authentication)
- [Troubleshooting](#troubleshooting)
- [License](#license)
- [Additional Information](#additional_information)

## Introduction

MongoLid ODM (Object Document Mapper) provides a beautiful, simple implementation for working with MongoDB. Each database collection can have a corresponding "Model" which is used to interact with that collection.

> Note: The ODM implementation is within the [(non laravel) mongolid repository](https://github.com/leroy-merlin-br/mongolid).

## Installation

Install with `composer require` (use one of the above tags if needed).

```shell
composer require leroy-merlin-br/mongolid-laravel
```

**Note:** Mongolid Laravel 2.0 only supports Laravel 5.4+. For older versions use the tags:

- Laravel 4.2 `"leroy-merlin-br/mongolid-laravel": "^0.7"`
- Laravel 5.1 `"leroy-merlin-br/mongolid-laravel": "2.0.0-beta4"`
- Laravel 5.2 `"leroy-merlin-br/mongolid-laravel": "2.0.0-beta6"`
- Laravel 5.3 `"leroy-merlin-br/mongolid-laravel": "2.0.0-beta6"`

Make sure to set minimum stability to `dev` when using a beta tag (`composer config minimum-stability dev`).

> **Note**: If you are using Laravel 5.5, the next steps for providers and aliases are unnecessaries. MongoLid supports Laravel new [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery).

In your `config/app.php` add `'MongolidLaravel\MongolidServiceProvider'` to the end of the `$providers` array

```php
'providers' => [
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    ...
    MongolidLaravel\MongolidServiceProvider::class,
],
```

(**Optional**) At the end of `config/app.php` add `'MongoLid'    => 'MongolidLaravel\MongoLidModel'` to the `$aliases` array

```php
'aliases' => [
    'App'         => Illuminate\Support\Facades\App::class,
    'Artisan'     => Illuminate\Support\Facades\Artisan::class,
    ...
    'MongoLid'    => MongolidLaravel\MongoLidModel::class,
],
```

Lastly, be sure to configure a database connection in `config/database.php`:

Paste the settings bellow at the end of your `config/database.php`, before the last `];`:

**Notice:** It must be **outside** of `connections` array.

```php
/*
|--------------------------------------------------------------------------
| MongoDB Databases
|--------------------------------------------------------------------------
|
| MongoDB is a document database with the scalability and flexibility
| that you want with the querying and indexing that you need.
| Mongolid Laravel use this config to starting querying right now.
|
*/

'mongodb' => [
    'default' => [
        'host'     => env('DB_HOST', '<IP_ADDRESS>'),
        'port'     => env('DB_PORT_NUMBER', 27017),
        'database' => env('DB_DATABASE', 'my_database'),
        'username' => env('DB_USERNAME', null),
        'password' => env('DB_PASSWORD', null),
    ],
],
```

For cluster with automatic failover, you need to set `cluster` key containing all `nodes` along with `replica_set` name.

```php
'mongodb' => [
    'default' => [
        'cluster' => [
            'replica_set' => env('DB_REPLICA_SET', null),
            'nodes' => [
                'primary' => [
                    'host' => env('DB_HOST_A', 'host-a'),
                    'port' => env('DB_PORT_A', 27017),
                ],
                'secondary' => [
                    'host' => env('DB_HOST_B', 'host-b'),
                    'port' => env('DB_PORT_B', 27017),
                ],
            ],
        ],
        'database' => env('DB_DATABASE', 'mongolid'),
        'username' => env('DB_USERNAME', null),
        'password' => env('DB_PASSWORD', null),
    ],
],
```

You can configure as much nodes as needed, node names (e.g. `primary` and `secondary` ) are optional.

> **Note:** If you don't specify the `mongodb` key in your `config/database.php` MongoLid will automatically try to connect to '<IP_ADDRESS>:27017' and use a database named 'mongolid'.

You may optionally provide a `connection_string` key to set a fully-assembled connection string that will override all other connection options. More info about connection string are found in [MongoDB documentation](https://docs.mongodb.com/manual/reference/connection-string/).

```php
'mongodb' => [
    'default' => [
        'connection_string' => 'mongodb://host-a:27017,host-b:27917/mongolid?replicaSet=rs-ds123',
    ],
],
```

Also, it is possible to pass `options` and `driver_options` to MongoDB Client. Mongolid always overrides `typeMap` configuration of `driver_options` to `array` because it makes easier to use internally with models. Possible `options` and `driver_options` are present on [`MongoDB\Client` documentation](https://docs.mongodb.com/php-library/master/reference/method/MongoDBClient__construct/).

## Basic Usage

To get started, create an MongoLid model. Models typically live in the `app/models` directory, but you are free to place them anywhere that can be auto-loaded according to your `composer.json` file.

**Defining a MongoLid Model**

```php
<?php
namespace App;

use MongolidLaravel\MongolidModel;

class User extends MongolidModel
{

}
```

In a nutshell, that's it!

### For further reading about models, CRUD operations, relationships and more, check the [Read the Docs: <small>leroy-merlin-br.github.com/mongolid</small>](http://leroy-merlin-br.github.io/mongolid/).
[![Mongolid Docs](https://user-images.githubusercontent.com/1991286/28967747-fe5c258a-78f2-11e7-91c7-8850ffb32004.png)](http://leroy-merlin-br.github.com/mongolid)

## Authentication

MongoLid Laravel comes with a Laravel auth provider.
In order to use it, simply change the `'driver'` provider value in your `config/auth.php` to `mongolid`
and make sure that the class specified in `model` is a MongoLid model that implements the `Authenticatable` contract:

```php

    'providers' => [

        // ...

        'users' => [
            'driver' => 'mongolid',
            'model' => \App\User::class
        ],

        // ...

    ],

```

The `User` model should implement the `Authenticatable` interface:

```php
<?php
namespace App;

use Illuminate\Contracts\Auth\Authenticatable;
use MongolidLaravel\MongolidModel;

class User extends MongolidModel implements Authenticatable
{
    /**
     * The database collection used by the model.
     *
     * @var string
     */
    protected $collection = 'users';

    /**
     * Get the name of the unique identifier for the user.
     *
     * @return string
     */
    public function getAuthIdentifierName()
    {
        return '_id';
    }

    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->_id;
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }

    /**
     * Get the token value for the "remember me" session.
     *
     * @return string
     */
    public function getRememberToken()
    {
        return $this->remember_token;
    }

    /**
     * Set the token value for the "remember me" session.
     *
     * @param  string  $value
     */
    public function setRememberToken($value)
    {
        $this->remember_token = $value;
    }

    /**
     * Get the column name for the "remember me" token.
     *
     * @return string
     */
    public function getRememberTokenName()
    {
        return 'remember_token';
    }
}
```

Now, to log a user into your application, you may use the `auth()->attempt()` method.
You can use [any method regarding authentication](https://laravel.com/docs/5.2/authentication#included-authenticating).

## Queue Failed Job Provider

Mongolid Laravel replaces Laravel queue failed job provider to use a collection instead of a table. To configure the provider, update `failed` key on `queue.php` to include `collection` name:

```php
    'failed' => [
        'database' => 'mongodb',
        'collection' => 'failed_jobs',
    ],
```

**Note:** `database` key is irrelevant.

## Troubleshooting

**"PHP Fatal error: Class 'MongoDB\Client' not found in ..."**

The `MongoDB\Client` class is contained in the [MongoDB PHP Library](https://docs.mongodb.com/php-library/master/) and it requires [MongoDB driver for PHP](https://pecl.php.net/package/mongodb).
Here is an [installation guide](http://php.net/manual/en/mongodb.setup.php) for this driver.
The driver is a PHP extension written in C and maintained by [MongoDB](https://mongodb.com).
MongoLid and most other MongoDB PHP libraries utilize it in order to be fast and reliable.

**"Class 'MongoDB\Client' not found in ..." in CLI persists even with MongoDB driver installed.**

Make sure that the **php.ini** file used in the CLI environment includes the MongoDB extension. In some systems, the default PHP installation uses different **.ini** files for the web and CLI environments.

Run `php --ini` in a terminal to check the **.ini** that is being used.

To check if PHP in the CLI environment is importing the driver properly run `php -i | grep mongo` in your terminal. You should get output similar to:

```shell
$ php -i | grep mongo
mongodb
mongodb support => enabled
...
```

**"This package requires php >=7.0 but your PHP version (X.X.X) does not satisfy that requirement."**

The new (and improved) version 2.0 of Mongolid Laravel requires php7. If you are looking for the old PHP 5.x version, or other Laravel versions, head to the [v0.8 branch](https://github.com/leroy-merlin-br/mongolid-laravel/tree/v0.8-dev).

## License

MongoLid & MongoLid Laravel are free software distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT).
Some of the code is based on the work of Taylor Otwell and contributors on [laravel/framework](https://github.com/laravel/framework), another free software distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT).

## Additional information

Mongolid was proudly built by the [Leroy Merlin Brazil](https://github.com/leroy-merlin-br) team. [See all the contributors](https://github.com/leroy-merlin-br/mongolid/graphs/contributors).

Any questions, feel free to contact us.

Any issues, please [report here](https://github.com/leroy-merlin-br/mongolid-laravel/issues).

repository: leroy-merlin-br/mongolid-laravel

gha_language: PHP

repo_name: leroy-merlin-br/mongolid-laravel


text:
# [Article Reader](https://cdn.rawgit.com/TeamGodfather/Reader-Concept/master/ReaderConcept/index.html)

## Features
----

1. Get data
    - NYTimes API TopStories
    - Wikipedia API ( regional info etc )
    - WorldBank openDB API
1. Canvas: Article Presenter
    - Data retrieved from NYTimes APi
    - Headline ( from api )
    - Thumbnail phot ( from api )
    - Short info ( from api )
    - Load article within page ( link to article from api )
    - Sroll through articles left / right ( up/ down ? ( in depth ?? ))

2. Article reader:
    - Hide Canvas - display this ( article )
    - Show Side Panels

2. Side Panel: Wiki country information
    - Data retrieved from Wikipedia APi
    - Short information about the country in question ( article info above )

3. Side Panel2: WorldBank country info
    - Capital
    - Region
    - Status ( rich / poor etc)
1. Frameworks
    - JQuery: manage dom + ajax requests
    - JQueryUI: dom fancy stuff
    - Handlebars: build side panels off input data
    - Kinetic: manage canvas
    - more ?

repository: TeamGodfather/Reader-Concept

repo_name: TeamGodfather/Reader-Concept


text:
# Deals

The Deals API allows you to get, create, update and delete your deals.

### Attributes

Parameter | Type | Permission | Description
--------- | ------- | ------- | -----------
id | integer | read | Unique identifier of the deal
code | string | write | Custom identifier of the deal
**name** | string | write | Brief description of the deal
value | float | write | (Estimated) value of the deal, with decimal part if needed
is_hot | boolean | write | To point if the deal is important or not
win_probability | integer | write | Probability of closing the deal successfully
estimated_close_at | datetime | write | Estimated close date of the deal
started_at | datetime | read | Date in which the deal has been opened
stage_changed_at | datetime | write | Last date in which the deal has been moved into a stage
tags | array | write | An array of tags for a deal
person_id | integer | write | Unique identifier of a primary person
company_id | integer | write | Unique identifier of a primary company
**stage_id** | integer | write | Unique identifier of the deal's current stage in the pipeline
source_id | integer | write | Unique identifier of the deal source
loss_reason_id | integer | write | Unique identifier of the deal loss reason
**user_id** | integer | write | Unique identifier of the user that the person is assigned to
created_at | datetime | read | Date of creation
updated_at | datetime | read | Date of last edit

Custom fields are also attributes that can be attached to create or update actions, as explained in the requests section. The can be also used as filters following the rules of the query language.

When you want to update the tags of a deal be aware to include any existing tag, otherwise they will be fully replaced by the tags specified in the update request. In fact, the tag attributes acts like the rtags (phantom) attribute, which replace any existing tag associated with the deal.

If you want to explicitly add tags to a deal instead of replacing the existing ones, use the atags (phantom) attribute instead of the tags one.

## Get All Deals

```shell
curl https://api.sellf.io/v2/deals -H "Api-Key: {YOUR_API_KEY}"
```

> The above command returns JSON structured like this:

```json
{
  "meta": {
    "has_more": true,
    "object": "list"
  },
  "data": [
    {
      "stage_id": 5,
      "stage_changed_at": "2016-01-05T16:02:41.058040",
      "user_id": 1,
      "name": "Rent in London",
      "tags": [
        "duplex",
        "luxury"
      ],
      "created_at": "2015-11-27T14:57:55.461828",
      "updated_at": "2016-07-05T12:21:24",
      "value": 5000,
      "company_id": 4,
      "person_id": 9,
      "win_probability": 100,
      "estimated_close_at": "2015-11-30T11:59:59",
      "source_id": null,
      "loss_reason_id": null,
      "is_hot": true,
      "started_at": "2015-11-27T14:57:55",
      "id": 2,
      "code": null
    },
    {
      "stage_id": 10,
      "stage_changed_at": "2015-11-28T07:34:13",
      "user_id": 1,
      "name": "Venice villa",
      "tags": [],
      "created_at": "2015-11-28T07:34:13.330420",
      "updated_at": "2016-07-05T12:21:24",
      "value": 370000,
      "company_id": 7,
      "person_id": null,
      "win_probability": 100,
      "estimated_close_at": null,
      "source_id": null,
      "loss_reason_id": null,
      "is_hot": false,
      "started_at": "2016-03-30T13:08:49",
      "id": 3,
      "code": null
    }
  ]
}
```

This endpoint retrieves all deals.

### HTTP Request

`GET /deals`

### Query Parameters

Parameter| Description
--------- | -----------
sort_by | Column to sort by
 (i.e. `id`, `name`, `value`, `estimated_close_at`, `stage_changed_at`, `created_at`, `updated_at`)
user_id | Unique identifier of the user the deal is owned by
stage_id | Unique identifier of the stage in which the deal is placed
person_id | Unique identifier of the main deal with whom the deal is associated
company_id | Unique identifier of the main company with whom the deal is associated
source_id | Unique identifier of the deal source
loss_reason_id | Unique identifier of the deal loss reason
name | A string matching the description of the deal
code | A string matching the custom code of the deal
created_at | A date to be compared with the creation of the deal
updated_at | A date to be compared with the last edit of the deal
tags | One or more tags associated to the deal

## Create a Deal

```shell
# Create a new deal
curl https://api.sellf.io/v2/deals \
  -H "Api-Key: {YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -X POST -d "{"name": "Apartment in Berlin",
               "value": 265789,
               "is_hot": true,
               "estimated_close_at": "2016-12-05T12:00:23",
               "tags": ["Germany"],
               "stage_id": 10,
               "user_id": 1}"
```

> The above command returns JSON structured like this:

```json
{
  "stage_id": 10,
  "stage_changed_at": "2016-09-08T18:14:06",
  "user_id": 1,
  "name": "Apartment in Berlin",
  "tags": [
    "Germany"
  ],
  "created_at": "2016-09-08T18:14:06",
  "updated_at": "2016-09-08T18:14:06",
  "value": 265789,
  "company_id": null,
  "person_id": null,
  "win_probability": 100,
  "estimated_close_at": "2016-12-05T12:00:23",
  "source_id": null,
  "loss_reason_id": null,
  "is_hot": true,
  "started_at": "2016-09-08T18:14:06",
  "id": 12,
  "code": null
}
```

This endpoint allows to create a deal.

### HTTP Request

`POST /deals`

## Get a Specific Deal

```shell
# Retrieve a deal with ID 12
curl https://api.sellf.io/v2/deals/12 -H "Api-Key: {YOUR_API_KEY}"
```

> The above command returns JSON structured like this:

```json
{
  "stage_id": 10,
  "stage_changed_at": "2016-09-08T18:14:06",
  "user_id": 1,
  "name": "Apartment in Berlin",
  "tags": [
    "Germany"
  ],
  "created_at": "2016-09-08T18:14:06",
  "updated_at": "2016-09-08T18:14:06",
  "value": 265789,
  "company_id": null,
  "person_id": null,
  "win_probability": 100,
  "estimated_close_at": "2016-12-05T12:00:23",
  "source_id": null,
  "loss_reason_id": null,
  "is_hot": true,
  "started_at": "2016-09-08T18:14:06",
  "id": 12,
  "code": null
}
```

This endpoint retrieves a specific deal.

### HTTP Request

`GET /deals/:id`

### URL Parameters

Parameter | Description
--------- | -----------
id | The unique identifier of the deal to retrieve

## Update a Specific Deal

```shell
# Update the deal with ID 12
curl https://api.sellf.io/v2/deals/12 \
  -H "Api-Key: {YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -X PUT -d "{"value": 470000,
              "win_probability": 95,
              "estimated_close_at": "2016-12-23T01:45:00"}"
```

> The above command returns JSON structured like this:

```json
{
  "stage_id": 10,
  "stage_changed_at": "2016-09-08T18:14:06",
  "user_id": 1,
  "name": "Apartment in Berlin",
  "tags": [
    "Germany"
  ],
  "created_at": "2016-09-08T18:14:06",
  "updated_at": "2016-09-08T18:14:06",
  "value": 470000,
  "company_id": null,
  "person_id": null,
  "win_probability": 95,
  "estimated_close_at": "2016-12-23T01:45:00",
  "source_id": null,
  "loss_reason_id": null,
  "is_hot": true,
  "started_at": "2016-09-08T18:14:06",
  "id": 12,
  "code": null
}
```

This endpoint allows to update a specific deal.

### HTTP Request

`PUT /deals/:id`

### URL Parameters

Parameter | Description
--------- | -----------
id | The unique identifier of the deal to retrieve

When you want to update the tags of a deal be aware to include any existing tag, otherwise they will be fully replaced by the tags specified in the update request. In fact, the tag attributes acts like the rtags (phantom) attribute, which replace any existing tag associated with the deal.

If you want to explicitly add tags to a deal instead of replacing the existing ones, use the atags (phantom) attribute instead of the tags one.

## Delete a Specific Deal

```shell
# Delete the deal with ID 3
curl https://api.sellf.io/v2/deals/3 \
  -H "Api-Key: {YOUR_API_KEY}" \
  -X DELETE
```

> The above command returns 200 with no content.

This endpoint deletes a specific deal. Deleting a deal implies that even all the associated entities are deleted, except for people and companies.

### HTTP Request

`DELETE /deals/:id`

### URL Parameters

Parameter | Description
--------- | -----------
id | The unique identifier of the deal to be deleted

repository: Sellf/docs

repo_name: Sellf/docs


text:
# Changelog

## 1.2.0 | 2018-03-19

### Added
- Added `!playdf10` and `!playdf` commands.

## 1.1.1 | 2018-12-04

### Fixed
- The `mystats` command now displays the correct total card count.

## 1.1.0 | 2018-12-01

### Added
- Member aliases are finally a thing.
- You can now filter members by the instrument that they play.
- Added `$play5` scam gacha command. Energy drinks not included.
- Feedback now logs your discriminator so that I can actually get in touch
with people for clarification purposes.

### Fixed
- The power attribute filter used to not work. It works now.

## 1.0.0

- Initial launch.

gha_language: Python


text:
# BBTools
---

This module makes [BBTools](https://jgi.doe.gov/data-and-tools/bbtools/) available in KBase.

It currently (5/2/2018) only exposes RQCFilter for use as either a standalone tool or as part of other pipelines, but other tools (BBMap, BBDuk, etc.) will be available over time.

## Usage
RQCFilter can be run either as an App from the Narrative Interface, or as a local function from other KBase Apps. Along with the configured parameters, it always uses the following set of arguments:
```
-Xmx24g barcodefilter=f sketch=f mapk=13
```
And a provided set of JGI Reference Data, kindly provided by Brian Bushnell.

To run it locally, first install this module with:
```
kb-sdk install BBTools
```
Then you can run `run_RQCFilter_local` with the following steps (Python below, Java and Perl will differ slightly).

Note that not all RQCFilter parameters are available right now. See [BBTools.spec](https://github.com/briehl/BBTools/blob/master/BBTools.spec#L12-L68) for a list.

```
# instantiate the client
from BBTools.BBToolsClient import BBTools
bbtools = BBTools(callback_url)   # see the SDK docs about finding the callback_url.

# set up input files
rqc_filter_input = {
    "reads_file": "/path/to/interleaved/fastq"
}
# or, if you want to use a KBase Workspace UPA for your reads object:
rqc_filter_input = {
    "reads_library_ref": "xx/yy/zz"
}

# set up parameters (example below, there are many more options, see BBTools.spec)
rqc_filter_params = {
    "qtrim": "rl",
    "maxns": 3,
    "minlength": 40
}

# run the local RQCFilter function
result = bbtools.run_RQCFilter_local(rqc_filter_input, rqc_filter_params)
```

The result of an RQCFilter run is a structure with the following keys:
* output_directory - the absolute path to the directory containing all output from the RQCFilter run.
* run_log - the absolute path to the generated log from RQCFilter (what's output to stderr)
* filtered_fastq_file - the absolute path to the generated fastq file that has been filtered according to the user's criteria.

All of the output directory info should be available from your SDK module's file system.

# How to Update
There's a few caveats for updating the version of BBTools being used here. Here's the steps to follow.
1. Update Dockerfile.
The version downloaded is embedded in the `Dockerfile` for this repo, line 29. Bump that version to whatever you need.
2. Update App Spec.
The version is also added to `ui/narrative/methods/RQCFilter/display.yaml`, line 4. Update that there to display the version of BBTools being run.
3. Update kbase.yml
The `module-version` in `kbase.yml` should also be bumped. It follows semantic versioning, so if you're just bumping the BBTools version, then a patch upgrade is most appropriate.
4. (optional) Update reference data.
If the reference data changes - either in the large tar file hosted at NERSC, or what's packaged with bbmap, this gets slightly more complex. The file `scripts/load_reference_data.sh` works outside of the module compile process, so it maintains its own version of things. There's a version of BBTools embedded there as well, so that will need to change if the bundled data is updated. Finally, you'll have to increase the value of the `data-version` line in `kbase.yml` for the reference data to be re-downloaded.

repository: kbaseapps/BBTools

repo_name: kbaseapps/BBTools


text:
# Composy for PHP - A base composer package template

![Image](files/graphics/composy-dark-plain-large-logo.png?raw=true)

Composy is a base composer package template for PHP. You can use Composy to easily build new composer compatible packages.

Composy is designed for you to use as a template for your own package so you can simply clone or download it as a base for your new PHP composer package.

## Features

* Simple PHP composer template package.
* PHP unit
    * For running unit tests
* PHP CS Fixer code checker
    * Automatically fix code
* PHP compatability checker
    * Checks your code for PHP version compatibility
* Prettier PHP
    * Auto format your code to various standards via Prettier and Prettier PHP
* Composer scripts to run various commands
* Example README.md file stored in the README-template.md
* Example folder

## Requirements

* PHP 7.2

## Clone

Clone Composy to adapt it to your own project:

```shell
$ git clone https://github.com/artbyrab/composy your-folder-name
```

## Download

Simply download via the repo to adapt Composy to your own project.

## Usage

Using Composy is easy just follow the steps:

* Clone the repo
* composer.json file
    * Create a new one or edit the existing one
* README.md
    * Copy the README.template.md to README.md and update it with your information
* LICENSE
    * Replace the variables in the license or choose a new license

Below is how to use each of the folders in the Composy package:

* documents
    * For package documents and guides
* example
    * If you have a HTML example of your package you can place the HTML files here.
* files
    * I use the files folder to store additional files for the package. For example i put any graphics here under files/graphics
* src
    * The src folder is where your code goes
* tests
    * The folder for the PHP Unit test files

For more usage guides please check the document links below:

## Documents for Composy

In alphabetical order:

* [Code Checks](documents/code-checks.md)
* [PHP Compatability Checks](documents/php-compatability-checks.md)
* [PHP-CS](documents/php-cs.md)
* [Prettier](documents/prettier.md)
* [Resources](documents/resources.md)
* [Code Checks](documents/code-checks.md)
* [Running Tests](documents/running-tests.md)

repository: artbyrab/composy

repo_name: artbyrab/composy