text:
<?php
/**
 * Created by PhpStorm.
 * User: michael
 * Date: 14-11-19
 * Time: 18:20
 */

namespace Jna\MainBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
/**
 * Project
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Jna\MainBundle\Repository\WorkTypeRepository")
 */
class WorkType {

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="type", type="string")
     */
    private $type;

    /**
     * @var string
     *
     */
    private $machine_name;

    /**
     * @ORM\OneToMany(targetEntity="Project", mappedBy="id", cascade={"persist"})
     */
    private $projects;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    public function getType()
    {
        return $this->type;
    }

    public function setType($type)
    {
        $this->type = $type;
    }

    public function addProject(Project $project)
    {
        // Si l'objet fait déjà partie de la collection on ne l'ajoute pas
        if (!$this->projects->contains($project)) {
            $this->projects->add($project);
        }
    }

    public function getMachineName()
    {
        $type = $this->type;
        $this->machine_name = str_replace(' ' , '-' , $type);
        return $this->machine_name;
    }

}


text:
package edu.usu.sdl.openstorefront.core.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Allows for adding not null fields to existing entities
 *
 * @author dshurtleff
 */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DefaultFieldValue
{

	String value();
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Cake\Routing;

use Cake\Controller\Controller;
use Cake\Event\EventDispatcherTrait;
use Cake\Event\EventListenerInterface;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Routing\Exception\MissingControllerException;
use LogicException;

/**
 * Dispatcher converts Requests into controller actions. It uses the dispatched Request
 * to locate and load the correct controller. If found, the requested action is called on
 * the controller
 *
 */
class Dispatcher
{

    use EventDispatcherTrait;

    /**
     * Connected filter objects
     *
     * @var array
     */
    protected $_filters = [];

    /**
     * Dispatches and invokes given Request, handing over control to the involved controller. If the controller is set
     * to autoRender, via Controller::$autoRender, then Dispatcher will render the view.
     *
     * Actions in CakePHP can be any public method on a controller, that is not declared in Controller. If you
     * want controller methods to be public and in-accessible by URL, then prefix them with a `_`.
     * For example `public function _loadPosts() { }` would not be accessible via URL. Private and protected methods
     * are also not accessible via URL.
     *
     * If no controller of given name can be found, invoke() will throw an exception.
     * If the controller is found, and the action is not found an exception will be thrown.
     *
     * @param \Cake\Network\Request $request Request object to dispatch.
     * @param \Cake\Network\Response $response Response object to put the results of the dispatch into.
     * @return string|null if `$request['return']` is set then it returns response body, null otherwise
     * @throws \Cake\Routing\Exception\MissingControllerException When the controller is missing.
     */
    public function dispatch(Request $request, Response $response)
    {
        $beforeEvent = $this->dispatchEvent('Dispatcher.beforeDispatch', compact('request', 'response'));

        $request = $beforeEvent->data['request'];
        if ($beforeEvent->result instanceof Response) {
            if (isset($request->params['return'])) {
                return $beforeEvent->result->body();
            }
            $beforeEvent->result->send();

            return null;
        }

        $controller = false;
        if (isset($beforeEvent->data['controller'])) {
            $controller = $beforeEvent->data['controller'];
        }

        if (!($controller instanceof Controller)) {
            throw new MissingControllerException([
                'class' => $request->params['controller'],
                'plugin' => empty($request->params['plugin']) ? null : $request->params['plugin'],
                'prefix' => empty($request->params['prefix']) ? null : $request->params['prefix'],
                '_ext' => empty($request->params['_ext']) ? null : $request->params['_ext']
            ]);
        }

        $response = $this->_invoke($controller);
        if (isset($request->params['return'])) {
            return $response->body();
        }

        $afterEvent = $this->dispatchEvent('Dispatcher.afterDispatch', compact('request', 'response'));
        $afterEvent->data['response']->send();
    }

    /**
     * Initializes the components and models a controller will be using.
     * Triggers the controller action and invokes the rendering if Controller::$autoRender
     * is true. If a response object is returned by controller action that is returned
     * else controller's $response property is returned.
     *
     * @param \Cake\Controller\Controller $controller Controller to invoke
     * @return \Cake\Network\Response The resulting response object
     * @throws \LogicException If data returned by controller action is not an
     *   instance of Response
     */
    protected function _invoke(Controller $controller)
    {
        $result = $controller->startupProcess();
        if ($result instanceof Response) {
            return $result;
        }

        $response = $controller->invokeAction();
        if ($response !== null && !($response instanceof Response)) {
            throw new LogicException('Controller action can only return an instance of Response');
        }

        if (!$response && $controller->autoRender) {
            $response = $controller->render();
        } elseif (!$response) {
            $response = $controller->response;
        }

        $result = $controller->shutdownProcess();
        if ($result instanceof Response) {
            return $result;
        }

        return $response;
    }

    /**
     * Add a filter to this dispatcher.
     *
     * The added filter will be attached to the event manager used
     * by this dispatcher.
     *
     * @param \Cake\Event\EventListenerInterface $filter The filter to connect. Can be
     *   any EventListenerInterface. Typically an instance of \Cake\Routing\DispatcherFilter.
     * @return void
     */
    public function addFilter(EventListenerInterface $filter)
    {
        $this->_filters[] = $filter;
        $this->eventManager()->on($filter);
    }

    /**
     * Get the list of connected filters.
     *
     * @return array
     */
    public function filters()
    {
        return $this->_filters;
    }
}


text:
<?php
use PDFfiller\OAuth2\Client\Provider\User;

$provider = require_once __DIR__ . '/../bootstrap/initWithFabric.php';

$e = User::me($provider);
dd($e);


text:
package com.cloud.network.cisco;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="network_asa1000v_map")
public class NetworkAsa1000vMapVO implements NetworkAsa1000vMap {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="id")
    private long id;

    @Column(name="network_id")
    private long networkId;

    @Column(name="asa1000v_id")
    private long asa1000vId;

    public NetworkAsa1000vMapVO() {
    }

    public NetworkAsa1000vMapVO(long networkId, long asa1000vId) {
        super();
        this.networkId = networkId;
        this.asa1000vId = asa1000vId;
    }

	@Override
	public long getId() {
		return id;
	}

	@Override
	public long getAsa1000vId() {
		return asa1000vId;
	}

	public void setAsa1000vId(long asa1000vId) {
		this.asa1000vId = asa1000vId;
	}

	@Override
	public long getNetworkId() {
		return networkId;
	}

	public void setNetworkId(long networkId) {
		this.networkId = networkId;
	}

}


text:
"use strict";

var cons = require('consolidate')
  , swig = require('swig')
  , conf = require('./conf/')
  , tzToMinutes = require('./util/date.js').tzToMinutes
  , filters = require('./filters.js')
  , debug = conf.env != 'production';

swig.init({
    root: conf.template_dir
  , allowErrors: debug
  , cache: !debug
  , tzOffset: tzToMinutes(conf.time_zone)
  , filters: filters
});

exports.setup = function setup(app) {
  app.set('views', conf.template_dir);
  app.set('view engine', 'html');
  app.set('view options', { layout: false });
  app.engine('.html', cons.swig);
};

exports.swig = swig;


text: [iOS 11-12] Forwards notifications to your Slack channel.


text:
<?php
class Calendar_model extends CI_Model {

    protected $user_id;
    function __construct() {
        parent::__construct();
        $this->user_id = $this->session->userdata['salon_user']['id'];
    }
}


text:
using System.Collections.Generic;
using Bari.Core.Build;
using Bari.Core.Build.Dependencies;
using Bari.Core.Model;
using Bari.Plugins.Csharp.Model;

