text:
# 🎒📓💻 Task 1

**NOTE: If you just fork this repository it will not be graded. Ask your supervisor for a special GitHub classroom URL.**

## How to do the task

Your task is to write a valid definition for every function declared in `src/Task.hs`. All functions have a comment describing what the function needs to do with some examples.

There are predefined tests for you to check your answer. You can look at the tests for some more usage examples in `test/Tests.hs`.

 An automated script will then check your solution and give you feedback as a CI result in your GitHub repository.

## Prerequisites

### Haskell Stack

First of all, you need to install [haskell stack](https://docs.haskellstack.org/en/stable/README/). To do that you can follow the [installation instructions on the website](https://docs.haskellstack.org/en/stable/README/#how-to-install).

Stack will manage to install the compiler and all required libraries when you try to compile a Haskell stack project. (The first time it might take a while, but when you will try to run it again, it will use the already installed tools).

Stack is also a sort of meta build system. It is "meta" because stack doesn't build anything -- it tells *cabal* how to build your project with the installed compiler and libraries. *Cabal* is to Haskell what the *CMake* is to C++.

### Git

If you are running macOS or Linux you should already have some version of git installed on your system. If you do not, or if you are running windows, you will need to install git. You can do so by following this [git installation tutorial](https://www.atlassian.com/git/tutorials/install-git).

## Cloning your project

After you follow the special URL, you should finally end up on your github project.

You will then want to grab the cloning URL:

![](img/3.png)

And in you terminal, navigate to where you would like to store your project and clone the git repo:

```bash
git clone https://github.com/hse-cs-2020/sc-task-1-ilyakooo0.git
```

### Making sure it builds

After you have cloned your project you should make sure you have everything set up and working properly.

Navigate to the project folder and run the following command:

```bash
stack test
```

This should download the compiler, download all necessary libraries and run the test in your project.

## IDE

The easiest way to develop is to use the [IntelliJ plugin for Haskell](https://github.com/rikvdkleij/intellij-haskell).

Unfortunately, the latest versions of the plugin are not available in the IntelliJ marketplace, so it is recommended that you download it from [the "Releases" tab on github](https://github.com/rikvdkleij/intellij-haskell/releases):

![](img/1.png)

You then need to install it from disk:

![](img/2.png)

To install and use it you can follow [the instructions given in the project readme](https://github.com/rikvdkleij/intellij-haskell#getting-started).

**NOTE: You need to make sure the project builds before importing**

**NOTE: You need to choose "Project from Existing Sources..." in IntelliJ**

When you first open a project, IntelliJ will download and build all the required tools to give you feedback about your project. (This may take a while, but is only required once)

## Build and test

Unfortunately, *IntelliJ plugin for Haskell* doesn't currently support building your project directly from the IDE, so you will have to build your project and run tests from the terminal.

All subsequent commands are assumed to be run when the current directory is the root of your project.

After you have installed stack, you can build your project by running `stack build` in the directory of your project. This will build the code of your library.

To run tests on your code you can write `stack test`.

**NOTE: you don't have to write `stack build` if you want to test your project. Running `stack test` will automatically build any necessary modules.**

You can experiment with your functions by running `stack ghci`. This will build your library and launch an interactive shell with all of the functions already loaded. You can then just call your functions directly.

### Lifehack

If you try to display your types in the console, you will get errors.

To get rid of the errors you have to add `deriving Show` to the definition like so:

```haskell
data Foo = Bar
  deriving Show
```

## Submitting you solution

You can submit the solution to your solution to GitHub using IntlliJ.

To do this you can go to "VCS > Commit...":

![](img/4.png)

After that you will need to write a commit message.

**NOTE: Don't forget to push your commit. You can commit and push at the same time.**

![](img/5.png)

![](img/6.png)

## FAQ

> Can I add extra functions in the `Task.hs` file?

Yes, you can, but you can not remove existing functions.

license: Unlicense

gha_language: Haskell

gha_license_id: Unlicense


text:
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.3.0] - 2021-11-03
### Fixed
- Fix evm tx's `from` field (#590)
### Changed
- Bump dependencies (#584)
- Moonbeam EVM improvement (#593)

## [0.2.0] - 2021-10-31
### Fixed
- Case sensitivity when compare hash strings (#581)
- Handle tx without ethereum(Executed) log (#583)

## 0.1.0 - 2021-10-31
### Added
- Basic implementation for moonbeam evm processor (#547)

[Unreleased]: https://github.com/subquery/subql/compare/contract-processors/0.3.0...HEAD
[0.3.0]: https://github.com/subquery/subql/compare/contract-processors/0.2.0...contract-processors/0.3.0

branch_name: refs/heads/main

extension: md

license_type: permissive


text:
---
name: Edith Keeler
rarity: 4
series: tos
memory_alpha:
bigbook_tier: 7
events: 19
in_portal: true
date: 01/01/2016
obtained: Launch
mega: false
published: true
---

Whodathunk Kirk would fall for a 453 DIP base? Keeler is generally bereft of power, but there’s a little something for both the new and the old.

She’s *only* a 2-skiller, but DIP/MED is not a stack you tend to see walls of in the gauntlet (outside of those insufferable Guinan gauntlets), so Edith and her fistfuls of elevated crit gauntlets could give her proficiencies room to maneuver for fresh rosters. On the flip side, her trio of collections should see one or two more hung on the wall before it’s all said and done and if you’ve been playing the game for a few years, that’s all you need to see from your super rares.

license: MIT

repository: joshurtree/datacore-website

branch_name: refs/heads/master

gha_language: TypeScript

gha_license_id: MIT

repo_name: joshurtree/datacore-website


text:
Runs a compliance search on Office 365 and deletes the results.

## Dependencies
This playbook uses the following sub-playbooks, integrations, and scripts.

### Sub-playbooks
* GenericPolling

### Integrations
* EWS v2

### Scripts
This playbook does not use any scripts.

### Commands
* ews-o365-purge-compliance-search-results
* ews-o365-get-compliance-search
* ews-o365-start-compliance-search
* ews-o365-remove-compliance-search

## Playbook Inputs
---

| **Name** | **Description** |  **Required** |
| --- | --- | --- |
| Query | The compliance search query. |  Required |

## Playbook Outputs
---
There are no outputs for this playbook.

## Playbook Image
---
![Office_365_Search_and_Delete](https://raw.githubusercontent.com/demisto/content/1bdd5229392bd86f0cc58265a24df23ee3f7e662/docs/images/playbooks/Office_365_Search_and_Delete.png)

## Known Limitations
---
* Due to a Microsoft limitation, you can perform a search and purge operation on a maximum of 50,000 mailboxes. To work around this limitation, configure multiple instances of the integration each with different permission filtering so that the number of mailboxes in each instance does not exceed 50,000.

repository: demisto/content

gha_language: Python

repo_name: demisto/content


text:
*Question: What does the following code print?*
```javascript
console.log('one');
setTimeout(function() {
  console.log('two');
}, 0);
console.log('three');
```

The code prints out
"one
three
undefined
two"
this is because it goes through and logs the first string but then runs a timeout on a function that contains the log of the string two and even though that timeout is set to 0 it still has to "stop and wait for 0 miliseconds" which means the log of "three" runs and the the nonexisent timeout finishes so the function (that does not have a return value) runs thereby returning undefined and logging out the string "two"


text:
# Video 2.4:
Interacting with smart contracts using Web3 and Infura

# Setup and Installation Guide:

# First we startup node and bootstrap our Web3 environment again
```
$ node
> const Web3 = require('web3');
> const web3 = new Web3(new Web3.providers.HttpProvider("https://kovan.infura.io/"));
```

# Next we store a reference to our ABI
```
> const contractAbi = [{"constant": true,"inputs":[],"name":"greet","outputs":[{"name": "","type": "string"}],"payable": false,"stateMutability": "view","type": "function"},{"inputs": [],"payable": false,"stateMutability": "nonpayable","type": "constructor"}];
```

# And our contract address too
```
> const contractAddress = "0x0e6dd50782dde9132f8e703722dc5cbfe45bca04";
```

# Next we create a Web3 instance that's interfaced with our contract
```
> let contractInstance = new web3.eth.contract(ContractAbi, contractAddress);
```

Sweet, now we can call our contract. If our Ethereum provider node from Infura has the block data for the transaction where our contract is deployed, calling our contract greet() function returns the desired output, namely the words "Hello world"

# First, let's store our method and method callback in local variables:
```
> let Greeter = contractInstance.methods.greet();
> let greeting = Greeter.call();
```

# Now we can call our method:
```
> console.log(greeting);
```

# Example Return:
```
: '
Promise {
  'Hello world',
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
'
```

url: https://raw.githubusercontent.com/PacktPublishing/Creating-Smart-Contracts-with-Ethereum/b20c1f4e176d259ffadc7d33c52d083fd7d10b4a/SECTION2-SMART-CONTRACTS-WITH-SOLIDITY/Video 2.4 - Interacting with smart contracts using Web3 and Infura/README.md

gha_language: HTML


text:
---
title: Indexing and PSI Stubs
---

The indexing framework provides a quick way to locate certain elements, e.g. files containing a certain word or methods with a particular name, in large code bases. Plugin developers can use the existing indexes built by the IDE itself, as well as build and use their own indexes.

It supports two main types of indexes:

* [File-based indexes](/basics/indexing_and_psi_stubs/file_based_indexes.md)
* [Stub indexes](/basics/indexing_and_psi_stubs/stub_indexes.md)

File-based indexes are built directly over the content of files. Stub indexes are built over serialized *stub trees*. A stub tree for a source file is a subset of its PSI tree which contains only externally visible declarations and is serialized in a compact binary format.

Querying a file-based index gets you the set of files matching a certain condition. Querying a stub index gets you the set of matching PSI elements. Therefore, custom language plugin developers should typically use stub indexes in their plugin implementations.

repository: LiliWeiSE/intellij-sdk-docs

repo_name: LiliWeiSE/intellij-sdk-docs


text:
# comms [![Build Status](https://api.travis-ci.org/aputlock/comms.svg?branch=master)](https://travis-ci.org/aputlock/comms)
Sending e-mail over the Ethereum blockchain. Hopefully, covertly.
## Installation
Clone this repo and then with [stack](https://www.haskellstack.org/) do ```$ stack install comms```

## Dependencies
- Ethereum node (Parity, Geth, etc)
	- Note: can also run with hosted nodes such as Infura, but this allows for traffic analysis by ISP
- Email client (Thunderbird)
    - Note: may work with other clients, but only Thunderbird is tested

## Usage

Assuming that `stack` has installed comms to somewhere on your `PATH` you should
be able to run:
```sh
$ comms -h
```

    comms [COMMAND] ... [OPTIONS]
    	Decentralized email server.

	Common flags:
    	-h --help             Display help message
        -V --version          Print version information
        --numeric-version  Print just the version number

	comms [run] [OPTIONS]
  		Runs the servers.

  		-d --debug            Print debugging info about the server

	comms import [OPTIONS] EMAIL HASH
  		Import a contact into a local only address book.

	comms publish [OPTIONS]
  		Publish contact card onto the public transaction log.

repository: aputlock/comms

repo_name: aputlock/comms


text:
# Microthyrium pieridis S.K. Bose & E. Müll., 1964 SPECIES

#### Status
ACCEPTED

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

#### Published in
Indian Phytopath. 17(1): 15 (1964)

#### Original name
Microthyrium pieridis S.K. Bose & E. Müll., 1964

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Multi-select mode

## Features

In addition to the general, self-explanatory features, this mode also offers support for the following options:

### Custom styles for drop-down container

The drop-down is placed globally in the DOM. As described in the [API docs](interfaces/options.baseoptions.md#css) you can add a custom css-class to the
container-div where the drop-down lives. Simply add this snippet to the options during initialization:
```js
css: {
    dropdownHolder: "my-custom-dropdown-styles"
}
```

### Customize displayed text for selected items

You can use this hook to customize the text which is displayed for selected items. See [API docs](interfaces/options.baseoptions.md#templateselectedtext) for details.
```js
templateSelectedText: node => (`Selected: ${node.label}`)
```

## Live demo

Try this [JSFiddle](https://jsfiddle.net/z6bj4e30/).

repository: Blakeinstein/simple-tree-component

repo_name: Blakeinstein/simple-tree-component


text:
@4lch4/do-manager
=================

A CLI utility for creating, removing, or otherwise managing resources in DigitalOcean without their Doctl CLI.

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@4lch4/do-manager.svg)](https://npmjs.org/package/@4lch4/do-manager)
[![Downloads/week](https://img.shields.io/npm/dw/@4lch4/do-manager.svg)](https://npmjs.org/package/@4lch4/do-manager)
[![License](https://img.shields.io/npm/l/@4lch4/do-manager.svg)](https://github.com/4lch4/do-manager/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @4lch4/do-manager
$ do-manager COMMAND
running command...
$ do-manager (-v|--version|version)
@4lch4/do-manager/0.0.1 darwin-x64 node-v14.15.4
$ do-manager --help [COMMAND]
USAGE
  $ do-manager COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`do-manager create:droplet [FILE]`](#do-manager-createdroplet-file)
* [`do-manager hello [FILE]`](#do-manager-hello-file)
* [`do-manager help [COMMAND]`](#do-manager-help-command)
* [`do-manager sizes:list [FILE]`](#do-manager-sizeslist-file)

## `do-manager create:droplet [FILE]`

describe the command here

```
USAGE
  $ do-manager create:droplet [FILE]

OPTIONS
  -f, --force
  -h, --help       show CLI help
  -n, --name=name  name to print
```

_See code: [src/commands/create/droplet.ts](https://github.com/4lch4/do-manager/blob/v0.0.1/src/commands/create/droplet.ts)_

## `do-manager hello [FILE]`

describe the command here

```
USAGE
  $ do-manager hello [FILE]

OPTIONS
  -f, --force
  -h, --help       show CLI help
  -n, --name=name  name to print

EXAMPLE
  $ do-manager hello
  hello world from ./src/hello.ts!
```

_See code: [src/commands/hello.ts](https://github.com/4lch4/do-manager/blob/v0.0.1/src/commands/hello.ts)_

## `do-manager help [COMMAND]`

display help for do-manager

```
USAGE
  $ do-manager help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.2/src/commands/help.ts)_

## `do-manager sizes:list [FILE]`

describe the command here

```
USAGE
  $ do-manager sizes:list [FILE]

OPTIONS
  -f, --force
  -h, --help       show CLI help
  -n, --name=name  name to print
```

_See code: [src/commands/sizes/list.ts](https://github.com/4lch4/do-manager/blob/v0.0.1/src/commands/sizes/list.ts)_
<!-- commandsstop -->


text:
# Elasticsearch::Model::Globalize

`elasticsearch-model-globalize` library allows you to use
[elasticsearch-model](https://github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-model)
\[[LICENSE](https://github.com/elasticsearch/elasticsearch-rails/blob/master/elasticsearch-model/LICENSE.txt)\]
with [Globalize](https://github.com/globalize/globalize) \[[LICENSE](https://github.com/globalize/globalize/blob/master/LICENSE)\].

This gem has two modules, one is `MultipleFields` and the other is `OneIndexPerLanguage`.
You can choose one for each model to fit your needs by simply including a module.

```ruby
class Item < ActiveRecord::Base
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
  include Elasticsearch::Model::Globalize::MultipleFields
  # Or
  # include Elasticsearch::Model::Globalize::OneIndexPerLanguage
end
```

### MultipleFields

`MultipleFields` module creates additional fields for each language.
For example, you have a model like:

```ruby
class Item < ActiveRecord::Base
  translates :name, :description
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
  include Elasticsearch::Model::Globalize::MultipleFields
end
```

and you have `:en` and `:ja` for available locales.

`MultipleFields` module creates `name_en`, `name_ja`, `description_en` and `description_ja`
field and stores these fields instead of `name` and `description` fields into Elasticsearch.

You can customize the way to localize field names.

```ruby
# Put this in config/initializers/elasticsearch-model-globalize.rb
Elasticsearch::Model::Globalize::MultipleFields.localized_name do |name, locale|
  "#{name}_#{locale}"
end
```

The way to define `mappings` and `as_indexed_json` is same as
[elasticsearch-model](https://github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-model)
without this library.

```ruby
class Item < ActiveRecord::Base
  translates :name, :description
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
  include Elasticsearch::Model::Globalize::MultipleFields

  mapping do
    indexes :id,             type: 'integer'
    indexes :name_ja,        analyzer: 'kuromoji'
    indexes :name_en,        analyzer: 'snowball'
    indexes :description_ja, analyzer: 'kuromoji'
    indexes :description_en, analyzer: 'snowball'
  end

  def as_indexed_json(options={})
    { id: id,
      name_ja: name_ja,
      name_en: name_en,
      description_ja: description_ja,
      description_en: description_en }
  end
end
```

Getters and setters of the derived fields are automatically added by `MultipleFields` module.

```ruby
I18n.locale = :en
item = Item.new
item.name_ja = '輪ゴム'
item.name_ja # => "輪ゴム"
item.name # => nil
Globalize.with_locale(:ja) { item.name } # => "輪ゴム"
item.name = 'elastic'
item.name # => "elastic"
item.name_en # => "elastic"
```

One thing you have to care about is that put `translates` line before including
`Elasticsearch::Model::Globalize::MultipleFields`, otherwise `MultipleFields` module are not able to
know from which fields to derive localized fields.

### OneIndexPerLanguage

`OneIndexPerLanguage` module creates one index per language.
For example, you have a model like:

```ruby
class Item < ActiveRecord::Base
  translates :name, :description
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
  include Elasticsearch::Model::Globalize::OneIndexPerLanguage
end
```

and you have `:en` and `:ja` for available locales,

`OneIndexPerLanguage` module creates `items-en` and `items-ja` indices.

You can customize the way to localize index names and document types.

```ruby
# Put this in config/initializers/elasticsearch-model-globalize.rb
Elasticsearch::Model::Globalize::OneIndexPerLanguage.localized_name do |name, locale|
  "#{locale}-#{name}"
end
```

You can use `index_name_base` and `documenty_type_base` in addition to `index_name` and
`document_type`.

You can define mappings using `globalized_mapping` as follows:

```ruby
class Item < ActiveRecord::Base
  translates :name, :description
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
  include Elasticsearch::Model::Globalize::OneIndexPerLanguage

  globalized_mapping do |locale|
    analyzer = locale == :ja ? 'kuromoji' : 'snowball'

    indexes :id,          type: 'integer'
    indexes :name,        analyzer: analyzer
    indexes :description, analyzer: analyzer
  end
end
```

## Development and Community

For local development, clone the repository and run bundle install.

To run all tests against a test Elasticsearch cluster, use a command like this:

```sh
curl -# https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.tar.gz | tar xz -C tmp/
SERVER=start TEST_CLUSTER_COMMAND=$PWD/tmp/elasticsearch-1.2.1/bin/elasticsearch bundle exec rake test
```

## Contributing

1. Fork it ( https://github.com/kentaroi/elasticsearch-model-globalize/fork )
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 a new Pull Request

repository: kentaroi/elasticsearch-model-globalize

gha_language: Ruby

repo_name: kentaroi/elasticsearch-model-globalize


text:
# Zenfonts

A tiny JavaScript helper to load and pre-load web fonts that are specified via @font-face. It uses best practices from other solutions, but it's still a unique combination:

- It's tiny (793 bytes minimized and gzipped), so it can be easily included in every page.
- It can preload a font before it's used.
- It can solve the “invisible text” issue (WebKit-based browsers on slow network) by applying a class during font loading.
- It can also solve the Flash Of Unformatted Text, aka [FOUT](http://www.paulirish.com/2009/fighting-the-font-face-fout/) (still happens in Internet Explorer).
- Supports practically all browsers. Tested under the latest browser on Android, iOS, OS X, Windows, as well as under IE6+, Firefox 3.6+.

Please note that Zenfonts isn't replacing the mechanic of loading web fonts. Instead, it is more like a safety valve as the majority of the browser population (Chrome desktop, Chrome for Android, Firefox, Opera) handles font-loading already quite smart, avoiding both FOUT and “invisible text”. Your fonts are also cached after the first load, and many times the network is fast enough. Zenfonts is there for you if everything fails: the fonts is not cahced, the network is very slow and the browser isn't handling it properly (most notably WebKit-based browsers, like iOS and older Android browsers. Zenfonts was made to make sure that even of those extreme cases are taken care, and you can have a peace of mind.

## Usage

You can include the minimized version in the head and call `Zenfonts` after that. Also you could bundle it with the other jsvascripts assets on your page:

````
<head>
    ...

    <script src="path/to/zenfonts.js"></script>
    <script>Zenfonts("Unibody", {fallbackClass: "fallback-unibody", timeout: 2500})</script>
</head>
    ...
````
`Zenfonts()` returns immediately after calling but it stays in the background and periodically checks whether the fonts is loaded. Note that this background checking gets slower and slower with time and Zenfonts gives up after about a minute and removes itself entirely. So it won't slow down the page.

`Zenfonts()` have two parameters:

1. `fonts` which is either an array or a single one. Every passed font can be specified as a string (e.g., `Liza`) or as an object with optional style attributes, e.g. `{family: "Liza"}` or `{family: "Sauna", style: "font-weight: bold"}`. The font-families that you pass as parameters must be specified in your CSS as `@font-face` declarations, e.g., `@font-face { font-family: "Liza"; src: url("/fonts/liza.woff") }`
2. `options` which is an object with attributes that are all optional: `loadingClass` which is applied during loading, `fallbackClass` which is only applied if `timeout` is reached before the font is loaded, `timeout` which defines the time before the fallbackClass is applied (default is `2222`), and `onLoad` which is a callback function that will be executed once the font is successfully loaded

Once the font is loaded the background checks of Zenfonts stop (and it removes `loadingClass` from the `<html>` element, if it was provided). However, if the networks is slow or the font is blocked somehow and `timeout` is reached then Zenfonts applies the `fallbackClass` to the `<html>` element. After that Zenfonts still keeps staying in the background and when the font is finally loaded, it removes the `fallbackClass`. Note that both `loadingClass` and `fallbackClass` can be a list of classes, separated by spaces, e.g., `"loading-liza loading-sauna"`

There are many ways to utilize Zenfonts. Below is a few examples.

### Example 1: Preload fonts

Handy if you know that a specific font will be needed and you want to make sure the browser loads it. There is no harm done calling `Zenfonts()` even if the font is already in the browser cache. It will simply quit.

Preloading a single font, called Dolly:

```
Zenfonts("Dolly")
```

Of course, if some elements on your page already uses this font-family then the browser will load in anyway, and calling `Zenfonts()` doesn't make sense. (And note that Internet Explorer will load every fonts that are references in `@font-face` definitions.) So you would use the above code if the current page doesn't use "Dolly" but you know that you may display a dialog box with this font, or the user may navigate to another page which uses "Dolly".

Preloading multiple fonts:

```
Zenfonts(["Dolly", "Fakir", "Bello"])
```

Preloading fonts with specific styles:

```
Zenfonts({family:"Dolly", style:"font-style: italic"})
```
or
```
Zenfonts([
    "Fakir",
	{family:"Sauna", style:"font-weight: 300"},
	{family:"Sauna", style:"font-weight: 700; font-style: italic"}
])
```

And if you want to set a cookie once a font was loaded:

```
Zenfonts("Fakir", {
    onLoad: function () {
        document.cookie = "fakir=loaded; expires=Wed, 22 Jan 2025 00:00:00 UTC"
    }
})
```

### Example 2: Fixing “invisible text” (WebKit-based browsers)

Fixing invisible text requires preparation in the CSS as Zenfonts will apply a CSS class if the loading of the font is too slow.

```
Zenfonts("Dolly", {fallbackClass: "fallback-dolly"})
```

And in your CSS you may have something like:

```
...
body { font-family: "Dolly", Georgia, serif; }
.fallback-dolly body { font-family: Georgia, serif; }
...
```

This way even in current WebKit-based browsers (old Android and iOS) the font-loading times out after a while instead of waiting forever for the font.

You can also change the timeout for the fallback to 1 second from the default 2222 ms:

```
Zenfonts("Fakir", {fallbackClass: "fallback-fakir", timeout: 1000})
```

Note that if the font is loaded before the timeout (because the network is fast enough or the font was already cached) then Zenfonts will simply quit without applying `fallbackClass` as there is no issue. This is an important philosophy of Zenfonts.

**Demo:** TBD

### Example 3: Controlling the order of font loading

To avoid multiple redrawing of the page on slow networks you can list all all required fonts in an array so that Zenfonts makes sure everything is loaded or fall back.

```
Zenfonts(["Dolly", "Dolly-Italic", "Dolly-Bold"], {fallbackClass: "fb-dolly fb-dolly-i fb-dolly-b"})
```

If you want to make sure more important fonts load first, you can do that too:

```
Zenfonts(
    "Dolly",
    {
		// make sure Italic and Bold won't be loaded initially:
        loadingClass: "fb-dolly-i fb-dolly-b",
        fallbackClass: "fb-dolly",
		// start loading Italic and Bold once the Regular was loaded:
        onLoad: function () {
			Zenfonts(["Dolly-Italic", "Dolly-Bold"], {fallbackClass: "fb-dolly-i fb-dolly-b"})
        }
    }
)
```

**Demo:** TBD

### Example 4: Fixing FOUT (Internet Explorer)

Internet Explorer will flash the text till all fonts are fully loaded. To fix this you may decide to hide specific elements or everything until the fonts are loaded. Here's one way to do it with Zenfonts:

```
<head>
    ...
    <!--[if IE]><style>.ie-fontloading body {visibility: hidden}</style><![endif]-->
    <script>...zenfonts-min.js embedded here...</script>
</head>
<body>
    <script>Zenfonts("Auto", {loadingClass: "ie-fontloading"})
```

This way the entire `body` stays hidden in Internet Explorer until the fonts are ready (either from the browser cache or from the network) or until `timeout`.

**Demo:** TBD

## License

[Public Domain](http://unlicense.org). You can do with it whatever you want and I am not responsible for anything.

repository: wtayyeb/zenfonts

gha_language: JavaScript

repo_name: wtayyeb/zenfonts


text:
---
layout: post
title:  "Perl Weekly Challenge 153: recursive CTEs"
author: Luca Ferrari
tags:
- postgresql
- perlweeklychallenge
- planet-postgresql-org
permalink: /:year/:month/:day/:title.html
---
My personal solutions to the Perl Weekly Challenge.

# Perl Weekly Challenge 153: recursive CTEs

This is a short tour about my solutions to the  [Challenge 153](https://perlweeklychallenge.org/blog/perl-weekly-challenge-0153/){:target="_blank"} done in PostgreSQL.

- [Task 1](#task1)
- [Task 2](#task2)

## PWC 153 - Task 1

This task was about producing *left factorial numbers*, where each value is computed by summing all the previously computed factorials.

I decided to implement it on top of a *recursive CTE* named `factorials` that, well, computes factorials. That was the easy part, then I needed to compute the `sum` of all the values less than the current one. Let's use a `LATERAL JOIN` for the task:

```sql
with recursive factorials as
(
   SELECT 0::numeric as num
         ,1::numeric as fac

   UNION

   SELECT f.num + 1
         , ( f.num + 1 ) * f.fac
   FROM factorials f
   WHERE f.num < 1000
)
SELECT f.num, sum( w.fac ) as left_factorial
FROM factorials f, LATERAL
( SELECT ff.fac FROM factorials ff WHERE ff.num < f.num ORDER BY ff.num ) w
WHERE f.num <= 10
GROUP BY f.num, f.fac
ORDER BY f.num
;

 ```

I limit the number of work to be done to `10`, as requested by the task. The `factorials` CTE computes all the factorials, and then I join `LATERAL` with a subquery `w` that selects all the factorial values for entries less then current one. Therefore, using the built-in `sum` function in the outer query solves the problem.

Clearly, this is not a particularly efficient solution, but it is a good example of what recursive CTEs and `LATERAL` an do when combined together.

## PWC 153 - Task 2

Similar to the previous task, but simpler: see if a given number is made by digits that, when summed as factorials, provide the number itself. As an example, `145` is a number that can be expressed as `!1 + 4! + 5!`.

Having a recursive CTE to compute factorials from the previous task, I decided to use the same starting point. However, this time, I used a `psql` variable named `needle` to which I assign the value I want to test:

```sql
\set needle 145

with recursive factorials as
(
   SELECT 0::numeric as num
         ,1::numeric as fac

   UNION

   SELECT f.num + 1
         , ( f.num + 1 ) * f.fac
   FROM factorials f
   WHERE f.num < 1000
)
SELECT CASE sum( f.fac ) WHEN :needle THEN :needle || ' OK' ELSE :needle || ' KO' END AS factorions
FROM factorials f JOIN regexp_split_to_table( :needle::text, '' ) w(n)
ON w.n = f.num::text
;
;

```

The trick here is that I join `factorials` with `regexp_split_to_table` that returns all the digits as a set of tuples. Then, in the outer query, I do `sum` the factorials of every digit and see if the result is still the `needle`, producing an `OK` string or a `KO` one.


text:
# KeePass-ExeIconPicker
[![GitHub release](https://img.shields.io/github/release/eveldee0680/KeePass-ExeIconPicker.svg)](https://github.com/eveldee0680/KeePass-ExeIconPicker/releases/latest) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/eveldee0680/KeePass-ExeIconPicker/blob/master/LICENSE)

ExeIconPicker plugin for KeePass 2.x is a plugin that let you grab an icon from a Windows executable file (.exe), a library (.dll) or an icon file (.ico) and use it as an entry or group icon.

![Context Menu Preview](Docs/Preview/Preview1.gif)

# Documentation

- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Build](#build)
- [Contributing](#contributing)
- [Copyright and license](#copyright-and-license)

## Prerequisites

- KeePass 2.20 or newer
- Windows 7 or newer
- .Net Framework 3.5

## Installation

### Manual installation

- [Download](https://github.com/eveldee0680/KeePass-ExeIconPicker/releases) the plugin in .plgx format.
- Copy the file in your KeePass plugins directory (C:\Program Files (x86)\KeePass\Plugins).
- Restart *KeePass* if it was already running.

### Chocolatey 📦
Or you can [use Chocolatey to install](https://community.chocolatey.org/packages/keepass-exe-icon-picker#install) it in a more automated manner:

```
choco install keepass-exe-icon-picker
```

To [upgrade KeePass Plugin Exe Icon Picker](https://community.chocolatey.org/packages/keepass-exe-icon-picker#upgrade) to the [latest release version](https://community.chocolatey.org/packages/keepass-exe-icon-picker#versionhistory) for enjoying the newest features, run the following command from the command line or from PowerShell:

```
choco upgrade keepass-exe-icon-picker
```

## Build

In order to build the plugin yourself, you will need to modify KeePassDir in the build.cmd file accorded to your *KeePass* installation folder.

Then you just need to run build.cmd and launch *KeePass*.

## Contributing

If you want to help the project, open a [new issue](https://github.com/eveldee0680/KeePass-ExeIconPicker/issues) or create a [new pull request](https://github.com/eveldee0680/KeePass-ExeIconPicker/pulls).

## Copyright and license

*ExeIconPicker* is licensed under the [Mit License](LICENSE).

*IconExtractor* library is under the [BSD License](https://opensource.org/licenses/bsd-license.php) and owned by [Tsuda Kageyu](https://www.codeproject.com/script/Membership/View.aspx?mid=5207992), you can get it [here](https://www.codeproject.com/Articles/26824/Extract-icons-from-EXE-or-DLL-files).

Also, some parts of my plugin are inspired by the great plugin [_Yet Another Favicon Downloader_](https://github.com/navossoc/KeePass-Yet-Another-Favicon-Downloader), so thanks to the author.

repository: Eveldee/KeePass-ExeIconPicker

gha_language: C#

repo_name: Eveldee/KeePass-ExeIconPicker


text:
> [Go to French version](/fr/Règlements/Décrets,%20ordonnances%20et%20règlements%20statutaires/2007/258.md)

# Eligible Financial Contract Regulations (Winding-up and Restructuring Act)

**SOR/2007-258**

Enabling authorities:
- [WINDING-UP AND RESTRUCTURING ACT](/en/Acts/Revised%20Statutes%20of%20Canada/W/W-11.md)

Date registered: 15 November 2007

----------

Her Excellency the Governor General in Council, on the recommendation of the Minister of Industry, pursuant to subsection 22.1(3)[a] of the [Winding-up and Restructuring Act](/en/Acts/Revised%20Statutes%20of%20Canada/W/W-11.md)[b], hereby makes the annexed Eligible Financial Contract Regulations (Winding-up and Restructuring Act).

a: S.C. 2007, c. 29, s. 113(4)

b: R.S., c. W-11; 1996, S.C. c. 6, s. 134

**1** The following definitions apply in these Regulations.

***derivatives agreement*** means a financial agreement whose obligations are derived from, referenced to, or based on, one or more underlying reference items such as interest rates, indices, currencies, commodities, securities or other ownership interests, credit or guarantee obligations, debt securities, climatic variables, bandwidth, freight rates, emission rights, real property indices and inflation or other macroeconomic data and includes
- **(a)** a contract for differences or a swap, including a total return swap, price return swap, default swap or basis swap;
- **(b)** a futures agreement;
- **(c)** a cap, collar, floor or spread;
- **(d)** an option; and
- **(e)** a spot or forward. (*contrat dérivé*)

***financial intermediary*** means
- **(a)** a clearing agency; or
- **(b)** a person, including a broker, bank or trust company, that in the ordinary course of business maintains securities accounts or futures accounts for others. (*intermédiaire financier*)
> SOR/2016-144, s. 3(F).

**2** The following kinds of financial agreements are prescribed for the purpose of the definition ***eligible financial contract*** in subsection 22.1(2) of the [Winding-up and Restructuring Act](/en/Acts/Revised%20Statutes%20of%20Canada/W/W-11.md):
- **(a)** a derivatives agreement, whether settled by payment or delivery, that
	- **(i)** trades on a futures or options exchange or board, or other regulated market, or
	- **(ii)** is the subject of recurrent dealings in the derivatives markets or in the over-the-counter securities or commodities markets;
- **(b)** an agreement to
	- **(i)** borrow or lend securities or commodities, including an agreement to transfer securities or commodities under which the borrower may repay the loan with other securities or commodities, cash or cash equivalents,
	- **(ii)** clear or settle securities, futures, options or derivatives transactions, or
	- **(iii)** act as a depository for securities;
- **(c)** a repurchase, reverse repurchase or buy-sellback agreement with respect to securities or commodities;
- **(d)** a margin loan in so far as it is in respect of a securities account or futures account maintained by a financial intermediary;
- **(e)** any combination of agreements referred to in any of paragraphs (a) to (d);
- **(f)** a master agreement in so far as it is in respect of an agreement referred to in any of paragraphs (a) to (e);
- **(g)** a master agreement in so far as it is in respect of a master agreement referred to in paragraph (f);
- **(h)** a guarantee of, or an indemnity or reimbursement obligation with respect to, the liabilities under an agreement referred to in any of paragraphs (a) to (g); and
- **(i)** an agreement relating to financial collateral, including any form of security or security interest in collateral and a title transfer credit support agreement, with respect to an agreement referred to in any of paragraphs (a) to (h).

[*]**3** These Regulations come into force on the day on which subsection 113(2) of the [Budget Implementation Act, 2007](/en/Acts/Statutes%20of%20Canada/2007/c.%2029.md), chapter 29 of the Statutes of Canada, 2007 comes into force.

*: [Note: Regulations in force on November 17, 2007, *see* SI/2007-106.]

repository: TravisMadill/CanadianLaws

path: /en/Regulations/Statutory Orders and Regulations/2007/258.md

repo_name: TravisMadill/CanadianLaws


text:
### [CVE-2020-8841](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8841)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

An issue was discovered in TestLink 1.9.19. The relation_type parameter of the lib/requirements/reqSearch.php endpoint is vulnerable to authenticated SQL Injection.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/5l1v3r1/CVE-2020-8841
- https://github.com/ARPSyndicate/cvemon
- https://github.com/nomi-sec/PoC-in-GitHub
- https://github.com/soosmile/POC

repository: trickest/cve

repo_name: trickest/cve


text:
---
layout: post
title: "Testing the new Web Design"
date: 2010-07-16 10:50
comments: true
author: Hiltmon
categories:
- Tools and Techniques
---

I decided to revamp the noverse.com website before it became too complex.  The original site had too many pages, and tons of html was being repeated.  Every change had to be made in too many places, and as a developer, that violates the rules.

So, I switched from HTML/CSS to PHP-HTML/CSS.  Easy.  The only PHP I am using is to include common blocks of code, like the navigation bar, sidebar and footer.

I also redid the CSS, used class attributes for formatting and id attributes for DOM naming, CSS to make the title bars, CSS to handle the background images and preloading, and CSS for the layout.

I initially tested the site CSS using CSSEdit from MacRabbit.  I created the home page as a pure html file, before breaking it up into PHP parts, and used the live preview feature to see how each CSS change applied. **This has seriously got to be the most productive way to build and test CSS**.

I then tested the site on 3 browsers, Safari, Chrome and Firefox, simply because these were installed on my Macintosh OS X development computer.  Since the CSS had already passed CSSEdit's preview tests, the browser tests were simply a formality.

But, before I sent the site out, I needed to test it against Internet Explorer, the most common browser out there.  So up came the VM with Windows XP, up came MAMP locally to host the site, and off I went.  IE8 showed the site reasonably well.  Some of the CSS awesomeness, such as rounded corners failed as expected, but it worked.

But the most common browser out there is IE6, and its CSS support is horrible.  Since I did not have IE6, I used some web sites to render for me.  The site turned out to be a mess.  PNG transparency, gone.  Hover images, gone.  Image preloading, nada. But surprisingly, the structure seems to hold.  IE7 is better, running like a dog under Wine, but still not very good.

But I don't care.  My target market uses iPhones, and iPhone users tend to be using Windows 7, or ubuntu or Macs, and their browsers stack up fine.

Waiting for the first complaint about the web site under IE6.  My guess it that I'll be waiting a while.

extension: markdown


text:
---
layout: post
title:      "Rising Challenges"
date:       2020-04-20 17:04:57 +0000
permalink:  rising_challenges
---

As this new epidemic cripples the economy, working, taking care of family, and school has proven to be alot more of a challenge than before. With finishing my degree in Computer Science hoping that this is my last semester, it has proven to be very challenging with the distance learning. Math class is alot more difficult because of how it is being taught. My CS-281 course - Data Structures - is challenging but it is bareable, learning sql with postgres, and eventually in MySQL, Cassandra, MongoDB, and Spark. More challenges rising doing my best to stay head strong to stay on task.

It was fun working on my CLI project, was neverous but my reviewer Howard made me feel comfortable, and I was able to complete aadding in a new method that checked for beers with strong alcohol levels:
```
def self.strong_beers
    all.select {|s_beer| s_beer.abv > 5}
end
```

After that I also worked on adding a method that checks for all beers that has low alcohol levels:
```
def self.weak_beers
    all.select {|w_beers| w_beers.abv < 5}
end
```

Thanks to Howard I learnt how to use the select method instead of an if statement to do itteration. Now as the next module starts and the focus is SQL with ruby objects, starting off it is pretty straight forward as it is working with basic SQL commands to create a table, insert data, and to query those data to get results. I have fallen behind as I have not completed last weeks work as of yet, and I also have this week set to do as well.

My peer-partner Peter is great to work with and talk to as we both understand each other, and able to help with completing ideas. I hope to finish all by the end of this week so that I am not totally left behind.


text:
# Ping-Pong Website

#### Git, HTML , Jscript , jQuery and CSS  Project For Epicodus,2.25.2019

#### By Ohood Obeidat

## Description

It is a website allow the user to enter a number and then display the numbers
from 1 to the provided number with this exceptions :
* Numbers divisible by 3 is "ping"
* Numbers divisible by 5 is "pong"
* Numbers divisible by 3 and 5 is "pingpong"

## Specifications

      Spec
      Input Example
      Output Example

      It can count to the provided number:
      Input Example:  2
      Output Example: 1 , 2

       It can count to the provided number with "ping"
       Input Example:  3
       Output Example:  1 , 2 , ping

      It can count to the provided number with "ping" ,"pong"
      Input Example: 5
      Output Example: 1 , 2 , ping , 4 , pong

       It can count to the provided number with "ping","pong","pingping"
       Input Example: 15
      Output Example: 1 , 2 , ping , 4 , pong , ping , 7 , 8 , ping , pong , 11 , ping , 13 , 14 , pingpong

## Setup/Installation Requirements

* Clone this repository
 https://github.com/ohood84/pingpong
* From git bash go to the project2
* Open the Atom from the git bash
* open the HTML index file to see the program from Atom
* To run the page double click on it from the folder.

## Technologies Used
* Git bash
* Atom
* HTML
* BOOTSTRAP
* CSS
* Markdown
* Java script
* jQuery

### Legal
Copyright (c) 2019 Ohood Obeidat
This software is licened under the MIT licence.


text:
Frequently Asked Questions (FAQ)
================================

Here are some frequently asked questions along with some (helpful?) answers.

### Why Isn't My Wiki Link Working?

Only certain characters are allowed in wiki links. If your link contains
characters that aren't allowed, then MarkWiki won't recognize it. Check out
the `Wiki Links` section on the [[MarkWiki/Features]] page.

### How Do I Make A Wiki Link To A Section?

If you want to make a wiki link directly to a section instead of a normal wiki
page, then you must add a forward slash at the end of the link like
[[MarkWiki/]].

repository: cabalamat/markwiki

repo_name: cabalamat/markwiki


text:
### Label Layer

Another big challenge napari is trying to solve is interactive labeling
data. Labels layer enable one to have arbitrary labels on any layer. One
can easily superimpose an image and corresponding labels with napari. An
example is given below:

```python
from skimage import data
from skimage.filters import threshold_otsu
from skimage.segmentation import clear_border
from skimage.measure import label
from skimage.morphology import closing, square, remove_small_objects
import napari

with napari.gui_qt():
    image = data.coins()[50:-50, 50:-50]

    # apply threshold
    thresh = threshold_otsu(image)
    bw = closing(image > thresh, square(4))

    # remove artifacts connected to image border
    cleared = remove_small_objects(clear_border(bw), 20)

    # label image regions
    label_image = label(cleared)

    # initialise viewer with coins image
    viewer = napari.view(coins=image, multichannel=False)
    viewer.layers[0].colormap = 'gray'

    # add the labels
    label_layer = viewer.add_labels(label_image, name='segmentation')
```

![image](../resources/screenshot-add-labels.png)

repository: alexdesiqueira/napari

repo_name: alexdesiqueira/napari


text:
## Deploying Molochv2.1
```
Compiling 7 files with 0.5.3
Compilation finished successfully
Deploying Moloch-V2.1 on network: harmonyTest
Account address: 0x1fc9C4a55726461052E6FeaB2E3fc374cFe63FDC
Account balance:<PHONE_NUMBER>1 ONE
Deploying the Moloch V2.1
Transaction Hash: 0xe6f73cabcd6bcfb6db4040991bc8afd255db043f613825b65d1ad77c746e0ae9
Contract Address: 0xf17d84eF088381477bD60EEB85B4342C5112533f
Block Number: 15505845
Deploying the Moloch Summoner using Moloch Template 0xf17d84eF088381477bD60EEB85B4342C5112533f
Transaction Hash: 0xffc5be4a9fdb642fd7fcec70c59f0b9e4404fae347acc3425bfd82cb41c94b1b
Contract Address: 0xa5940E291Fe2a33F401042c389008e332f89dfB3
Block Number: 15505851
```
## Deploying Molochv1
```
Compiling 1 file with 0.7.5
Compilation finished successfully
Deploying Moloch-V1 on network: harmonyTest
Account address: 0x1fc9C4a55726461052E6FeaB2E3fc374cFe63FDC
Account balance:<PHONE_NUMBER>3 ONE
Deploying the Moloch V1
Transaction Hash: 0x4cbe02d5a2a313491b52525d35d59841fe7a8b44acf0d8d278df1769438bdcf8
Contract Address: 0xe8EC5915C04770cfE34e6713E089cdC574120025
Block Number: 15505879
Deploying the Moloch Factory using Moloch Template 0xe8EC5915C04770cfE34e6713E089cdC574120025
Transaction Hash: 0x9b5ef44aa4152b050bcb4784fa4e6657bbab33306f0134c1ee6697fbe8482f91
Contract Address: 0x28F01B4559A5880b25fb6176C8D9143f92F16A54
Block Number: 15505883
```

## Deploying Nifty Minion
```
Compiling 1 file with 0.7.5
Compilation finished successfully
Deploying Nifty Minion Summoner on network: harmonyTest
Account address: 0x1fc9C4a55726461052E6FeaB2E3fc374cFe63FDC
Account balance:<PHONE_NUMBER>3 ONE
Deploying the Minion
Transaction Hash: 0x93abc3d4fb3241f346160f2ae05ac018eb46e1570b4f6eca00bc2faf55dba6f2
Contract Address: 0x2b642D6CC4a0D5f33EF8fc0885e899FFe26bcC15
Block Number: 15505920
Deploying the Minion Summoner using Minion Template 0x2b642D6CC4a0D5f33EF8fc0885e899FFe26bcC15
Transaction Hash: 0x1c2c9f87c33e8147b620c1e65175d1f6a96782ceb97df4de1739d0e7b2313eb1
Contract Address: 0x8ce6703E91c1E3fE93d1260C74339aE1773ecC2F
Block Number: 15505926
```

## Deploying Wrap N Zap
```
Compiling 3 files with 0.8.1
Compilation finished successfully
Deploying WrapNZapFactory on network: harmonyTest
Account address: 0x1fc9C4a55726461052E6FeaB2E3fc374cFe63FDC
Account balance:<PHONE_NUMBER>8 ONE
Transaction Hash: 0x7978c08c4abf93257ffcf8dc165d7b185c89d54bb9e25c828a2d9784c8762c53
Contract Address: 0x22c4Ec01843380244F8a578d7053ABFa19A68F06
Block Number: 15505949
```


text:
# Contributing

Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.

You can contribute in many ways:

## Types of Contributions

### Report Bugs

Report bugs at [GitHub Issues](https://github.com/zalando/ghe-backup/issues)

If you are reporting a bug, please include:

* Any details about your setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

### Fix Bugs

Look through the [GitHub Issues](https://github.com/zalando/ghe-backup/issues) for bugs. Anything tagged with [bug](https://github.com/zalando/ghe-backup/issues?utf8=%E2%9C%93&q=label%3Abug%20)
and [help wanted](https://github.com/zalando/ghe-backup/issues?utf8=%E2%9C%93&q=label%3A%22help%20wanted%22%20) is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with [enhancement](https://github.com/zalando/ghe-backup/issues?utf8=%E2%9C%93&q=label%3Aenhancement%20)
and [help wanted](https://github.com/zalando/ghe-backup/issues?utf8=%E2%9C%93&q=label%3A%22help%20wanted%22%20) is open to whoever wants to implement it.

## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

1. Submit an issue or a detailed pull request description.
2. Add respective tests if the pull request contains code changes.
2. If the pull request changes or adds functionality, the readme should be updated.

repository: zalando/ghe-backup

gha_language: Shell

repo_name: zalando/ghe-backup


text:
# Using Immutable Data Structures

With React's virtual DOM, immutable data structures make a lot of sense to make diffing more efficient, and immutable data structures have the additional benefit of preventing views from updating store data in a Flux architecture. For reasons like this, it makes a lot of sense to incorporate immutable data structures into your alt app, and where they come into play primarily is in your stores.

We will focus on Facebook's [Immutable](http://facebook.github.io/immutable-js/) library.

## Returning Immutable Data from Stores

We can continue to work with standard JS data structures in our stores, but return immutable data structures to our views in order to protect the unidirectional flow of data in Flux and ensure the view does not modify store data directly.

This has the benefit of requiring less code changes than using immutable data structures everywhere and may be a conceptually easier model to work with.

### `Record`

One of the lowest impact ways to start getting some of the benefits of immutable is to take advantage of Immutable's [`Record`](http://facebook.github.io/immutable-js/docs/#/Record) types. This method will result in the smallest changes for existing projects. You can read more about them on Facebook's docs, but the best thing about Records is that they enable you to access values the same way you would from a normal JS object (`object.prop`). This means no changes to the view code using the immutable data and our changes only occur in store methods that return data to the view.

Here is an example of how a Record can be used:

```js
// MyStore.js
import {Record} from 'immutable';

class MyStore {
  constructor() {
    this.data = {
      prop1: 1,
      prop2: 2
    };
  }

  getImmutState() {
    var ObjectRecord = Record(this.getState());
    return new ObjectRecord();
  }
}

// MyComponent.js
import {Component} from 'react';
import MyStore from 'stores/MyStore';

class MyComponent extends Component {
  render() {
    var storeData = MyStore.getImmutState();
    return (
      <div>Prop1: {storeData.prop1}</div>
    );
  }
}
```

### `fromJS`

Immutable has a nice helper, [`fromJS`](http://facebook.github.io/immutable-js/docs/#/fromJS) that allows us to convert JS object/arrays to immutable [`Map`s](http://facebook.github.io/immutable-js/docs/#/Map) and [`List`s](http://facebook.github.io/immutable-js/docs/#/List). This is an easy way to convert plain JS store data to immutable data structures before sending to the view. Unlike the "Record method" described above, you must remember to use getters to access data within these immutable objects.

Here is an example of using `fromJS` to return immutable data:

```js
// MyStore.js
import Immutable from 'immutable';

class MyStore {
  constructor() {
    this.data = {
      prop1: 1,
      prop2: 2
    };
  }

  getImmutState() {
    return Immutable.fromJS(this.getState());
  }
}

// MyComponent.js
import {Component} from 'react';
import MyStore from 'stores/MyStore';

class MyComponent extends Component {
  render() {
    var storeData = MyStore.getImmutState().get('data');
    return (
      <div>Prop1: {storeData.get('prop1')}</div>
    );
  }
}
```

## Using Immutable Data in Stores/Everywhere

You can also use Immutable's data structures in your stores or throughout your app. You just need to remember that you need to use getters to access the data in your views or wherever you are reading it.

Immutable provides many nice data structures like [`Map`](http://facebook.github.io/immutable-js/docs/#/Map), [`List`](http://facebook.github.io/immutable-js/docs/#/List), [`Set`](http://facebook.github.io/immutable-js/docs/#/Set), etc.

Here is a basic example of using immutable data structures in your stores, rather than just returning immutable data structures to the view from them.

```js
// MyStore.js
import {Map} from 'immutable';

class MyStore {
  constructor() {
    this.data = new Map({
      prop1: 1,
      prop2: 2
    });
  }

  onUpdateProp1(newProp1) {
    this.data = this.data.set(prop1: newProp1);
  }
}

// MyComponent.js
import {Component} from 'react';
import MyStore from 'stores/MyStore';

class MyComponent extends Component {
  render() {
    var storeData = MyStore.getState().get('data');
    return (
      <div>Prop1: {storeData.get('prop1')}</div>
    );
  }
}
```

## Serializing/Deserializing Immutable Data

If you are using immutable data and plan on taking advantage of alt's [snapshot](../takeSnapshot.md) and [bootstrap](../bootstrap.md) capabilities you must ensure that [serialize](../lifecycleListeners.md#serialize) and [deserialize](../lifecycleListeners.md#deserialize) handle the immutable data.

Serialize returns the data from the store to be used in a snapshot so the immutable getters will need to be used to return a plain JS object to be serialized.

Deserialize takes bootstrap data and uses it to set the state of the store. This means in order for your store to function as you initially set it up, the bootstrapped data must be converted back to immutable data structures.

Example serialize/deserialize with immutable data structures:

```js
// MyStore.js
import Immutable, {Map} from 'immutable';

class MyStore {
  constructor() {

    this.on('serialize', () => {
      return {
        data: this.data.toJS()
      };
    });

    this.on('deserialize', (data) => {
      return Immutable.fromJS({
        prop1: data.prop1,
        prop2: data.prop2
      });
    });

    this.data = new Map({
      prop1: 1,
      prop2: 2
    });
  }
}
```


text:
# Todo List

---

## **Description**

An interactive to-do list using React and Formik.

![screenshot of todo list app](assets/to-do-list.png)

---

## **How to run**

**Add listing**: Type into the bottom input field.
![typed "add to list" in input field](assets/add-to-list.png)
Press enter to add to list.
!["add to list" was added to list](assets/added-to-list.png)

**Remove listing**: Hovering over the listing will change the styling.
![hovering over a listing](assets/delete.png)
Click on listing to delete.
![listing that was hovered over was deleted](assets/deleted.png)

**Scroll through list**: The listings are contained inside the `todo-list`. You can scroll through the list within the `<div>`.
![top of the list](assets/scroll.png)
![bottom of the list](assets/scrolled.png)

---

## **Road Map**

1. Add checkboxes to show completed todos.
2. Add button to delete completed.
3. Create a local storage so that changes are kept.

---

## **Licenses**

- MIT
- Custom styling and code using HTML, CSS, JavaScript and React.

repository: IvyNozaki/Todo-List-React-Formik

repo_name: IvyNozaki/Todo-List-React-Formik


text:
# README
*forked from [omegazeng/run-mariabackup.sh](https://github.com/omegazeng/run-mariabackup) which was*
*forked from [jmfederico/run-xtrabackup.sh](https://gist.github.com/jmfederico/1495347)*

Note: tested on CentOS 7 with MariaDB 10.4

## Links

[Full Backup and Restore with Mariabackup](https://mariadb.com/kb/en/library/full-backup-and-restore-with-mariabackup/)

[Incremental Backup and Restore with Mariabackup](https://mariadb.com/kb/en/library/incremental-backup-and-restore-with-mariabackup/)

---

## Install

    yum -y install MariaDB-backup
    curl https://raw.githubusercontent.com/shunkica/run-mariabackup/master/run-mariabackup.sh --output /usr/local/sbin/run-mariabackup.sh
    chmod 700 /usr/local/sbin/run-mariabackup.sh

## Create a backup user

    GRANT PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup'@'localhost' identified by 'YourPassword';
    FLUSH PRIVILEGES;

## Usage

    MYSQL_PASSWORD=YourPassword bash run-mariabackup.sh

## Crontab

    #MySQL Backup, run every hour at the 30th minute
    30 */1 * * * MYSQL_PASSWORD=YourPassword /bin/bash /usr/local/sbin/run-mariabackup.sh

---

## Restore Example

The script for restoring data from backups is intentionally left out, but here is an example of how you might do it.

    # tree /home/mysqlbackup/
    /home/mysqlbackup/
    ├── base
    │   └── 2020-03-12_12-08-44
    │       ├── backup.stream.gz
    │       ├── xtrabackup_checkpoints
    │       └── xtrabackup_info
    └── incr
        └── 2020-03-12_12-08-44
            ├── 2020-03-12_13-24-20
            │   ├── backup.stream.gz
            │   ├── xtrabackup_checkpoints
            │   └── xtrabackup_info
            └── 2020-03-12_13-54-25
                ├── backup.stream.gz
                ├── xtrabackup_checkpoints
                └── xtrabackup_info

```bash
# decompress
cd /home/mysqlbackup/
for i in $(find . -name backup.stream.gz | grep '2020-03-12_12-08-44' | xargs dirname); \
do \
mkdir -p $i/backup; \
zcat $i/backup.stream.gz | mbstream -x -C $i/backup/; \
done

# prepare
mariabackup --prepare --target-dir base/2020-03-12_12-08-44/backup/ --user backup --password "YourPassword"
mariabackup --prepare --target-dir base/2020-03-12_12-08-44/backup/ --user backup --password "YourPassword" --incremental-dir incr/2020-03-12_12-08-44/2020-03-12_13-24-20/backup/
mariabackup --prepare --target-dir base/2020-03-12_12-08-44/backup/ --user backup --password "YourPassword" --incremental-dir incr/2020-03-12_12-08-44/2020-03-12_13-54-25/backup/

# stop mariadb
systemctl stop mariadb

# move datadir
mv /var/lib/mysql/ /var/lib/mysql_bak/

# copy-back
mariabackup --copy-back --target-dir base/2020-03-12_12-08-44/backup/ --user backup --password "YourPassword" --datadir /var/lib/mysql/

# fix privileges
chown -R mysql:mysql /var/lib/mysql/

# fix selinux context
restorecon -Rv /var/lib/mysql

# start mariadb
systemctl start mariadb

# done!
```

repository: shunkica/run-mariabackup

repo_name: shunkica/run-mariabackup


text:
# Snowflake Reference Environment

This reference environment spins up two containers:

- A jupyter notebook server
- A server to host data docs (to view navigate to http://<IP_ADDRESS>:3000/)

The jupyter notebook server contains a notebook with a quickstart for using Great Expectations with snowflake.

GX will use the `snowflake-sqlalchemy` connector to connect to Snowflake.

You can connect to the database by setting up your Snowflake connection string as an environment variable named `SNOWFLAKE_CONNECTION_STRING`:
```bash
SNOWFLAKE_CONNECTION_STRING='snowflake://<user_login_name>:<password>@<account_identifier>'
```

More information on the Connection Parameters you can use with the `sqlalchemy-snowflake` connector can be found at the [Snowflake developer guide](https://docs.snowflake.com/developer-guide/python-connector/sqlalchemy#connection-parameters
).

Please also note that the jupyter notebook will use the default ports, so please make sure you don't have anything else running on those ports, or take steps to avoid port conflicts.

The container serving the jupyter notebook will install Great Expectations with the appropriate dependencies based on the latest release, then install from the latest on the `develop` branch. To modify this e.g. install from the latest release only or from a different branch, edit `jupyter.Dockerfile`.

branch_name: refs/heads/develop


text:
Numerous resources are available on the internet to get started with android application security. This application provides an interface to assess the security knowledge you gained over time. There are multiple vulnerabilities in the application and we documented all of them in this [guide](https://rewanthtammana.com/damn-vulnerable-bank/). Take your own sweet time to explore the application and detect all the vulnerabilities.

<style>
img.resize {
  max-width:50%;
  max-height:50%;
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
}
img {
  border: 5px solid #555;
}
</style>

<img class="resize" align="center" src="https://rewanthtammana.com/damn-vulnerable-bank/images/ui.jpg" alt="Splash screen here">

## Outline

<!-- - [About Damn Vulnerable Bank](about.md) -->
<!-- - [Introduction](README.md) -->
- [Authors](authors.md)
- [Tools](tools.md)
- [Installation](installation/index.md)
    - [Bypass](installation/bypass/index.md)
        - [GPU detection](installation/bypass/gpu-detection.md)
        - [Root Detection](installation/bypass/root-detection.md)
        - [Frida detection with Ghidra](installation/bypass/frida-detection-with-ghidra.md)
- [Footprinting](footprinting/index.md)
    - [Decrypting response](footprinting/decrypt-response.md)
    - [Recreating crypto functions](footprinting/crypto.md)
- [Exploits](exploits/index.md)
    - [REST API vulnerabilities](exploits/exploit-1.md)
    - [Sensitive Information Disclosure](exploits/exploit-2.md)
    - [Exported activities](exploits/exploit-3.md)
    - [Webview via deeplink](exploits/exploit-4.md)
- [Contribute](contribution.md)
- [Additional Resources](additional-resources.md)

repository: Talakunchi/master

gha_language: Java

repo_name: Talakunchi/master


text:
# Change Log

## [0.4.3](https://github.com/lewispeckover/consulator/tree/0.4.3) (2017-04-06)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.4.2...0.4.3)

**Implemented enhancements:**

- Performance: don't walk the destination kv tree for `import` [\#4](https://github.com/lewispeckover/consulator/issues/4)

## [0.4.2](https://github.com/lewispeckover/consulator/tree/0.4.2) (2017-04-02)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.4.1...0.4.2)

## [0.4.1](https://github.com/lewispeckover/consulator/tree/0.4.1) (2017-04-01)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.4.0...0.4.1)

**Implemented enhancements:**

- Handle tar archives directly [\#3](https://github.com/lewispeckover/consulator/issues/3)

## [0.4.0](https://github.com/lewispeckover/consulator/tree/0.4.0) (2017-03-28)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.3.3...0.4.0)

**Closed issues:**

- Optional purge / delete [\#2](https://github.com/lewispeckover/consulator/issues/2)

## [0.3.3](https://github.com/lewispeckover/consulator/tree/0.3.3) (2017-03-18)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.3.2...0.3.3)

## [0.3.2](https://github.com/lewispeckover/consulator/tree/0.3.2) (2017-03-17)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.3.1...0.3.2)

## [0.3.1](https://github.com/lewispeckover/consulator/tree/0.3.1) (2017-03-17)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.3.0...0.3.1)

## [0.3.0](https://github.com/lewispeckover/consulator/tree/0.3.0) (2017-03-16)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.2.1...0.3.0)

## [0.2.1](https://github.com/lewispeckover/consulator/tree/0.2.1) (2017-02-25)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.2.0...0.2.1)

## [0.2.0](https://github.com/lewispeckover/consulator/tree/0.2.0) (2017-02-25)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.1.11...0.2.0)

**Implemented enhancements:**

- Move to subcommand-driven cli [\#1](https://github.com/lewispeckover/consulator/issues/1)

## [0.1.11](https://github.com/lewispeckover/consulator/tree/0.1.11) (2017-02-21)
[Full Changelog](https://github.com/lewispeckover/consulator/compare/0.1.10...0.1.11)

## [0.1.10](https://github.com/lewispeckover/consulator/tree/0.1.10) (2017-02-21)

\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

repository: inhuman/consulator

gha_language: Go

repo_name: inhuman/consulator


text:
# atom-memolist-new

create New simply memo on atom editor.

:satisfied: I use for vim with [glidenote/memolist.vim](https://github.com/glidenote/memolist.vim)

## Usage

* create new file `ctrl+alt+n` and enter `filename`
* cancel `ctrl+alt+n`

## Note
* :astonished: for show all memolist with: [atom-memolist](https://github.com/tgfjt/atom-memolist)
* :astonished: for grep memo with: [atom-memolist-grep](https://github.com/tgfjt/atom-memolist-grep)

## Link
for Sublime Text: [Sublime-memolist](https://github.com/tgfjt/Sublime-memolist)

## Setting

`ctrl + shift + p` and `config`

or edit `~/.atom/config.cson`

```cson
# others...
'atom-memolist':
  'memo_dir_path': '/Users/tgfjt/memo'
```

## Licence
[MIT](https://github.com/tgfjt/atom-memolist/blob/master/LICENSE.md)

repository: tgfjt/atom-memolist-new

gha_language: CoffeeScript

repo_name: tgfjt/atom-memolist-new


text:
# Hierarchical Attention Networks for Document Classification

This is an implementation of the paper [Hierarchical Attention Networks for Document Classification](https://www.cs.cmu.edu/~hovy/papers/16HLT-hierarchical-attention-networks.pdf), NAACL 2016.

![alt tag](img/model.png)

## Requirements

- Python 3
- Tensorflow > 1.0
- Pandas
- Nltk
- Tqdm
- [Glove pre-trained word embeddings](http://nlp.stanford.edu/data/glove.6B.zip)

## Data

We use the [data](http://ir.hit.edu.cn/~dytang/paper/emnlp2015/emnlp-2015-data.7z) provided by [Tang et al. 2015](http://ir.hit.edu.cn/~dytang/paper/emnlp2015/emnlp2015.pdf), including 4 datasets:

- IMDB
- Yelp 2013
- Yelp 2014
- Yelp 2015

**Note:**
The original data seems to have an [issue](https://github.com/tqtg/hierarchical-attention-networks/issues/1) with unzipping. I re-uploaded the [data](https://drive.google.com/file/d/1OQ_ggjlNUWiTg_zFXc0_OpYXpJRwJP3y) to GG Drive for better downloading speed. Please request for access permission.

## Usage

First, download the [datasets](#data) and unzip into `data` folder.

Then, run script to prepare the data *(default is using Yelp-2015 dataset)*:

```bash
python data_prepare.py
```

Train and evaluate the model:

*(make sure [Glove embeddings](#requirements) are ready before training)*
```
wget http://nlp.stanford.edu/data/glove.6B.zip
unzip glove.6B.zip
```
```bash
python train.py
```

Print training arguments:

```bash
python train.py --help
```
```
optional arguments:
  -h, --help            show this help message and exit
  --cell_dim            CELL_DIM
                        Hidden dimensions of GRU cells (default: 50)
  --att_dim             ATTENTION_DIM
                        Dimensionality of attention spaces (default: 100)
  --emb_dim             EMBEDDING_DIM
                        Dimensionality of word embedding (default: 200)
  --learning_rate       LEARNING_RATE
                        Learning rate (default: 0.0005)
  --max_grad_norm       MAX_GRAD_NORM
                        Maximum value of the global norm of the gradients for clipping (default: 5.0)
  --dropout_rate        DROPOUT_RATE
                        Probability of dropping neurons (default: 0.5)
  --num_classes         NUM_CLASSES
                        Number of classes (default: 5)
  --num_checkpoints     NUM_CHECKPOINTS
                        Number of checkpoints to store (default: 1)
  --num_epochs          NUM_EPOCHS
                        Number of training epochs (default: 20)
  --batch_size          BATCH_SIZE
                        Batch size (default: 64)
  --display_step        DISPLAY_STEP
                        Number of steps to display log into TensorBoard (default: 20)
  --allow_soft_placement ALLOW_SOFT_PLACEMENT
                        Allow device soft device placement
```

## Results

With the *Yelp-2015* dataset, after 5 epochs, we achieved:

- **69.79%** accuracy on the *dev set*
- **69.62%** accuracy on the *test set*

No systematic hyper-parameter tunning was performed. The result reported in the paper is **71.0%** for the *Yelp-2015*.

![alt tag](img/train_log.png)


text:
# KPCRotateWalkthrough

![language](https://img.shields.io/badge/Language-%20Swift%20-orange.svg)
[![CI Status](http://img.shields.io/travis/Kaihoko Kenta/KPCRotateWalkthrough.svg?style=flat)](https://travis-ci.org/Kaihoko Kenta/KPCRotateWalkthrough)
[![Version](https://img.shields.io/cocoapods/v/KPCRotateWalkthrough.svg?style=flat)](http://cocoapods.org/pods/KPCRotateWalkthrough)
[![License](https://img.shields.io/cocoapods/l/KPCRotateWalkthrough.svg?style=flat)](http://cocoapods.org/pods/KPCRotateWalkthrough)
[![Platform](https://img.shields.io/cocoapods/p/KPCRotateWalkthrough.svg?style=flat)](http://cocoapods.org/pods/KPCRotateWalkthrough)

## Usage

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

## Requirements
Swift 2.0

## Installation

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

```ruby
pod "KPCRotateWalkthrough"
```

## Get Started

First of all, import this library.
```swift
import KPCRotateWalkthrough
```

prepare two UIView Array, one is fixed view the other is rotated view.

```swift
//view which is fixed,such as text.
var fixView: [UIView] = []
//view which rotates, such as Image.
var rotationView: [UIView] = []

let wtv = WalkThroughView(frame: self.view.frame, fixView: fixView, rotationView: rotationView)
self.view.addSubview(wtv)

```

##Example

```swift
self.view.backgroundColor = UIColor(red: 1/255, green: 143/255, blue: 100/255, alpha: 1.0)

let dh: CGFloat = self.view.frame.height
let dw: CGFloat = self.view.frame.width

let rotationFrame = CGRectMake(0, dh * 0.1, dw, dh * 0.7)
//rotationView factor
let firstImage = UIImageView(frame: rotationFrame)
firstImage.contentMode = .ScaleAspectFit
firstImage.image = UIImage(named: "first")
let secondImage = UIImageView(frame: rotationFrame)
secondImage.contentMode = .ScaleAspectFit
secondImage.image = UIImage(named: "second")
let thirdImage = UIImageView(frame: rotationFrame)
thirdImage.contentMode = .ScaleAspectFit
thirdImage.image = UIImage(named: "third")
rotationView.append(firstImage)
rotationView.append(secondImage)
rotationView.append(thirdImage)

let fixFrame = CGRectMake(50, dh * 0.8, dw - 100, dh * 0.2)
//fixView factor
let firstText = UILabel(frame: fixFrame)
firstText.text = "The text of first view. \nThis text is not rotatable"
firstText.textColor = UIColor.whiteColor()
firstText.numberOfLines = 0
firstText.textAlignment = .Center
let secondText = UILabel(frame: fixFrame)
secondText.text = "The text of second view. \nSmooth rotation will contribute to user's high grade UX"
secondText.textColor = UIColor.whiteColor()
secondText.numberOfLines = 0
secondText.textAlignment = .Center
let thirdText = UILabel(frame: fixFrame)
thirdText.text = "The text of third view. \nIf you like, please star me. \nThis Library was developed for Channel on AppStore"
thirdText.textColor = UIColor.whiteColor()
thirdText.numberOfLines = 0
thirdText.textAlignment = .Center
fixView.append(firstText)
fixView.append(secondText)
fixView.append(thirdText)

//Call WalkThroughView
let wtv = WalkThroughView(frame: self.view.frame, fixView: fixView, rotationView: rotationView)
self.view.addSubview(wtv)

```

## Author

Chotchy,inc CEO(http://chotchy.net)

Kaihoko Kenta

Twitter(http://twitter.com/umipocoken)

## License

KPCRotateWalkthrough is available under the MIT license. See the LICENSE file for more info.

repository: kaihoko-kenta/KPCRotateWalkthrough

repo_name: kaihoko-kenta/KPCRotateWalkthrough


text:
# Notes_Taken_A_Very_Particular_Set_of_Skills_TT

  ## Table of Contents
  * [Description](#descrip)
  * [Installation](#install)
  * [Usage](#usage)
  * [Contributions](#contri)
  * [Tests](#tests)
  * [Contact & Qustions](#contact)
  * [License](#license)
  * [Powered By](#powered-by)

  ### Description:
      Create an app that will allow users to create and delete notes.

  ### Installation:
      Vist the website.

  ### Usage:
      To keep track of notes

  ### Contributions:
      N/A

  ### Tests
      none

  ### Contact & Qustions
  If you have any questions, suggestions or concerns, please contact me at:
  GitHub
  https://github.com/DerTodd
  email
<EMAIL_ADDRESS>

  ### License:
  [MIT](https://opensource.org/licenses/MIT)

  #### Powered By
  ![Monster](./assets/images/monster.jpg)
  ![Coke](./assets/images/coke.jpg)
  ![Alani Nu](./assets/images/alani_nu.jpg)


text:
---
title: Templating with Twig
metadata:
    description: UserFrosting uses the extremely popular Twig templating engine to facilitate clean separation between content and logic in your application.
taxonomy:
    category: docs
---

Twig is a [templating engine](http://twig.sensiolabs.org/), which is designed to help maintain a clean separation between your application's logic and its content.

If we go back to the spaghetti code example:

```php
if (isset($_POST)) {
    $stmt = $db->prepare("INSERT INTO users (:username, :email)");
    $stmt->execute([
        ':username' => $_POST['username'],
        ':email' => $_POST['email']
    ]);
} else {
    echo "<table><tr><th>Username</th><th>Email</th></tr>";

    $stmt = $db->prepare("SELECT * FROM users");
    $stmt->execute();

    while ($r = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo "<tr><td>$r['user_name']</td><td>$r['email']</td></tr>";
    }

    echo "</table>"
}
```

You'll notice that the HTML we generate is heavily intermingled with PHP code.  Wouldn't it be easier to read and maintain if we could separate the two?  If we used Twig, we could factor all of our HTML out into a **template** file:

**user-table.html.twig**

```html
<table>
    <tr>
        <th>Username</th>
        <th>Email</th>
    </tr>

    {% for user in users %}
        <tr>
            <td>{{user.user_name}}</td>
            <td>{{user.email}}</td>
        </tr>
    {% endfor %}
</table>
```

Notice the `{{ mustache }}` syntax, which tells Twig where to substitute dynamic content into the template.  Our PHP code can now **render** this template, passing in any required dynamic content:

```php
if (isset($_POST)) {
    $stmt = $db->prepare("INSERT INTO users (:username, :email)");
    $stmt->execute([
        ':username' => $_POST['username'],
        ':email' => $_POST['email']
    ]);
} else {
    $stmt = $db->prepare("SELECT * FROM users");
    $stmt->execute();

    $users = $stmt->fetchAll(PDO::FETCH_ASSOC);

    // Assume that $twig is an instance of the Twig view object
    echo $twig->render('user-table.html.twig', [
        'users' => $users
    ]);
}
```

So, what did this get us?  Well in this example, not _that_ much.  We don't have our HTML littered with PHP syntax anymore, like `echo` and `;`, though we still need some logic in our template to loop through the array of `users` and render each row in our table.  We could conceivably pass off our Twig template to our web designer friend, who knows HTML and CSS but isn't familiar with PHP, and he could get to work styling the page.

Our PHP code also looks better, because it's no longer full of calls to `echo` and mixed with scraps of HTML.  Overall, it's a solid improvement.  The _real_ power of Twig, however, comes from its more advanced features:

- Using `include` and `extend`, we can reuse HTML components like headers and footers on multiple pages, and develop "child pages" that build off a common base template;
- Twig, unless directed otherwise, will automatically escape dynamic content.  This protects your pages from [XSS vulnerabilities](https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)).
- Template files can be completely overridden, so you can modify page content in your Sprinkle without touching the UserFrosting core.

We'll explain these features more as we discuss how Twig is used in UserFrosting.

## Sprinkle templates

Any Sprinkle that works with Twig templates will contain a `templates/` directory.  By convention, this directory is structured as follows:

```
templates/
├── components/
├── layouts/
├── mail/
└── pages/
```

By replicating this structure in your own Sprinkle, it is possible to completely override a core template with your own.  When a template is rendered, Twig will search for the specified path relative to the most recently loaded Sprinkle, falling back to previously loaded Sprinkles until it finds a match.

### components/

The `components/` directory contains partial HTML and Javascript templates, such as forms, tables, navigation bars, and other commonly reused components.

Templates in `components/` are typically used via Twig's [`include` tag](http://twig.sensiolabs.org/doc/2.x/tags/include.html).  Suppose, for example, we have a page template:

```twig
<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="utf-8">
        <meta name="generator" content="UserFrosting" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="description" content="{% block page_description %}This page has not yet been configured.{% endblock %}">
        <meta name="author" content="{% block page_author %}{{ site.author }}{% endblock %}">

        <title>{{ site.title }} | {% block page_title %}New Page{% endblock %}</title>

        {% include "components/favicons.html.twig" %}

        ...
```

The last line `{% include "components/favicons.html.twig" %}` tells Twig to insert the contents of the `components/favicons.html.twig` template.  Additional parameters can be passed to `include`, which will override any variables of the same name that were passed to the main template:

```twig
<div class="box-body">
    {% include "components/tables/users.html.twig" with {
            "table" : {
                "id" : "table-users",
                "columns" : ["last_activity"]
            }
        }
    %}
</div>
```

This sets custom values for the `table` variable used in `components/tables/users.html.twig`.

In some Sprinkles, the `components/` directory is further divided into directories containing common types of components.  For example, the `admin/` Sprinkle contains subdirectories for `forms/`, `modals/`, and `tables/`.

### layouts/

One particularly powerful feature of Twig is the ability to **extend** templates.  The concept is similar to class inheritance in object-oriented programming.  We can define a **base template**, and then override parts of the base template in a **child template**.  Thus, we can have many child templates that inherit from the same base template.  If we want to modify some common feature in all of those pages, all we need to do is modify the base template.

UserFrosting's base templates are generally kept in the `layouts/` directory.  Every UserFrosting page inherits from the base layout template `layouts/basic.html.twig`, found in the `core` Sprinkle.  The main purpose of this template is to define the basic structure of an HTML page.  Let's take a look:

```twig
{# basic.html.twig: This is the base layout template for all pages.  #}

{% block page %}
<!DOCTYPE html>
<html lang="en-US">
    {% block head %}
        <head>
            <!-- The 'X-UA-Compatible' tag must be first, otherwise IE will not respect it.  See http://stackoverflow.com/questions/25557299/internet-explorer-11-disable-display-intranet-sites-in-compatibility-view-via -->
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta charset="utf-8">
            <meta name="generator" content="UserFrosting" />
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
            <meta name="description" content="{% block page_description %}This page has not yet been configured.{% endblock %}">
            <meta name="author" content="{% block page_author %}{{ site.author }}{% endblock %}">

            <title>{{ site.title }} | {% block page_title %}New Page{% endblock %}</title>

            {% include "components/favicons.html.twig" %}

            {# Use this block to add extra content in page head without having to override the entire base layout #}
            {% block head_extra %}{% endblock %}

            {% block stylesheets %}
                {# Override this block in a child layout template or page template to override site-level stylesheets. #}
                {% block stylesheets_site %}
                    <!-- Include main CSS asset bundle -->
                    {{ assets.css() | raw }}
                {% endblock %}

                {# Override this block in a child layout template or page template to specify or override stylesheets for groups of similar pages. #}
                {% block stylesheets_page_group %}
                {% endblock %}

                {# Override this block in a child layout template or page template to specify or override page-level stylesheets. #}
                {% block stylesheets_page %}
                {% endblock %}
            {% endblock %}

            {# Site author link #}
            {% if site.uri.author %}
                <link href="{% block page_author_link %}{{ site.uri.author }}{% endblock %}" rel="author" />
            {% endif %}

            {# Site publisher link #}
            {% if site.uri.publisher %}
                <link href="{% block page_publisher_link %}{{ site.uri.publisher }}{% endblock %}" rel="publisher" />
            {% endif %}

            {# Canonical page link #}
            {% if block('page_canonical') %}
                <link href="{{site.uri.base.scheme}}://{% block page_canonical %}{% endblock %}" rel="canonical" />
            {% endif %}

            <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
            <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
            <!--[if lt IE 9]>
                <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
                <script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
            <![endif]-->

            {% include "components/analytics.html.twig" %}
        </head>
    {% endblock %}

    {% block body %}
        <body {% block body_attributes %}{% endblock %}>
            <!-- Page Content -->
            {% block content %}{% endblock %}

            <!-- Javascript configuration -->
            <script>
            {% include "components/config.js.twig" %}
            </script>

            {% block scripts %}
                {# Override this block in a child layout template or page template to override site-level scripts. #}
                {% block scripts_site %}
                    <!-- Load jQuery -->
                    <script src="//code.jquery.com/jquery-2.2.4.min.js" ></script>
                    <!-- Fallback if CDN is unavailable -->
                    <script>window.jQuery || document.write('<script src="{{ assets.url('assets://vendor/jquery/dist/jquery.min.js', true) }}"><\/script>')</script>

                    {{ assets.js() | raw }}
                {% endblock %}

                {# Override this block in a child layout template or page template to specify or override scripts for groups of similar pages. #}
                {% block scripts_page_group %}
                {% endblock %}

                {# Override this block in a child layout template or page template to specify or override page-level scripts. #}
                {% block scripts_page %}
                {% endblock %}

                {# Override this block to alter UfAlerts. #}
                {% block scripts_UFAlert %}
                    <script>
                        $("#alerts-main").ufAlerts();
                        $("#alerts-main").ufAlerts('fetch').ufAlerts('render');
                    </script>
                {% endblock %}
            {% endblock %}

        </body>
    {% endblock %}
</html>
{% endblock %}
```

You'll notice that this template is composed almost entirely of `block` blocks.  The [`block` tag](http://twig.sensiolabs.org/doc/2.x/tags/extends.html) allows us to define named blocks of code that can be overridden in our child templates.  In many cases, these blocks are completely empty in our base template, and serve mainly as a way to define placeholders that we can fill in with content in our child templates.

To define a child template, we use the [`extends` tag](http://twig.sensiolabs.org/doc/tags/extends.html) at the top of a new file, and then define the blocks we wish to override:

```twig
{# This is a child template, which inherits from basic.html.twig. #}

{% extends "layouts/basic.html.twig" %}

{% block content %}
    Hello World!
{% endblock %}
```

When we render this template, Twig will use `basic.html.twig`, but then replace any instances of the `content` block with the contents of the `content` block we've defined in the child template.

>>> Like with OOP, child templates can themselves be extended, creating a hierarchy of template inheritance.  For example, in the `core` sprinkle, `layouts/default.html.twig` extends `layouts/basic.html.twig`, and `pages/index.html.twig` extends `layouts/default.html.twig`.

### mail/

`mail/` contains email templates - see [Chapter 11](/mail) for more information.

### pages/

You can think of the `layouts/` directory as a place to put your "abstract" templates - templates that are meant to be extended by other templates rather than being used directly.  `pages/` on the other hand, contains the concrete templates that correspond to specific pages in your application.  For example, the main content template for `http://owlfancy.com/supplies/preening` might be located at `pages/supplies/preening.html.twig`.

repository: kerel-fs/learn

repo_name: kerel-fs/learn


text:
---
title: "Clean Code"
layout: post
date: 2016-04-03 22:48
image: /assets/images/markdown.jpg
headerImage: false
tag:
- Books
category: blog
author: andrewpierce
description: My Thoughts on the book Clean Code
# jemoji: '<img class="emoji" title=":ramen:" alt=":ramen:" src="https://assets.github.com/images/icons/emoji/unicode/1f35c.png" height="20" width="20" align="absmiddle">'
---

I just finished reading Clean Code, by Uncle Bob. Lately I've been really trying to
write _better_ code. I feel really confident that in most cases, I can figure out
some kind of working solution to whatever problem I'm asked to solve. The counterpoint
to that though, is I certainly can't make the claim that I can find solutions that
are either efficient or generally good readable code.

Reading Clean Code was a really great way to get some great, actionable, techniques
for writing better and cleaner code. I felt like one of my major barriers to writing
better code before, was that I just didn't really know what clean code looked like.
When I say that, I mean that while I was able to recognize that what I was writing
_wasn't_ clean, I wasn't exactly able to put my finger on what exactly was dirty about
it or how it had become that way.

Some things really stuck out to me that I've really tried to keep in mind while I'm
writing new code at work.

*Variable names.* One thing that Uncle Bob mentions that made a lot of sense is that
as developers, we're the authors of our code. With that idea, we should think of
ourselves as authors when we write code, and strive to make as easy an experience as
possible for those people reading our code. With descriptive names, people don't have
to guess what a variable contains or hunt down clues to what 'a' or 'obj' actually
contain.

*Smaller functions.* Uncle Bob says that every function should act on one layer of
abstraction. This makes a lot of sense. You should have high level functions, like a
main gameplay loop for example, that calls things like move_player() or fire_shot() or
whatever else your game is going to do. Then you'll have functions that are much
lower level, that might do things like directly change the coordinate values of your
player or missile. Doing it all in the same function gets pretty confusing pretty fast.

These lower level functions tend to also be code thats repeated more often, so its
pretty nice to have it wrapped up in a nice helper function.

*Clean out commented code.* This one comes up a lot at my current work place and now
that I've seen it, it drives me crazy to find commented out code still hanging out.
The reason for this makes a lot of sense, code that's commented out isn't being maintained.
Everyone is scared to delete it because they're not sure what it was supposed to do,
but thats the thing, it doesn't _do_ anything! It just confuses us and clutters up
our working space. He makes a good point that if you really need it, Git remembers.

*Formatting.* This one comes a little easier when you have small functions and aren't
hanging on to commented out code, but having nice formatting does make your code much
easier on the eyes. Python was the first language I learned, and I'm continually grateful
for it. Whitespace matters in Python and its given me a pretty good base for decent formatting.


text:
# mailSendNotification

## Description

Sends notifications to all potential culprits of a current or previous build failure and to fixed list of recipients.
It will attach the current build log to the email.

Notifications are sent in following cases:

* current build failed or is unstable
* current build is successful and previous build failed or was unstable

## Prerequsites

none

## Example

Usage of pipeline step:

```groovy
mailSendNotification script: this
```

## Parameters

| name | mandatory | default | possible values |
|------|-----------|---------|-----------------|
| `buildResult` | no |  |  |
| `gitCommitId` | no |  |  |
| `gitSshKeyCredentialsId` | no | `` | Jenkins credentials id |
| `gitUrl` | no |  |  |
| `notificationAttachment` | no | `true` | `true`, `false` |
| `notificationRecipients` | no |  |  |
| `notifyCulprits` | no | `true` | `true`, `false` |
| `numLogLinesInBody` | no | `100` |  |
| `projectName` | no |  |  |
| `script` | yes |  |  |
| `wrapInNode` | no | `false` | `true`, `false` |

* `buildResult` - Set the build result used to determine the mail template. default `currentBuild.result`
* `gitCommitId` - Only if `notifyCulprits` is set: Defines a dedicated git commitId for culprit retrieval. default `commonPipelineEnvironment.getGitCommitId()`
* `gitSshKeyCredentialsId` - Only if `notifyCulprits` is set: Credentials if the repository is protected.
* `gitUrl` - Only if `notifyCulprits` is set: Repository url used to retrieve culprit information. default `commonPipelineEnvironment.getGitSshUrl()`
* `notificationAttachment` - defines if the console log file should be attached to the notification mail.
* `notificationRecipients` - A space-separated list of recipients that always get the notification.
* `notifyCulprits` - Notify all committers since the last successful build.
* `numLogLinesInBody` - Number of log line which are included in the email body.
* `projectName` - The project name used in the email subject. default `currentBuild.fullProjectName`
* `script` - The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the `this` parameter, as in `script: this`. This allows the function to access the `commonPipelineEnvironment` for retrieving, e.g. configuration parameters.
* `wrapInNode` - Needs to be set to `true` if step is used outside of a node context, e.g. post actions in a declarative pipeline script. default `false`

## Step configuration

We recommend to define values of step parameters via [config.yml file](../configuration.md).

In following sections of the config.yml the configuration is possible:

| parameter | general | step/stage |
|-----------|---------|------------|
| `buildResult` |  | X |
| `gitCommitId` |  | X |
| `gitSshKeyCredentialsId` | X | X |
| `gitUrl` |  | X |
| `notificationAttachment` |  | X |
| `notificationRecipients` |  | X |
| `notifyCulprits` |  | X |
| `numLogLinesInBody` |  | X |
| `projectName` |  | X |
| `script` |  |  |
| `wrapInNode` |  | X |

## Dependencies

The step depends on the following Jenkins plugins

* [email-ext](https://plugins.jenkins.io/email-ext)
* [pipeline-utility-steps](https://plugins.jenkins.io/pipeline-utility-steps)
* [ssh-agent](https://plugins.jenkins.io/ssh-agent)
* [workflow-basic-steps](https://plugins.jenkins.io/workflow-basic-steps)
* [workflow-cps-global-lib](https://plugins.jenkins.io/workflow-cps-global-lib)
* [workflow-durable-task-step](https://plugins.jenkins.io/workflow-durable-task-step)

Transitive dependencies are omitted.

The list might be incomplete.

Consider using the [ppiper/jenkins-master](https://cloud.docker.com/u/ppiper/repository/docker/ppiper/jenkins-master)
docker image. This images comes with preinstalled plugins.

## Side effects

none

## Exceptions

none

repository: bertpersyn/jenkins-library

repo_name: bertpersyn/jenkins-library


text:
# disktools
Extensions to basic disk tools like du, df, etc, but written in python.

## Installation

> pip install disktools

## Disk Usage (Cached)

*duc* is a python-based rewrite of *du*. It is relatively fast compared to its naive LLVM (numba optimized version). The main performance gain comes from using cache. Here is an example:

The output of

```bash
duc /foo/bar
```

is equivalent to the output of

```bash
du -sb /foo/bar
```

The difference would be, that *duc* creates cache stock called **.duc** in each folder as it traverses over the file system tree, hosting all previous results for all the subfolders if there are any.

The minor caveat of such approach is that creating the **.duc** entry screws the *last modification* timestamp of the containing folder. But over time this is not important, since it happens only once. Newly cache updates do not affect the containing folder anymore.

The idea of such caching design vs. global filesystem entry is to enable long term monitoring of any chosen sub path of your data. It has been tested to perform on XFS filesystems with volumes over 100TB and over 10 millions of files.

Any improvements and issue reports are welcomed.

---

You might also want to check out [findtools](https://github.com/ewiger/findtools)

repository: ewiger/disktools

repo_name: ewiger/disktools


text:
# Imperative Array Handling

In this lesson you will use your basic JavaScript skills to iterate an Array using a `for` loop to come up with the answer.

## Exercises

1. [Problem](problem1.js) - [Solution](solution1.js)