text:
---
published: true
layout: post
title: Newsletters Newsletters Newsletters. Oh My!
---

So here is my curated list of (mostly) curated newsletters. I've enjoyed all of these, and if you're subscribed to [Hacker Newsletter](http://hackernewsletter.com) I think you'll find many of these useful as well. I will update this list as I discover others.

## Favorites
* [Now I Know](http://nowiknow.com) is one I've mentioned several times before. Dan Lewis does an awesome job of coming up with interesting content every single day. If you're not one of the 100,000+ people already subscribed, you should check it out.
* Dave Pell's [NextDraft](http://nextdraft.com) seems to be a favorite for many. He covers a range of topics every weekday, and does so with enough humor to make news actually fun to read.
* [Practicing Ruby](https://practicingruby.com) is a paid newsletter, so that makes it different than all the others listed here. However, if you do anything Ruby related I don't think this one is even optional - it is that good. It would be great to see this much passion poured into other topics. Check out an [article](https://practicingruby.com/articles/improving-legacy-systems?u=8d98bee1e9) to see what I mean.
* Each day, a random subscriber from [The List Serve](http://thelistserve.com/) is allowed to send out whatever they want to the 25k subscribers. To answer what you'r e thinking - yes, it provides for some crazy talk, but the great reads easy make up for it. I love ideas like this!
* [Links I Love](http://www.legalnomads.com/2012/03/links-i-loved.html) is a monthly newsletter that you'll wish was weekly. You can sign-up [here](http://forms.aweber.com/form/71/876507671.htm). Jodi does a great job curating articles that you won't find elsewhere.
* [Uncommon](https://uncommon.cc/story) asks when was the last time you stopped amidst a sea of 'likes'? It is something totally different and one that I think you'll enjoy.
* Scott Hanselman's [Newsletter of Wonderful Things](http://www.hanselman.com/newsletter/), which is like Hacker Newsletter minus Hacker News.
* [Brain Pickings](http://www.brainpickings.org/index.php/newsletter/) is probably one of the better known curated newsletters. Like 'Now I Know', you're always going to learn something new each week with this one.
* [Longreads](http://longreads.com/) - five great looooooooooong reads every week. A great and simple design make is even better (and gives you more time to read them).

## Non-tech News
* [Muck Rack Daily](http://muckrack.com/daily/email)
* [The Brief](http://thebrief.io/)

## Startup
* [Term Sheet](http://ebm.cheetahmail.com/r/regf2?a=0&aid=2087267012&n=1) - probably one of the ugliest sign-up forms ever, but Dan Primack of Fortune does a great job covering all the VC, IPO, and exit deals going on.
* [Launch](http://launch.co/)
* [Startup Textbook](http://www.startuptextbook.com/newsletter/)
* [Startup Digest](http://startupdigest.com)
* [Startup Reading List Startup Digest](https://www.startupdigest.com/digests/startup) (okay, that is a tongue twister)
* [Founder Weekly](founderweekly.com)
* [Startup Frontier](startupfrontier.com)
* [Startup Edition](http://startupedition.com/)
* [Biz Dev Newsletter](http://bdnewsletter.com/signup/)

## Mobile
* [Android Weekly](http://androidweekly.net/)
* [iOS Dev Weekly](http://iosdevweekly.com/)
* [Blackberry Weekly](/images/nooo.gif)

## Programming / General Technology
* [Devops Weekly](http://devopsweekly.com/)
* [Status Code](http://statuscode.org)
* [Hacker Talks](http://www.hackertalks.io/)
* [Coder Weekly](http://www.coderweekly.com/)
* [Software Lead Weekly](http://softwareleadweekly.com/)
* [3d Printing Letter](http://3dprintingletter.com/)
* [Security Letter](http://secletter.com/)
* [Co-working Weekly](http://coworkingweekly.com/)

## Programming Digests

The weekly digest format for various programming languages and technologies has been hot. It seems like every week there is a new one, so this probably only covers the more popular ones. These are great resources to stay on top of a particular topic through curated experts. I have some favorites here, but sorted alphabetically since there are so many!

* [(def newsletter)](http://defnewsletter.com/) (Clojure)
* [Dart Weekly](http://dartweekly.com)
* [Django Weekly](http://djangoweek.ly/)
* [Ember Weekly](http://emberweekly.com/)
* [Golang Weekly](http://eepurl.com/DzXI5)
* [JavaScript Weekly](http://javascriptweekly.com)
* [Mac Dev Weekly](http://macdevweekly.com/)
* [NoSQL Weekly](http://www.nosqlweekly.com/)
* [PHP Weekly](http://www.phpweekly.com)
* [Perl Weekly](http://perlweekly.com)
* [Postgres Weekly](http://postgresweekly.com)
* [Pycoder’s Weekly](http://pycoders.com)
* [Python Weekly](http://pythonweekly.com)
* [Ruby Weekly](http://rubyweekly.com)
* [ng-newsletter](http://www.ng-newsletter.com/) (AngularJS)
* [wpMail](http://wpmail.me/) (WordPress)

## Design & UX
* [Web Design Weekly](http://web-design-weekly.com)
* [Sidebar](http://sidebar.io/)
* [Good Experience](http://www.goodexperience.com/)
* [GoodUI Newsletter](http://goodui.us6.list-manage.com/subscribe?u=ad9057edac5b98ad4892b6a6f&id=43263e0814)
* [CSS Weekly](http://css-weekly.com)
* [UX Weekly](http://www.uxwkly.com/)

## Courses
* [Coding for Interviews](http://codingforinterviews.com)
* [A Drip of JavaScript](http://designpepper.com/a-drip-of-javascript)
* [Machine Learning](http://daoudclarke.github.io/machine-learning-practice.html)

## Company Related
The following are pushing their products and/or content more, but are done very well. If you have a company and your newsletter is "me, me, me", learn from these.

* Patrick McKenzie (better known as patio11 on Hacker News) puts out some great ideas and training via his [newsletter](https://training.kalzumeus.com/)
* [Photojojo's](http://photojojo.com/subscribe/) newsletter is simply a fun email to read.
* [Incoming Transmission](http://37signals.com/incoming-transmission) by 37signals
* [The Do Lectures](http://thedolectures.us1.list-manage.com/subscribe?u=c4eaa02d05979c3317681c1e7&id=dda53c16d1) - great format.
* Did you know Ted has a newsletter? You'll find it in the bottom right corner of [Ted.com](http://www.ted.com/). A great example of a way to present new and old content to subscribers.
* [Newfangled](http://www.newfangled.com/web_marketing_strategy_newsletter_for_ad_agencies) puts out a great monthly newsletter.
* The [MailChimp UX Team](http://mailchimp.us5.list-manage1.com/subscribe?u=7e093c5cf4&id=ef8cc474cd) newsletter is an awesome example of the type of content a company can share outside their walls.

## Fun
* [Gaping Void](http://us1.campaign-archive2.com/?u=028de8672d5f9a229f15e9edf&id=849df15a35)
* [Cup of Zup](http://cupofzup.com/)

## Other

I haven't subscribed to these, but each was recommended by two or more readers and they all look interesting. Have any others I should know about? Let me know!

* [Ken Jennings’ Tuesday Trivia](http://ken-jennings.com/blog/) - the sign-up form is on the left.
* [Delancey Place](http://delanceyplace.com)
* [Latest Documentaries](http://latestdocumentaries.com/newsletter/)
* [NTK](http://www.ntk.net/) - a replay of the [Need To Know](http://en.wikipedia.org/wiki/Need_To_Know_(newsletter)) newsletter from Danny O'Brien.
* [Word of the Day](http://wordsmith.org/awad/subscribe.html) - I think this is one of the original newsletters and I believe it has 1+ million subscribers.


text:
wo-markdown-blog
====

Render Markdown files as web pages.

Start
----

+ Fork [this project](https://github.com/LearnShare/wo-markdown-pages), or `npm install wo-markdown-blog`;
+ `npm install` and `bower install`.

Write
----

+ Put all article markdown files in dir 'src/articles/';
+ 'src/articles/readme.md' will show as main page(index).

Release
----

+ Run `gulp`;
+ The site will release to '_dist/'.

+ Run `node build.js` or `iojs build.js` (should after `gulp`);
+ The static pages build to '_build/'.

Dev
----

+ angular.js
+ markdown-it
+ highlight.js
+ less
+ gulp

license: MIT

repository: LearnShare/wo-markdown-pages

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: LearnShare/wo-markdown-pages


text:
# Open Search for Magento

A very simple module that creates an open search endpoint that returns the correct XML format for [Open Search](http://www.opensearch.org/Home)

## Install

Just drag and drop the app folder into your base Magento folder :smile:

Nothing else from their needs to be done!

:heart:

_Note: I am a newbie at Magento!_

repository: iamphill/magento-opensearch

repo_name: iamphill/magento-opensearch


text:
# APINIT

APINIT is a setup of an apiREST using nodeJS with a mongo database and Docker.

There is a simple model of user implemented with these methods (GET/POST/PUT/DELETE), and an authentification service using JWT.

## Installation

Use [curl](https://curl.haxx.se/) to install [Docker Compose](https://docs.docker.com/compose/install/#install-compose).

```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```
Then apply executable permissions to the binary:

```bash
sudo chmod +x /usr/local/bin/docker-compose
```

## Usage

To start the container
```bash
sudo docker-compose up --build
```
Does not forget to create a '.env' file with :
```bash
SECRET = "your secret"
```

## AUTHENTIFICATION

Mind always to use the __"user"__ object into your request

* __POST__: localhost:8080/auth/login

```json
{
	"user": {
		"username": "sankamille",
		"password": "password123"
	}
}
```

* __PUT__: localhost:8080/auth/register

```json
{
	"user": {
		"username": "sankamille",
		"password": "password123"
	}
}
```

## API CALLS

Mind always to use the __"user"__ object into your request

* __GET__: localhost:8080/api/user + [Bearer auth]

```json
nothing to send
```

* __PUT__: localhost:8080/api/user + [Bearer auth]

```json
{
	"user": {
		"username": "sankamille",
		"password": "password123"
	}
}
```

* __POST__: localhost:8080/api/user + [Bearer auth]

```json
{
	"user": {
		"_id": "5bf6499c3d5ce90012a9722c"
	}
}
```

* __DELETE__: localhost:8080/api/user + [Bearer auth]

```json
{
	"user": {
		"_id": "5bf6499c3d5ce90012a9722c"
	}
}
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

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

repository: lbrulet/APINIT

gha_language: JavaScript

gha_license_id: MIT

repo_name: lbrulet/APINIT


text:
# DEFFUN

**Created At:** 8/16/2017 2:31:45 PM
**Updated At:** 1/5/2018 12:45:17 AM
**Original Doc:** [267423-deffun](https://docs.jbase.com/36868-jbase-basic/267423-deffun)
**Original ID:** 267423
**Internal:** No

## Description

This statement is used to declare an external jBASE BASIC function to the jBASE BASIC compiler and optionally define its arguments. The statement is used in the program that calls the function. It takes the general form:

```
DEFFUN FuncName({ {MAT} Argument1, {MAT} Argument2...})
```

Where

- **FuncName**, is the name used to define the function. It must be the same as the source file name.
- **Argument**, specifies a value passed to the function by the calling program. To pass an array, you must use the MAT before the argument name. These parameters are optional (as indicated in the Command Syntax) but can be specified for clarity. Note that if the arguments are not initialized somewhere in the program you will receive a compiler warning.

## Note

> The **DEFFUN** statement identifies a user-written function to the jBASE BASIC compiler, which must be present in each program that calls the function, before the function is called. A hidden argument is passed to the function so that a value can be returned to the calling program. The return value is set in the function using the RETURN (value) statement. If the [RETURN](./../return) statement specifies no value then the function returns an empty string.

An example of use is as follows:

- Main program:

```
DEFFUN Add()

A = 10
B = 20

sum = Add(A, B)

CRT sum

X = RND(42)
Y = RND(24)

CRT Add(X, Y)
```

- Function:

```
FUNCTION Add(operand1, operand2)
    result = operand1 + operand2
RETURN(result)
```

Go back to [jBASE BASIC](./../jbase-basic-programmers-reference-guide).

repository: CBarouch/docs

repo_name: CBarouch/docs


text:
---
layout: default
title: Styles of writing code
---

## Styles of writing code

[![](img/smacss.png)](https://smacss.com/) [![](img/bem.png)](https://en.bem.info/) [![](img/maintainablecss.png)](http://maintainablecss.com/)

When writing code, it can be helpful to have an agreed upon style. Where do spaces go, and how many? Do you line break after the bracket or before it? Having a code style guide means it's easier to work as a team, and with future you.

For CSS, the big ones are [SMACSS](https://smacss.com/) (Scalable and Modular Architecture for CSS); [OOCSS](http://oocss.org/) (Object-Oriented CSS); [BEM](https://en.bem.info/) (Block Element Modifier). Each is a different take on how to write classes and organise your CSS. There's no right or wrong way: only the way that makes sense to you and your team. Along similar lines there's also [Maintainable CSS](http://maintainablecss.com/).

For JavaScript, there are two main things to do: run [JS Hint](http://jshint.com/) to detect errors and potential problems; run [JSCS](http://jscs.info/) to enforce a style guide.

## Preprocessors

[![](img/sass.png)](http://sass-lang.com/) [![](img/less.png)](http://lesscss.org/) [![](img/stylus.png)](http://stylus-lang.com/)

There are a couple of well-known preprocessors: [Sass](http://sass-lang.com/), [Less](http://lesscss.org/), and [Stylus](http://stylus-lang.com/).

They all have similar features, but Sass seems to be one of the most widely adopted. You don't have to use a preprocessor, but there are a couple of features that might make it worthwhile.

**Variables** are handy, **Nesting** selectors makes for much better readability (but don't nest too deeply), better use of **Media Queries** (write them inside a selector, rather than in big blocks by themselves). **Partials** let you write your CSS in a modular way, but compile them into one file at the end. You can also set an option to minify the final file.

---

Next: [frameworks](./frameworks.html) Boilerplates and helpers.

repository: codex-academy/Front-end-Frameworks

branch_name: refs/heads/gh-pages

gha_language: HTML

repo_name: codex-academy/Front-end-Frameworks


text:
# Week 9: Classical Content Analysis

1. text as proxy for experience
2. free flowing text
3. analysis of: codes
4. confirmatory
5. content analysis & content dictionaries

- begins with theory,
- generates a set of specific, testable hypotheses,
- and test those hypotheses against the data

### Typical process of content analysis

- conceptualization to operationalization

#### content analysis begins with (ideal workflow)

- a theoretical rational derived from the literature or the investigator’s previous work.
- first task is to identify the important constructs involved in that theory
- develop ways to measure those constructs in text.

### sampling

- Sampling in content analysis is a two-step process.
- first step is the identification of the corpus of texts. If a small number of texts is collected (e.g., 40 life histories), then all can be analyzed. When hundreds or even thousands of texts are involved, a representative sample of records is required.
- In that case, the standard in classical content analysis is to draw a probability sample to represent the larger corpus of text to which you want to generalize.

#### sampling segmenting

- designed to identify the basic, nonoverlapping units of analysis within the texts.
- units may be the entire texts (books, interviews, responses to an open-ended survey question) or segments (words, word-senses, sentences, themes, paragraphs).
- Where the object is to compare across texts—to see whether or not certain themes occur—the whole text (representing an informant or an organization) is the appropriate unit of analysis.
- When the object is to compare the number of times a theme occurs across a set of texts, then a “context unit”—a chunk of text that reflects a theme—is likely to be the appropriate unit of analysis.

### Coding

- codes are typically developed from definitions given in the literature.
- In exploratory content analysis, inductive coding (open coding in grounded theory terms) is appropriate
- after an initial period of scrutinizing key resources (academic publications, the dataset itself, or both), researchers must make some tough decisions to define each code:
- What are the inclusion and exclusion criteria for this code?
- Is a particular instance of meaning “in” or “out”?
- What values can the code take?

#### steps

1. sample
2. pretest coding scheme
3. assign to two independent coders
4. measure reliability (reliability must be assessed for every code)
5. test for differences

### Sampling

- sampling frame
- systematic random sample

#### simple random sample

- A simple random sample is where you have a list of cases and you use a computer or random number table to pick a probability sample.
- There’s an important sampling problem here. A lot of researchers who do content analyses with periodicals avoid simple random samples, because there’s a high possibility that you could miss an entire issue or volume just by random sampling error.

#### systematic random sample

- Creating a systematic sample is rather easy. The researcher must first decide how many people out of the total population to include in the sample, keeping in mind that the larger the sample size, the more accurate, valid, and applicable the results will be. Then, the researcher will decide what the interval for sampling is, which will be the standard distance between each sampled element. This should be decided by dividing the total population by the desired sample size. In the example given above, the sampling interval is 10 because it is the result of dividing 10,000 (the total population) by 1,000 (the desired sample size). Finally, the researcher chooses an element from the list that falls below the interval, which in this case would be one of the first 10 elements within the sample, and then proceeds to select every tenth element.

## Live Session

- confirmatory
- the most extreme of text analysis approach in terms of orthodox implementation
- may be uncomfortable with people doing exploratory research
- goals of deductive/confirmatory text analysis are to test hypotheses or strengthen already existing models
- research must be within theory making space in already existing literature
- have some sense about key concepts and
- research question that posits relationship between concepts
- testing hypotheses
- asking question of comparison
- suitable approach for comparison, testing hypotheses
- understand terrain of exploratory and confirmatory; therefore you are able better understand which methods are most appropriate

with content analysis:

- suitable for cookie cutter approach; i.e. deductive coding
- ..
- with regard to transparency and scholarship it is important to share codes
- coding segments -> coding itself -> ..

segmentation:

- with transcripts or textual data;
- why do we need to segment data? word, sentence, paragraph
- to segment is to delineate unit
- yes, literature and theory can guide towards meaning,
- how do different types of data need to be segmented
- for example, segment focus group data by speaker; although problematic because may not be meaningful segmentation in context
- online survey and text box? depends on the question
- field notes? in time units,
- unstructured interview? by sentence? justifiable to talk about concept at level of interview
- line by line coding
- in vivo

grounded theory: does not support, structured valid and reliable comparisons within cross groups, instead supports ..

for example, policy is heavily structured:

codebook: maximum of up to 60 codes

in content comparison, why important for interrelate reliability:

- validation
- establish reliability
- do different people look at the codes and apply them in the same way
- fidelity
- coders must have similar understanding of the context, question, hypotheses, insider knowledge,

thought experiment, direct comparisons between groups:

- we are studying high income and low income, what is poverty?
- high income says poverty is "low social status"
- low income says poverty is "managing bureaucracy of poverty"
- it's possible that you will find non-meaningful comparison because codes aren't well defined leading to a giant mess because neither group is talking about the same thing

repository: renedarioherrera/ASU

repo_name: renedarioherrera/ASU


text:
---
title: "What's in JCIM (#1, Vol. 61 (6))"
collection: blogposts
permalink: /blog/2021-07-03-JCIM
excerpt: "An overall review of some papers from the most recent JCIM issue (published on 28.06.2021). In this post: quantum machine learning for drug design, thorough docking score assessment, druggable sites detection, and more!"
date: 2021-07-03
read_time: true
---

Hello! Recently, there was [a new JCIM release](https://pubs.acs.org/toc/jcisd8/current) (volume 61, issue 6). I like this journal a lot, and, as always, there are some articles that interested me the most. In this short post, I'd like to share the short summaries of these articles with you, and invite you to read/discuss them. My list doesn't have any particular order for the articles.

![](https://pubs.acs.org/na101/home/literatum/publisher/achs/journals/content/jcisd8/2021/jcisd8.2021.61.issue-6/jcisd8.2021.61.issue-6/20210628/jcisd8.2021.61.issue-6.largecover.jpg)

The cover of the most recent JCIM release

## Article 1: [Quantum Machine Learning Algorithms for Drug Discovery Applications](https://pubs.acs.org/doi/10.1021/acs.jcim.1c00166) (Batra et al.)

![](../assets/images/test.png)

Nowadays, there are more and more data on small molecules tested against various biological targets. This data is often used to train predictive machine learning (ML) models.

The data is becoming so large, though, that it becomes challenging to use it to efficiently train conventional ML algorithms on classical computers (CC). For example, training conventional algorithms on large databases may take a considerable amount of time.

Quantum computers, on the other hand, could avoid this pitfall and produce equally good results using the same amount of high-dimensional data in a much shorter time – and this is exactly what the authors of this work show.

Additionally, the authors turn the attention of readers to quantum computing as a new method that could potentially be used in drug discovery.

---

## Article 2: [XGraphBoost: Extracting Graph Neural Network-Based Features for a Better Prediction of Molecular Properties](https://pubs.acs.org/doi/10.1021/acs.jcim.0c01489) (Deng et al.)

![](../assets/images/article2-jcim-3-07-2021.png)

When working with molecular data, it is only natural to think of chemical compounds as graphs, with atoms being the vertices, and chemical bonds between them – the edges.

The idea behind a current hot-topic in chemoinformatics is to use special trainable graph neural networks to learn the atomic features from the data in an end-to-end fashion, meaning that the features are learned by optimizing the predicted target values.

The authors of this work, however, show that graph neural networks' performance could be improved by extracting the features learned by a GNN and using them as input to a gradient boosting algorithm implemented in the `XGBoost` python library.

According to the benchmarking that the authors provide, such an approach significantly increases the predictive performance of models trained this way.

---

## Article 3: [True Accuracy of Fast Scoring Functions to Predict High-Throughput Screening Data from Docking Poses: The Simpler the Better](https://pubs.acs.org/doi/10.1021/acs.jcim.1c00292) (Tran-Nguyen et al.)

![](../assets/images/article3-jcim-03-07-2021.png)

In a typical virtual screening setting, a set of molecules is docked (using protein-ligand docking techniques) into a target protein of interest. It is then the task of the special docking score functions to "predict binding free energies from three-dimensional structures of protein-ligand
complexes".

The authors of the present work (our colleagues from the University of Strasbourg, by the way!) wondered whether or not the four most popular fast scoring functions (2 machine learning-based, 2 knowledge-base topological functions) are capable of correctly picking the active molecules from the whole set of studied compounds, and which scoring functions perform the best.

To do so, they collected a database of "experimental
high-confidence screening data covering about 3 million data points on 15 diverse pharmaceutical targets". Then they performed the virtual screening of this library using 1 docking method and 4 scoring functions to computationally assess the "activity" of the docked compounds.

The result? Turns out, machine learning-based scoring functions perform worse than knowledge-base ones! Apparently, the ML ones are biased towards the values they were trained on.

---

## Article 4: [Finding Druggable Sites in Proteins Using TACTICS](https://pubs.acs.org/doi/10.1021/acs.jcim.1c00204) (Evans et al.)

![](../assets/images/article4-jcim-03-07-2021.png)

When trying to find a new drug against some protein, you may already know some of the available binding sites due to the presence of experimental crystal structures.

However, it may be interesting to explore other, not-yet-established binding sites. This is especially true when dealing with so-called cryptic sites: the ones that "are apparent when a ligand is bound to it but difficult to detect when no ligand is present".

The authors of this paper present their own development, a utility called TACTICS, that inputs the results of an MD simulation of your protein, and, using machine learning algorithms, detects whether or not your macromolecule has these cryptic sites.

According to the authors, their algorithm is capable of detecting both known and unknown cryptic sites on known targets.

Additionally, what I liked about this paper is that it provides a very nice literature review on the topic of protein binding site detection.

---

Well, I guess that's it for today. Despite I only selected a few, the recent JCIM issue has many more fantastic articles, and I suggest you take a look at them [here](https://pubs.acs.org/toc/jcisd8/61/6). Thank you very much for your kind attention, I hope you enjoyed this short overview. See you next time! Cheers.


text:
# AWS Vault Configure
Fetches new AWS credentials from a Vault instance using Vault's AWS backend.

## Usage
1. Download the latest release from the Releases tab on GitHub.
2. Ensure that you have an up to date version of Java installed.
3. Run the jar, `java -jar AWSVaultConfigure.jar {Vault AWS path}`. `Vault AWS path` is the secret path to the AWS secret backend that you want to use, like `v1/aws/creds/deploy`.
4. Enter the Vault Root Address and Vault Token as instructed.
5. The new credentials will be saved to your user AWS configuration.

## Compatability
* Linux

## License & Authors
- Author:: Tyler Wong ([ty-w@live.com](mailto:ty-w@live.com))

```text
Copyright 2017, Tyler Wong

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

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

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

repository: T-Wong/AWSVaultConfigure

repo_name: T-Wong/AWSVaultConfigure


text:
# Projects
The Projects resource enables you to interact with the Project profiles in Watson.
The following table describes the available endpoints of the Projects resource:

| Endpoint | Description |
| -------- | ----------- |
| GET /projects | Retrieves the data objects of the Project profiles available in Watson. |
| POST /projects | Creates a new Project profile. |
| PUT /projects/{project} | Updates the data object of a Project profile. |
| DELETE /projects/{project} | Deletes a Project profile. |

## GET /PROJECTS

GET

### Summary
The **GET /PROJECTS** endpoint retrieves the data objects of the Project profiles available in Watson.

### Parameters
> Use this cURL to make a request to this endpoint

```shell
curl -X GET --header 'Accept: application/json'
'{API Environment URL}/projects?from={from}&size={size}'
```
This endpoint allows the following parameters:

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| from | Query | The Project identification number | No | Integer |
| size | Query | The number of Projects to retrieve. | No | Integer |

### Responses
This endpoint receives the following response code:

| Code | Description |
| ---- | ----------- |
| 200 | Success |

### Sample Request
These are examples of an API request to this endpoint:

#### cURL Request
`curl -X GET --header 'Accept: application/json' 'http://watson-nonprod.com/api/projects?from=0&size=2'`

#### HTTP Request
` http://watson-nonprod.com/api/projects?from=0&size=2 `

### Sample Response Body
```json
{
  "total": 27,
  "from": 0,
  "pageSize": 2,
  "results": [
    {
      "project": "Test-Project",
      "projectTeam": "Test Team",
      "projectBu": "Test BU",
      "projectRepository": "Test Repo",
      "lastActivity":<PHONE_NUMBER>030,
      "timestamp":<PHONE_NUMBER>192
    },
    {
      "project": "Allesseh.Ingest",
      "projectTeam": "Allesseh",
      "projectBu": "Allesseh",
      "projectRepository": "git@github.dowjones.net:Content/Allesseh.Ingest.git",
      "lastActivity":<PHONE_NUMBER>757,
      "timestamp":<PHONE_NUMBER>073
    }
  ]
}
```

The sample JSON file at the right of the page presents the Response Body obtained with the Sample Request.

### Sample Response Headers
```json
{
  "access-control-allow-headers": "Content-Type, Last-Update",
  "access-control-allow-methods": "POST, GET, OPTIONS, PUT, DELETE",
  "access-control-allow-origin": "*",
  "cache-control": "no-cache, private, no-store",
  "connection": "keep-alive",
  "content-encoding": "gzip",
  "content-type": "application/json;charset=utf-8",
  "date": "Fri, 18 Jun 2021 03:49:02 GMT",
  "expires": "Fri, 18 Jun 2021 03:49:02 GMT",
  "pragma": "no-cache",
  "server": "nginx/1.18.0",
  "transfer-encoding": "chunked"
}
```
The sample JSON file at the right of the page presents the Response Headers obtained with the Sample Request.

 ← Go back to the Projects resource page

## POST /PROJECTS

POST

### Summary
The **POST /PROJECTS** endpoint creates a new Project profile.

### Parameters
> Use this cURL to make a request to this endpoint

```shell
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{body}' '{API Environment URL}/projects'
```

This endpoint allows the following parameters:

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| body | Body | The object data with the new Project profile details | Yes | JSON file |

> body parameter content example

```json
 {
  "name": "new-project",
  "team": "Project Team",
  "bu": "Project Business Unit",
  "repository": "github.seed.com"
}
```
This tables lists the parameters of the body JSON file:

| parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| name | Yes | String | The name of the Project |
| team | Yes | String | The name of the Project Team |
| bu | No | String | The Business Unit of the Team |
| repository | No | String | The URL to the Project repository |

### Responses
This endpoint receives the following response code:

| Code | Description |
| ---- | ----------- |
| 201 | Success |

### Sample Request
These are examples of an API request to this endpoint:

#### cURL Request
`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
   "name": "new-project", \
   "team": "Project Team", \
   "bu": "Project Business Unit", \
   "repository": "github.seed.com" \
 }' 'http://watson-nonprod.com/api/projects'`

#### HTTP Request
`http://watson-nonprod.com/api/projects`

### Sample Response Body
```json
true
```
The sample JSON file at the right of the page presents the Response Body obtained with the Sample Request.

### Sample Response Headers
```json
{
  "access-control-allow-headers": "Content-Type, Last-Update",
  "access-control-allow-methods": "POST, GET, OPTIONS, PUT, DELETE",
  "access-control-allow-origin": "*",
  "cache-control": "no-cache, private, no-store",
  "connection": "keep-alive",
  "content-length": "4",
  "content-type": "application/json;charset=utf-8",
  "date": "Fri, 18 Jun 2021 14:12:24 GMT",
  "expires": "Fri, 18 Jun 2021 14:12:24 GMT",
  "pragma": "no-cache",
  "server": "nginx/1.18.0"
}
```
The sample JSON file at the right of the page presents the Response Headers obtained with the Sample Request.

 ← Go back to the Projects resource page

## PUT PROJECTS/{PROJECT}

PUT

### Summary
The **PUT PROJECTS/{PROJECT}** endpoint updates the data object of a Project profile.

### Parameters
> Use this cURL to make a request to this endpoint

```shell
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{body}' '{API Environment URL}/projects/{project}'
 ```

This endpoint allows the following parameters:

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| project | Path | The current Project details | Yes | String |
| body | Body | The data object with the updated Project details | Yes | JSON file |

> body parameter content example

```json
 {
  "name": "seed-project",
  "team": "The Seed Team",
  "bu": "Plant Business Unit",
  "repository": "github.seed.com"
}
```

This tables lists the parameters of the body JSON file:

| parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| name | Yes | String | The name of the Project |
| team | Yes | String | The name of the Project Team |
| bu | Yes | String | The Business Unit of the Team |
| repository | No | String | The URL to the Project repository |

### Responses
This endpoint receives the following response code:

| Code | Description |
| ---- | ----------- |
| 201 | Success |

### Sample Request
These are examples of an API request to this endpoint:

#### cURL Request
`curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
   "name": "seed-project", \
   "team": "Seed team", \
   "bu": "Business Seed Unit”, \
   "repository": "github.seed.com" \
 }' 'http://watson-nonprod.com/api/projects/new-project'`

#### HTTP Request
`http://watson-nonprod.com/api/projects/new-project`

### Sample Response Body
```json
true
```

The sample JSON file at the right of the page presents the Response Body obtained with the Sample Request.

### Sample Response Headers
```json
{
  "access-control-allow-headers": "Content-Type, Last-Update",
  "access-control-allow-methods": "POST, GET, OPTIONS, PUT, DELETE",
  "access-control-allow-origin": "*",
  "cache-control": "no-cache, private, no-store",
  "connection": "keep-alive",
  "content-length": "4",
  "content-type": "application/json;charset=utf-8",
  "date": "Fri, 18 Jun 2021 15:33:05 GMT",
  "expires": "Fri, 18 Jun 2021 15:33:05 GMT",
  "pragma": "no-cache",
  "server": "nginx/1.18.0"
}
```
The sample JSON file at the right of the page presents the Response Headers obtained with the Sample Request.

 ← Go back to the Projects resource page

## DELETE /PROJECTS/{PROJECT}

DELETE

### Summary
The **DELETE /PROJECTS/{PROJECT}** endpoint deletes a Project profile.

### Parameters
> Use this cURL to make a request to this endpoint

```shell
curl -X DELETE --header 'Accept: application/json'
'{API Environment URL}/projects/{project}'
```
This endpoint allows the following parameters:

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| project | Path | The name of the Project to delete | Yes | String |

### Responses
This endpoint receives the following response code:

| Code | Description |
| ---- | ----------- |
| 201 | Success |

### Sample Request
These are examples of an API request to this endpoint:

#### cURL Request
`curl -X DELETE --header 'Accept: application/json'
'http://watson-nonprod.com/api/projects/new-project'`

#### HTTP Request
`http://watson-nonprod.com/api/projects/new-project` `

### Sample Response Body
This endpoint does not have a response body.

### Sample Response Headers
```json
{
  "access-control-allow-headers": "Content-Type, Last-Update",
  "access-control-allow-methods": "POST, GET, OPTIONS, PUT, DELETE",
  "access-control-allow-origin": "*",
  "cache-control": "no-cache, private, no-store",
  "connection": "keep-alive",
  "content-length": "0",
  "date": "Fri, 18 Jun 2021 20:37:05 GMT",
  "expires": "Fri, 18 Jun 2021 20:37:05 GMT",
  "pragma": "no-cache",
  "server": "nginx/1.18.0",
  "content-type": null
}
```
The sample JSON file at the right of the page presents the Response Headers obtained with the Sample Request.

 ← Go back to the Projects resource page

repository: Jose-Sayago/three-panel-slate

branch_name: refs/heads/main

repo_name: Jose-Sayago/three-panel-slate


text:
# lemma-finder

[![Build Status](https://travis-ci.org/anqooqie/lemma-finder.svg)](https://travis-ci.org/anqooqie/lemma-finder)

This program shows lemmas of each word using WordNet.

## Usage
```bash
git clone https://github.com/anqooqie/lemma-finder.git
cd lemma-finder
mvn package dependency:copy-dependencies -Dmaven.test.skip=true
java -jar target/lemma-finder-"$(mvn help:evaluate -Dexpression=project.version | grep -v INFO)".jar /path/to/wordnet/dictionary <input >output
```

## Example of Input
    Linked
    Version4
    Women

## Example of Output
    	link	linked
    version
    woman

The output has four tab-separated fields.
The first field shows lemmas as nouns.
The second field shows lemmas as verbs.
The third field shows lemmas as adjectives.
The fourth field shows lemmas as adverbs.

license: Unlicense

repository: anqooqie/lemma-finder

repo_name: anqooqie/lemma-finder


text:
# Guardmi - React Native / Expo UI
[![made with expo](https://img.shields.io/badge/MADE%20WITH%20EXPO-000.svg?style=for-the-badge&logo=expo&labelColor=4630eb&logoWidth=20)](https://github.com/expo/expo)
[![supports iOS and Android](https://img.shields.io/badge/Platforms-Native-4630EB.svg?style=for-the-badge&logo=EXPO&labelColor=000&logoColor=fff)](https://github.com/expo/expo)
![License](https://img.shields.io/github/license/jsxclan/guardmi?style=for-the-badge)
[![Twitter Follow](https://img.shields.io/twitter/follow/jsx_clan?style=for-the-badge)](https://twitter.com/jsx_clan)

![Guardmi](https://repository-images.githubusercontent.com/373394426/71b88f00-c43a-11eb-9525-77bf2266da19)

# Installation
First, make sure you have Expo CLI installed:
```
npm install -g expo-cli
```

Clone:
```
git clone https://github.com/jsxclan/guardmi.git
```

Navigate to the project directory:
```
cd guardmi
```

Install:
```
npm install || yarn || yarn install
```

Run Project Locally:
```
expo start || npm run start || yarn start
```

# Features
 - Expo SDK 41
 - iOS, Android
 - React Navigation v4
 - PropTypes

# Dependencies
 - [@expo/vector-icons](https://www.npmjs.com/package/@expo/vector-icons)
 - [@react-native-async-storage/async-storage](https://www.npmjs.com/package/@react-native-async-storage/async-storage)
 - [@react-navigation/native](https://www.npmjs.com/package/@react-navigation/native)
 - [expo-ads-admob](https://www.npmjs.com/package/expo-ads-admob)
 - [expo-asset](https://www.npmjs.com/package/expo-asset)
 - [expo-linear-gradient](https://www.npmjs.com/package/expo-linear-gradient)
 - [expo-linking](https://www.npmjs.com/package/expo-linking)
 - [expo-status-bar](https://www.npmjs.com/package/expo-status-bar)
 - [expo-store-review](https://www.npmjs.com/package/expo-store-review)
 - [react-native-paper](https://www.npmjs.com/package/react-native-paper)
 - [react-native-safe-area-context](https://www.npmjs.com/package/react-native-safe-area-context)
 - [react-native-shadow](https://www.npmjs.com/package/react-native-shadow)
 - [react-native-svg](https://www.npmjs.com/package/react-native-svg)
 - [react-redux](https://www.npmjs.com/package/react-redux)
 - [redux](https://www.npmjs.com/package/redux)

# Contributing
Contributions are _very_ welcome!

If you see an issue that you'd like to see fixed, the best way to make it happen is to help out by submitting a pull request implementing it.

# License
Your project is Open Source and available under the Apache 2 License.

repository: Sandeepatrollick/guardmi

repo_name: Sandeepatrollick/guardmi


text:
writeup
================
Logan King
8/31/2020

# Using Computer Simulation to Analyze the Martingale Strategy in Roulette

Despite being notorious for having the worst odds to win of the various
casino game offerings, people gather around the roulette table day after
day with hopes of winning big. Several strategies have been developed to
try and improve roulette outcomes, one of which being the [Martingale
strategy](https://github.com/thomasgstewart/data-science-5620-Fall-2020/blob/master/deliverables/01-roulette.md).

With simulation, it is possible to calculate the average earnings for a
player utilizing the Martingale strategy over many repetitions. This
will allow for evaluation of whether or not Martingale is a profitable
strategy. To begin, several functions must be created. A function for a
single play of the roulette game, a function for when play should cease,
and a function for an overall series of plays.

## Single Play Function

The single play function takes several inputs which describe the game
state prior to a spin of the roulette wheel. The output for the function
is the game state following a spin of the wheel. The parameters which
make up the game state are: player budget, maximum budget threshold for
stopping play (essentially one’s ideal end cash amount to be satisfied
with no longer playing), the maximum allowed number of plays, the
casino’s wager limit, the number of plays that have occurred, the
previous wager amount, and the previous outcome (win/loss). These
parameters are used for the input of the single play function and will
be updated as the output, following one play.

## Stopping Function

The stopping function is necessary for construction of the function for
a series of plays. The stopping function is an indicator of whether or
not play at the roulette table should continue. There are three
instances in which this function will trigger the game to end: when the
budget reaches zero, when the maximum number of plays have been reached,
and when the budget is greater than the max budget threshold. If none of
the previously mentioned game state conditions have been met, play will
continue.

## Series of Play Function

The series of play function executes the one play function on a given
set of parameters repeatedly until the stopping function triggers the
series to end. Given initial inputs of budget, winning threshold,
maximum number of plays, and maximum wager amount, the series function
can calculate the final budget, earnings, and number of plays over a
series of roulette spins.

## Simulation

Using simulation, we can specify the amount of series of roulette plays
to be simulated. With simulation, the long run viability of the
Martingale strategy can be evaluated. For the purposes of this exercise,
10,000 series will be simulated. The end budget result of each series is
then stored in a vector to allow for calculation of average earnings.

## Average Earnings

When simulated 10,000 times given the following parameters:

  - Starting Budget: $200
  - Winning Threshold: $300
  - Max Plays: 1000
  - Max Wager: $100

Over 10,000 repetitions, we see that the Martingale strategy is not
profitable, as the average earnings are $-45.6885.

## Earnings Over a Series

![](writeup_files/figure-gfm/earnings%20over%20a%20series-1.png)<!-- -->![](writeup_files/figure-gfm/earnings%20over%20a%20series-2.png)<!-- -->![](writeup_files/figure-gfm/earnings%20over%20a%20series-3.png)<!-- -->

The above plots each display examples of a single series of roulette
plays. In the first two, the Martingale strategy provides earnings of
$100 (a final budget of $300) after approximately 200 and 250 turns,
respectively. In the third series example, the strategy leaves the
gambler with -$200 in earnings (a final budget of $0) after just 8
turns.

## Changing Parameters

A change in the parameters allows us to see the interaction with each on
the average earnings. As each individual parameter changes, the other
parameters hold their default value seen in the initial simulation.

![](writeup_files/figure-gfm/parameter%20change%20plots-1.png)<!-- -->![](writeup_files/figure-gfm/parameter%20change%20plots-2.png)<!-- -->![](writeup_files/figure-gfm/parameter%20change%20plots-3.png)<!-- -->![](writeup_files/figure-gfm/parameter%20change%20plots-4.png)<!-- -->

As seen in the above plots, altering the parameters doesn’t ever make
the Martingale strategy profitable in the long run. However, changing
certain parameters may serve to mitigate long-term losses. Increasing
the initial starting budget causes earnings to approach zero in the long
term. Meanwhile, a winning threshold close to the initial starting
budget mitigates long term losses. For casino-implemented rules of
maximum plays and maximum wager amount, behavior is mirrored. Generally,
losses are mitigated by fewer plays and a higher max wager.

## Average Number of Plays

Similar to how the average earnings over 10,000 simulated series were
calculated, the average number of plays is able to be calculated.
Instead of recording the earnings of each series in a vector and taking
the mean, the number of turns in a series is recorded. The average
number of turns over 10,000 repetitions is 202.522.

## Limitations

As with any model, the simulation method of the Martingale strategy has
limitations. The simulation does not take into account any payout rules
that the casino may have enforced for the roulette game, we assume a 1:1
payout. Additionally, the model assumes that the player is placing bets
on red each turn. It is important to note that while a roulette player
may see success over a given series or group of series, simulation looks
at the long term outcome expectation.


text:
# Eye-Tracking Visualization

This repository contains a collection of Python scripts, which visualizes the eye-tracking data of our fMRI experiments.

**Disclaimer 1: The code is very specific to our use case and may need substantial changes to work with other setups.**
**Disclaimer 2: I am not a Python programmer. I'm always grateful for feedback on how to improve my code.**

## Setup

The project should run in any Python 3.6 environment. It was developed with the [PyCharms IDE](https://www.jetbrains.com/pycharm/).

## Work Flow ##

Before starting the Python script, prepare the data. It needs to have the format of our [analyzer scripts](https://github.com/peitek/eyetracking-analyses). The easiest way is to run the data through the analyzer first, then to visualize it.

Make necessary adjustments to `config.py`.

Finally, you can create the visualizations by executing `main.py`.

# Related Repositories

* [EyeLink Ogama Connector](https://github.com/peitek/eyelink-ogama-connector)
* [Eye-Tracking Analysis Pipeline](https://github.com/peitek/eyetracking-analyses)

# License #

```
MIT License

Copyright (c) 2018 Norman Peitek
```

repository: peitek/eyetracking-visualizations

repo_name: peitek/eyetracking-visualizations


text:
Unity-NGUIExtension
===================

Various NGUI extension modules.

Modules
-------
* **UIShaderSprite** - It enables to apply and specify shader on each of sprite in the atlas. (It will work on NGUI 3.7.0 or higher version)

* **Alpha Masked shader** - It enables to use compressed image format for an Atlas image file, PVRTC on iOS and ETC on Android. Both of format are 4bits so it reduces image size to 1/4. Inspired by [unity-alphamask](https://github.com/keijiro/unity-alphamask). See also [Texture Compression](http://egloos.zum.com/littles/v/3439290)(*Korean only*) for more details about benefit of using PVRTC on iOS and ETC1 on Android device.

NGUI with Alpha-Masked Atlas
----------------------------

As mentioned on [this post](https://github.com/keijiro/unity-alphamask), you can also recude NGUI's atlas image size up to 1/4 compared with RGBA32 format. And it leads reducing image loading time so can make an user feel the game runs smoothly. An overhead of using alpha-mask which is known as not good at on a mobile device is slight, so it can be ignored in rendering UI images point of view.

The problem of using alpha maksed image approach can be found on a translucent sprite. Using alpha-masked approach is not good for a translucent sprite image. An image can be more translucent than it should be rendered due to its lack of color pixels. Compare the following images:

When all sprites of atals images are rendred with alpha masked 4bit images, the second image of the above, the differences are subtle except windows background sprite.  The sprite image is more translucent than the RGBA32 one. So it is highly recommanded to use RGBA32 format, especially for a GUI sprite if the sprite image is translucent one.

All the sprite images of Alpha-Masked are made with NGUI and rendered with *Transparent Colored Masked.shader* in this repository. Surely its atlas image size is reduced up to 1/4 and very good strategy for reducing image size such as equipment icon sprite images.

***NOTE: Don't forget to make an atlas image to have same width and height as power of two on iOS platform.***

UISlider burn effect with TweenerSlider
---------------------------------------

Drawing burn out effect when value is going down can be easily done with two UISlider, one of that has TweenSlider component.

The red slider is burn out effect which does delayed move after value of the yellow slider changed. Attach TweenSlider compoent to the red slider then call UITweener related methods as the following:

``` csharp
    public UISlider yellowSlider; // NGUI UISlider object.
    public TweenSlider tweener;

    ...

    tweener.ResetToBeginning();

    tweener.slider.value = from;
    float duration = 0.5f;
    float to = yellowSlider.value;
    TweenSlider t = TweenSlider.Begin(tweener.slider, duration, to);
    t.PlayForward();
```

Other Resources
---------------

Other useful NGUI modules found on github.

* [NGUI Additions](https://github.com/yeticrabgames/NGUIAdditions)
* [MateNGUI](https://github.com/ddionisio/MateNGUI)
* [DataBinderForNGUI](https://github.com/kyubuns/DataBinderForNGUI)
* [UIUnityRenderer](https://github.com/tarob19/UIUnityRenderer) manages NGUI widgets to use that together with other gameobjects which contain ParticleSystem or MeshRenderer by its depth.

License
-------

This code is distributed under the terms and conditions of the MIT license.

Copyright (c) 2014 Kim, Hyoun Woo


text:
# Example: CSV

Comma-Separated Values is a very simple text format. CSV files consist of a
list of *records*, each on a separate line. Each record is a list of *fields*
separated by commas.

For example, here is a CSV file with numeric fields:

```
65279,1179403647,1463895090
3.1415927,2.7182817,1.618034
-40,-273.15
13,42
65537
```

Let's write a program that computes the **sum of these fields** and counts the
**number of records**.

## Setup

Start by initializing a new project using [Cargo]:

```shell
$ cargo init --bin csv-tool
     Created binary (application) project
$ cd csv-tool
```

Add the `pest` and `pest_derive` crates to the dependencies section in `Cargo.toml`:

```toml
[dependencies]
pest = "2.6"
pest_derive = "2.6"
```

## Writing the parser

`pest` works by compiling a description of a file format, called a *grammar*,
into Rust code. Let's write a grammar for a CSV file that contains numbers.
Create a new file named `src/csv.pest` with a single line:

```pest
field = { (ASCII_DIGIT | "." | "-")+ }
```

This is a description of every number field: each character is either an ASCII
digit `0` through `9`, a full stop `.`, or a hyphen–minus `-`. The plus
sign `+` indicates that the pattern can occur one or more times.

Rust needs to know to compile this file using `pest`:

```rust
use pest::Parser;
use pest_derive::Parser;

#[derive(Parser)]
#[grammar = "csv.pest"]
pub struct CSVParser;
```

If you run `cargo doc`, you will see that `pest` has created the function
`CSVParser::parse` and an enum called `Rule` with a single variant
`Rule::field`.

Let's test it out! Rewrite `main`:

```rust
fn main() {
    let successful_parse = CSVParser::parse(Rule::field, "-273.15");
    println!("{:?}", successful_parse);

    let unsuccessful_parse = CSVParser::parse(Rule::field, "this is not a number");
    println!("{:?}", unsuccessful_parse);
}
```

```shell
$ cargo run
  [ ... ]
Ok([Pair { rule: field, span: Span { str: "-273.15", start: 0, end: 7 }, inner: [] }])
Err(Error { variant: ParsingError { positives: [field], negatives: [] }, location: Pos(0), path: None, line: "this is not a number", continued_line: None, start: (1, 1), end: None })
```

Yikes! That's a complicated type! But you can see that the successful parse was
`Ok`, while the failed parse was `Err`. We'll get into the details later.

For now, let's complete the grammar:

```pest
field = { (ASCII_DIGIT | "." | "-")+ }
record = { field ~ ("," ~ field)* }
file = { SOI ~ (record ~ ("\r\n" | "\n"))* ~ EOI }
```

The tilde `~` means "and then", so that `"abc" ~ "def"` matches `abc` followed
by `def`. (For this grammar, `"abc" ~ "def"` is exactly the same as `"abcdef"`,
although this is not true in general; see [a later chapter about
`WHITESPACE`].)

In addition to literal strings (`"\r\n"`) and built-ins (`ASCII_DIGIT`), rules
can contain other rules. For instance, a `record` is a `field`, and optionally
a comma `,` and then another `field` repeated as many times as necessary. The
asterisk `*` is just like the plus sign `+`, except the pattern is optional: it
can occur any number of times at all (zero or more).

There are two more rules that we haven't defined: `SOI` and `EOI` are two
special rules that match, respectively, the *start of input* and the *end of
input*. Without `EOI`, the `file` rule would gladly parse an invalid file! It
would just stop as soon as it found the first invalid character and report a
successful parse, possibly consisting of nothing at all!

## The main program loop

Now we're ready to finish the program. We will use [`File`] to read the CSV
file into memory. We'll also be messy and use [`expect`] everywhere.

```rust
use std::fs;

fn main() {
    let unparsed_file = fs::read_to_string("numbers.csv").expect("cannot read file");

    // ...
}
```

Next we invoke the parser on the file. Don't worry about the specific types for
now. Just know that we're producing a [`pest::iterators::Pair`] that represents
the `file` rule in our grammar.

```rust
fn main() {
    // ...

    let file = CSVParser::parse(Rule::file, &unparsed_file)
        .expect("unsuccessful parse") // unwrap the parse result
        .next().unwrap(); // get and unwrap the `file` rule; never fails

    // ...
}
```

Finally, we iterate over the `record`s and `field`s, while keeping track of the
count and sum, then print those numbers out.

```rust
fn main() {
    // ...

    let mut field_sum: f64 = 0.0;
    let mut record_count: u64 = 0;

    for record in file.into_inner() {
        match record.as_rule() {
            Rule::record => {
                record_count += 1;

                for field in record.into_inner() {
                    field_sum += field.as_str().parse::<f64>().unwrap();
                }
            }
            Rule::EOI => (),
            _ => unreachable!(),
        }
    }

    println!("Sum of fields: {}", field_sum);
    println!("Number of records: {}", record_count);
}
```

If `p` is a parse result (a [`Pair`]) for a rule in the grammar, then
`p.into_inner()` returns an [iterator] over the named sub-rules of that rule.
For instance, since the `file` rule in our grammar has `record` as a sub-rule,
`file.into_inner()` returns an iterator over each parsed `record`. Similarly,
since a `record` contains `field` sub-rules, `record.into_inner()` returns an
iterator over each parsed `field`.

## Done

Try it out! Copy the sample CSV at the top of this chapter into a file called
`numbers.csv`, then run the program! You should see something like this:

```shell
$ cargo run
  [ ... ]
Sum of fields:<PHONE_NUMBER>.327908
Number of records: 5
```

[Cargo]: https://doc.rust-lang.org/cargo/
[a later chapter about `WHITESPACE`]: ../grammars/syntax.html
[`File`]: https://doc.rust-lang.org/std/fs/struct.File.html
[`expect`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.expect
[`pest::iterators::Pair`]: https://docs.rs/pest/2.0/pest/iterators/struct.Pair.html
[`Pair`]: https://docs.rs/pest/2.0/pest/iterators/struct.Pair.html
[iterator]: https://doc.rust-lang.org/std/iter/index.html

repository: pest-parser/book

repo_name: pest-parser/book


text:
# About
localhost-reverse-proxy is a web server for static files and a reverse proxy.
Since many browsers have CORS restrictions, you can either setup a reverse proxy or
disable CORS. I'm now at a point where I think its easier to have a small reverse
proxy that can test frontend backend and backend.

It is assumed that your frontend and backend runs on localhost, and your frontend
is HTML/JavaScript that is stored in a specific folder.

# Installation

```bash
mkdir -p go/src/github.com/tbocek
cd go/src/github.com/tbocek
git clone https://github.com/tbocek/localhost-reverse-proxy.git
#this will build the binary and copy it to go/bin
cd localhost-reverse-proxy
go install
#now you can run the binary localhost-reverse-proxy if your go/bin is in your $PATH
localhost-reverse-proxy -d /var/www
```

# Output

If you run localhost-reverse-proxy, it will use default settings and print
its options:

```
Static file HTTP server and reverse proxy for localhost. This tool exists due to CORS.
  -d string
    	directory to server HTML files from, e.g. /var/www (default ".")
  -l string
    	listen on port, e.g., 8080 (default "8080")
  -r string
    	port to redirect to, e.g., 8545. This will redirect http://localhost:8080/8545 to http://localhost:8545 (default "8545")
Serving: /var/www on http://localhost:8080, redirecting http://localhost:8080/8545 to http://localhost:8545
```

repository: tbocek/localhost-reverse-proxy

gha_language: Go

repo_name: tbocek/localhost-reverse-proxy


text:
# Riverbed Community Cookbooks - AppResponse Simple Demo

[![Deploy to Azure](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.svg?sanitize=true)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Friverbed%2FRiverbed-Community-Toolkit%2Fmaster%2FAppResponse%2FAzure-Cloud-Cookbooks%2F101-appresponse-simple-demo%2Fazuredeploy.json) [![Deploy to Azure Gov](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazuregov.svg?sanitize=true)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Friverbed%2FRiverbed-Community-Toolkit%2Fmaster%2FAppResponse%2FAzure-Cloud-Cookbooks%2F101-appresponse-simple-demo%2Fazuredeploy.json)

Deploy a simple demo topology for [Riverbed AppResponse](https://www.riverbed.com/products/npm/appresponse) in your own Azure Cloud subscription in just few clicks with the Riverbed Community Toolkit provided by the [Riverbed Community](https://community.riverbed.com/).

Have a try and join the [Riverbed Community](https://community.riverbed.com/) to discuss.

![Topology diagram](images/appresponse-simple-demo.svg)

## Deployment Steps

1. Hit the "Deploy to Azure" button above
2. Fill usual fields:
    - Subscription
    - Resource Group: create a new, e.g. Riverbed-AppResponse-Demo
    - Region: Select an Azure Region
3. Fill the parameters
    - Version: Select the AppResponse version among the version supported by the template
    - Appliance Source Image Blob Uri: uri of the Blob containing the VHD of AppResponse. Contact [Riverbed TAC](https://support.riverbed.com) to get a standard uri with a temporary SAS Token.
    - Appliance Size: Size of the Azure VM, Standard_B8ms is a minimum
    - Demo Jumpbox Username: Default is riverbed-community
    - Demo Jumpbox Password: Set a password with enough complexity (8 characters lengths, 1 or more numeric, 1 or more special characters)
4. Hit "Review + create", then hit "Create"
5. Wait for the deployment, approximately 5 to 10 min depending on the region.

## Usage

When the deployment is done, you can grab the the default admin credential from the deployment outputs. They will be required next to log on the appliance webconsole

![Grab outputs](images/appresponse-simple-demo-outputs.png)

In the Azure Portal, navigate to the resource group. Then find the virtual machine named "Visibility" and connect via the Bastion using the Jumpbox username and password set in the deployment steps.

![Bastion](images/visibility-connect-bastion.png)

On the Jumpbox you can launch the web browser, navigate to the AppResponse webconsole url https://<IP_ADDRESS> and log in with the initial admin credential of the appliance (previously grabbed from the deployment outputs).

![AppResponse first login inside Bastion](images/appresponse-simple-demo-bastion-login.png)

## Notes

`Tags: Riverbed,Visibility,NPM,Network,Performance,Monitoring,AppResponse,Packet,Capture`

repository: riverbed/Riverbed-Community-Toolkit

gha_language: Python

repo_name: riverbed/Riverbed-Community-Toolkit


text:
# p5 Yeoman Generator

[![NPM version](https://img.shields.io/npm/v/generator-p5js.svg)](https://www.npmjs.org/package/generator-p5js)
[![NPM downloads](https://img.shields.io/npm/dm/generator-p5js.svg)](https://npmjs.org/package/generator-p5js "View this project on NPM")
[![Coverage Status](https://coveralls.io/repos/github/StefanoDeVuono/p5-yeoman-generator/badge.svg)](https://coveralls.io/github/StefanoDeVuono/p5-yeoman-generator)

A [yeoman](http://yeoman.io) generator for a p5 project, based off of [pflannery's p5 generator](https://github.com/pflannery/p5-yeoman-generator/blob/master/README.md)

## Getting Started

http://yeoman.io/learning/

## Install Yeoman (and bower and gulp)

- (If you haven't already installed it, install yeoman: `npm install -g yo gulp bower`).
- If you're having trouble with permissions, [npm recommends the following](https://docs.npmjs.com/getting-started/fixing-npm-permissions):
  - `npm config get prefix` (**Important**: It should show `/usr/local` if not, follow option two [here]((https://docs.npmjs.com/getting-started/fixing-npm-permissions)))
  - `sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}`

## Usage

- Assuming you have a directory called $DIRECTORY_NAME:
- `npm install -g generator-p5js`
- `mkdir $DIRECTORY_NAME`
- `cd $DIRECTORY_NAME`
- `yo p5js`
- `gulp serve`
- Open $DIRECTORY_NAME up in your favourite text editor and live your life. Every time you save, your browser window will update the new sketch.

## Notes

- Feel free to run `git init` inside $DIRECTORY_NAME. We've already created a `.gitignore` for you.
- Also, `p5.dom.js` and `p5.sound.js` are included but commented out in `index.html`. You'll need to uncomment those.
- Finally, assets will be stored in and served from the `assets` folder. This is useful for sound files, images, and the like.

### License

Licensed under the MIT License. See LICENSE in the project root for license information.


text:
---
layout: post
title: branch
---

Businessmodel of Branch
------------------------

### Customer Segments

Branch Metrics has a niche market business model, with a specialized customer segment. The company targets its offering at developers of mid-tier and long-tail apps.

### Value Proposition

Branch Metrics offers four primary value propositions: accessibility, performance, risk reduction, and brand/status.

The company creates accessibility by offering a wide variety of options. It bills its solution as the only deep linking platform that supports all current mobile app platforms and standards, including iOS, Android, Web App Banner, Cordova/Ionic, Unity, Titanium, Xamarin, AIR, and React Native. Its offering maintains all link creation/analytics functionalities, making it suitable for all use/edge cases.

The company has demonstrated strong performance through tangible results. Its solution matches at 100% accuracy if a user has clicked on a Branch link previously. It claims that its deep linking technology improves app performance, with 1.8x signups, 2.0x engagement, and 1.9x retention. High-profile examples of positive outcomes with its product include the following:

 * Bento used Branch Metrics‘ solution to create deep linked emails that increased engagement with their app by 100%
* Gigtown used Branch Metrics‘ solution to provide its users with referral capabilities, resulting in a 6.5x increase in sharing and 41% increase in one-day retention
* HotelTonight used Branch Metrics’ solution to place Branch links in ads, resulting in a 16% decrease in cost-per-install and an 18% increase in install-to-booking rate
* Yummly used Branch Metrics’ solution to implement app-to-app sharing with Instacart, resulting in 28% more items added to shopping lists and 35% higher retention
* Vango used Branch Metrics’ solution to deploy deep linked content sharing, resulting in a 2.5x increase in conversions and a 2x increase in retention
 The company reduces risk through responsiveness. Its distributed, service-oriented architecture is monitored 24/7 by a group of people who can react to problems in seconds. It also offers enterprise-level service agreements to guarantee that customers‘ links will work when they need them most.

The company has established a strong brand as a result of its performance. It bills itself as the largest deep linking network,  serving over 1.7 billion users across thousands of mobile apps. These include prominent eCommerce apps such as Ticketmaster and Jet, digital content apps such as Buzzfeed, We Heart It, and Fox Sports, real estate apps and travel apps such as Home Away and Redfin, social apps such as Dubsmash, Pinterest, and Coffee Meets Bagel, and games by developers such as Zynga. Lastly, it has won a number of honors, including first place in the GSMA Mobile World Congress Startup Innovation Competition (2015) and a Strictly Mobile Innovation Award (2015).

### Channels

Branch Metrics’ main channel is its website, through which customers sign up for a free account; that said, it also maintains a direct sales team.

The company promotes its offering through its social media pages; “Mobile Growth” Meetup group events where it invites marketers and app developers to share best practices and solutions; and the “Branch Ambassadors Program“, through which it invites mobile growth experts to promote the company and deep linking in general.

### Customer Relationships

Branch Metrics’ customer relationship is primarily of a self-service, automated nature. Customers utilize the service through the main platform while having limited interaction with employees. The company’s website features a “Resources” section that includes numerous self-help tools, including case studies, eBooks, data sheets, infographics, webinars, and podcasts. The site also provides answers to frequently asked questions.

That said, there is a personal assistance component in the form of e-mail support, as well as live technical and non-technical workshops hosted by the firm that demonstate best practices. There is also a community element in the form of a peer forum.

### Key Activities

Branch Metrics’ business model entails designing and developing software for its customers.

### Key Partners

Branch Metrics maintains the following types of strategic partnerships:

 * App Development & Marketing - Marketing and mobile development agencies that can assist apps in adding Branch to their growth stack, as well as build new product and marketing strategies around contextual deep linking. Specific partners are Somo Global, Prolific Interactive, Dom & Tom, Yeti CGI, Yodel Mobile, Carrot, FDV Solutions, PredictSpring, Mavin Digital, and Ladder Digital.
* Measurement Platforms - In-app analytics and attribution platforms that can integrate Branch's deep link event data into apps‘ measurement initiatives. Specific partners are Apptimize, Localytics, Amplitude, Adjust, and Appboy.
* Growth Tools - App marketing platforms that leverage Branch's contextual deep links for programs such as engagement campaigns, email campaigns, A/B testing, push messaging, and more. Specific partners include mParticle, Segment, Referral Saasquatch, LeanPlum, Apptimize, and Localytics.
 Partners receive education and tools for integrating contextual deep linking into their products.

In addition to these partnerships, Branch Metrics also maintains a referral program through which it invites third parties to refer developers to its offering. Once the new customers have integrated the Branch SDK, the company sends the referring party promotional gifts such as branded T-shirts.

### Key Resources

Branch Metrics’ main resources are its human resources, who include the engineering employees that design and develop its software, the sales staff that promote it, and the customer service staff that provide support.

As a relatively new startup it has relied heavily on funding from outside parties, raising $53.1 million from 12 investors as of January 2015.

### Cost Structure

Branch Metrics has a cost-driven structure, aiming to minimize expenses through significant automation.

Its biggest cost driver is likely product development, a fixed expense. Other major drivers are in the areas of product development and sales/marketing, both fixed costs.

### Revenue Streams

Branch Metrics has two revenue streams:

Usage Fees – Fees the company charges for one-off uses of its software; they fall into the following categories:

 * Data Integrations – Price per event is $.0025/per event forwarded
* Deep-Linked E-mail – Price per click is $.02/per click
 Subscription Fees – Fees the company charges for monthly access to its Journeys Web-to-App Tool, which enables app installs. They range in amount from $59 per month for 20,000 monthly mobile web visits to $6,999 per month for 20 million+ monthly mobile web visits.


text:
---
title: Webmin for Koding
author: Mike Spick
username: syntackz
categories: [developer tools, webmin]
---

# Installing Webmin on your Koding VM

Before you continue reading this guide why not try a more easy way, using the [Koding Package Manager (kpm)](http://learn.koding.com/guides/getting-started-kpm/) and install Webmin using just one command:

```
kpm install webmin
```

***

## The Details

This guide will cover the installation of Webmin on your Koding VM.

Webmin is a web-based adminstration tool for Unix based operating systems.
This tool will allow you to modify and control applications like Apache, and view/modify your MySQL DBs. Webmin also allows you to modify other system tools
from the web like users, passwords, iptables, log file rotations and more!

If you'd like to read more about Webmin, you can check out their website [here](http://webmin.com).

## Downloading and installing Webmin

Alright, first thing's first, we want to add the webmin team's repo to our apt sources. Run the following command to open apt's source list for editing.

```
sudo vi /etc/apt/sources.list
```

Press **i** to enter the vi input mode to edit the list. Add the following to the bottom of the file.

```
deb http://download.webmin.com/download/repository sarge contrib
```

It should look like below when you are done.

![sourceslist](sourceslist.png)

After adding this line press **ESC** to exit input mode. Then type **:wq** to write(save) and quit the file.

Now that apt has the source, lets run the following command to download and install the key needed for Webmin.

```
wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add -
```

We can now update apt, and install Webmin. You can use the following commands.

```
sudo apt-get update

sudo apt-get install webmin
```

You will be prompted if you want to continue, press **Y** to accept.

Once the install is complete, you will see the following as the final output:

![webmincomplete](webmincomplete.png)

Make note of the url given here as you will need it to access Webmin once it is setup.

## Configuration

Congratulations! Webmin is now installed on your Koding VM. We only have a few things left to do before it is useable. We need to change the SSL setting in the miniserv config file from **1** to **0**. Enter the following command to open the config file for editing.

```
sudo vim /etc/webmin/miniserv.conf
```

Once the file is open press **i** to enter input mode. Use the arrow keys to navigate to the line **SSL=1** change this line to read **SSL=0**. Again, hit **ESC** and type **:wq** to write(save) and quit the file.

The file should look like below before editing.

![miniserv](miniserv.png)

In order to apply the changes we have made to the configuration, we will need to restart the webmin service. To do that enter the following command.

```
sudo service webmin restart
```

And that's it!

If you encounter any issues or have any questions please drop us an email [here](mailto:support@koding.com).

repository: WebDevelopmentStudioWebAristan/kdlearn

gha_language: CSS

repo_name: WebDevelopmentStudioWebAristan/kdlearn


text:
# save-instance

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

## Why save-instance

If you have a class like:

```
class Test {
    constructor (...args) {}
}
```

And you initialize some instances in a module (ie. a bootstrap module), like:

```
const a = new Test(...args);
```

Since you don't know what module would use them, you should export them by `exports` or `global`

Yet both `exports` and `global` seems not perfect for this case.
* For `exports`, you should require that bootstrap module to use the instances, which is puzzle
* For `global`, you should handle the namespace problem carefully

Maybe a better way is to bind the instances with the class itself, like:

```
const a1 = Test.getInstance('A');
```

Now it seems more reasonable, as _"to get the Test instance named 'A' "_

Of course, you should initalize and name it before using.

```
new Test(...args).saveInstance('A');
// or
Test.saveInstance('A', ...args);
```

## How to use

_Decoration_ is supposed as the best way to use this

```
const savable = require('save-instance');

@savable()
class Test {...}
```

Yet decorator is not implemented till current version (v7.6), use it like

```
class Test {...}
savable()(Test);
```

## Other uses

### Lazy mode

Maybe we want instances initialized in a lazy mode. Just use it like this:

```
Test.saveLazyInstance('A', ...args);
```

### Singleton

Use default name '' to pretend as a singleton instance

```
new Test(...args).saveInstance();
const test =  Test.getInstance();
```

### Options

If you want to preprocess arguments, use `options.preprocessArguments(name, ...args)`

```
@savable({
    preprocessArguments(name, ...args) {
        return ['arg1', 'arg2', 'arg3'];
    }
})
class Test {}
```

If you want to preprocess instance, use `options.preprocessInstance(instance, name, ...args)`

```
@savable({
    preprocessInstance(instance, name) {
        instance.name = name;
        return instance;
    }
})
class Test {}
```

If you want to set a default name, or want to map some names into one, use `options.defaultName` and `options.map`

```
@savable({
    defaultName: 'foo',
    map: {
        'bar': 'foo',
        'baz': 'foo',
    },
})
class Test {}
```

Notice that the default name is `undefined` and maps `null` to `undefined`.

[npm-image]: https://img.shields.io/npm/v/save-instance.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/save-instance
[travis-image]: https://img.shields.io/travis/viRingbells/save-instance/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/viRingbells/save-instance
[coveralls-image]: https://img.shields.io/codecov/c/github/viRingbells/save-instance.svg?style=flat-square
[coveralls-url]: https://codecov.io/github/viRingbells/save-instance?branch=master

repository: viRingbells/save-instance

repo_name: viRingbells/save-instance


text:
[![GitHub issues](https://img.shields.io/github/issues/Biswajee/biswajee.github.io.svg)](https://github.com/Biswajee/biswajee.github.io/issues)
[![GitHub license](https://img.shields.io/github/license/Biswajee/biswajee.github.io.svg)](https://github.com/Biswajee/biswajee.github.io/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/Biswajee/biswajee.github.io.svg?branch=master)](https://travis-ci.org/Biswajee/biswajee.github.io)

# Biswajee.github.io

## Repository information
This repository contains the files that runs [this website](https://biswajee.github.io).
This website can be distributed freely with just a small credit of mention of the repository owner.
The website contains an all round overview of the owner of the repository and related projects.

## View a snapshot here

![Alt text](images/screenshot.png?raw=true "Snapshot of GitHub website")

## License

MIT License


text:
[![CI Status](http://img.shields.io/travis/AladinWay/PromisedFuture.svg?style=flat)](https://travis-ci.org/AladinWay/PromisedFuture)
[![Version](https://img.shields.io/cocoapods/v/PromisedFuture.svg?style=flat)](http://cocoapods.org/pods/PromisedFuture)
[![License](https://img.shields.io/cocoapods/l/PromisedFuture.svg?style=flat)](http://cocoapods.org/pods/PromisedFuture)
[![Platform](https://img.shields.io/cocoapods/p/PromisedFuture.svg?style=flat)](http://cocoapods.org/pods/PromisedFuture)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

## PromisedFuture
**PromisedFuture** is a lightweight implementation of Futures/Promises.
`PromisedFuture` helps to write readable and comprehensible asynchronous code.

Usually the callback mechanism is used when working with asynchronous tasks. It should get the job done for some use cases, but usually we need to perform more that one asynchronous operation, so we have to nest the second operation inside the completion block of the first one, but when we have nested callbacks it starts to get messy, the code is not friendly in term of maintainability, readability and control, and this leads to the Pyramid of doom, Callback hell and error handling issues.

**PromisedFuture** is here to rescue, the code will go from this:

```
APIClient.login(email<EMAIL_ADDRESS>password: "myPassword", completion: { result in
    switch result {
    case .success(let user):
        APIClient.userArticles(userID: user.id, completion: { result in
            switch result {
            case .success(let articles):
                APIClient.getArticle(id: articles.last!.id, completion: { result in
                    switch result {
                    case .success(let article):
                        print(article)
                    case .failure(let error):
                        print(error)
                    }
                })
            case .failure(let error):
                print(error)
            }
        })
    case .failure(let error):
        print(error)
    }
})

```

to this:

```
APIClient.login(email<EMAIL_ADDRESS>password: "myPassword")
         .map({$0.id})
         .andThen(APIClient.userArticles)
         .map({$0.last!.id})
         .andThen(APIClient.getArticle)
         .execute(onSuccess: { article in
            print(article)
         }, onFailure: {error in
            print(error)
         })
```

## Features

- [x] Chainable asynchronous operations.
- [x] Lightweight and simple to use (just ≈ 40 lines of code).
- [x] Fully unit tested.
- [x] Fully Documented.

## Requirements

- iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
- Xcode 9.0+
- Swift 4.0+

## Example

To run the example project, clone the repo, then open the workspace `PromisedFuture.xcworkspace` run using `iOS Example` scheme.

## Installation

### CocoaPods

[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:

```bash
$ gem install cocoapods
```

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

```ruby
use_frameworks!

pod 'PromisedFuture'
```

Then, run the following command:

```bash
$ pod install
```

### Carthage

[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with [Homebrew](http://brew.sh/) using the following command:

```bash
$ brew update
$ brew install carthage
```

To integrate PromisedFuture into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "aladinway/PromisedFuture"
```

Run `carthage update` to build the framework and on your application targets’ “General” settings tab, in the “Embedded Binaries” section, drag and drop the built `PromisedFuture.framework` from the Carthage/Build folder on disk.

## Usage

**Create a `Future`**:

to create a `Future` using an operation (network call for example) we use:

`init(operation: @escaping (_ completion:@escaping Completion) -> Void)`

  - Parameters:
      - `operation`: the operation that should be performed by the Future. This is usually the asynchronous operation.
      - `completion`: the completion block of the operation. It has the `Result` of the operation as parameter.
  - Example usage:

```swift
let future = Future(operation: { completion in
// Your operation here to retrieve the value
Alamofire.request("https://httpbin.org/get")
    .responseData { response in
        switch response.result {
        case .success(let value):
		// Then in case of success you call the completion
		// with the Result passing the value
		completion(.success(data))
        case .failure(let error):
		// or in case of error call the completion
		// with the Result passing the error like :
		//completion(.failure(error))
        }
    }
})
```

You can also create a `Future` by `Result`, `Value` or `Error`.

Initialize a new `Future` with the provided `Result`:

`init(result: Result<Value>)`

  - Parameters:
      - `result`: The result of the `Future`. It can be a `Result` of success with a value or failure with an `Error`.

  - Example usage:

```swift
let future = Future(result: Result.success(12))
```
 Initialize a new `Future` with the provided value:

`init(value: Value)`

  - Parameters:
      - `value`: The value of the `Future`.

  - Example usage:

```swift
let future = Future(value: "Hello")
```

Initialize a new `Future` with the provided `Error`:

`init(value: Value)`

  - Parameters:
      - `value`: The value of the `Future`.

  - Example usage:

```swift
let f: Future<Int>= Future(error: NSError(domain: "E", code: 4, userInfo: nil))
```

**Execute a `Future`**:

 To execute the operation of the Future we can use one these methods:

 - `func execute(completion: @escaping Completion)`

   - Parameters:
      - `completion`: the completion block of the operation. It has the `Result` of the operation as parameter.

  - Example usage:

	```swift
     let future = Future(value: 14)
     future.execute(completion: { result in
        switch result {
        case .success(let value):
            print(value) // it will print 14
        case .failure(let error):
            print(error)
        }
     })
	```

 - `func execute(completion: @escaping Completion)`

   - Parameters:
       - `onSuccess`: the success completion block of the operation. It has the value of the operation as parameter.
       - `onFailure`: the failure completion block of the operation. It has the error of the operation as parameter.

  - Example usage:

	```swift
     let future = Future(value: 14)
     future.execute(onSuccess: { value in
        print(value) // it will print 14
     }, onFailure: { error in
        print(error)
     })
	```

**Chaining multiple `Future`**:

 The powerful part of the Future is the ability to chain asynchronous operations.  We can use `andThen` method to chain two depending futures.

 - `func andThen<U>(_ f: @escaping (_ value: Value) -> Future<U>) -> Future<U>`

   - Parameters:
       - `f`: function that will generate a new `Future` by passing the value of this Future.

  - Example usage:

	```swift
     struct User {
        id: Int
     }

     // Let's assume we need to perform two network operations
     // The first one to get the user id
     // And the second one to get the user information
     // we can use `andThen` to chain them

     let userIdFuture = Future(value: 14)

     func userFuture(by userId: Int) -> Future<User> {
        return Future(value: User(id: userId))
     }

     userIdFuture.andThen(userFuture).execute { user in
        print(user)
     }
	```

	We can also map the result of the `Future` using `map` function:

	 - `func map<T>(_ f: @escaping (_ value: Value) -> T) -> Future<T>`

   - Parameters:
       - `f`: function that will generate a new `Future` by passing the value of this Future

  - Example usage:

	```swift
     let stringFuture = Future(value: "http://www.google.com")
     let urlFuture = stringFuture.map({URL(string: $0)})
	```

## Reading

I highly recommend reading my article below, If you want to learn more about `Futures` and how we can use **PromisedFuture** in the networking layer with `Alamofire` :

[Write a Networking Layer in Swift 4 using Alamofire 5 and Codable Part 3: Using Futures/Promises](https://medium.com/@AladinWay/write-a-networking-layer-in-swift-4-using-alamofire-5-and-codable-part-3-using-futures-promises-cf3977fc8a5)

## Author

Alaeddine Messaoudi<EMAIL_ADDRESS>
## License

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