namespace Bari.Plugins.Csharp.Build.Dependencies
{
    public class CsharpParametersDependencies : InheritableProjectParametersDependencies<CsharpProjectParameters, CsharpProjectParametersDef>
    {
        CsharpParametersDependencies(Project project) : base(project, "csharp")
        {
        }

        public static void Add(Project project, ICollection<IDependencies> target)
        {
            if (project.HasParameters("csharp"))
                target.Add(new CsharpParametersDependencies(project));
        }
    }
}


text:
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.invalidation;

import android.accounts.Account;
import android.app.Application;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SyncResult;
import android.os.Bundle;
import android.os.Handler;

import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.library_loader.LibraryProcessType;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.components.invalidation.PendingInvalidation;
import org.chromium.content.app.ContentApplication;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.sync.ModelType;
import org.chromium.sync.ModelTypeHelper;
import org.chromium.sync.signin.ChromeSigninController;

import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

/**
 * A Sync adapter that receives invalidations from {@link InvalidationClientService} and dispatches
 * it to the native side with a caching layer in {@link DelayedInvalidationsController}.
 */
public abstract class ChromiumSyncAdapter extends AbstractThreadedSyncAdapter {
    private static final String TAG = "cr.invalidation";

    private final Application mApplication;
    private final boolean mAsyncStartup;

    public ChromiumSyncAdapter(Context context, Application application) {
        super(context, false);
        mApplication = application;
        mAsyncStartup = useAsyncStartup();
    }

    protected abstract boolean useAsyncStartup();

    @Override
    public void onPerformSync(Account account, Bundle extras, String authority,
            ContentProviderClient provider, SyncResult syncResult) {
        if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE)) {
            Account signedInAccount = ChromeSigninController.get(getContext()).getSignedInUser();
            if (account.equals(signedInAccount)) {
                ContentResolver.setIsSyncable(account, authority, 1);
            } else {
                ContentResolver.setIsSyncable(account, authority, 0);
            }
            return;
        }
        PendingInvalidation invalidation = new PendingInvalidation(extras);

        DelayedInvalidationsController controller = DelayedInvalidationsController.getInstance();
        if (!controller.shouldNotifyInvalidation(extras)) {
            controller.addPendingInvalidation(getContext(), account.name, invalidation);
            return;
        }

        // Browser startup is asynchronous, so we will need to wait for startup to finish.
        Semaphore semaphore = new Semaphore(0);

        // Configure the callback with all the data it needs.
        BrowserStartupController.StartupCallback callback =
                getStartupCallback(mApplication, account.name, invalidation, syncResult, semaphore);
        startBrowserProcess(callback, syncResult, semaphore);

        try {
            // This code is only synchronously calling a single native method
            // to trigger and asynchronous sync cycle, so 5 minutes is generous.
            if (!semaphore.tryAcquire(5, TimeUnit.MINUTES)) {
                Log.w(TAG, "Sync request timed out!");
                syncResult.stats.numIoExceptions++;
            }
        } catch (InterruptedException e) {
            Log.w(TAG, "Got InterruptedException when trying to request an invalidation.", e);
            // Using numIoExceptions so Android will treat this as a soft error.
            syncResult.stats.numIoExceptions++;
        }
    }

    private void startBrowserProcess(final BrowserStartupController.StartupCallback callback,
            final SyncResult syncResult, Semaphore semaphore) {
        try {
            ThreadUtils.runOnUiThreadBlocking(new Runnable() {
                @Override
                @SuppressFBWarnings("DM_EXIT")
                public void run() {
                    ContentApplication.initCommandLine(getContext());
                    if (mAsyncStartup) {
                        try {
                            BrowserStartupController.get(mApplication,
                                                             LibraryProcessType.PROCESS_BROWSER)
                                    .startBrowserProcessesAsync(callback);
                        } catch (ProcessInitException e) {
                            Log.e(TAG, "Unable to load native library.", e);
                            System.exit(-1);
                        }
                    } else {
                        startBrowserProcessesSync(callback);
                    }
                }
            });
        } catch (RuntimeException e) {
            // It is still unknown why we ever experience this. See http://crbug.com/180044.
            Log.w(TAG, "Got exception when trying to notify the invalidation.", e);
            // Using numIoExceptions so Android will treat this as a soft error.
            syncResult.stats.numIoExceptions++;
            semaphore.release();
        }
    }

    @SuppressFBWarnings("DM_EXIT")
    private void startBrowserProcessesSync(
            final BrowserStartupController.StartupCallback callback) {
        try {
            BrowserStartupController.get(mApplication, LibraryProcessType.PROCESS_BROWSER)
                    .startBrowserProcessesSync(false);
        } catch (ProcessInitException e) {
            Log.e(TAG, "Unable to load native library.", e);
            System.exit(-1);
        }
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                callback.onSuccess(false);
            }
        });
    }

    private BrowserStartupController.StartupCallback getStartupCallback(final Context context,
            final String account, final PendingInvalidation invalidation,
            final SyncResult syncResult, final Semaphore semaphore) {
        return new BrowserStartupController.StartupCallback() {
            @Override
            public void onSuccess(boolean alreadyStarted) {
                // Startup succeeded, so we can notify the invalidation.
                notifyInvalidation(invalidation.mObjectSource, invalidation.mObjectId,
                        invalidation.mVersion, invalidation.mPayload);
                semaphore.release();
            }

            @Override
            public void onFailure() {
                // The startup failed, so we defer the invalidation.
                DelayedInvalidationsController.getInstance().addPendingInvalidation(
                        context, account, invalidation);
                // Using numIoExceptions so Android will treat this as a soft error.
                syncResult.stats.numIoExceptions++;
                semaphore.release();
            }
        };
    }

    @VisibleForTesting
    public void notifyInvalidation(
            int objectSource, String objectId, long version, String payload) {
        InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile())
                .notifyInvalidationToNativeChrome(objectSource, objectId, version, payload);

        // Count the number of sessions sync invalidations to evaluate effectiveness of
        // AndroidSessionNotifications field trial. The histogram is recorded here because
        // RecordHistogram requires the native library to be loaded.
        if (ModelTypeHelper.toNotificationType(ModelType.SESSIONS).equals(objectId)) {
            RecordHistogram.recordBooleanHistogram("Sync.InvalidationSessionsAndroid", true);
        }
    }
}


text:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	echo $css;
	if(isset($image->content))
	{
		$options = json_decode($image->options);
		if(!isset($options->animation))
			$options->animation = '';
		if(!isset($options->class_sfx))
			$options->class_sfx = '';
		if(!isset($options->alignment))
			$options->alignment = '';
		if(!isset($options->width))
			$options->width = '';
		if(!isset($options->height))
			$options->height = '';
		if(!isset($options->style))
			$options->style = '';

		echo '
animation.' '.$options->class_sfx.'" style="text-align: '.$options->alignment.'" >';
		if(!isset($options->size))
			$options->size = '';
		if(!isset($options->style))
			$options->style = '';

		if($options->width != '' && $options->height != '')
			$size = 'width: '.$options->width.'px; height: '.$options->height.'px';
		else if($options->width != '')
			$size = 'width: '.$options->width.'px;';
		else if($options->height != '')
			$size = 'height: '.$options->height.'px;';
		else
			$size = '';

		$responsive = 'img-responsive';
		if(isset($options->link) && $options->link != '' && strlen($options->link) > 7)
			echo 'link.'">content).'" style="'.$size.'" alt="'.$image->title.'" class="'.$options->style.' '.$responsive.'">';
		else
			echo 'content).'" style="'.$size.'" alt="'.$image->title.'" class="'.$options->style.' '.$responsive.'">';
		echo '
';
	}
?>


text:
#include "EventListener.hpp"

/*
Helper class from which you are supposed to inherit the objects that want to be listener for specific event.
The help comes from the fact that you don't have to take care of removing delegates before destroying subclass of EventListener,
since ~EventListener takes already care of this for you.
*/

