text:
# PowerShellForGitHub PowerShell Module
## Contributing

Looking to help out?  You've come to the right place.  We'd love your help in making this the best
way to automate GitHub repos.

Looking for information on how to use this module?  Head on over to [README.md](README.md).

----------
#### Table of Contents

*   [Overview](#overview)
*   [Maintainers](#maintainers)
*   [Feedback](#feedback)
    *   [Bugs](#bugs)
    *   [Suggestions](#suggestions)
    *   [Questions](#questions)
*   [Static Analysis](#static-analysis)
*   [Module Manifest](#module-manifest)
*   [Logging](#logging)
*   [PowerShell Version](#powershell-version)
*   [Coding Guidelines](#coding-guidelines)
*   [Adding New Configuration Properties](#adding-new-configuration-properties)
*   [Code Comments](#code-comments)
*   [Debugging Tips](#debugging-tips)
*   [Pipeline Support](#pipeline-support)
*   [Formatters](#formatters)
*   [Testing](#testing)
    *   [Installing Pester](#installing-pester)
    *   [Configuring Your Environment](#configuring-your-environment)
    *   [Running the Tests](#running-the-tests)
    *   [Automated Tests](#automated-tests)
    *   [New Test Guidelines](#new-test-guidelines)
*   [Releasing](#releasing)
    *   [Updating the Version Number](#updating-the-version-number)
        *   [Semantic Versioning](#semantic-versioning)
    *   [Updating the CHANGELOG](#updating-the-changelog)
    *   [Adding a New Tag](#adding-a-new-tag)
    *   [Running the Release Build](#running-the-release-build)
    *   [Updating the Wiki documentation](#updating-the-wiki-documentation)
*   [Contributors](#contributors)
*   [Legal and Licensing](#legal-and-licensing)

----------

## Overview

We're excited that _you're_ excited about this project, and would welcome your contributions to help
it grow.  There are many different ways that you can contribute:

 1. Submit a [bug report](#bugs).
 2. Verify existing fixes for bugs.
 3. Submit your own fixes for a bug. Before submitting, please make sure you have:
   * Performed code reviews of your own
   * Updated the [test cases](#testing) if needed
   * Run the [test cases](#testing) to ensure no feature breaks or test breaks
   * Added the [test cases](#testing) for new code
   * Ensured that the code is free of [static analysis](#static-analysis) issues
 4. Submit a feature request.
 5. Help answer [questions](https://github.com/PowerShell/PowerShellForGitHub/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Aquestion).
 6. Write new [test cases](#testing).
 7. Tell others about the project.
 8. Tell the developers how much you appreciate the product!

You might also read these two blog posts about contributing code:
 * [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza
 * [Don't "Push" Your Pull Requests](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik.

Before submitting a feature or substantial code contribution, please discuss it with the
PowerShellForGitHub team via [Issues](https://github.com/PowerShell/PowerShellForGitHub/issues), and ensure it
follows the product roadmap. Note that all code submissions will be rigorously reviewed by the
PowerShellForGitHub Team. Only those that meet a high bar for both quality and roadmap fit will be merged
into the source.

## Maintainers

PowerShellForGitHub is maintained by:

- **[@HowardWolosky](http://github.com/HowardWolosky)**

As this module is a production dependency for Microsoft, we have a couple workflow restrictions:

- Anyone with commit rights can merge Pull Requests provided that there is a :+1: from one of
  the members above.
- Releases are performed by a member above so that we can ensure Microsoft internal processes
  remain up to date with the latest and that there are no regressions.

## Feedback

All issue types are tracked on the project's [Issues]( https://github.com/PowerShell/PowerShellForGitHub/issues)
page.

In all cases, make sure to search the list of issues before opening a new one.
Duplicate issues will be closed.

### Bugs

For a great primer on how to submit a great bug report, we recommend that you read:
[Painless Bug Tracking](http://www.joelonsoftware.com/articles/fog0000000029.html).

To report a bug, please include as much information as possible, namely:

* The version of the module (located in `PowerShellForGitHub.psd1`)
* Your OS version
* Your version of PowerShell (`$PSVersionTable.PSVersion`)
* As much information as possible to reproduce the problem.
* If possible, logs from your execution of the task that exhibit the erroneous behavior
* The behavior you expect to see

Please also mark your issue with the 'bug' label.

### Suggestions

We welcome your suggestions for enhancements to the extension.
To ensure that we can integrate your suggestions effectively, try to be as detailed as possible
and include:

* What you want to achieve / what is the problem that you want to address.
* What is your approach for solving the problem.
* If applicable, a user scenario of the feature / enhancement in action.

Please also mark your issue with the 'suggestion' label.

### Questions

If you've read through all of the documentation, checked the Wiki, and the PowerShell help for
the command you're using still isn't enough, then please open an issue with the `question`
label and include:

* What you want to achieve / what is the problem that you want to address.
* What have you tried so far.

----------

## Static Analysis

This project leverages the [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer/)
PowerShell module for static analysis.

It is expected that this module shall remain "clean" from the perspective of that module.

If you have never installed PSScriptAnalyzer, do this from an Administrator PowerShell console window:

```powershell
Install-Module -Name PSScriptAnalyzer
```

In the future, before running it, make sure it's up-to-date (run this from an Administrator
PowerShell console window):

```powershell
Update-Module -Name PSScriptAnalyzer
```

Once it's installed (or updated), from the root of your enlistment simply call

```powershell
Invoke-ScriptAnalyzer -Settings ./PSScriptAnalyzerSettings.psd1 -Path ./ -Recurse
```

That should return with no output.  If you see any output when calling that command,
either fix the issues that it calls out, or add a `[Diagnostics.CodeAnalysis.SuppressMessageAttribute()]`
with a justification explaining why it's ok to suppress that rule within that part of the script.
Refer to the [PSScriptAnalyzer documentation](https://github.com/PowerShell/PSScriptAnalyzer/) for
more information on how to use that attribute, or look at other existing examples within this module.

----------

### Module Manifest

This is a manifested PowerShell module, and the manifest can be found here:

    PowerShellForGitHub.psd1

If you add any new modules/files to this module, be sure to update the manifest as well.
New modules should be added to `NestedModules`, and any new functions or aliases that
should be exported need to be added to the corresponding `FunctionsToExport` or
`AliasesToExport` section.  Please keep all entries to those sections in **alphabetical order**.

----------

### Logging

Instead of using the built-in `Write-*` methods (`Write-Host`, `Write-Warning`, etc...),
please use

```powershell
Write-Log
```

which is implemented in Helpers.ps1.  It will take care of formatting your content in a
consistent manner, as well ensure that the content is logged to a file (if configured to do so
by the user).

----------

### PowerShell Version

This module must be able to run on PowerShell version 4.  It is permitted to add functionality
that requires a higher version of PowerShell, but only if there is a fallback implementation
that accomplishes the same thing in a PowerShell version 4 compatible way, and the path choice
is controlled by a PowerShell version check.

For an example of this, see `Write-Log` in `Helpers.ps1` which uses `Write-Information`
for `Informational` messages on v5+ and falls back to `Write-Host` for earlier versions:

```powershell
if ($PSVersionTable.PSVersion.Major -ge 5)
{
    Write-Information $ConsoleMessage -InformationAction Continue
}
else
{
    Write-Host $ConsoleMessage
}
```

----------

### Coding Guidelines

As a general rule, our coding convention is to follow the style of the surrounding code.
Avoid reformatting any code when submitting a PR as it obscures the functional changes of your change.

A basic rule of formatting is to use "Visual Studio defaults".
Here are some general guidelines

* No tabs, indent 4 spaces.

* Use `camelCase` for instance fields, `PascalCase` for function and parameter names
* Avoid the creation of `script` scoped variables unless absolutely necessary.
  If referencing one, be sure to explicitly reference it by scope.
* Don't use globals.  If you want to add module configuration, [add a new property instead](#adding-new-configuration-properties).
* Avoid more than one blank empty line.
* Always use a blank line following a closing bracket `}` unless the next line itself is a closing bracket.
* Add full [Comment Based Help](https://technet.microsoft.com/en-us/library/hh847834.aspx) for all
  methods added, whether internal-only or external.  The act of writing this documentation may help
  you better design your function.
* File encoding should be ASCII (preferred) or UTF8 (with BOM) if absolutely necessary.
* We try to adhere to the [PoshCode Best Practices](https://github.com/PoshCode/PowerShellPracticeAndStyle/tree/master/Best%20Practices)
  and [DSCResources Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md)
  and think that you should too.
* We try to limit lines to 100 characters to limit the amount of horizontal scrolling needed when
  reviewing/maintaining code.  There are of course exceptions, but this is generally an enforced
  preference.  The [Visual Studio Productivity Power Tools](https://visualstudiogallery.msdn.microsoft.com/34ebc6a2-2777-421d-8914-e29c1dfa7f5d)
  extension has a "Column Guides" feature that makes it easy to add a Guideline in column 100
  to make it really obvious when coding.  If you use VS Code, this module's `.vscode/settings.json`
  configures that for you automatically.

----------

## Adding New Configuration Properties

If you want to add a new configuration value to the module, you must modify the following:
 * In `Import-GitHubConfiguration`, update `$config` to declare the new property along with
   its default value, being sure that PowerShell will understand what its type is. Properties
   should be alphabetical.
 * Update `Get-GitHubConfiguration` and add the new property name to the `ValidateSet` list
   so that tab-completion and documentation gets auto-updated. You shouldn't have to add anything
   to the body of the method. Property names should be alphabetical.
 * Add a new explicit parameter to `Set-GitHubConfiguration` to receive the property, along with
   updating the CBH (Comment Based Help) by adding a new `.PARAMETER` entry. You shouldn't
   have to add anything to the body of the method. Parameters should be alphabetical save for the
   `SessionOnly` switch, which should be last.

----------

### Code comments

It's strongly encouraged to add comments when you are making changes to the code and tests,
especially when the changes are not trivial or may raise confusion.
Make sure the added comments are accurate and easy to understand.
Good code comments should improve readability of the code, and make it much more maintainable.

That being said, some of the best code you can write is self-commenting.  By refactoring your code
into small, well-named functions that concisely describe their purpose, it's possible to write
code that reads clearly while requiring minimal comments to understand what it's doing.

----------

### Debugging Tips

You may find it useful to configure the module to log the body of all REST requests during
development of a new feature, to make it easier to see exactly what is being sent to GitHub.

```powershell
Set-GitHubConfiguration -LogRequestBody
```

----------

### Pipeline Support

This module has comprehensive support for the PowerShell pipeline.  It is imperative that all
new functionality added to the module embraces this design.

 * Most functions are declared as a `filter`.  This is the equivalent of a `function` where the
   body of the function is the `process` block, and the `begin/end` blocks are empty.

 * In limited cases where one of the inputs is an array of something, and you specifically want that
   to be processed as a single command (like adding a bunch of labels to a single issue at once),
   you can implement it as a `function` where you use `begin/process` to gather all of the values
   into a single internal array, and then do the actual command execution in the `end` block.  A
   good example of that which you can follow can be seen with `Add-GitHubIssueLabel`.

 * Any function that requires the repo's `Uri` to be provided should be additionally aliased with
   `[Alias('RepositoryUrl')]` and its `[Parameter()]` definition should include `ValueFromPipelineByPropertyName`.

 * Do not use any generic term like `Name` in your parameters.  That will end up causing unintended
   pipeline issues down the line.  For instance, if it's a label, call it `Label`, even though `Name`
   would make sense, other objects in the pipeline (like a `GitHub.Respository` object) also have
   a `name` property that would conflict.

 * You should plan on adding additional properties to all objects being returned from an API call.
   Any object that is specific to a repository should have a `RepositoryUrl` `NoteProperty` added
   to it, enabling it to be piped-in to any other command that requires knowing which repository
   you're talking about.  Additionally, any other property that might be necessary to uniquely
   identify that object in a different command should get added properties.  For example, with Issues,
   we add both an `IssueNumber` property and an `IssueId` property to it, as the Issue commands
   need to interact with the `IssueNumber` while the Event commands interact with the `IssueId`.
   We prefer to _only_ add additional properties that are believed to be needed as input to other
   commands (as opposed to creating alias properties for all of the object's properties).

 * For every major file, you will find an `Add-GitHub*AdditionalProperties` filter method at the end.
   If you're writing a new file, you'll need to create this yourself (and model it after an existing
   one).  The goal of this is that you can simply pipe the output of your `Invoke-GHRestMethod`
   directly into this method to update the result with the additional properties, and then return
   that modified version to the user.  The benefit of this approach is that you can then apply that
   filter on child objects within the primary object.  For instance, a `GitHub.Issue` has multiple
   `GitHub.User` objects, `GitHub.Label` objects, a `GitHub.Milestone` object and more.  Within
   `Add-GitHubIssueAdditionalProperties`, it just needs to know to call the appropriate
   `Add-GitHub*AdditionalProperties` method on the qualifying child properties, without needing to
   know anything more about them.

 * That method will also "type" information to each object.  This is forward-looking work to ease
   support for providing formatting of various object types in the future.  That type should be
   defined at the top of the current file at the script level (see other files for an example),
   and you should be sure to both specify it in the `.OUTPUTS` section of the Comment Based Help (CBH)
   for the command, as well as with `[OutputType({$script:GitHubUserTypeName})]` (for example).

 * Going along with the `.OUTPUTS` is the `.INPUTS` section.  Please maintain this section as well.
   If you add any new type that will gain a `RepositoryUrl` property, then you'll need to update
   virtually _all_ of the `.INPUTS` entries across all of the files where the function has a `Uri`
   parameter.  Please keep these type names alphabetical.

 * To enable debugging issues involving pipeline support, there is an additional configuration
   property that you might use:  `Set-GitHubConfiguration -DisablePipelineSupport`.  That will
   prevent the module from adding _any_ additional properties to the objects.

----------

### Formatters

[Our goal](https://github.com/microsoft/PowerShellForGitHub/issues/27) is to have automattic
formatting for all `GitHub.*` types that this project defines.

Formatting was first introduced to the project with [#205](https://github.com/microsoft/PowerShellForGitHub/pull/205),
and succcesive PR's which introduce new types have added their additional formatters as well.
Eventually we will get Formatters for all previously introduced types as well.

Formatter files can be found in [/Formatters](https://github.com/microsoft/PowerShellForGitHub/tree/master/Formatters).

When adding a new formatter file, keep the following in mind:

* One formatter file per PowerShell module file, and name them similarly
  (e.g. `GitHubRepositories.ps1` gets a `Formatters\GitHubRepositories.Format.ps1xml` file)
* Be sure to add the formatter file to the manifest (common mistake to forget this).
* Don't display all the type's properties ...just choose the most relevant pieces of information;
  sometimes this might mean using a script block to grab an inner-property or to perform a
  calculation.

----------

### Testing
[![Build status](https://dev.azure.com/ms/PowerShellForGitHub/_apis/build/status/PowerShellForGitHub-CI?branchName=master)](https://dev.azure.com/ms/PowerShellForGitHub/_build/latest?definitionId=109&branchName=master)
[![Azure DevOps tests](https://img.shields.io/azure-devops/tests/ms/PowerShellForGitHub/109/master)](https://dev.azure.com/ms/PowerShellForGitHub/_build/latest?definitionId=109&branchName=master)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/ms/PowerShellForGitHub/109/master)](https://dev.azure.com/ms/PowerShellForGitHub/_build/latest?definitionId=109&branchName=master)

#### Installing Pester
This module supports testing using the [Pester UT framework](https://github.com/pester/Pester).

To install it:

```powershell
Install-Module -Name Pester -MinimumVersion 5.3.3 -AllowClobber -SkipPublisherCheck -Force
```

#### Configuring Your Environment
The tests intentionally do not mock out interaction with the real GitHub API, as we want to know
when our interaction with the API has been broken.  That means that to execute the tests, you will
need Administrator privilege for an account.  For our purposes, we have a "test" account that our
team uses for having the tests [run automated](#automated-tests).  For you to run the tests locally,
you must make a couple changes:

 1. Choose if you'll be executing the tests on your own personal account or your own test account
    (the tests should be non-destructive, but ... hey ... we are developing code here, mistakes happen.)
 2. Update your local copy of [tests/config/Settings.ps1](./tests/config/Settings.ps1) to note
    the `OwnerName` and `OrganizationName` that the tests will be running under.
    > While you can certainly check-in this file to your own fork, please DO NOT include your
    > changes as part of any pull request that you may make.  The `.gitignore` file tries
    > to help prevent that.
 3. Run `Set-GitHubAuthentication` to ensure that it is configured with an administrator-level
    Access Token for the specified owner/organization.
    > Unfortunately, you cannot use `-SessionOnly` with `Set-GitHubAuthentication` when testing,
    > as Pester works by making new sessions for every test.  That means that it must be "globally"
    > configured with that access token for the duration of the Pester test execution.

#### Running the Tests
Tests can be run either from the project root directory or from the `Tests` subfolder.
Navigate to the correct folder and simply run:

```powershell
Invoke-Pester
```

Make sure you have previously configured your Access Token via `Set-GitHubAuthentication`.
Please keep in mind some tests may fail on your machine, as they test private items (e.g. secret teams) which your key won't have access to.

Pester can also be used to test code-coverage, like so:

```powershell
$pesterConfig = New-PesterConfiguration
$pesterConfig.CodeCoverage.Path = @("$root\GitHubLabels.ps1")
$pesterConfig.CodeCoverage.Enabled = $true

Invoke-Pester -Configuration $pesterConfig
# Be sure you're not passing this in to -PesterOption, since that's different than the configuration.
```

This command tells Pester to check the `GitHubLabels.ps1` file for code-coverage.

The code-coverage object can be captured and interacted with, like so:

```powershell
$pesterConfig = New-PesterConfiguration
$pesterConfig.CodeCoverage.Path = @("$root\GitHubLabels.ps1")
$pesterConfig.CodeCoverage.Enabled = $true
$pesterConfig.Run.PassThru = $true

$cc = (Invoke-Pester -Configuration $pesterConfig).CodeCoverage
```

There are many more nuances to code-coverage, see
[its documentation](https://pester.dev/docs/usage/code-coverage) for more details.

#### Automated Tests
[![Build status](https://dev.azure.com/ms/PowerShellForGitHub/_apis/build/status/PowerShellForGitHub-CI?branchName=master)](https://dev.azure.com/ms/PowerShellForGitHub/_build/latest?definitionId=109&branchName=master)
[![Azure DevOps tests](https://img.shields.io/azure-devops/tests/ms/PowerShellForGitHub/109/master)](https://dev.azure.com/ms/PowerShellForGitHub/_build/latest?definitionId=109&branchName=master)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/ms/PowerShellForGitHub/109/master)](https://dev.azure.com/ms/PowerShellForGitHub/_build/latest?definitionId=109&branchName=master)

These test are configured to automatically execute upon any update to the `master` branch
of `microsoft/PowerShellForGitHub`.

The [Azure DevOps pipeline](https://dev.azure.com/ms/PowerShellForGitHub/_build?definitionId=109&_a=summary)
has been [configured](https://github.com/microsoft/PowerShellForGitHub/blob/master/build/pipelines/templates/run-unitTests.yaml#L25-L28)
to execute the tests against a test GitHub account (for the user `PowerShellForGitHubTeam`,
and the org `PowerShellForGitHubTeamTestOrg`).  You will see the AccessToken being referenced there
as well...it is stored, encrypted, within Azure DevOps.  It is not accessible for use outside of
the CI pipeline.  To run the tests locally with your own account, see
[configuring-your-environment](#configuring-your-environment).

> Your change must successfully pass all tests before they will be merged.  While we will run a CI
> build on your behalf for any submitted pull request, it's to your benefit to verify your changes
> locally first.

#### New Test Guidelines
Your tests should have NO dependencies on an account being set up in a specific way.  They should
get the configured account set up in the appropriate state that it can then test/verify.  In this
way, anyone should be able to run the tests from their own machine/account.

Use a new GUID for any object that you have to create (repository, label, team name, etc...) to avoid
any possible name collisions with existing objects on the executing user's accounts.

----------

### Releasing

When new code changes are checked in to the repo, most users of the module will not see those changes
unless an updated module gets published by Microsoft to
[PowerShell Gallery](https://www.powershellgallery.com/packages/PowerShellForGitHub).

The general guidance on publishing an update is that changes should not be in `master` more than
one week without having been published through PowerShell Gallery as well.

When you are ready to publish a new update, the following steps are necessary:
  * Create (and complete) a changelist that:
    * Updates the [version number](#updating-the-version-number)
    * Updates the [CHANGELOG.md](./CHANGELOG.md) (and [contributors](#contributors) list if necessary)
  * [Add a tag](#adding-a-new-tag) for the new version to the repo
  * [Queue a new release build](#running-the-release-build)

#### Updating the Version Number

Whenever new changes to the module are to be released to PowerShellGallery, it is important to
properly update the version of the module.  The version number is stored in the module manifest
([PowerShellForGitHub.psd1](https://github.com/microsoft/PowerShellForGitHub/blob/master/PowerShellForGitHub.psd1)),
and it should be updated following the [Semantic Versioning](#semantic-versioning) standard.

> The update to the module manifest should happen in the same changelist where the
> [CHANGELOG is updated](#updating-the-changelog).

##### Semantic Versioning

This project follows [semantic versioning](http://semver.org/) in the following way:

    <major>.<minor>.<patch>

Where:
* `<major>` - Changes only with _significant_ updates.
* `<minor>` - If this is a feature update, increment by one and be sure to reset `<patch>` to 0.
* `<patch>` - If this is a bug fix, leave `<minor>` alone and increment this by one.

#### Updating the CHANGELOG
To update [CHANGELOG.md](./CHANGELOG.md), just duplicate the previous section and update it to be
relevant for the new release.  Be sure to update all of the sections:
  * The version number
  * The hard path to the change (we'll get that path working [in a moment](#adding-a-new-tag))
  * The release date
  * A brief list of all the changes (use a `-` for the bullet point if it's fixing a bug, or a `+` for a feature)
  * The link to the pull request (pr) (so that the discussion on the change can be easily reviewed) and the changelist (cl)
  * The author (and a link to their profile)
  * If it's a new contributor, also add them to the [Contributors](#contributors) list below.

Then get a new pull request out for that change and for the change to the
[module manifest's version number](#updating-the-version-number).

#### Adding a New Tag
To add a new tag:
   1. Make sure that you're in a clone of the actual repo and not your own private fork.
   2. Make sure that you've already merged in the change that updates the module version.
   3. Make sure that you have checked out `master` and that it's fully up-to-date
   4. Run `git tag -a '<version number>'`
   5. In the pop-up editor, just copy the content from the CHANGELOG that you just wrote, but remove
      any of the `###` heading blocks since those will be dropped from git as comments instead of
      headings.
   6. Save and close the editor
   7. Run `git push --tags` to upload the new tag you just created

If you want to make sure you get these tags on any other forks/clients, you can run
`git fetch origin --tags` or `git fetch upstream --tags`, or whatever you've named the source to be.

> Doing this makes it possible for users to simply run `git checkout <version number>` to quickly
> set their clone to the state of any previous version.
> It also has the added benefit that GitHub will automatically create a new "Release" in the
> Releases tab of the project for this new version.

#### Running the Release Build

A [YAML definition exists](https://github.com/microsoft/PowerShellForGitHub/blob/master/build/pipelines/azire-pipelines.release.yaml)
that will run the equivalent of the CI build, followed by the necessary steps to sign the module
files and publish the update to PowerShell Gallery.  This YAML file can only be run by a Microsoft
maintainer because it accesses internal services to sign the module files with Microsoft's certificate.

> **Microsoft Maintainers**: You can access the internal pipeline which can execute the release build
> [here](https://microsoft.visualstudio.com/Apps/_build?definitionId=43898).  Simply hit `Queue` to
> get a new module released.
>
> Instructions for updating the `PowerShellGalleryApiKey` secret in the pipeline can be found in the
> [internal Microsoft repo for this project](https://microsoft.visualstudio.com/Apps/_git/eng.powershellforgithub).

#### Updating the Wiki Documentation

The [Wiki](https://github.com/microsoft/PowerShellForGitHub/wiki) contains the full documentation
for all exported commands from the module, thanks to [platyPS](https://github.com/PowerShell/platyPS).

Every time a new release occurs, the Wiki should be updated to reflect any changes that occurred
within the module.

1. Ensure that you have cloned the Wiki:

   ```
   git clone https://github.com/microsoft/PowerShellForGitHub.wiki.git
   ```

2. Open a PowerShell 7+ console window (don't use Windows PowerShell as there's a platyPS bug
   with that version regarding multi-line examples) and navigate to your Wiki clone.

3. Run this command (assuming that you have a `PowerShellForGitHub` clone at the same level as your
   Wiki clone):

   ```powershell
   ..\PowerShellForGitHub\build\scripts\Build-Wiki.ps1 -Path .\ -RemoveDeprecated -Verbose -Force
   ```

4. Verify the changes all make sense.  You will also need to manually copy the core content of
   `PowerShellForGitHub.md` into `Home.md`.  For the time being, we are duplicating that content
   in Home until such time as we have better content to put there.

5. Commit the change and directly push it to the Wiki's `master` branch...no need to go through
   a pull request for the Wiki changes.

> This is not currently automated as part of the [Release pipeline](#running-the-release-build)
> because I don't currently want to store any credentials/tokens with write access to the repo
> in the pipeline.

----------

### Contributors

Thank you to all of our contributors, no matter how big or small the contribution:

- **[Howard Wolosky (@HowardWolosky)](http://github.com/HowardWolosky)**
- **[Karol Kaczmarek (@KarolKaczmarek)](https://github.com/KarolKaczmarek)**
- **[Josh Rolstad (@jrolstad)](https://github.com/jrolstad)**
- **[Zachary Alexander (@zjalexander)](http://github.com/zjalexander)**
- **[Andrew Dahl (@aedahl)](http://github.com/aedahl)**
- **[Pepe Rivera (@joseartrivera)](https://github.com/joseartrivera)**
- **[Ethan Gottlieb (@etgottli)](https://github.com/etgottli)**
- **[François-Xavier Cat (@lazywinadmin)](https://github.com/lazywinadmin)**
- **[Cliff Chapman (@Cellivar)](https://github.com/Cellivar)**
- **[Robert Holt (@rjmholt)](https://github.com/rjmholt)**
- **[Steven Maglio (@smaglio81)](https://github.com/smaglio81)**
- **[Kiran Reddy (@v2kiran)](https://github.com/v2kiran)**
- **[Darío Hereñú (@kant)](https://github.com/kant)**
- **[@wikijm](https://github.com/wikijm)**
- **[Przemysław Kłys (@PrzemyslawKlys)](https://github.com/PrzemyslawKlys)**
- **[Matt Boren (@mtboren)](http://github.com/mtboren)**
- **[Shannon Deminick (@Shazwazza)](http://github.com/Shazwazza)**
- **[Jess Pomfret (@jpomfret)](https://github.com/jpomfret)**
- **[Giuseppe Campanelli (@themilanfan)](https://github.com/themilanfan)**
- **[Christoph Bergmeister (@bergmeister)](https://github.com/bergmeister)**
- **[Simon Heather (@X-Guardian)](https://github.com/X-Guardian)**
- **[Neil White (@variableresistor)](https://github.com/variableresistor)**
- **[Mark Curole(@tigerfansga)](https://github.com/tigerfansga)**

----------

### Legal and Licensing

PowerShellForGitHub is licensed under the [MIT license](..\LICENSE).

You will need to complete a Contributor License Agreement (CLA) for any code submissions.
Briefly, this agreement testifies that you are granting us permission to use the submitted change
according to the terms of the project's license, and that the work being submitted is under
appropriate copyright. You only need to do this once.

When you submit a pull request, [@msftclas](https://github.com/msftclas) will automatically
determine whether you need to sign a CLA, comment on the PR and label it appropriately.
If you do need to sign a CLA, please visit https://cla.microsoft.com and follow the steps.

repository: HowardWolosky/PowerShellForGitHub

gha_language: PowerShell

repo_name: HowardWolosky/PowerShellForGitHub


text:
# About the #data-structures series

The [#data-structures series](/category/data-structures-in-javascript/) is a collection of posts about reimplemented data structures in JavaScript.

If you are not familiar with data structures, a quick introduction and the full list of reimplemented data structures can be found in the [introduction post of the series on data structures in JavaScript](/data-structures-in-javascript/data-structures-in-javascript/).

If you feel comfortable with the concept of each data structure and only want to see the code, have a look at the summary post of the series. It removes all explanations and contains only the [JavaScript code for all data structures](/data-structures-in-javascript/data-structures-in-javascript-all-the-code/) discussed in the series.

## Get the code on Github

Of course, all the code can also be found on Github in the repository [data-structures-in-javascript](https://github.com/benoitvallon/computer-science-in-javascript/tree/master/data-structures-in-javascript).

branch_name: refs/heads/master

extension: md

gha_language: SCSS

license_type: permissive


text:
---
order: 4
description: Define keepers for the nameservice module.
---

# Keeper

> The main core of a Cosmos SDK module is a piece called the keeper. The keeper handles interactions with the store, has references to other [keepers](https://docs.cosmos.network/master/building-modules/keeper.html) for cross-module interactions, and contains most of the core functionality of a module.

## Define Keepers for the Nameservice Module

Keepers are module-specific. Keeper is part of the Cosmos SDK that is responsible for writing data to the store. Each module uses its own keeper.

In this section, define the keepers that are required by the nameservice module:

- Buy name
- Set name
- Delete name

## Buy Name

To define the keeper for the buy name transaction, add this code to the `msg_server_buy_name.go` file:

```go
// x/nameservice/keeper/msg_server_buy_name.go
import (
	"context"
	"github.com/cosmonaut/nameservice/x/nameservice/types"
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

func (k msgServer) BuyName(goCtx context.Context, msg *types.MsgBuyName) (*types.MsgBuyNameResponse, error) {
  ctx := sdk.UnwrapSDKContext(goCtx)
  // Try getting a name from the store
  whois, isFound := k.GetWhois(ctx, msg.Name)
  // Set the price at which the name has to be bought if it didn't have an owner before
  minPrice := sdk.Coins{sdk.NewInt64Coin("token", 10)}
  // Convert price and bid strings to sdk.Coins
  price, _ := sdk.ParseCoinsNormalized(whois.Price)
  bid, _ := sdk.ParseCoinsNormalized(msg.Bid)
  // Convert owner and buyer address strings to sdk.AccAddress
  owner, _ := sdk.AccAddressFromBech32(whois.Creator)
  buyer, _ := sdk.AccAddressFromBech32(msg.Creator)
  // If a name is found in store
  if isFound {
    // If the current price is higher than the bid
    if price.IsAllGT(bid) {
      // Throw an error
      return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Bid is not high enough")
    }
    // Otherwise (when the bid is higher), send tokens from the buyer to the owner
    k.bankKeeper.SendCoins(ctx, buyer, owner, bid)
  } else { // If the name is not found in the store
    // If the minimum price is higher than the bid
    if minPrice.IsAllGT(bid) {
      // Throw an error
      return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Bid is less than min amount")
    }
    // Otherwise (when the bid is higher), burn tokens from the buyer's account (as a payment for the name)
    k.bankKeeper.SubtractCoins(ctx, buyer, bid)
  }
  // Create an updated whois record
  newWhois := types.Whois{
    Index:   msg.Name,
    Name:    msg.Name,
    Value:   whois.Value,
    Price:   bid.String(),
    Creator: buyer.String(),
  }
  // Write whois information to the store
  k.SetWhois(ctx, newWhois)
  return &types.MsgBuyNameResponse{}, nil
}
```

When you scaffolded the `nameservice` module you used `--dep bank` to specify a dependency between the `nameservice` and `bank` modules.

This dependency automatically created an `expected_keepers.go` file with a `BankKeeper` interface.

The `BuyName` transaction uses `SendCoins` and `SubtractCoins` methods from the `bank` module.

Edit the `expected_keepers.go` file to add `SendCoins` and `SubtractCoins` to be able to use it in the keeper methods of the `nameservice` module.

```go
// x/nameservice/types/expected_keepers.go
import (
	sdk "github.com/cosmos/cosmos-sdk/types"
)

type BankKeeper interface {
  SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error
  SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
}
```

## Set Name

To define the keeper for the set name transaction, add this code to the `msg_server_set_name.go` file:

```go
// x/nameservice/keeper/msg_server_set_name.go
import (
	"context"
	"github.com/cosmonaut/nameservice/x/nameservice/types"
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

func (k msgServer) SetName(goCtx context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
  ctx := sdk.UnwrapSDKContext(goCtx)
  // Try getting name information from the store
  whois, _ := k.GetWhois(ctx, msg.Name)
  // If the message sender address doesn't match the name owner, throw an error
  if !(msg.Creator == whois.Creator) {
    return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Owner")
  }
  // Otherwise, create an updated whois record
  newWhois := types.Whois{
    Index:   msg.Name,
    Name:    msg.Name,
    Value:   msg.Value,
    Creator: whois.Creator,
    Price:   whois.Price,
  }
  // Write whois information to the store
  k.SetWhois(ctx, newWhois)
  return &types.MsgSetNameResponse{}, nil
}
```

## Delete Name

To define the keeper for the delete name transaction, add this code to the `msg_server_buy_name.go` file:

```go
// x/nameservice/keeper/msg_server_delete_name.go
import (
	"context"
	"github.com/cosmonaut/nameservice/x/nameservice/types"
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

func (k msgServer) DeleteName(goCtx context.Context, msg *types.MsgDeleteName) (*types.MsgDeleteNameResponse, error) {
  ctx := sdk.UnwrapSDKContext(goCtx)
  // Try getting name information from the store
  whois, isFound := k.GetWhois(ctx, msg.Name)
  // If a name is not found, throw an error
  if !isFound {
    return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name doesn't exist")
  }
  // If the message sender address doesn't match the name owner, throw an error
  if !(whois.Creator == msg.Creator) {
    return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Owner")
  }
  // Otherwise, remove the name information from the store
  k.RemoveWhois(ctx, msg.Name)
  return &types.MsgDeleteNameResponse{}, nil
}
```

branch_name: refs/heads/develop

gha_language: Go

gha_license_id: NOASSERTION


text:
---
name: Issues
about: Write about the wrongs about this code
title: Errors & Improvements
labels: ''
assignees: sarthak625, apoorvsingh15

---

* **I'm submitting a ...**
  - [ ] error report
  - [ ] algorithm request
  - [ ] support request => To get help in understanding some algorithm.

* **Do you want to request a *algorithm* or report an *error*?**

* **What is the current behavior?**

* **What is the expected behavior?**

* **Other information** (e.g. detailed explanation, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

license: MIT

gha_language: JavaScript

gha_license_id: MIT


text:
# Gravatar Helper
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Travis](https://img.shields.io/travis/PotatoPowered/gravatar-helper.svg?style=flat-square)](https://travis-ci.org/PotatoPowered/gravatar-helper)
[![Codecov](https://img.shields.io/codecov/c/github/PotatoPowered/gravatar-helper.svg?style=flat-square)](https://codecov.io/github/PotatoPowered/phone-helper)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/PotatoPowered/gravatar-helper.svg?style=flat-square)](https://scrutinizer-ci.com/g/PotatoPowered/phone-helper/)
[![Packagist](https://img.shields.io/packagist/dt/potatopowered/gravatar-helper.svg?style=flat-square)](https://packagist.org/packages/potatopowered/gravatar-helper)

A helper that can be used to pull profile pictures from the gravatar service for CakePHP 3.x

## Description

The gravatar helper aims to make it easy to pull user avatars from the gravatar service rather than having to rebuilt the basic connection and link generation for the API every time you want to use it. There are many customizations that can be set including defaults and the avatar size returned.

## Installation

```
composer require potatopowered/gravatar-helper
```
Add the helper to the public helpers variable of the controller you need it on or in the AppController
to have it accessible in all controllers.
```
public $helpers = [
    'Gravatar' => [
        'className' => 'GravatarHelper.Gravatar'
    ]
];
```

## Usage

To use the gravatar helper you simply call the avatar function of the Gravatar helper with the user email as the argument. There are also several options you can set to change defaults like size.
```
// the avatar of the user with an email of $email
$this->Gravatar->avatar($email, ['size' => 40]);
```

## Options for Avatar

 * size: The width and height of the profile (150 default)
 * default: The default gravatar image (mm default) [List Here](http://en.gravatar.com/site/implement/images/)
 * class: The css class of the image tag (gravatar default)

repository: PotatoPowered/gravatar-helper

gha_language: PHP

repo_name: PotatoPowered/gravatar-helper


text:
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/

title: "PhD Thesis"
summary: "Software developers need to search for reusable code that would assist them in implementing
a given feature or development task. Often, the timely discovery of a critical piece of
information can have a dramatic impact on productivity. Current code search systems focus on
providing code against a specific user query and repeated searches need to be performed until the
code for the desired feature or set of features is found. The problem of repeated code searches
needs to be addressed and a solution is desired for helping developers to get the code for related
features, thus enabling opportunistic reuse for increased developer productivity.
We propose FACER (Feature-driven API usage-based Code Examples Recommender), a recommendation
system that provides developers with method recommendations having functionality
relevant to their feature or development task. The main idea behind FACER is to provide
code recommendations against a feature query based on patterns of frequently co-occurring API
usage-based Method Clone Classes. Such patterns are called Method Clone Structures (MCS)."
authors: [Shamsa Abid]
tags: []
categories: []
date: 2021-12-03T00:11:28+05:00

# Optional external URL for project (replaces project detail page).
external_link: ""

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
#image:
  #caption: "FACER System Architecture"
  #focal_point: "Bottom"
  #preview_only: true

# Custom links (optional).
#   Uncomment and edit lines below to show custom links.
#links:
# - name: Follow
#   url: https://twitter.com
#   icon_pack: fab
#   icon: twitter

url_code: ""
url_pdf: "files/ShamsaPhDThesis2021.pdf"
url_slides: ""
url_video: ""

# Slides (optional).
#   Associate this project with Markdown slides.
#   Simply enter your slide deck's filename without extension.
#   E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
#   Otherwise, set `slides = ""`.
slides: ""
---

repository: shamsa-abid/academic-kickstart

repo_name: shamsa-abid/academic-kickstart


text:
---
title: How to delete pending Switch Updates
help-desc: Erase pending updates on Nintendo Switch
---

When an update is downloaded, but not installed, the console will not display the firmware version in System Settings.

• To reset on a stock system, *power the console off* (hold the power button, follow on-screen prompts). __Hold__ Volume - and Volume +, then Power. When you see Maintenance Mode, you can reboot, and check System Settings.
• If you're using CFW, launch Hekate, select your boot option, then immediately __Hold__ Volume - and Volume +. When you see Maintenance Mode, you can reboot, and check System Settings.

To block automatic update downloads, type '.90dns' in <#261581918653513729> for further information.

repository: nh-server/Kurisu

branch_name: refs/heads/main

gha_language: Python

repo_name: nh-server/Kurisu


text:
# NatCorder API
NatCorder is a lightweight, easy-to-use, native video recording API for iOS, Android, macOS, and Windows. NatCorder comes with a rich featureset including:
+ Record any texture, anything that can be rendered into a texture, or any pixel data.
+ Record to MP4 videos and animated GIF images.
+ Control recording quality and file size with bitrate and keyframe interval.
+ Record at any resolution. You get to specify what resolution recording you want.
+ Get path to recorded video in device storage.
+ Record game audio with video.
+ Support for recording HEVC videos.

## Fundamentals of Recording
NatCorder provides a simple recording API with instances of the `IMediaRecorder` interface. **NatCorder works by encoding video and audio frames on demand**. To start recording, simply create a recorder corresponding to the media type you want to record:
```csharp
var gifRecorder = new GIFRecorder(...);
var mp4Recorder = new MP4Recorder(...);
var hevcRecorder = new HEVCRecorder(...);
```

Once you create a recorder, you then commit frames to it. You can commit video and audio frames to these recorders. These committed frames are then encoded into a media file. When committing frames, you must provide the frame data with a corresponding timestamp. The spacing between timestamps determine the final frame rate of the recording.

### Committing Video Frames
NatCorder records video using pixel buffers. The pixel buffers must be 32-bit per pixel, RGBA encoding (`TextureFormat.RGBA32`). The managed type of the pixel buffer is entirely flexible. As a result, you can commit a `Color32[]`, a `byte[]`, an `int[]`, or any struct array that can be interpreted as an `RGBA32` pixel buffer.

When committing a pixel buffer for encoding, you will need to provide a corresponding timestamp. For this purpose, you can use implementations of the `IClock` interface. Here is an example illustrating recording a `WebCamTexture`:
```csharp
async void Start () {
    // Start camera
    var cameraTexture = new WebCamTexture();
    cameraTexture.Play();
    // Create a clock for generating recording timestamps
    var clock = new RealtimeClock();
    // Create a recorder
    var recorder = new MP4Recorder(...);
    // Record 150 frames
    for (int i = 0; i < 150; i++) {
        // Commit the frame to NatCorder for encoding
        recorder.CommitFrame(cameraTexture.GetPixels32(), clock.timestamp);
        // Wait for some milliseconds
        await Task.Delay(10);
    }
    // Finish writing
    var recordingPath = await recorder.FinishWriting();
}
```

### Committing Audio Frames
NatCorder records audio provided as interleaved PCM sample buffers (`float[]`). Similar to recording video frames, you will call the `IMediaRecorder.CommitSamples` method, passing in a sample buffer and a corresponding timestamp. It is important that the timestamps synchronize with those of video, so it is recommended to use the same `IClock` for generating video and audio timestamps. Below is an example illustrating recording game audio using Unity's `OnAudioFilterRead` callback:
```csharp
void OnAudioFilterRead (float[] sampleBuffer, int channels) {
    // Commit the audio frame
    recorder.CommitSamples(sampleBuffer, clock.Timestamp);
}
```

## Easier Recording with Recorder Inputs
In most cases, you will likely just want to record a game camera optionally with game audio. To do so, you can use NatCorder's recorder `Inputs`. A recorder `Input` is a lightweight utility class that eases out the process of recording some aspect of a Unity application. NatCorder comes with two recorder inputs: `CameraInput` and `AudioInput`. You can create your own recorder inputs to do more interesting things like add a watermark to the video, or retime the video. Here is a simple example showing recording a game camera:
```csharp
IClock clock;
IMediaRecorder recorder;
CameraInput cameraInput;
AudioInput audioInput;

void StartRecording () {
    // Create a recording clock
    clock = new RealtimeClock();
    // Start recording
    mediaRecorder = new ...;
    // Create a camera input to record the main camera
    cameraInput = new CameraInput(recorder, clock, Camera.main);
    // Create an audio input to record the scene's AudioListener
    audioInput = new AudioInput(recorder, clock, audioListener);
}

async void StopRecording () {
    // Destroy the recording inputs
    cameraInput.Dispose();
    audioInput.Dispose();
    // Stop recording
    var recordingPath = await recorder.FinishWriting();
}
```

___

## Using NatCorder with NatDevice
If you use NatCorder with our NatDevice API, then you will have to remove a duplicate copy of the `NatRender.aar` library. The duplicate libraries can be found at `NatCorder > Plugins > Android > NatRender.aar` or `NatDevice > Plugins > Android > NatRender.aar`.

## Tutorials
- [Unity Recording Made Easy](https://medium.com/@olokobayusuf/natcorder-unity-recording-made-easy-f0fdee0b5055)
- [Audio Workflows](https://medium.com/@olokobayusuf/natcorder-tutorial-audio-workflows-1cfce15fb86a)

## Requirements
- Unity 2018.3+
- Android API Level 21+
- iOS 11+
- macOS 10.13+
- Windows 10+, 64-bit only

## Notes
- NatCorder doesn't support recording UI canvases that are in Screen Space - Overlay mode. See [this](https://forum.unity3d.com/threads/render-a-canvas-to-rendertexture.272754/#post-1804847).
- When recording audio, make sure that the 'Bypass Listener Effects' and 'Bypass Effects' flags on your `AudioSource`s are turned off.
- If you face `DllNotFound` errors on standalone Windows builds, install the latest Visual C++ redistributable from Microsoft.
- Recording may fail when a dimension (width or height) is an odd number. Always make sure to record at even resolutions.

## Quick Tips
- Please peruse the included scripting reference in the `Docs` folder.
- To discuss or report an issue, visit Unity forums [here](https://forum.unity.com/threads/natcorder-video-recording-api.505146/)
- Contact me at [olokobayusuf<EMAIL_ADDRESS>
Thank you very much!

gha_language: C#


text:
# DrawIt- New generation of mapping d3 graphs
A graph library based on d3 for simple manipulation with customization.

##How to use it
```html
//example.html
<script type="text/javascript" src="js/d3/d3.min.js"></script>
<!-- Insert drawit.js here-->
<script type="text/javascript" src="js/drawit.min.js"></script>
```
```js
//example.js
var stackedGraph = new DI({ //Initiate a graph
        selector:"svg", //Selector for element,
        type:DI.GraphNames.stacked, //Type of the graph, DI.GraphNames contains list of the graph enum
        dim:{   //Define/override dimention of the graph
          height:200,
          width:200
        },
        data:[ //Data source for graph to draw
          {
            name: "Hoodie",
            values: [
              { count: 6, date: "2014-01-01" },
              { count: 7, date: "2014-01-02" },
              { count: 8, date: "2014-01-03" }
            ]
          },
          {
            name: "Lost",
            values: [
              { count: 8, date: "2014-01-01" },
              { count: 3, date: "2014-01-02" },
              { count: 5, date: "2014-01-03" }
            ]
          },
          {
            name: "Jacket",
            values: [
              { count: 2, date: "2014-01-01" },
              { count: 5, date: "2014-01-02" },
              { count: 7, date: "2014-01-03" }
            ]
          },
          {
            name: "Snuggie",
            values: [
              { count: 3, date: "2014-01-01" },
              { count: 2, date: "2014-01-02" },
              { count: 3, date: "2014-01-03" }
            ]
          }
        ]
      })
      stackedGraph.draw(); //Draw the graph, Alternate stackedGraph.draw(/*{data here}*/)
      var listener = stackedGraph.on('layers', 'click', function () { //This will return listener object
                   //Bind event on stackedGraph['layers'] element, params {selector(available in that graph), event, callback}
        console.log("Hi haaa...!!", arguments);
        console.log(listener);
        listener.unbind(); //Unbind listener on stackedGraph['layers'] element
        stackedGraph.unbind(0);//Alternate way to Unbind listener on stackedGraph['layers'] element, using listener id
      })
```
##How to use development tools
```bash
#Install all dev dependency
$npm install

#Clean build folder
$npm run clean

#Review  code using jshint
$npm run jshint

#Build distribution js
$npm run build

#Build distribution js with d3 lib
$npm run d3build
```
##API document
> [Wiki](API Reference) ▸ **API Reference**

* [Create a DrawIt graph object](#graph-object)
* [Choose Graph type](#graph-type)
* [Define Selector](#graph-node-selection)
* [Override Graph Dimensions](#graph-dimensions)
* [Override Data](#graph-data)
* [Bind Node Listener](#graph-node-listener)
* [Unbind Node Listener](#graph-unbind-listener)

##[Graph Object](#wiki)
DI constructor will return graph object based on graph type
```js
var stackedGraph = new DI({ //Initiate a graph
  type:DI.GraphNames.stacked, //mandatory type for element,
});
//DI constructor will return graph object based on graph type
//User can see list of the graph available in DI.GraphNames enum
```

##[Graph Type](#wiki)
User has to choose a type while creating new DI object. User can see list of the graph available in DI.GraphNames enum.
```js
var config = {
 type:DI.GraphNames.stacked, //mandatory type for element,
};
```
```js
var stackedGraph = new DI(config);
```

##[Graph Node Selection](#wiki)
Similarly as graph type, User has to choose a selector on which d3 will create/draw graph. Selector will be relative to Document body.
```js
var config = {
 selector:"svg.stacked" //mandatory selector for element
};
```
```js
var stackedGraph = new DI(config);
```

##[Graph Dimensions](#wiki)
Similarly as graph selector, User can choose dimansion of the graph.By default width and height of graph chosen from *_DrawIt.default_* or *_DI.default_* which are 600x600.
```js
var config = {
  dim:{   //Define/override dimension of the graph
    height:200,
    width:200
  }
};
```
```js
var stackedGraph = new DI(config);
```
```js
//Override DI defaults
DrawIt.defaults = {
        height: 600,
        width: 600
    };
```

##[Graph Data](#wiki)
User can pass data to graph object in two way.

1. Using DI constructor
2. Using instance variable
```js
//example.js
//Using DI constructor
var stackedGraph = new DI({ //Initiate a graph
  //...
  data:[ //Data source for graph to draw
    {
      name: "Hoodie",
      values: [
        { count: 6, date: "2014-01-01" },
        { count: 7, date: "2014-01-02" },
        { count: 8, date: "2014-01-03" }
      ]
    }
    //...more data here
  ]
})
```
```js
//example.js
//Using instance variable
var stackedGraph = new DI({ //Initiate a graph
  //...
  //config here
  //...
})
stackedGraph.data = [ //Data source for graph to draw
  {
    name: "Hoodie",
    values: [
      { count: 6, date: "2014-01-01" },
      { count: 7, date: "2014-01-02" },
      { count: 8, date: "2014-01-03" }
    ]
  }
  //...more data here
];
```

##[Graph Node Listener](#wiki)
Binding an event to an element is never been so easy. Just grab the element attached to the graph and using *_on_* method you can bind a callback to any DOM element. Just like Jquery.
```js
var listener = stackedGraph.on('layers', 'click', function () { //This will return listener object
    //Bind event on stackedGraph['layers'] element, params {selector(available in that graph), event, callback}
    console.log("Hie ha...!!", arguments);
    console.log(listener);
    stackedGraph.unbind(0);//Alternate way to Unbind listener on stackedGraph['layers'] element, using listener id
  })
```
>Note: *_.on_*(binding) will throw an error if _'layers'_ will not attacked to the stackedGraph instance.

##[Graph Unbind Listener](#wiki)
Similarly unbinding is very easy. When user bind and event using *_.on_* method. It returns a listener object which contains all the details of the that event listener. Developer can unbind an event either using that listener object or developer can use unbind method of graph instance.
```js
//Using listener instance
var listener = stackedGraph.on('layers', 'click', function () { //This will return listener object
    console.log("Do something here on click");
});
/*
snapshot of listener
{
    id:0,
    event:"click",
    prop:"layers",
    callback:[function],
    unbind:[function]
}
 */
setTimeout(function unbindAfter10Sec() {
  listener.unbind();
}, 10 * 1000)
```
```js
//Using unbind method
var listener = stackedGraph.on('layers', 'click', function () { //This will return listener object
    console.log("Do something here on click");
});
setTimeout(function unbindAfter10Sec() {
  stackedGraph.unbind(listener.id);
}, 10 * 1000)
```

repository: manishnakar/drawit

repo_name: manishnakar/drawit


text:
# Hysterostegiella dowardensis (Graddon) B. Hein, 1983 SPECIES

#### Status
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Nova Hedwigia 38: 692 (1983)

#### Original name
Hysteropezizella dowardensis Graddon, 1974

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
This event contains information that should be displayed on LED(s) pointed out by zone/sub-zone.

 | Byte | Description                                                        |
 | :----: | -----------                                                        |
 | 0    | Index                                                              |
 | 1    | Zone for which event applies to (0-255). 255 is all zones.         |
 | 2    | Sub-zone for which event applies to (0-255). 255 is all sub-zones. |
 | 3    | 0 =off, 1=on, 2=blink                                              |
 | 4    | Blink period: MSB milliseconds for ON.                             |
 | 5    | Blink period: LSB milliseconds for ON.                             |
 | 6    | Blink period: MSB milliseconds for OFF.                            |
 | 7    | Blink period: LSB milliseconds for OFF.                            |

Blink period can be omitted if not used or if blink period is defined hard.

repository: grodansparadis/vscp-classes

gha_language: C

repo_name: grodansparadis/vscp-classes


text:
Content Management API

JavaScript

  Readme ·
  Setup ·
  Migration ·
  Changelog ·
  Contributing

# Migration to contentful-management.js 1.x from previous versions

**(May 30th, 2016)**

contentful.js 1.x was a major rewrite, with some API changes. While the base functionality remains the same, some method names have changed, as well as some internal behaviors.

The main change you should look out for, is the fact that some of the actions executed on objects you retrieve from the API (Entries, Assets, etc) now have instance methods on them to perform those actions (such as update or delete) rather than methods such as `updateEntry` on the space object.

This file lists the changes to the API and behavior, and how you should proceed to update your code.

For more specific details consult the [reference documentation](https://contentful.github.io/contentful-management.js/) for the current version.

Future releases will have any changes listed in the changelog on the [releases page](https://github.com/contentful/contentful-management.js/releases).

## Instance methods

The pre 1.x version of the SDK exposed a top level client object, from which you could create or get spaces. This space object then contained methods to perform all the actions that were possible on that space, such as creating entities (assets, entries, etc), updating them, deleting them, publishing them, etc.

The new version, works a bit differently. All the methods in the space object which retrieve or create entities (such as `space.createEntry` or `space.getEntry`) retrieve an object for that kind of entity. If you then perform actions such as update, delete, publish/unpublish or archive/unarchive, you perform them directly on methods on the entities. So if you'd get and update an Entry, it would look something like this:

```js
client.getSpace('spaceid', (space) => {
  space.getEntry('entryid', (entry) => {
    entry.fields.title['en-US'] = 'new value for title field'
    entry.update().then(
      (updatedEntry) => {
        console.log(updatedEntry.fields.title['en-US'])
      },
      (err) => {
        console.log('oh no! we failed to update!', err)
      }
    )
  })
})
```

Check out the new reference documentation to see what methods exist and on which objects and entities they are available.

 This is more similar to what is actually returned from the REST API.

## Class removal

Before contentful-management.js 1.x, the entities returned from the API such as Entries or Content Types were wrapped in prototype based classes.

From contentful-management.js 1.x this is not the case anymore.

The objects returned by the promises are now JavaScript Objects, which contain the relevant data and some helper methods.

You can get a plain version of this object with only the data by using the `toPlainObject()` method.

Also note that Date fields such as `sys.createdAt` are not turned into JavaScript `Date` objects anymore, and are now plain ISO-8601 strings.

## New features

Some new features were also added to this version:

- Status methods, such as `isPublished` or `isArchived`
- Asset processing wait
  - After creating an asset, it's necessary to call processing on this asset's file so that the file gets properly processed on Contentful's backend systems. In order to do this there are now two separate calls, `processForLocale` and `processForAllLocales`.
  - In the older SDK, the only way to know if an asset was ready would be to retrieve the asset again and check if the `upload` property had been removed and if an `url` property was now available.
  - The processing calls now do this for you on the background, so the promise only gets resolved when a successful verification call occurs.
- New API endpoints:
  - Webhooks
  - Roles
  - Space Memberships
  - API Keys

gha_language: TypeScript


text:
# ADChromePullToRefresh

[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ADChromePullToRefresh.svg)](https://img.shields.io/cocoapods/v/ADChromePullToRefresh.svg)

Yet another custom pull to refresh for your needs.

Inspired by Google Chrome iOS app

## Easy to use

You can simply setup your own chrome style pull to refresh using the initializer below

```swift
/*
 * To initialize ADChromePullToRefresh use this designated initializer
 * @param view - view to overlay by pull to refresh
 * @param scrollView - for which scrollView we add pull to refresh
 * @param scrollViewOriginalOffsetY - initial offset y of the given scrollView
 * @param delegate - object conformed to ADChromePullToRefreshDelegate protocol
 */
init(view: UIView, forScrollView scrollView: UIScrollView, scrollViewOriginalOffsetY: CGFloat, delegate: ADChromePullToRefreshDelegate)
```

To provide custom handler for pull to refresh actions you need to implement this delegate methos in your class

```swift
/*
 * Use this function to provide an action for the given action view type
 */
func chromePullToRefresh(_ pullToRefresh: ADChromePullToRefresh, actionForViewWithType: ADChromePullToRefreshActionViewType) -> ADChromePullToRefreshAction?
```

You're able to customize pull to refresh action view according to your needs 🚀

```swift
/*
 * Use this function to create view with icon for the given pullToRefresh. To customize view use subclass of
 * ADChromePullToRefreshActionView
 * @see ADChromePullToRefreshActionView.swift
 * @see UITableViewDelegate - similar method to get header and footer view
 */
func chromePullToRefresh(_ pullToRefresh: ADChromePullToRefresh, viewWithType: ADChromePullToRefreshActionViewType) -> ADChromePullToRefreshActionView
```

## Easy to install

### CocoaPods

To integrate ADPuzzleAnimation into your Xcode project using CocoaPods, specify it in your `Podfile`:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'ADChromePullToRefresh', '~> 0.5'


text:
# Facial Recognition Applied To Security

Bala, Charu, Prabhat

First part project report - [link](https://docs.google.com/document/d/1CeWY0QDh86EX6yaYoWL0uZVnAzm1DtFaTEapW6kGT4k/edit)

This code is available at [https://github.com/baladutt/face].
# How To Run?

Main.ipynb is the jupyter notebook to run the project.
Before running that,
* LFW dataset needs to be present in data directory. For example: data/lfw/Aaron_Eckhart/
* Download http://download.tensorflow.org/models/inception_v3_2016_08_28.tar.gz into models/cnn

# Referenced Links

https://research.fb.com/publications/deepface-closing-the-gap-to-human-level-performance-in-face-verification/
https://pypi.org/project/deepface/

https://medium.com/@williamkoehrsen/facial-recognition-using-googles-convolutional-neural-network-5aa752b4240e
https://towardsdatascience.com/capsule-networks-the-new-deep-learning-network-bd917e6818e8

repository: baladutt/facial-recognition

repo_name: baladutt/facial-recognition


text:
---
path: '/issues/2019/dec/39'
published: true
date: '2019-12-11'
title: 'Issue #39'
contentTitle: 'Reading a WebPageTest Waterfall Chart, Inspecting Facebooks WebView and Dont call a React function component ...'
---

                Reading a WebPageTest Waterfall Chart

Many performance problems can be identified using waterfall charts. Do you have a bit of JavaScript which is holding up your website?

calendar.perfplanet.com Matt Hobbs

                Inspecting Facebook's WebView

Both Facebook's Android app as well as Facebook's iOS app use a so-called in-app browser, sometimes also referred to as IAB.

blog.tomayac.com Thomas Steiner

                How to convince your client to focus on Web Performance: a case study

The first thing to do when it comes to web performance is to get a picture of the current status, so we can easily see the comparison before and after our work.

dev.to Armel

                Don't call a React function component

There is difference between React.createElement and calling a function component directly.

kentcdodds.com Kent C. Dodds

                Whats new in Chrome v79?

Installed Progressive Web Apps on Android now support maskable icons, You can now create immersive experiences with the WebXR Device API and more

developers.google.com Pete LePage

repository: code-kotis/this-week-in-web

gha_language: HTML

repo_name: code-kotis/this-week-in-web


text:
---
id: kinesis
title: Kinesis
---

The [Kinesis API](/docs/reference/interfaces/kinesis) is based on the Motor Imagery BCI method. Fires when a user attempts to trigger a side effect from defined thoughts. E.g. motor imagery, etc.

Kinesis implements a spike detection algorithm over the [predictions](/docs/api/predictions) observable.

To train a Kinesis command, use [console.neurosity.co](https://console.neurosity.co/) and use the corresponding label for the `Active` classifier. Learn how to train a new command [here](https://support.neurosity.co/hc/en-us/articles/360036344012-Imagined-thought-training). To make your own custom training, see [guides/training](/docs/guides/training).

```js
const mind = new Notion();

mind.kinesis("rightArm").subscribe(intent => {
  // Switch light off/on
  light.togglePower();
  console.log(intent);
});

// { probability: 0.93, label: "rightArm", timestamp:<PHONE_NUMBER>174, metric: "kinesis" }
```

or

```js
mind.kinesis("leftArm").subscribe(intent => {
  // Launch drone
  drone.launch();
  console.log(intent);
});

// { probability: 0.92, label: "leftArm", timestamp:<PHONE_NUMBER>191, type: "kinesis"  }
```

repository: charliegerard/notion-js

repo_name: charliegerard/notion-js


text:
## salt-states

Contains the salt states that I use to provision servers. It is designed to bootstrap servers based on their hostname and inject data using pillars.

The states provided are:
* nginx
  * sets up a load balancer
* mongodb
  * with replica set support
* nodejs
* deploys
  * supports git urls
  * can run post deploy hook
* papertrail
  * installs remote_syslog2
* redis

## getting started

* had to get salt installed

        apt-get install salt-master salt-cloud salt-api

### salt master

the salt master pretty much controls all the servers and what is
applied to them.

* changed the following lines in `/etc/salt/master`

        interface: <IP_ADDRESS>

        pillar_roots:
          base:
            - /srv/pillar

        gitfs_remotes:
          - https://github.com/sjlu/salt-states

        fileserver_backend:
          - git

* to apply your states run highstate

        salt '*' state.highstate

### salt cloud

the salt cloud helps provision minions. in my example I use digital ocean

* configure salt-cloud `/etc/salt/cloud`
  * appended

          provider: do
          minion:
            master: <IP_ADDRESS> # replace this with your IP

* created `/etc/salt/cloud.providers.d/digital_ocean.conf`

        do:
          provider: digital_ocean
          client_key: # https://cloud.digitalocean.com/api_access
          api_key: # https://cloud.digitalocean.com/api_access
          ssh_key_name: salt
          ssh_key_file: /root/.ssh/id_rsa

* created `/etc/salt/cloud.profiles.d/digital_ocean.config`

        ny3-micro:
          provider: do
          image: 14.04 x64
          size: 512MB
          location: New York 3
          private_networking: True

  * you can run the following to get config details

          salt-cloud --list-sizes do
          salt-cloud --list-images do
          salt-cloud --list-locations do

* used saltmine pillar which mines the private ip addresses from the boxes `/srv/pillar/saltmine.sls`

        mine_functions:
          network.ip_addrs: [eth0]
          public_ip_addrs:
            mine_function: network.ip_addrs
            interface: eth0
          private_ip_addrs:
            mine_function: network.ip_addrs
            cidr: <IP_ADDRESS>/16 # change this according to your local network cidr

  * the cidr `/16` references that the first 16 bits are static while the rest are ignored (the `.0.0` part)
  while `/32` would mean the entire IP matters

* added `/srv/pillar/top.sls`

        base:
          '*':
            - saltmine

* spun up an instance

        salt-cloud -p ny3-micro hostname

    * remember to set the hostname to a pattern that will bootstrap the server. for example 'mongodb01' will bootstrap that server with mongodb

### salt api

* created `/etc/salt/master.d/salt-api.conf`

        rest_cherrypy:
          port: 443
          host: <IP_ADDRESS>
          ssl_crt: /etc/ssl/private/cert.pem
          ssl_key: /etc/ssl/private/key.pem
          webhook_disable_auth: True
          webhook_url: /hook

* needed to create self signed keys

        openssl genrsa -out /etc/ssl/private/key.pem 4096
        openssl req -new -x509 -key /etc/ssl/private/key.pem -out /etc/ssl/private/cert.pem -days 1826

* created `/etc/salt/master.d/reactor.conf`

        reactor:
          - 'salt/netapi/hook/deploy':
            - /srv/reactor/deploy.sls

  * `salt/netapi/hook` is a command reference that the reactor looks upon `/deploy` is the end
  of the webhook url. An example would be `https://<IP_ADDRESS>/hook/deploy` would reference it.

* created `/etc/reactor/deploy.sls`

        {% set postdata = data.get('post', {}) %}

        {% if postdata.repository.full_name == 'sjlu/salt-state' %}
          {% set glob = 'salt*' %}
        {% endif %}

        {% if glob %}
        run_deploy:
          local.state.highstate:
            - tgt: '{{ glob }}'
        {% endif %}

  * this will run `state.highstate` on all minions that match that glob

* stolen from [Benjamin Cane](http://bencane.com/2014/07/17/integrating-saltstack-with-other-services-via-salt-api/)

## pillars

These are just some sample pillars that you're able ot use.

* deploy.sls

        deploy:
          config:
            - ENV: production
          git: git@github.com:sjlu/salt-states.git
          branch: master
          target: /path/on/remote/server
          logs: /path/on/remote/server
          user: run_as_user
          cmd: 'post deploy cmd'
          ssh_key: |
            <REDACTED_PRIVATE_KEY>

* nginx.sls

        nginx:
          load_balancer:
            glob: '*'
            port: 3000

* papertrail.sls

        papertrail:
          port: 13131 # the port to report to, something like logs.papertrail.com:13131

* mongodb.sls

        mongodb:
          replica:
            glob: '*' # glob that matches all your mongo nodes
            auth: 'changeme' # root password to your mongo instance
            key: |
              # generated ssl key
              # openssl rand -base64 741

* redis.sls

        redis:
          auth: # auth key

## notes

* because saltstack runs in parallel for servers, the mongodb slaves could build slower than the master. if that's the case, you'll see an error. all you need to do is re-run and the replica init file will run successfully.
* built on top of digital ocean in mind

## license

MIT

repository: yostzach/salt-states

repo_name: yostzach/salt-states


text:
# Sharepoint online debug switch

A [tampermonkey](https://www.tampermonkey.net/) script that allows to switch on/off the debug mode on sharepoint sites.

![](/Screenshot.png)


text:
# Code4Lib Chicago Fall 2019 Meeting Website

Built with:
- [Jekyll](https://jekyllrb.com/)
- [Bootstrap](https://getbootstrap.com/)
- [GitHub Pages](https://pages.github.com/)

Editing:
- `_config.yml` contains all site wide settings and event details
- `index.md` contains homepage contents
- `_layouts/default.html` contains the site's HTML template
- `custom.scss` contains all CSS style overrides


text:
---
layout: post
title:  "Perl5 -> Perl 6: about the topic variable"
author: Luca Ferrari
tags:
- raku
- perl
- programming
permalink: /:year/:month/:day/:title.html
---
Perl 6 aggressively reduces the need for the topic variable. Or does not?

## Perl5 -> Perl 6: about the topic variable
-----

The topic variable ```$_``` is a well known variable that is used as a global variable when nothing is provided.
In Perl 5 the rule of thumb is that a lot of operators can modify/act the topic varaible when nothing more is provided.
As an example, consider the following piece of code:

```perl
my @bands = ( 'Foo Fighters', 'Soundgarden', 'Puddle of Mudd', 'Depeche Mode' );

for ( @bands ){
    say "I like $_ !";
}

my %albums_of = map { $_ => int( rand( 10 ) ) } @bands;

for ( keys %albums_of ){
    say "I've got $albums_of{ $_ } albums of $_ !";
}

```

that produces the following output:

```
I like Foo Fighters !
I like Soundgarden !
I like Puddle of Mudd !
I like Depeche Mode !
I've got 2 albums of Puddle of Mudd !
I've got 1 albums of Foo Fighters !
I've got 1 albums of Depeche Mode !
I've got 1 albums of Soundgarden !
```

As you can see, the *for* loop as well as *map* operates on ```$_``` (topic variable) by default.

Let's see this in Perl 6:

```perl
my @bands = 'Foo Fighters', 'Soundgarden', 'Puddle of Mudd', 'Depeche Mode';

for @bands { "I like $_".say; }

my %albums_of = @bands.map: { $_ => Int( 10.rand ); }
for %albums_of.keys { say "I've got %albums_of{ $_ } albums of $_ !"; }
```

Nothing really impressive here: operators we were used to work with the topic variable remain pretty much the same.
What is new in Perl 6 is that **the [topic variable can be omitted](https://docs.perl6.org/syntax/$_), so that you can find method calls on no-object at all**, imagine the
topic variable is there. Let's see this in action:

```perl
for @bands { .say; }

# it is the same as
# for @bands { $_.say; }
```

As another example consider the following:

```perl
my $when = Date.today( formatter => { "%02d / %02d / %04d".sprintf: .day, .month, .year ; } );

$when.say;
```

where within the block for the formatter the default object refence is ```$_``` since none has been specified as prototype.
You can name the topic variable as you want by either place it explicitly or use a named variable (signature):

```perl
my $when = Date.today( formatter => -> $o { "%02d / %02d / %04d".sprintf: $o.day, $o.month, $o.year ; } );
```


text:
[![npm version][npm-img]][npm-url]
[![build status][travis-img]][travis-url]
[![gzip bundle size][gzip-image]][npm-url]
[![Coverage Status][coverage-img]][coverage-url]
[![apache licensed](https://img.shields.io/badge/license-Apache-green.svg?style=flat-square)](https://raw.githubusercontent.com/Esri/hub.js/master/LICENSE)

[npm-img]: https://img.shields.io/npm/v/@esri/hub-auth.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@esri/hub-search
[travis-img]: https://img.shields.io/travis/Esri/hub.js/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/Esri/hub.js
[coverage-img]: https://codecov.io/gh/Esri/hub.js/branch/master/graph/badge.svg
[coverage-url]: https://codecov.io/gh/Esri/hub.js

# @esri/hub-search

> **DEPRECATED**: This package is now deprecated and currently only includes functions that are still in use in legacy applications.
Use the `hubSearch()` function and related classes in `@esri/hub-common` instead.

Module to search for ArcGIS items and format them for display in ArcGIS Hub.

### Example

```bash
npm install @esri/hub-search
```

#### Use in frontend

```js
import { serialize } from '@esri/hub-search';

// Search query params that ArcGIS Hub expects
const params = {
  q: 'crime',
  sort: 'name',
  agg: { fields: 'tags,collection,owner,source,hasApi,downloadable' },
  start: 1,
  num: 10,
  groupIds: '1ef,2ef',
  orgId: '3ef',
  initiativeId: '4ef'
}
const token = 'xxxYYY' // AGO token
const portal = 'https://qaext.arcgis.com/sharing/rest'
const headers = { authorization: token, portal }
const serializedParams = serialize(params)
// Query hub v3's new search endpoint
fetch(`hub.arcgis.com/api/v3/search?${serializedParams}`, { headers })
```

#### Use in backend

```js
const { agoSearch } = require('@esri/hub-search')
// req.query has deserialized query parameters
// req.headers.authorization has token
agoSearch(req.query, req.headers.authorization, req.headers.portal)
```

### Issues

If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/hub.js/issues) first.  Have you found a new bug?  Want to request a new feature?  We'd [**love**](https://github.com/Esri/hub.js/issues/new) to hear from you.

If you're looking for help you can also post issues on [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-oss).

### Versioning

For transparency into the release cycle and in striving to maintain backward compatibility, @esri/hub.js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible.

For more information on SemVer, please visit <http://semver.org/>.

### Contributing

Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](CONTRIBUTING.md).

### License

Copyright © 2019 Esri

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.

A copy of the license is available in the repository's [LICENSE](../../LICENSE) file.


text:
### Routing

Routing is the core of any web framework because it allows the user
to map URL endpoints to functions.

```py
@app.route("/home", methods=['GET'])
async def home():
    return Response(b'123')
```

> In this example you are mapping every HTTP request with a `GET`
method and a path equals to `/home` to `async def home()`.

### Request Parameters

Often parts of an URL have a special meaning, for example,
specifying which product should be displayed.

```py
@app.route('/product/<product_id>')
async def show_product(product_id: int):
    return Response(f'Chosen product: {product_id}'.encode())
```

Not usually you'll need something more sophisticated.
Vibora allows regular expressions as route patterns.

```py
import re

@app.route(re.compile('/product/(?P<product_id>[0-9]+)'))
async def show_product(product_id: int):
    return Response(f'Chosen product: {product_id}'.encode())
```

### Virtual Hosts

Maybe you have different domains and you want to host them all
with a single Vibora application. So `http://docs.vibora.io/` and
`http://vibora.io/` would hit the same application but return different
responses based on the `HTTP host header`. Vibora makes it very easy
thanks to the `hosts` attribute.

```py
@app.route('/', hosts=['docs.vibora.io'])
async def docs():
    return Response(b'Docs')

@app.route('/', hosts=['vibora.io'])
async def home():
    return Response(b'Home')
```

To avoid repeting hosts attribute for every route,
you can group routes using a Blueprint.

```py
from vibora import Blueprint

docs = Blueprint(hosts=['docs.vibora.io'])
main = Blueprint(hosts=['vibora.io'])

@docs.route('/')
async def docs():
    return Response(b'docs')

@main.route('/')
async def home():
    return Response(b'docs')
```

### Router Strategies

A common source of headaches in URL routing are ending slashes.

Let's take the path `/home` and `/home/` for example.

In a web environment these are two completely different paths,
it's up to the server interpret those as the same or not.

Vibora has three different strategies to deal with this problem:

    1. **Strict**. Does nothing. If you map your endpoints ending with
    slashes them if you try to access `/home` instead of `/home/`
    you'll get a 404 response.

    2. **Redirect (Default)**. If you map your route as `/home` then
    Vibora will return a 302 response if someone tries to access `/home/'
    and vice-versa.

    3. **Clone**. This one is similar to redirect but instead of a 302 it'll
    return the same response for both routes.

Configuration example:

```py
from vibora import Vibora
from vibora.router import RouterStrategy

app = Vibora(router_strategy=RouterStrategy.Strict)
```

### Caching

Caching can be a tremendous ally when handling performance issues.
Imagine an API that does a read-only query being hitted by 10k requests/sec,
this means that you are stressing your database at 10k queries/sec.

If you start caching the response for at least one second
you drop from 10k queries/sec to 1 query per second.
That's a huge improvement with almost no effort.

Vibora has some internal optimizations to speed-up cached APIs
so instead of handling it all by ourself you should use the `CacheEngine`.

```py
import time
from vibora import Vibora
from vibora.cache import CacheEngine

app = Vibora()

class YourCacheEngine(CacheEngine):
    async def get(self, request: Request):
        return self.cache.get(request.url)

    async def store(self, request: Request, response):
        self.cache[request.url] = response

@app.route('/', cache=YourCacheEngine(skip_hooks=True))
def home():
    return Response(b'123')
```

> Notice the "skip_hooks" parameter which makes cached responses to
  skip any listeners/hooks. Sometimes this is useful, often not,
  use wisely.

### Static Files

Vibora is fast enough to host static files and it tries hard to implement
the same features as some battle proven solutions like Nginx.

By default Vibora will seek for a directory called "static"
in the same parent directory related to the file that
created Vibora app instance.

You can configure the `StaticHandler` as bellow:

> All parameters are optional.

```py
from vibora.static import StaticHandler

app = Vibora(
    static=StaticHandler(
        paths=['/your_static_dir', '/second_static_dir'],
        host='static.vibora.io',
        url_prefix='/static',
        max_cache_size=1 * 1024 * 1024
    )
)
```

> **Host** parameter can be used to only serve static files when
  the Host header matches this specific host.

> **max_cache_size** specifies the amount of memory that Vibora
may invest into optimizations.

repository: PranayJain/vibora

repo_name: PranayJain/vibora


text:
# Async::RSpec

Provides useful `RSpec.shared_context`s for testing code that builds on top of [async](https://github.com/socketry/async).

[![Development Status](https://github.com/socketry/async-rspec/workflows/Test/badge.svg)](https://github.com/socketry/async-rspec/actions?workflow=Test)

## Installation

``` shell
$ bundle add async-rspec
```

Then add this require statement to the top of `spec/spec_helper.rb`

``` ruby
require 'async/rspec'
```

## Usage

### Async Reactor

Many specs need to run within a reactor. A shared context is provided which includes all the relevant bits, including the above leaks checks. If your spec fails to run in less than 10 seconds, an `Async::TimeoutError` raises to prevent your test suite from hanging.

``` ruby
require 'async/io'

RSpec.describe Async::IO do
	include_context Async::RSpec::Reactor

	let(:pipe) {IO.pipe}
	let(:input) {Async::IO::Generic.new(pipe.first)}
	let(:output) {Async::IO::Generic.new(pipe.last)}

	it "should send and receive data within the same reactor" do
		message = nil

		output_task = reactor.async do
			message = input.read(1024)
		end

		reactor.async do
			output.write("Hello World")
		end

		output_task.wait
		expect(message).to be == "Hello World"

		input.close
		output.close
	end
end
```

### Changing Timeout

You can change the timeout by specifying it as an option:

``` ruby
RSpec.describe MySlowThing, timeout: 60 do
	# ...
end
```

### File Descriptor Leaks

Leaking sockets and other kinds of IOs are a problem for long running services. `Async::RSpec::Leaks` tracks all open sockets both before and after the spec. If any are left open, a `RuntimeError` is raised and the spec fails.

``` ruby
RSpec.describe "leaky ios" do
	include_context Async::RSpec::Leaks

	# The following fails:
	it "leaks io" do
		@input, @output = IO.pipe
	end
end
```

In some cases, the Ruby garbage collector will close IOs. In the above case, it's possible that just writing `IO.pipe` will not leak as Ruby will garbage collect the resulting IOs immediately. It's still incorrect to not close IOs, so don't depend on this behaviour.

### Allocations

This functionality was moved to [`rspec-memory`](https://github.com/socketry/rspec-memory).

## Contributing

We welcome contributions to this project.

1.  Fork it.
2.  Create your feature branch (`git checkout -b my-new-feature`).
3.  Commit your changes (`git commit -am 'Add some feature'`).
4.  Push to the branch (`git push origin my-new-feature`).
5.  Create new Pull Request.

repository: socketry/async-rspec

gha_language: Ruby

repo_name: socketry/async-rspec


text:
---
title: Listen to this } Manchester Orchestra - A Black Mile to the Surface
updated: 2017-08-02 16:23
---

This album was quite highly anticipated, but wow. Manchester Orchestra really delivered on this one!

> *A Black Mile to the Surface*, Manchester Orchestra's fifth studio album, deals with this looming existential terror with a now-typical obliqueness. On one hand, it's a concept album about a small, wintry town in South Dakota that none of Manchester Orchestra's members have ever so much as driven through; on the other, it's a memoir trapped between a stream of first- and second-person pronouns. It's the most lyrically intricate and sonically ambitious record that the band have made. It's also their best.

- [Manchester Orchestra Know That Winter is Coming](https://noisey.vice.com/en_us/article/3kq8a8/manchester-orchestra-know-that-winter-is-coming) } VICE

repository: penciledin/bdl-blog

repo_name: penciledin/bdl-blog


text:
## List keys

Get a list of currently authenticated user's keys.

```
GET /keys
```

```json
[
  {
    "id": 1,
    "title" : "Public key"
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
      596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
      soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
  },
  {
    "id": 3,
    "title" : "Another Public key"
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
      596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
      soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
  }
]
```

## Single key

Get a single key.

```
GET /keys/:id
```

Parameters:

+ `id` (required) - The ID of a key

```json
{
  "id": 1,
  "title" : "Public key"
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
      596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
      soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
}
```
## Add key

Create new key owned by currently authenticated user

```
POST /keys
```

Parameters:

+ `title` (required) - new SSH Key's title
+ `key` (required) - new SSH key

Will return created key with status `201 Created` on success, or `404 Not
found` on fail.

## Delete key

Delete key owned by currently authenticated user

```
DELETE /keys/:id
```

Parameters:

+ `id` (required) - key ID

Will return `200 OK` on success, or `404 Not Found` on fail.

repository: codeponpon/gitlabhq

repo_name: codeponpon/gitlabhq


text:
# Virus Proxy #

This is a Virus Proxy that uses Virus Total to scan a file for the presence of viruses.

This was created for use with Hmail server but could be used elsewhere of course.

The proxy is written in GoLang and an executable is located in the dist folder allowing you to download an run with a minimum of effort.

### Use ###

This takes a single parameter which is the location of the file to be checked.

```
.\virus-proxy.exe -file %FILEPATH%
```
A response code is then returned, 0 if virus 1 if no virus.

Logs will be written to log.txt at the same location as the exe.

### Setup ###

* Download exe
* Open config.json and add your Virus-Total apikey
* That's it

repository: Azert-Software/virus-total-proxy

repo_name: Azert-Software/virus-total-proxy


text:
[![npm version](https://badge.fury.io/js/affinity-engine-style-transparent.svg)](https://badge.fury.io/js/affinity-engine-style-transparent)
[![Build Status](https://travis-ci.org/affinity-engine/affinity-engine-style-transparent.svg?branch=master)](https://travis-ci.org/affinity-engine/affinity-engine-style-transparent)

# affinity-engine-style-transparent

You'll find the interactive guides [here](http://www.affinityengine.org/#/api/styles/transparent).


text:
# Employee Directory
<img src="https://avatars.githubusercontent.com/u/73988543?v=4" alt="avatar" style="border-radius: 36px" width="60" />

## Description

This is a react application which allows you to view a list of employees from an an external API. You may search through a list of employees by using the search box to narrow down a search by name. Clicking on on the headings will allow you to ascend or descend order.

## Table of Contents

* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Tests](#tests)
* [Questions](#questions)

## Installation

 npx create-react-app
## Usage

npm install

## License

MIT License

## Tests

To run tests, run the following command:
npm test

## Questions

[![GitHub license](https://img.shields.io/badge/GitHubUser-lindahlubi-orange)](https://api.github.com/users/lindahlubi)
If you have any questions please contact me directly here: (https://api.github.com/users/lindahlubi).

repository: LindaHlubi/Employee-Directory

repo_name: LindaHlubi/Employee-Directory


text:
Samples Folder
==============

In this folder we store the samples created using Ring.

You can find samples in

(1) [Online Documentation](http://ring-lang.sourceforge.net/doc1.7/index.html)
(2) [Resources](http://ring-lang.sourceforge.net/resources.html)
(3) [Rosettacode](https://rosettacode.org/wiki/Category:Ring)


text:
# Intractability

Is there a universal problem-solving model to which all problems that we would like to solve reduce and for which we know an efficient algorithm? You may be surprised to learn that we do not know the answer to this question. In this lecture we introduce the complexity classes P, NP, and NP-complete, pose the famous P = NP question, and consider implications in the context of algorithms that we have treated in this course.

![image](../../media/Intractability-image1.jpg)

![image](../../media/Intractability-image2.jpg)

![image](../../media/Intractability-image3.jpg)

## Church-Turing Thesis (Computability Thesis)

Church-Turing Thesis is a hypothesis about the nature of computable functions. It states that a function on the natural numbers is computable by a human being following an algorithm, ignoring resource limitation, if and only if it is computable by a Turing machine

![image](../../media/Intractability-image4.jpg)

![image](../../media/Intractability-image5.jpg)

![image](../../media/Intractability-image6.jpg)

![image](../../media/Intractability-image7.jpg)

![image](../../media/Intractability-image8.jpg)

Intractable - hard to control or deal with (difficult or stubborn)

![image](../../media/Intractability-image9.jpg)

## Search Problems

![image](../../media/Intractability-image10.jpg)

## ILP - Integer Linear Programming

Aninteger programmingproblem is a [mathematical optimization](https://en.wikipedia.org/wiki/Mathematical_optimization) or [feasibility](https://en.wikipedia.org/wiki/Constraint_satisfaction_problem) program in which some or all of the variables are restricted to be [integers](https://en.wikipedia.org/wiki/Integer). In many settings the term refers tointeger [linear programming](https://en.wikipedia.org/wiki/Linear_programming)(ILP), in which the objective function and the constraints (other than the integer constraints) are [linear](https://en.wikipedia.org/wiki/Linear_function_(calculus)).

Integer programming is [NP-complete](https://en.wikipedia.org/wiki/NP-complete). In particular, the special case of 0-1 integer linear programming, in which unknowns are binary, and only the restrictions must be satisfied, is one of [Karp's 21 NP-complete problems](https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems).

If some decision variables are not discrete the problem is known as amixed-integer programmingproblem.

<https://en.wikipedia.org/wiki/Integer_programming>

<https://www.toptal.com/algorithms/mixed-integer-programming>

![image](../../media/Intractability-image11.jpg)

![image](../../media/Intractability-image12.jpg)

![image](../../media/Intractability-image13.jpg)

![image](../../media/Intractability-image14.jpg)

![image](../../media/Intractability-image15.jpg)

![image](../../media/Intractability-image16.jpg)

![image](../../media/Intractability-image17.jpg)

![image](../../media/Intractability-image18.jpg)

## P vs NP

NP - Non Deterministic Polynomial Time (The complexity class NPcontains all of the problems inP - it is often incorrectly ascribed to mean "not polynomial time.")

![image](../../media/Intractability-image19.jpg)

![image](../../media/Intractability-image20.jpg)

![image](../../media/Intractability-image21.jpg)

![image](../../media/Intractability-image22.jpg)

![image](../../media/Intractability-image23.jpg)

![image](../../media/Intractability-image24.jpg)

![image](../../media/Intractability-image25.jpg)

![image](../../media/Intractability-image26.jpg)

## Classifying Problems

![image](../../media/Intractability-image27.jpg)

![image](../../media/Intractability-image28.jpg)

![image](../../media/Intractability-image29.jpg)

![image](../../media/Intractability-image30.jpg)

![image](../../media/Intractability-image31.jpg)

![image](../../media/Intractability-image32.jpg)

![image](../../media/Intractability-image33.jpg)

<https://sahandsaba.com/understanding-sat-by-implementing-a-simple-sat-solver-in-python.html>

## NP-completeness

![image](../../media/Intractability-image34.jpg)

## Cook - Levin Theorem

In [computational complexity theory](https://en.wikipedia.org/wiki/Computational_complexity_theory), the**Cook--Levin theorem**, also known as **Cook's theorem**, states that the [Boolean satisfiability problem](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem) is [NP-complete](https://en.wikipedia.org/wiki/NP-completeness). That is, any problem in [NP](https://en.wikipedia.org/wiki/NP_(complexity)) can be [reduced](https://en.wikipedia.org/wiki/Reduction_(complexity)) in polynomial time by a [deterministic Turing machine](https://en.wikipedia.org/wiki/Deterministic_Turing_machine) to the problem of determining whether a Boolean formula is satisfiable.

An important consequence of this theorem is that if there exists a deterministic polynomial time algorithm for solving Boolean satisfiability, then every [NP](https://en.wikipedia.org/wiki/NP_(complexity)) problem can be solved by a deterministic polynomial time algorithm.

![image](../../media/Intractability-image35.jpg)

![image](../../media/Intractability-image36.jpg)

![image](../../media/Intractability-image37.jpg)

![image](../../media/Intractability-image38.jpg)

![image](../../media/Intractability-image39.jpg)

![image](../../media/Intractability-image40.jpg)

## Coping with intractability

![image](../../media/Intractability-image41.jpg)

![image](../../media/Intractability-image42.jpg)

![image](../../media/Intractability-image43.jpg)

![image](../../media/Intractability-image44.jpg)

![image](../../media/Intractability-image45.jpg)

![image](../../media/Intractability-image46.jpg)

![image](../../media/Intractability-image47.jpg)

![image](../../media/Intractability-image48.jpg)


text:
terraform-gcr-init
==================

This can be used as a Terraform module to set up a Google Project
for each developer working on cluster-api-provider-azure as a place for them
to push container images.

**NOTE:**
> To make GCR usable, it will make the repositories publicly readable.

## Example use

``` hcl
module "a_dev" {
  source  = "<path to here>"

  // The name of the developer
  short_name = "a_dev"

  // A Google entity that has ownership of the project
  owners =<EMAIL_ADDRESS>
  // The organisation ID
  org_id = "123456789012"

  // The billing account for this project
  billing_account = "012345-6789AB-CDEF01"
}
```