EventListener::EventListener()
{
}

EventListener::~EventListener()
{
#if LOG_OUTPUT_CONSOLE
	std::string methodName = _FUNCTION_NAME_;
	std::ostringstream oss;
	oss << "dctr called";
	Utils::PrintDebugLog(methodName, oss.str());
#endif

	for(const auto& event : m_registeredEvents)
	{
		delete event.second;
		EventManager::RemoveListener(event.first, event.second);
	}
}


text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.designer.propertyTable.renderers;

import com.intellij.designer.model.PropertiesContainer;
import com.intellij.designer.model.PropertyContext;
import com.intellij.designer.propertyTable.PropertyRenderer;
import com.intellij.designer.propertyTable.PropertyTable;
import com.intellij.openapi.util.NlsSafe;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

/**
 * This is convenient class for implementing property renderers which
 * are based on JLabel.
 *
 * @author Anton Katilin
 * @author Vladimir Kondratyev
 */
public class LabelPropertyRenderer extends JLabel implements PropertyRenderer {
  @Nullable private final @Nls String myStaticText;

  public LabelPropertyRenderer(@Nullable @Nls String staticText) {
    myStaticText = staticText;
    setOpaque(true);
    putClientProperty("html.disable", true);
    setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
  }

  @Override
  @NotNull
  public JComponent getComponent(@Nullable PropertiesContainer container,
                                 PropertyContext context,
                                 @Nullable Object value,
                                 boolean selected,
                                 boolean hasFocus) {
    // Reset text and icon
    setText(null);
    setIcon(null);

    // Background and foreground
    PropertyTable.updateRenderer(this, selected);

    if (value != null) {
      customize(value);
    }

    return this;
  }

  /**
   * Here all subclasses should customize their text, icon and other
   * attributes. Note, that background and foreground colors are already
   * set.
   */
  protected void customize(@NotNull Object value) {
    @NlsSafe String stringValue = value.toString();
    setText(myStaticText != null ? myStaticText : stringValue);
  }
}


text:
package com.siyeh.ig.controlflow;

import com.intellij.codeInsight.BlockUtils;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.ConstantExpressionUtil;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.psiutils.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.*;
import java.util.function.Supplier;

public class PointlessBooleanExpressionInspection extends BaseInspection {
  private enum BooleanExpressionKind {
    USELESS, USELESS_WITH_SIDE_EFFECTS, UNKNOWN
  }

  static final Set<IElementType> booleanTokens = new HashSet<>();
  static {
    booleanTokens.add(JavaTokenType.ANDAND);
    booleanTokens.add(JavaTokenType.AND);
    booleanTokens.add(JavaTokenType.OROR);
    booleanTokens.add(JavaTokenType.OR);
    booleanTokens.add(JavaTokenType.XOR);
    booleanTokens.add(JavaTokenType.EQEQ);
    booleanTokens.add(JavaTokenType.NE);
  }

  @SuppressWarnings("PublicField")
  public boolean m_ignoreExpressionsContainingConstants = true;

  @Override
  public JComponent createOptionsPanel() {
    return new SingleCheckboxOptionsPanel(
      InspectionGadgetsBundle.message("pointless.boolean.expression.ignore.option"), this, "m_ignoreExpressionsContainingConstants"
    );
  }

  @Override
  public boolean isEnabledByDefault() {
    return true;
  }

  @Override
  @NotNull
  public String buildErrorString(Object... infos) {
    final String replacement = (String)infos[1];
    final PsiExpression expression = (PsiExpression)infos[0];
    if (replacement.isEmpty() && expression instanceof PsiAssignmentExpression) {
      return InspectionGadgetsBundle.message("boolean.expression.does.not.modify.problem.descriptor", expression.getText());
    }
    return InspectionGadgetsBundle.message("boolean.expression.can.be.simplified.problem.descriptor", replacement);
  }

  StringBuilder buildSimplifiedExpression(@Nullable PsiExpression expression, StringBuilder out, CommentTracker tracker) {
    if (expression instanceof PsiAssignmentExpression) {
      buildSimplifiedAssignmentExpression((PsiAssignmentExpression)expression, out, tracker);
    }
    else if (expression instanceof PsiPolyadicExpression) {
      buildSimplifiedPolyadicExpression((PsiPolyadicExpression)expression, out, tracker);
    }
    else if (expression instanceof PsiPrefixExpression) {
      buildSimplifiedPrefixExpression((PsiPrefixExpression)expression, out, tracker);
    }
    else if (expression instanceof PsiParenthesizedExpression) {
      final PsiParenthesizedExpression parenthesizedExpression = (PsiParenthesizedExpression)expression;
      final PsiExpression expression1 = parenthesizedExpression.getExpression();
      out.append('(');
      buildSimplifiedExpression(expression1, out, tracker);
      out.append(')');
    }
    else if (expression != null) {
      out.append(tracker.text(expression));
    }
    return out;
  }

  private void buildSimplifiedPolyadicExpression(PsiPolyadicExpression expression,
                                                 StringBuilder out,
                                                 CommentTracker tracker) {
    final IElementType tokenType = expression.getOperationTokenType();
    final PsiExpression[] operands = expression.getOperands();
    final List<PsiExpression> expressions = new ArrayList<>();
    if (tokenType.equals(JavaTokenType.ANDAND) || tokenType.equals(JavaTokenType.AND)) {
      for (PsiExpression operand : operands) {
        if (evaluate(operand) == Boolean.TRUE) {
          continue;
        }
        if (evaluate(operand) == Boolean.FALSE) {
          out.append(PsiKeyword.FALSE);
          return;
        }
        expressions.add(operand);
      }
      if (expressions.isEmpty()) {
        out.append(PsiKeyword.TRUE);
        return;
      }
      buildSimplifiedExpression(expressions, tokenType.equals(JavaTokenType.ANDAND) ? "&&" : "&", false, out, tracker);
    } else if (tokenType.equals(JavaTokenType.OROR) || tokenType.equals(JavaTokenType.OR)) {
      for (PsiExpression operand : operands) {
        if (evaluate(operand) == Boolean.FALSE) {
          continue;
        }
        if (evaluate(operand) == Boolean.TRUE) {
          out.append(PsiKeyword.TRUE);
          return;
        }
        expressions.add(operand);
      }
      if (expressions.isEmpty()) {
        out.append(PsiKeyword.FALSE);
        return;
      }
      buildSimplifiedExpression(expressions, tokenType.equals(JavaTokenType.OROR) ? "||" : "|", false, out, tracker);
    }
    else if (tokenType.equals(JavaTokenType.XOR) || tokenType.equals(JavaTokenType.NE)) {
      boolean negate = false;
      for (PsiExpression operand : operands) {
        if (evaluate(operand) == Boolean.FALSE) {
          continue;
        }
        if (evaluate(operand) == Boolean.TRUE) {
          negate = !negate;
          continue;
        }
        expressions.add(operand);
      }
      if (expressions.isEmpty()) {
        if (negate) {
          out.append(PsiKeyword.TRUE);
        }
        else {
          out.append(PsiKeyword.FALSE);
        }
        return;
      }
      buildSimplifiedExpression(expressions, tokenType.equals(JavaTokenType.XOR) ? "^" : "!=", negate, out, tracker);
    }
    else if (tokenType.equals(JavaTokenType.EQEQ)) {
      boolean negate = false;
      for (PsiExpression operand : operands) {
        if (evaluate(operand) == Boolean.TRUE) {
          continue;
        }
        if (evaluate(operand) == Boolean.FALSE) {
          negate = !negate;
          continue;
        }
        expressions.add(operand);
      }
      if (expressions.isEmpty()) {
        if (negate) {
          out.append(PsiKeyword.FALSE);
        }
        else {
          out.append(PsiKeyword.TRUE);
        }
        return;
      }
      buildSimplifiedExpression(expressions, "==", negate, out, tracker);
    }
    else {
      out.append(tracker.text(expression));
    }
  }

  private void buildSimplifiedExpression(List<PsiExpression> expressions,
                                         String token,
                                         boolean negate,
                                         StringBuilder out,
                                         CommentTracker tracker) {
    if (expressions.size() == 1) {
      final PsiExpression expression = expressions.get(0);
      if (!negate) {
        out.append(tracker.text(expression));
        return;
      }
      if (ComparisonUtils.isComparison(expression)) {
        final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)expression;
        final String negatedComparison = ComparisonUtils.getNegatedComparison(binaryExpression.getOperationTokenType());
        final PsiExpression lhs = binaryExpression.getLOperand();
        final PsiExpression rhs = binaryExpression.getROperand();
        assert rhs != null;
        out.append(tracker.text(lhs)).append(negatedComparison).append(tracker.text(rhs));
      }
      else {
        out.append('!').append(tracker.text(expression, ParenthesesUtils.PREFIX_PRECEDENCE));
      }
    }
    else {
      if (negate) {
        out.append("!(");
      }
      boolean useToken = false;
      for (PsiExpression expression : expressions) {
        if (useToken) {
          out.append(token);
          final PsiElement previousSibling = expression.getPrevSibling();
          if (previousSibling instanceof PsiWhiteSpace) {
            out.append(previousSibling.getText());
          }
        }
        else {
          useToken = true;
        }
        buildSimplifiedExpression(expression, out, tracker);
        final PsiElement nextSibling = expression.getNextSibling();
        if (nextSibling instanceof PsiWhiteSpace) {
          out.append(nextSibling.getText());
        }
      }
      if (negate) {
        out.append(')');
      }
    }
  }

  private void buildSimplifiedPrefixExpression(PsiPrefixExpression expression, StringBuilder out, CommentTracker tracker) {
    final PsiJavaToken sign = expression.getOperationSign();
    final IElementType tokenType = sign.getTokenType();
    final PsiExpression operand = expression.getOperand();
    if (JavaTokenType.EXCL.equals(tokenType)) {
      final Boolean value = evaluate(operand);
      if (value == Boolean.TRUE) {
        out.append(PsiKeyword.FALSE);
        return;
      }
      else if (value == Boolean.FALSE) {
        out.append(PsiKeyword.TRUE);
        return;
      }
    }
    buildSimplifiedExpression(operand, out.append(sign.getText()), tracker);
  }

  private void buildSimplifiedAssignmentExpression(PsiAssignmentExpression expression, @NonNls StringBuilder out, CommentTracker tracker) {
    final IElementType tokenType = expression.getOperationTokenType();
    final PsiExpression lhs = expression.getLExpression();

    if (tokenType == JavaTokenType.ANDEQ) {
      if (evaluate(expression.getRExpression()) == Boolean.TRUE) {
        if (expression.getParent() instanceof PsiExpressionStatement) {
          return;
        }
        out.append(lhs.getText());
      }
      else {
        out.append(lhs.getText()).append("=false");
      }
      tracker.markUnchanged(lhs);
      return;
    }
    else if (tokenType == JavaTokenType.OREQ) {
      if (evaluate(expression.getRExpression()) == Boolean.FALSE) {
        if (expression.getParent() instanceof PsiExpressionStatement) {
          return;
        }
        out.append(lhs.getText());
      }
      else {
        out.append(lhs.getText()).append("=true");
      }
      tracker.markUnchanged(lhs);
      return;
    }
    tracker.markUnchanged(lhs);
    out.append(lhs.getText()).append(expression.getOperationSign().getText());
    buildSimplifiedExpression(expression.getRExpression(), out, tracker);
  }

  @Override
  public InspectionGadgetsFix buildFix(Object... infos) {
    final String replacement = (String)infos[1];
    if (replacement.isEmpty() && infos[0] instanceof PsiAssignmentExpression) {
      return new RemovePointlessBooleanExpressionFix();
    }
    boolean hasSideEffect = (boolean)infos[2];
    return new PointlessBooleanExpressionFix(hasSideEffect);
  }

  private static class RemovePointlessBooleanExpressionFix extends InspectionGadgetsFix {

    @Nls
    @NotNull
    @Override
    public String getFamilyName() {
      return InspectionGadgetsBundle.message("boolean.expression.remove.compound.assignment.quickfix");
    }

    @Override
    protected void doFix(Project project, ProblemDescriptor descriptor) {
      final PsiElement element = descriptor.getPsiElement();
      if (!(element instanceof PsiAssignmentExpression)) {
        return;
      }
      final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)element;
      final PsiElement parent = assignmentExpression.getParent();
      assert parent instanceof PsiStatement;
      final List<PsiExpression> sideEffects = SideEffectChecker.extractSideEffectExpressions(assignmentExpression.getLExpression());
      final CommentTracker commentTracker = new CommentTracker();
      for (PsiExpression sideEffect : sideEffects) {
        commentTracker.markUnchanged(sideEffect);
      }
      final PsiStatement[] statements = StatementExtractor.generateStatements(sideEffects, assignmentExpression);
      if (statements.length > 0) {
        BlockUtils.addBefore((PsiStatement)parent, statements);
      }
      commentTracker.deleteAndRestoreComments(parent);
    }
  }

  private class PointlessBooleanExpressionFix extends InspectionGadgetsFix {
    private final boolean myHasSideEffect;

    PointlessBooleanExpressionFix(boolean hasSideEffect) {
      myHasSideEffect = hasSideEffect;
    }

    @Nls
    @NotNull
    @Override
    public String getName() {
      return myHasSideEffect
             ? InspectionGadgetsBundle.message("constant.conditional.expression.simplify.quickfix.sideEffect")
             : InspectionGadgetsBundle.message("constant.conditional.expression.simplify.quickfix");
    }

    @Override
    @NotNull
    public String getFamilyName() {
      return InspectionGadgetsBundle.message("constant.conditional.expression.simplify.quickfix");
    }

    @Override
    public void doFix(Project project, ProblemDescriptor descriptor) {
      final PsiElement element = descriptor.getPsiElement();
      if (!(element instanceof PsiExpression)) {
        return;
      }
      PsiExpression expression = (PsiExpression)element;
      CommentTracker tracker = new CommentTracker();
      String simplifiedExpression = buildSimplifiedExpression(expression, new StringBuilder(), tracker).toString();
      boolean isConstant = simplifiedExpression.equals("true") || simplifiedExpression.equals("false");
      if (isConstant && myHasSideEffect) {
        CodeBlockSurrounder surrounder = CodeBlockSurrounder.forExpression(expression);
        if (surrounder == null) return;
        CodeBlockSurrounder.SurroundResult result = surrounder.surround();
        expression = result.getExpression();
        PsiStatement anchor = result.getAnchor();
        List<PsiExpression> sideEffects = extractSideEffects(expression);
        for (PsiExpression sideEffect : sideEffects) {
          tracker.markUnchanged(sideEffect);
        }
        PsiStatement[] statements = StatementExtractor.generateStatements(sideEffects, expression);
        if (statements.length > 0) {
          BlockUtils.addBefore(anchor, statements);
        }
      }
      expression = (PsiExpression)tracker.replaceAndRestoreComments(expression, simplifiedExpression);
      PsiExpression topExpression = ExpressionUtils.getTopLevelExpression(expression);
      if (getExpressionKind(topExpression) == BooleanExpressionKind.USELESS) {
        tracker = new CommentTracker();
        simplifiedExpression = buildSimplifiedExpression(topExpression, new StringBuilder(), tracker).toString();
        tracker.replaceAndRestoreComments(topExpression, simplifiedExpression);
      }
    }

    private List<PsiExpression> extractSideEffects(PsiExpression expression) {
      if (!(expression instanceof PsiPolyadicExpression)) {
        return Collections.emptyList();
      }
      PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)expression;
      IElementType sign = polyadicExpression.getOperationTokenType();
      Boolean stopper = (sign == JavaTokenType.ANDAND) ? Boolean.FALSE : sign == JavaTokenType.OROR ? Boolean.TRUE : null;
      PsiExpression[] operands = polyadicExpression.getOperands();
      List<PsiExpression> sideEffects = new ArrayList<>();
      for (PsiExpression operand : operands) {
        if (stopper != null && stopper.equals(evaluate(operand))) {
          break;
        }
        sideEffects.addAll(SideEffectChecker.extractSideEffectExpressions(operand));
      }
      return sideEffects;
    }
  }

  @Override
  public BaseInspectionVisitor buildVisitor() {
    return new PointlessBooleanExpressionVisitor();
  }

  private class PointlessBooleanExpressionVisitor extends BaseInspectionVisitor {

    @Override
    public void visitPolyadicExpression(PsiPolyadicExpression expression) {
      super.visitPolyadicExpression(expression);
      checkExpression(expression);
    }

    @Override
    public void visitPrefixExpression(PsiPrefixExpression expression) {
      super.visitPrefixExpression(expression);
      checkExpression(expression);
    }

    @Override
    public void visitAssignmentExpression(PsiAssignmentExpression expression) {
      super.visitAssignmentExpression(expression);
      checkExpression(expression);
    }

    private void checkExpression(PsiExpression expression) {
      BooleanExpressionKind kind = getExpressionKind(expression);
      if (kind == BooleanExpressionKind.UNKNOWN) {
        return;
      }
      final PsiElement parent = ParenthesesUtils.getParentSkipParentheses(expression);
      if (parent instanceof PsiExpression && getExpressionKind((PsiExpression)parent) != BooleanExpressionKind.UNKNOWN) {
        return;
      }

      final String replacement = buildSimplifiedExpression(expression, new StringBuilder(), new CommentTracker()).toString();
      final Supplier<PsiElement> newBodySupplier =
        () -> JavaPsiFacade.getElementFactory(expression.getProject()).createExpressionFromText(replacement, expression);
      if (parent instanceof PsiLambdaExpression && !LambdaUtil.isSafeLambdaBodyReplacement((PsiLambdaExpression)parent, newBodySupplier)) {
        return;
      }

      registerError(expression, expression, replacement, kind == BooleanExpressionKind.USELESS_WITH_SIDE_EFFECTS);
    }
  }

  @NotNull
  private BooleanExpressionKind getExpressionKind(PsiExpression expression) {
    if (expression instanceof PsiPrefixExpression || expression instanceof PsiAssignmentExpression) {
      return evaluate(expression) != null ? BooleanExpressionKind.USELESS : BooleanExpressionKind.UNKNOWN;
    }
    if (expression instanceof PsiPolyadicExpression) {
      final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)expression;
      final IElementType sign = polyadicExpression.getOperationTokenType();
      if (!booleanTokens.contains(sign)) {
        return BooleanExpressionKind.UNKNOWN;
      }
      final PsiExpression[] operands = polyadicExpression.getOperands();
      boolean containsConstant = false;
      boolean stopCheckingSideEffects = false;
      boolean sideEffectMayBeRemoved = false;
      boolean reducedToConstant = false;
      for (PsiExpression operand : operands) {
        if (operand == null) {
          return BooleanExpressionKind.UNKNOWN;
        }
        final PsiType type = operand.getType();
        if (type == null || !type.equals(PsiType.BOOLEAN) && !type.equalsToText(CommonClassNames.JAVA_LANG_BOOLEAN)) {
          return BooleanExpressionKind.UNKNOWN;
        }
        if (!stopCheckingSideEffects && SideEffectChecker.mayHaveSideEffects(operand)) {
          sideEffectMayBeRemoved = true;
          continue;
        }
        Boolean value = evaluate(operand);
        if (value != null) {
          containsConstant = true;
          if ((JavaTokenType.ANDAND.equals(sign) && !value) || (JavaTokenType.OROR.equals(sign) && value)) {
            stopCheckingSideEffects = true;
            reducedToConstant = true;
          }
          if ((JavaTokenType.AND.equals(sign) && !value) || (JavaTokenType.OR.equals(sign) && value)) {
            reducedToConstant = true;
          }
        }
      }
      if (containsConstant) {
        if (sideEffectMayBeRemoved && reducedToConstant) {
          return CodeBlockSurrounder.canSurround(expression)
                 ? BooleanExpressionKind.USELESS_WITH_SIDE_EFFECTS
                 : BooleanExpressionKind.UNKNOWN;
        }
        return BooleanExpressionKind.USELESS;
      }
    }
    return BooleanExpressionKind.UNKNOWN;
  }

  @Nullable
  Boolean evaluate(@Nullable PsiExpression expression) {
    if (expression == null || m_ignoreExpressionsContainingConstants && containsReference(expression)) {
      return null;
    }
    if (expression instanceof PsiParenthesizedExpression) {
      final PsiParenthesizedExpression parenthesizedExpression = (PsiParenthesizedExpression)expression;
      return evaluate(parenthesizedExpression.getExpression());
    }
    if (expression instanceof PsiPolyadicExpression) {
      final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)expression;
      final IElementType tokenType = polyadicExpression.getOperationTokenType();
      if (tokenType.equals(JavaTokenType.OROR)) {
        final PsiExpression[] operands = polyadicExpression.getOperands();
        for (PsiExpression operand : operands) {
          if (SideEffectChecker.mayHaveSideEffects(operand)) {
            return null;
          }
          if (evaluate(operand) == Boolean.TRUE) {
            return Boolean.TRUE;
          }
        }
      }
      else if (tokenType.equals(JavaTokenType.ANDAND)) {
        final PsiExpression[] operands = polyadicExpression.getOperands();
        for (PsiExpression operand : operands) {
          if (SideEffectChecker.mayHaveSideEffects(operand)) {
            return null;
          }
          if (evaluate(operand) == Boolean.FALSE) {
            return Boolean.FALSE;
          }
        }
      }
    }
    else if (expression instanceof PsiPrefixExpression) {
      final PsiPrefixExpression prefixExpression = (PsiPrefixExpression)expression;
      final IElementType tokenType = prefixExpression.getOperationTokenType();
      if (JavaTokenType.EXCL.equals(tokenType)) {
        final PsiExpression operand = prefixExpression.getOperand();
        final Boolean b = evaluate(operand);
        if (b == Boolean.FALSE) {
          return Boolean.TRUE;
        } else if (b == Boolean.TRUE) {
          return Boolean.FALSE;
        }
      }
    }
    else if (expression instanceof PsiAssignmentExpression) {
      final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expression;
      final IElementType tokenType = assignmentExpression.getOperationTokenType();
      final PsiExpression rhs = assignmentExpression.getRExpression();
      if (JavaTokenType.ANDEQ.equals(tokenType) || JavaTokenType.OREQ.equals(tokenType)) {
        return evaluate(rhs);
      }
    }
    return (Boolean)ConstantExpressionUtil.computeCastTo(expression, PsiType.BOOLEAN);
  }

  private static boolean containsReference(@Nullable PsiExpression expression) {
    if (expression == null) {
      return false;
    }
    final ReferenceVisitor visitor = new ReferenceVisitor();
    expression.accept(visitor);
    return visitor.containsReference();
  }

  private static class ReferenceVisitor extends JavaRecursiveElementWalkingVisitor {

    private boolean referenceFound;

    @Override
    public void visitElement(@NotNull PsiElement element) {
      if (referenceFound) {
        return;
      }
      super.visitElement(element);
    }

    @Override
    public void visitReferenceExpression(PsiReferenceExpression expression) {
      final PsiElement target = expression.resolve();
      if (target instanceof PsiVariable && ((PsiVariable)target).hasModifierProperty(PsiModifier.FINAL) &&
          ((PsiVariable)target).hasInitializer()) {
        referenceFound = true;
      }
      else {
        super.visitReferenceExpression(expression);
      }
    }

    boolean containsReference() {
      return referenceFound;
    }
  }
}


text:
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Toppers Tips</title>
    <link rel="icon" type="image/x-icon" href="/img/favicon.ico">
    <!-- Auth0 Lock script -->
    <script src="http://cdn.auth0.com/js/lock/10.2/lock.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Montserrat" type="text/css">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato" type="text/css">
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">

    <base href="/">
  </head>
  <body id="toppersTipsBody" data-spy="scroll" data-target=".navbar" data-offset="60">
    <my-app>Loading...</my-app>
    <!-- https://www.sitepoint.com/building-an-interactive-navigation-bar/ -->
    <!-- http://www.w3schools.com/bootstrap/bootstrap_navbar.asp -->
    <!-- http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_theme_company_complete_animation -->
    <!-- http://www.w3schools.com/bootstrap/bootstrap_scrollspy.asp -->
    <!-- https://lbroudoux.wordpress.com/2016/07/05/dockerize-your-mean-application/ -->
    <!-- https://semaphoreci.com/community/tutorials/dockerizing-a-node-js-web-application -->

    <!-- http://www.codekitchen.ca/guide-to-structuring-and-building-a-restful-api-using-express-4/ -->
    <!-- http://stackoverflow.com/questions/5778245/expressjs-how-to-structure-an-application -->
    <!-- https://github.com/focusaurus/express_code_structure -->
    <!-- https://gist.github.com/branneman/8048520 -->

    <!-- https://www.npmjs.com/package/wavy -->
    <!-- https://github.com/DSKrepps/requireFrom -->
    <!-- http://stackoverflow.com/questions/34364880/expression-has-changed-after-it-was-checked -->

    <!-- http://blog.angular-university.io/angular2-ngmodule/ -->

    <!-- http://4dev.tech/2016/03/login-screen-and-authentication-with-angular2/ -->
    <!-- http://blog.thoughtram.io/angular/2016/02/22/angular-2-change-detection-explained.html -->

    <!--Routing-->
    <!--https://scotch.io/tutorials/routing-angular-2-single-page-apps-with-the-component-router-->

    <!--http://www.sohamkamani.com/blog/2016/06/30/docker-mongo-replica-set/-->

    <!--Database-->
    <!--http://thejackalofjavascript.com/re-architecting-a-firebase-app-in-node/-->
    <!--http://stackoverflow.com/questions/29223835/mongodb-vs-firebase-->
    <!--https://mongodb-documentation.readthedocs.io/en/latest/ecosystem/tutorial/install-mongodb-on-amazon-ec2.html-->
    <!--https://scalegrid.io/blog/secure-mongodb-deployment-on-amazon-aws/-->
    <!--http://serverfault.com/questions/737356/aws-nodejs-connecting-app-to-mongodb-on-another-ec2-instance-->
    <!--http://docs.aws.amazon.com/quickstart/latest/mongodb/welcome.html-->

    <!--Auth 0-->
    <!--https://auth0.com/rules/roles-creation-->
    <!--https://auth0.com/docs/rules-->
    <!--https://auth0.com/university/2/18/how-to-use-auth0-s-rules-feature-->
    <!--https://auth0.com/docs/libraries/lock/v10/customization-->

    <script>
          $(document).ready(function(){
            // Add smooth scrolling to all links in navbar + footer link
            $(".navbar a, footer a[href='#myPage']").on('click', function(event) {
              // Make sure this.hash has a value before overriding default behavior
              if (this.hash !== "") {
                // Prevent default anchor click behavior
                event.preventDefault();

                // Store hash
                var hash = this.hash;

                // Using jQuery's animate() method to add smooth page scroll
                // The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
                $('html, body').animate({
                  scrollTop: $(hash).offset().top
                }, 900, function(){

                  // Add hash (#) to URL when done scrolling (default click behavior)
                  window.location.hash = hash;
                });
              } // End if
            });

            $(window).scroll(function() {
              $(".slideanim").each(function(){
                var pos = $(this).offset().top;

                var winTop = $(window).scrollTop();
                  if (pos < winTop + 600) {
                    $(this).addClass("slide");
                  }
              });
            });
          })
      </script>
  </body>

</html>


text:
// Package exec contains helper utilities for exec credential plugins.
package exec

import (
	"errors"
	"fmt"
	"os"

	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/runtime/serializer"
	"k8s.io/client-go/pkg/apis/clientauthentication"
	"k8s.io/client-go/pkg/apis/clientauthentication/install"
	"k8s.io/client-go/rest"
)

const execInfoEnv = "KUBERNETES_EXEC_INFO"

var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)

func init() {
	install.Install(scheme)
}

// LoadExecCredentialFromEnv is a helper-wrapper around LoadExecCredential that loads from the
// well-known KUBERNETES_EXEC_INFO environment variable.
//
// When the KUBERNETES_EXEC_INFO environment variable is not set or is empty, then this function
// will immediately return an error.
func LoadExecCredentialFromEnv() (runtime.Object, *rest.Config, error) {
	env := os.Getenv(execInfoEnv)
	if env == "" {
		return nil, nil, errors.New("KUBERNETES_EXEC_INFO env var is unset or empty")
	}
	return LoadExecCredential([]byte(env))
}

// LoadExecCredential loads the configuration needed for an exec plugin to communicate with a
// cluster.
//
// LoadExecCredential expects the provided data to be a serialized client.authentication.k8s.io
// ExecCredential object (of any version). If the provided data is invalid (i.e., it cannot be
// unmarshalled into any known client.authentication.k8s.io ExecCredential version), an error will
// be returned. A successfully unmarshalled ExecCredential will be returned as the first return
// value.
//
// If the provided data is successfully unmarshalled, but it does not contain cluster information
// (i.e., ExecCredential.Spec.Cluster == nil), then an error will be returned.
//
// Note that the returned rest.Config will use anonymous authentication, since the exec plugin has
// not returned credentials for this cluster yet.
func LoadExecCredential(data []byte) (runtime.Object, *rest.Config, error) {
	obj, gvk, err := codecs.UniversalDeserializer().Decode(data, nil, nil)
	if err != nil {
		return nil, nil, fmt.Errorf("decode: %w", err)
	}

	expectedGK := schema.GroupKind{
		Group: clientauthentication.SchemeGroupVersion.Group,
		Kind:  "ExecCredential",
	}
	if gvk.GroupKind() != expectedGK {
		return nil, nil, fmt.Errorf(
			"invalid group/kind: wanted %s, got %s",
			expectedGK.String(),
			gvk.GroupKind().String(),
		)
	}

	// Explicitly convert object here so that we can return a nicer error message above for when the
	// data represents an invalid type.
	var execCredential clientauthentication.ExecCredential
	if err := scheme.Convert(obj, &execCredential, nil); err != nil {
		return nil, nil, fmt.Errorf("cannot convert to ExecCredential: %w", err)
	}

	if execCredential.Spec.Cluster == nil {
		return nil, nil, errors.New("ExecCredential does not contain cluster information")
	}

	restConfig, err := rest.ExecClusterToConfig(execCredential.Spec.Cluster)
	if err != nil {
		return nil, nil, fmt.Errorf("cannot create rest.Config: %w", err)
	}

	return obj, restConfig, nil
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace MsTestToXunitConverter.xUnit
{
    class DisposeB : IDisposable
    {
        public void Cleanup()
        {

        }

        public void Dispose()
        {
            Cleanup();
            var x = 1 + 2;
        }
    }
}


text:
import {Component} from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent {
    title = 'app works!';

    public photos = [
        {src: 'assets/img/slider/pac-slider-image-1.jpg'},
        {src: 'assets/img/slider/pac-slider-image-2.jpg'},
        {src: 'assets/img/slider/pac-slider-image-3.jpg'},
        {src: 'assets/img/slider/pac-slider-image-4.jpg'},
        {src: 'assets/img/slider/pac-slider-image-5.jpg'},
        {src: 'assets/img/slider/pac-slider-image-6.jpg'}
    ]
}


text:
var fs = require('fs');
var _ = require('underscore');

module.exports = {

    create: function (data) {

        return new Promise(function (resolve, reject) {

            fs.readFile(__dirname +'/data.json', 'utf8', function (err, result) {
                if (err) {
                    return reject(err);
                }

                result = JSON.parse(result);

                var newId = 1;
                if (result.length) {
                    var maxItem = _(result).max(function (item) {
                        return item.id;
                    });
                    newId = maxItem.id + 1;
                }

                data.id = newId;
                result.push(data);

                var toStore = JSON.stringify(result);

                fs.writeFile(__dirname +'/data.json', toStore, 'utf8', function (err, result) {
                    if (err) {
                        return reject(err);
                    }

                    resolve(data);
                });
            });
        });
    },

    getAll: function () {

        return new Promise(function (resolve, reject) {

            fs.readFile(__dirname +'/data.json', 'utf8', function (err, result) {
                if (err) {
                    return reject(err);
                }

                result = JSON.parse(result);

                resolve(result);
            });
        });
    },

    getById: function (id) {

        return new Promise(function (resolve, reject) {

            fs.readFile(__dirname +'/data.json', 'utf8', function (err, result) {
                if (err) {
                    return reject(err);
                }

                result = JSON.parse(result);

                var item = _(result).findWhere({id: id});

                resolve(item);
            });
        });
    },

    updateById: function (id, data) {

        return new Promise(function (resolve, reject) {

            fs.readFile(__dirname +'/data.json', 'utf8', function (err, result) {
                if (err) {
                    return reject(err);
                }

                result = JSON.parse(result);

                var item = _(result).findWhere({id: id});

                _(item).extend(data);

                var toStore = JSON.stringify(result);

                fs.writeFile(__dirname +'/data.json', toStore, 'utf8', function (err, result) {
                    if (err) {
                        return reject(err);
                    }

                    resolve(item);
                });
            });
        });
    },

    removeById: function (id) {

        return new Promise(function (resolve, reject) {

            fs.readFile(__dirname +'/data.json', 'utf8', function (err, result) {
                if (err) {
                    return reject(err);
                }

                result = JSON.parse(result);

                var existItem = _(result).findWhere({id: id});
                if (!existItem) {
                    return reject('No se puede eliminar un item que no se encuentra en la base de datos.');
                }

                result = _(result).reject(function (item) {
                    return item.id === id;
                });

                var toStore = JSON.stringify(result);

                fs.writeFile(__dirname +'/data.json', toStore, 'utf8', function (err, result) {
                    if (err) {
                        return reject(err);
                    }

                    resolve();
                });
            });
        });
    }

};


text:
package org.shipkit.internal.gradle.java.tasks;

import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.DependencyArtifact;
import org.gradle.api.artifacts.ModuleDependency;
import org.shipkit.internal.gradle.util.StringUtil;
import org.shipkit.internal.notes.util.IOUtil;

import java.util.SortedSet;
import java.util.TreeSet;

public class CreateDependencyInfoFile {

    public static final String SEPARATOR = ":";
    public static final String NEWLINE = "\r\n";
    public static final String DEPENDENCY_INDENT = NEWLINE + " - ";
    public static final String ARTIFACT_INDENT = NEWLINE + "   - ";

    private static final String DESCRIPTION = "This file was generated by Shipkit Gradle plugin. " +
        "It contains all declared runtime dependencies of the project. See http://dependency-info.shipkit.org." + NEWLINE;

    public void createDependencyInfoFile(CreateDependencyInfoFileTask task) {
        String result = "# Description" + NEWLINE
            + DESCRIPTION + NEWLINE
            + "# Dependencies";

        //sorting dependencies to assure that they are always in the same order
        //without depending on Gradle implementation
        SortedSet<String> dependencies = new TreeSet<>();
        for (Dependency dependency: task.getConfiguration().getAllDependencies()) {
            if (dependency instanceof ModuleDependency) {
                String dep = getDependencyWithArtifacts(task, (ModuleDependency) dependency);
                dependencies.add(dep);
            }
        }

        result += DEPENDENCY_INDENT + StringUtil.join(dependencies, DEPENDENCY_INDENT);

        IOUtil.writeFile(task.getOutputFile(), result.toString());
    }

    private String getDependencyWithArtifacts(CreateDependencyInfoFileTask task, ModuleDependency dependency) {
        String result = getDependency(task, dependency);
        if (!dependency.getArtifacts().isEmpty()) {
            //sorting artifacts to assure that they are always in the same order
            //without depending on Gradle implementation
            SortedSet<String> artifacts = new TreeSet<>();
            for (DependencyArtifact artifact : dependency.getArtifacts()) {
                artifacts.add(getArtifact(artifact));
            }
            return result + ARTIFACT_INDENT + StringUtil.join(artifacts, ARTIFACT_INDENT);
        }
        return result;
    }

    private boolean isSubmodule(CreateDependencyInfoFileTask task, ModuleDependency dependency) {
        return task.getProjectGroup().equals(dependency.getGroup())
            && task.getProjectVersion().equals(dependency.getVersion());
    }

    private String getDependency(CreateDependencyInfoFileTask task, ModuleDependency dependency) {
        String result =  dependency.getGroup() + SEPARATOR + dependency.getName();
        if (!isSubmodule(task, dependency)) {
            result += SEPARATOR + dependency.getVersion();
        }
        return result;
    }

    private String getArtifact(DependencyArtifact artifact) {
        return artifact.getName() + SEPARATOR +
            artifact.getClassifier() + SEPARATOR +
            artifact.getType() + SEPARATOR +
            artifact.getExtension();
    }

}


text:
"""private_base will be populated from puppet and placed in this directory"""

import logging
import os

import dj_database_url

from lib.settings_base import (
    CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING, CSP_SCRIPT_SRC,
    CSP_FRAME_SRC)

from .. import splitstrip
import private_base as private

ENGAGE_ROBOTS = False

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = private.EMAIL_HOST

DEBUG = False
TEMPLATE_DEBUG = DEBUG
DEBUG_PROPAGATE_EXCEPTIONS = False
SESSION_COOKIE_SECURE = True
REDIRECT_SECRET_KEY = private.REDIRECT_SECRET_KEY

ADMINS = ()

DATABASES = {}
DATABASES['default'] = dj_database_url.parse(private.DATABASES_DEFAULT_URL)
DATABASES['default']['ENGINE'] = 'mysql_pool'
DATABASES['default']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}

DATABASES['slave'] = dj_database_url.parse(private.DATABASES_SLAVE_URL)
DATABASES['slave']['ENGINE'] = 'mysql_pool'
DATABASES['slave']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}

SERVICES_DATABASE = dj_database_url.parse(private.SERVICES_DATABASE_URL)

DATABASE_POOL_ARGS = {
    'max_overflow': 10,
    'pool_size': 5,
    'recycle': 30
}

SLAVE_DATABASES = ['slave']

CACHES = {
    'default': {
        'BACKEND': 'caching.backends.memcached.CacheClass',
        #'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        #'BACKEND': 'memcachepool.cache.UMemcacheCache',
        'LOCATION': splitstrip(private.CACHES_DEFAULT_LOCATION),
        'TIMEOUT': 500,
        'KEY_PREFIX': CACHE_PREFIX,
    },
}

SECRET_KEY = private.SECRET_KEY

LOG_LEVEL = logging.DEBUG

# Celery
BROKER_URL = private.BROKER_URL

CELERY_IGNORE_RESULT = True
CELERY_DISABLE_RATE_LIMITS = True
CELERYD_PREFETCH_MULTIPLIER = 1

NETAPP_STORAGE = private.NETAPP_STORAGE_ROOT + '/shared_storage'
MIRROR_STAGE_PATH = private.NETAPP_STORAGE_ROOT + '/public-staging'
GUARDED_ADDONS_PATH = private.NETAPP_STORAGE_ROOT + '/guarded-addons'
UPLOADS_PATH = NETAPP_STORAGE + '/uploads'
USERPICS_PATH = UPLOADS_PATH + '/userpics'
ADDON_ICONS_PATH = UPLOADS_PATH + '/addon_icons'
COLLECTION_ICONS_PATH = UPLOADS_PATH + '/collection_icons'
IMAGEASSETS_PATH = UPLOADS_PATH + '/imageassets'
REVIEWER_ATTACHMENTS_PATH = UPLOADS_PATH + '/reviewer_attachment'
PREVIEWS_PATH = UPLOADS_PATH + '/previews'
SIGNED_APPS_PATH = NETAPP_STORAGE + '/signed_apps'
SIGNED_APPS_REVIEWER_PATH = NETAPP_STORAGE + '/signed_apps_reviewer'
PREVIEW_THUMBNAIL_PATH = PREVIEWS_PATH + '/thumbs/%s/%d.png'
PREVIEW_FULL_PATH = PREVIEWS_PATH + '/full/%s/%d.%s'

HERA = []
LOGGING['loggers'].update({
    'z.task': {'level': logging.DEBUG},
    'z.hera': {'level': logging.INFO},
    'z.redis': {'level': logging.DEBUG},
    'z.pool': {'level': logging.ERROR},
})

REDIS_BACKEND = private.REDIS_BACKENDS_CACHE
REDIS_BACKENDS = {
    'cache': private.REDIS_BACKENDS_CACHE,
    'cache_slave': private.REDIS_BACKENDS_CACHE_SLAVE,
    'master': private.REDIS_BACKENDS_MASTER,
    'slave': private.REDIS_BACKENDS_SLAVE,
}
CACHE_MACHINE_USE_REDIS = True

RECAPTCHA_PUBLIC_KEY = private.RECAPTCHA_PUBLIC_KEY
RECAPTCHA_PRIVATE_KEY = private.RECAPTCHA_PRIVATE_KEY
RECAPTCHA_URL = (
    'https://www.google.com/recaptcha/api/challenge?k=%s' %
    RECAPTCHA_PUBLIC_KEY)

TMP_PATH = os.path.join(NETAPP_STORAGE, 'tmp')
PACKAGER_PATH = os.path.join(TMP_PATH, 'packager')

ADDONS_PATH = private.NETAPP_STORAGE_ROOT + '/files'

PERF_THRESHOLD = 20

SPIDERMONKEY = '/usr/bin/tracemonkey'

# Remove DetectMobileMiddleware from middleware in production.
detect = 'mobility.middleware.DetectMobileMiddleware'
csp = 'csp.middleware.CSPMiddleware'

RESPONSYS_ID = private.RESPONSYS_ID

CRONJOB_LOCK_PREFIX = 'marketplace-identity-stage'

ES_HOSTS = splitstrip(private.ES_HOSTS)
ES_URLS = ['http://%s' % h for h in ES_HOSTS]
ES_INDEXES = dict((k, '%s_identity_stage' % v) for k, v in ES_INDEXES.items())

STATSD_HOST = private.STATSD_HOST
STATSD_PORT = private.STATSD_PORT
STATSD_PREFIX = private.STATSD_PREFIX

GRAPHITE_HOST = private.GRAPHITE_HOST
GRAPHITE_PORT = private.GRAPHITE_PORT
GRAPHITE_PREFIX = private.GRAPHITE_PREFIX

CEF_PRODUCT = STATSD_PREFIX

ES_TIMEOUT = 60

KNOWN_PROXIES += ['10.2.83.105',
                  '10.2.83.106',
                  '10.2.83.107',
                  '10.8.83.200',
                  '10.8.83.201',
                  '10.8.83.202',
                  '10.8.83.203',
                  '10.8.83.204',
                  '10.8.83.210',
                  '10.8.83.211',
                  '10.8.83.212',
                  '10.8.83.213',
                  '10.8.83.214',
                  '10.8.83.215',
                  '10.8.83.251',
                  '10.8.83.252',
                  '10.8.83.253',
                  ]

NEW_FEATURES = True

PERF_TEST_URL = (
    'http://talos-addon-master1.amotest.scl1.mozilla.com/trigger/trigger.cgi')

REDIRECT_URL = 'https://outgoing.allizom.org/v1/'

CLEANCSS_BIN = 'cleancss'
UGLIFY_BIN = 'uglifyjs'

CELERYD_TASK_SOFT_TIME_LIMIT = 240

LESS_PREPROCESS = True

XSENDFILE_HEADER = 'X-Accel-Redirect'

ALLOW_SELF_REVIEWS = True

GEOIP_URL = 'http://geo.marketplace.allizom.org'

API_THROTTLE = False

CSP_SCRIPT_SRC = CSP_SCRIPT_SRC + ("https://firefoxos.anosrep.org",)
CSP_FRAME_SRC = CSP_FRAME_SRC + ("https://firefoxos.anosrep.org",)

AES_KEYS = private.AES_KEYS


text:
Scala - Examples
================

Program List
------------

*Language*

-  **CreatePoly**.scala
    - create a polyhedron that is sub-divided a set amount of times
    - has a custom run script in the *CreatePoly* folder
-  **ForLoop**.scala
    - hello world, inside a backward for loop
-  **HelloWorld**.scala
    - classic Hello, World program

Compiling & Running Code
------------------------

For Linux, you can use the provided bash script:
>  e.g. for program: **ForLoop.scala**

> >  ./run **ForLoop**


text:
describe Letsads::SmsSender do
  let(:letsads_api_enpoint) { Letsads::EXTERNAL_API_ENDPOINT }

  let(:message)    { 'test_msg'}
  let(:one_number) { [123456789] }

  let(:few_different_numbers) { [123456789, 133456789, 143456789, 153456789, 163456789] }
  let(:two_equal_numbers)     { [123456789, 123456789] }

  let(:sms_sender)    { Letsads::SmsSender.new }
  let(:xml_builder)   { double(Letsads::XMLBuilder)}
  let(:generated_xml) { 'some_xml_string' }

  describe '#send_sms' do
    before do
      stub_request(:post, letsads_api_enpoint).
        with(body: generated_xml, headers: { 'Content-Type' => 'application/xml' }).
        to_return(status: 200)

      allow(Letsads::XMLBuilder).to receive(:new) { xml_builder }
    end

    it 'sends request to Letsads API endpont with generated XML in body' do
      expect(xml_builder).to receive(:send_sms_xml).with(one_number, message) { generated_xml }

      sending_process_result = sms_sender.send_sms(one_number, message)

      expect(sending_process_result.code).to eq(200)
    end
  end
end


text:
package ejb;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import facade.AbstractFacade;
import facade.FilmFacade;
import model.Film;

@Stateless
public class FilmFacadeEJB extends AbstractFacade<Film> implements FilmFacade {

	@PersistenceContext(unitName = "sakilaPU")
	private EntityManager em;

	public FilmFacadeEJB() {
		super(Film.class);
	}

	@Override
	protected EntityManager getEntityManager() {
		return this.em;
	}

}