text:
/**
 * HTTP Server Settings
 * (sails.config.http)
 *
 * Configuration for the underlying HTTP server in Sails.
 * Only applies to HTTP requests (not WebSockets)
 *
 * For more information on configuration, check out:
 * http://sailsjs.org/#/documentation/reference/sails.config/sails.config.http.html
 */

module.exports.http = {

  /****************************************************************************
  *                                                                           *
  * Express middleware to use for every Sails request. To add custom          *
  * middleware to the mix, add a function to the middleware config object and *
  * add its key to the "order" array. The $custom key is reserved for         *
  * backwards-compatibility with Sails v0.9.x apps that use the               *
  * `customMiddleware` config option.                                         *
  *                                                                           *
  ****************************************************************************/

  middleware: {

  /***************************************************************************
  *                                                                          *
  * The order in which middleware should be run for HTTP request. (the Sails *
  * router is invoked by the "router" middleware below.)                     *
  *                                                                          *
  ***************************************************************************/

    order: [
      'startRequestTimer',
      'cookieParser',
      'session',
      'bodyParser',
      'handleBodyParserError',
      'compress',
      'methodOverride',
      '$custom',
      'customFieldsMiddleware',
      'router',
      'www',
      '404',
      '500'
    ],

    customFieldsMiddleware: require('custom-fields-middleware')

  },

  /***************************************************************************
  *                                                                          *
  * The number of seconds to cache flat files on disk being served by        *
  * Express static middleware (by default, these files are in `.tmp/public`) *
  *                                                                          *
  * The HTTP static cache is only active in a 'production' environment,      *
  * since that's the only time Express will cache flat-files.                *
  *                                                                          *
  ***************************************************************************/

  // cache: 31557600000
};


text:
public interface IChessModel {
	/**
	 * Returns whether the game is complete.
	 *
	 * @return {@code true} if complete, {@code false} otherwise.
	 */
	boolean isComplete();

	/**
	 * Returns whether the piece at location {@code [move.fromRow, move.fromColumn]} is allowed to move to location
	 * {@code [move.fromRow, move.fromColumn]}.
	 *
	 * @param move a {@link W13project3.Move} object describing the move to be made.
	 * @return {@code true} if the proposed move is valid, {@code false} otherwise.
	 * @throws IndexOutOfBoundsException if either {@code [move.fromRow, move.fromColumn]} or {@code [move.toRow,
	 *                                   move.toColumn]} don't represent valid locations on the board.
	 */
	boolean isValidMove(Move move);

	/**
	 * Moves the piece from location {@code [move.fromRow, move.fromColumn]} to location {@code [move.fromRow,
	 * move.fromColumn]}.
	 *
	 * @param move a {@link W13project3.Move} object describing the move to be made.
	 * @throws IndexOutOfBoundsException if either {@code [move.fromRow, move.fromColumn]} or {@code [move.toRow,
	 *                                   move.toColumn]} don't represent valid locations on the board.
	 */
	void move(Move move);

	/**
	 * Report whether the current player p is in check.
	 * @param  p {@link W13project3.Move} the Player being checked
	 * @return {@code true} if the current player is in check, {@code false} otherwise.
	 */
	boolean inCheck(Player p);

	/**
	 * Return the current player.
	 *
	 * @return the current player
	 */
	Player currentPlayer();
}

redpajama_set_name: RedPajamaGithub


text:
package com.planet_ink.coffee_mud.Races;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

public class Jelly extends Unique
{
	@Override
	public String ID()
	{
		return "Jelly";
	}

	private final static String localizedStaticName = CMLib.lang().L("Jelly");

	@Override
	public String name()
	{
		return localizedStaticName;
	}

	@Override
	public int shortestMale()
	{
		return 24;
	}

	@Override
	public int shortestFemale()
	{
		return 20;
	}

	@Override
	public int heightVariance()
	{
		return 12;
	}

	@Override
	public int lightestWeight()
	{
		return 200;
	}

	@Override
	public int weightVariance()
	{
		return 200;
	}

	@Override
	public long forbiddenWornBits()
	{
		return 0;
	}

	private final static String localizedStaticRacialCat = CMLib.lang().L("Slime");

	@Override
	public String racialCategory()
	{
		return localizedStaticRacialCat;
	}

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

	@Override
	public String arriveStr()
	{
		return "sloshes in";
	}

	@Override
	public String leaveStr()
	{
		return "sloshes";
	}

	@Override
	public Weapon myNaturalWeapon()
	{
		if(naturalWeapon==null)
		{
			naturalWeapon=CMClass.getWeapon("StdWeapon");
			naturalWeapon.setName(L("an appendange"));
			naturalWeapon.setRanges(0,2);
			naturalWeapon.setMaterial(RawMaterial.RESOURCE_BERRIES);
			naturalWeapon.setUsesRemaining(1000);
			naturalWeapon.setWeaponDamageType(Weapon.TYPE_BASHING);
		}
		return naturalWeapon;
	}

	@Override
	public DeadBody getCorpseContainer(final MOB mob, final Room room)
	{
		final DeadBody body = super.getCorpseContainer(mob, room);
		if(body != null)
		{
			body.setMaterial(RawMaterial.RESOURCE_BLOOD);
		}
		return body;
	}

	private static Vector<RawMaterial>	resources = new Vector<RawMaterial>();

	@Override
	public List<RawMaterial> myResources()
	{
		synchronized(resources)
		{
			if(resources.size()==0)
			{
				resources.addElement(makeResource
				(L("a palm-full of @x1",name().toLowerCase()),RawMaterial.RESOURCE_BLOOD));
			}
		}
		return resources;
	}

	@Override
	public String makeMobName(final char gender, final int age)
	{
		switch(age)
		{
			case Race.AGE_INFANT:
			case Race.AGE_TODDLER:
			case Race.AGE_CHILD:
				return name().toLowerCase()+" puddle";
			default :
				return super.makeMobName('N', age);
		}
	}

}


text:
<?php

namespace Slice\Search\Filter;

use Slice\Search\AliasResolver\AliasResolverInterface;

use Doctrine\ORM\QueryBuilder;

class NullFilter extends CriteriaFilter
{
	private $inverse;

	public function __construct($propertyPath, $inverse = false) {
		$this->inverse = (bool) $inverse;
		parent::__construct($propertyPath, null);
	}

	public function getDQL(AliasResolverInterface $resolver)
	{
		return $resolver->resolveAlias($this->propertyPath)." IS"
				. ($this->inverse ? ' NOT' : '')
				. " NULL";

	}

	public function getParameters() {
		return array();
	}

	public function getType()
	{
		return 'null';
	}
}

?>


text:
namespace Lucene
{
    SpanGradientFormatter::SpanGradientFormatter(double maxScore, const String& minForegroundColor, const String& maxForegroundColor, const String& minBackgroundColor, const String& maxBackgroundColor) :
        GradientFormatter(maxScore, minForegroundColor, maxForegroundColor, minBackgroundColor, maxBackgroundColor)
    {
    }

    SpanGradientFormatter::~SpanGradientFormatter()
    {
    }

    String SpanGradientFormatter::highlightTerm(const String& originalText, TokenGroupPtr tokenGroup)
    {
        if (tokenGroup->getTotalScore() == 0)
            return originalText;
        double score = tokenGroup->getTotalScore();
        if (score == 0.0)
            return originalText;
        StringStream buffer;
        buffer << L"<span style=\"";
        if (highlightForeground)
            buffer << L"color: " << getForegroundColorString(score) << L"; ";
        if (highlightBackground)
            buffer << L"background: " << getBackgroundColorString(score) << L"; ";
        buffer << L"\">" << originalText << L"";
        return buffer.str();
    }
}


text:
package distsqlrun

import (
	"container/list"

	"golang.org/x/net/context"

	"github.com/cockroachdb/cockroach/pkg/util/log"
	"github.com/cockroachdb/cockroach/pkg/util/stop"
	"github.com/cockroachdb/cockroach/pkg/util/syncutil"
)

const maxRunningFlows = 500
const flowDoneChanSize = 8

// flowScheduler manages running flows and decides when to queue and when to
// start flows. The main interface it presents is ScheduleFlows, which passes a
// flow to be run.
type flowScheduler struct {
	log.AmbientContext
	stopper    *stop.Stopper
	flowDoneCh chan *Flow

	mu struct {
		syncutil.Mutex
		numRunning int
		queue      *list.List
	}
}

// flowWithCtx stores a flow to run and a context to run it with.
// TODO(asubiotto): Figure out if asynchronous flow execution can be rearranged
// to avoid the need to store the context.
type flowWithCtx struct {
	ctx  context.Context
	flow *Flow
}

func newFlowScheduler(ambient log.AmbientContext, stopper *stop.Stopper) *flowScheduler {
	fs := &flowScheduler{
		AmbientContext: ambient,
		stopper:        stopper,
		flowDoneCh:     make(chan *Flow, flowDoneChanSize),
	}
	fs.mu.queue = list.New()
	return fs
}

func (fs *flowScheduler) canRunFlow(_ *Flow) bool {
	// TODO(radu): we will have more complex resource accounting (like memory).
	// For now we just limit the number of concurrent flows.
	return fs.mu.numRunning < maxRunningFlows
}

// runFlowNow starts the given flow; does not wait for the flow to complete.
func (fs *flowScheduler) runFlowNow(ctx context.Context, f *Flow) {
	fs.mu.numRunning++
	f.Start(ctx, func() { fs.flowDoneCh <- f })
	// TODO(radu): we could replace the WaitGroup with a structure that keeps a
	// refcount and automatically runs Cleanup() when the count reaches 0.
	go func() {
		f.Wait()
		f.Cleanup(ctx)
	}()
}

// ScheduleFlow is the main interface of the flow scheduler: it runs or enqueues
// the given flow.
func (fs *flowScheduler) ScheduleFlow(ctx context.Context, f *Flow) error {
	return fs.stopper.RunTask(ctx, func(ctx context.Context) {
		fs.mu.Lock()
		defer fs.mu.Unlock()

		if fs.canRunFlow(f) {
			fs.runFlowNow(ctx, f)
		} else {
			fs.mu.queue.PushBack(&flowWithCtx{
				ctx:  ctx,
				flow: f,
			})
		}
	})
}

// Start launches the main loop of the scheduler.
func (fs *flowScheduler) Start() {
	ctx := fs.AnnotateCtx(context.Background())
	fs.stopper.RunWorker(ctx, func(context.Context) {
		stopped := false
		fs.mu.Lock()
		defer fs.mu.Unlock()

		for {
			if stopped && fs.mu.numRunning == 0 {
				// TODO(radu): somehow error out the flows that are still in the queue.
				return
			}
			fs.mu.Unlock()
			select {
			case <-fs.flowDoneCh:
				fs.mu.Lock()
				fs.mu.numRunning--
				if !stopped {
					if frElem := fs.mu.queue.Front(); frElem != nil {
						n := frElem.Value.(*flowWithCtx)
						fs.mu.queue.Remove(frElem)
						// Note: we use the flow's context instead of the worker
						// context, to ensure that logging etc is relative to the
						// specific flow.
						fs.runFlowNow(n.ctx, n.flow)
					}
				}

			case <-fs.stopper.ShouldStop():
				fs.mu.Lock()
				stopped = true
			}
		}
	})
}


text:
package apiservercerts

import (
	"context"
	"errors"
	"testing"

	apiserviceclientfake "github.com/google/kf/v2/pkg/client/kube-aggregator/clientset/versioned/fake"
	"github.com/google/kf/v2/pkg/kf/testutil"
	"github.com/google/kf/v2/pkg/reconciler"
	"github.com/google/kf/v2/pkg/system"
	_ "github.com/google/kf/v2/pkg/system/testing"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/client-go/kubernetes/fake"
	ktesting "k8s.io/client-go/testing"
	apiv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
	certresources "knative.dev/pkg/webhook/certificates/resources"
)

//go:generate go run ../../kf/internal/tools/fakelister/generator.go --pkg apiservercerts --object-type Secret --object-pkg k8s.io/api/core/v1 --lister-pkg k8s.io/client-go/listers/core/v1
//go:generate go run ../../kf/internal/tools/fakelister/generator.go --pkg apiservercerts --object-type APIService --object-pkg k8s.io/kube-aggregator/pkg/apis/apiregistration/v1 --lister-pkg k8s.io/kube-aggregator/pkg/client/listers/apiregistration/v1 --namespaced=false

func TestReconciler_Reconcile(t *testing.T) {
	t.Parallel()

	caCert := []byte("some-cert")
	secret := &corev1.Secret{
		ObjectMeta: metav1.ObjectMeta{
			Name:      SecretName,
			Namespace: system.Namespace(),
		},
		Data: map[string][]byte{
			certresources.CACert: caCert,
		},
	}

	apiService := &apiv1.APIService{
		ObjectMeta: metav1.ObjectMeta{
			Name: apiServiceName,
		},
		Spec: apiv1.APIServiceSpec{
			CABundle: caCert,
		},
	}

	type fakes struct {
		fakeSecretLister     *fakeSecretLister
		fakeAPIServiceLister *fakeAPIServiceLister

		fakeAPIServiceClientSet *apiserviceclientfake.Clientset
		fakeClientSet           *fake.Clientset
	}

	testCases := []struct {
		name  string
		setup func(t *testing.T, f *fakes)
		err   error
	}{
		{
			name: "getting secret fails",
			setup: func(t *testing.T, f *fakes) {
				f.fakeSecretLister.err = errors.New("some-error")
			},
			err: errors.New("some-error"),
		},
		{
			name: "getting API Service fails",
			setup: func(t *testing.T, f *fakes) {
				f.fakeSecretLister.Add(secret)
				f.fakeAPIServiceLister.err = errors.New("some-error")
			},
			err: errors.New("some-error"),
		},
		{
			name: "does NOT update anything if they match",
			setup: func(t *testing.T, f *fakes) {
				f.fakeSecretLister.Add(secret)
				f.fakeAPIServiceLister.Add(apiService)

				f.fakeAPIServiceClientSet.PrependReactor("update", "apiservices",
					func(action ktesting.Action) (handled bool, ret runtime.Object, err error) {
						t.Fail()
						return false, nil, nil
					},
				)
			},
		},
		{
			name: "updating API Service Client fails",
			setup: func(t *testing.T, f *fakes) {

				// Make a copy and altere the secret to ensure they aren't the
				// same and require an update.
				copiedSecret := secret.DeepCopy()
				copiedSecret.Data[certresources.CACert] = []byte("different")

				f.fakeSecretLister.Add(copiedSecret)
				f.fakeAPIServiceLister.Add(apiService)
				f.fakeAPIServiceClientSet.PrependReactor("update", "apiservices",
					func(action ktesting.Action) (handled bool, ret runtime.Object, err error) {
						return true, nil, errors.New("some-error")
					},
				)
			},
			err: errors.New("some-error"),
		},
		{
			name: "success",
			setup: func(t *testing.T, f *fakes) {

				// Make a copy and altere the secret to ensure they aren't the
				// same and require an update.
				copiedSecret := secret.DeepCopy()
				copiedSecret.Data[certresources.CACert] = []byte("different")

				f.fakeSecretLister.Add(copiedSecret)
				f.fakeAPIServiceLister.Add(apiService)
				f.fakeAPIServiceClientSet.PrependReactor("update", "apiservices",
					func(action ktesting.Action) (handled bool, ret runtime.Object, err error) {
						s := action.(ktesting.UpdateActionImpl).Object.(*apiv1.APIService)

						testutil.AssertEqual(t, "name", apiServiceName, s.Name)
						testutil.AssertEqual(t, "caBundle", "different", string(s.Spec.CABundle))

						return true, ret, nil
					},
				)
			},
		},
	}

	for _, tc := range testCases {
		t.Run(tc.name, func(t *testing.T) {

			f := &fakes{
				fakeSecretLister:     &fakeSecretLister{},
				fakeAPIServiceLister: &fakeAPIServiceLister{},

				fakeAPIServiceClientSet: apiserviceclientfake.NewSimpleClientset(),
				fakeClientSet:           fake.NewSimpleClientset(),
			}

			// Ensure the informer copies weren't altered.
			defer func() {
				f.fakeSecretLister.AssertCacheIsPreserved(t)
				f.fakeAPIServiceLister.AssertCacheIsPreserved(t)
			}()

			if tc.setup != nil {
				tc.setup(t, f)
			}

			r := Reconciler{
				Base: &reconciler.Base{
					SecretLister:  f.fakeSecretLister,
					KubeClientSet: f.fakeClientSet,
				},
				apiServiceLister:    f.fakeAPIServiceLister,
				apiServiceClientSet: f.fakeAPIServiceClientSet,
			}

			err := r.Reconcile(context.Background(), "doesn't matter")
			testutil.AssertErrorsEqual(t, tc.err, err)
		})
	}
}


text:
from swgpy.object import *

def create(kernel):
	result = Tangible()

	result.template = "object/tangible/lair/base/shared_objective_banner_rebel.iff"
	result.attribute_template_id = -1
	result.stfName("lair_n","rebel_banner")

	#### BEGIN MODIFICATIONS ####
	####  END MODIFICATIONS  ####

	return result


text:
desc 'apikitchen' do
  doc = html('http://apikitchen.com')
  url = doc.at_css('#header h1 a')[:href]
  version = url.match(/ApiKitchen_([\d\.]+)\.dmg/)[1]
  Latest.new version: version, url: url
end


text:
title: Tammy Coron
summary: Creative professional
date: 2021-03-23
categories:
- designer
- developer
- game
- podcaster
- writer
---

### Who are you, and what do you do?

Hi, my name is Tammy Coron, and I'm an independent creative professional.

As a creative professional, I get to do a lot of neat things: design, development, write, edit, animate, illustrate, speak at conferences, and host a podcast ([past](https://roundaboutfm.com/ "Tammy's podcast about tech, music, arts and zombies.") and [present](https://pragprog.libsyn.com/ "Tammy's podcast interviewing Pragmatic Programmers authors.")).

You can find out more about me at [tammycoron.com](https://tammycoron.com/ "Tammy's website.") and [justwritecode.net](https://justwritecode.net/ "Tammy's production company.").

### What hardware do you use?

My "daily driver" is a [MacBook Pro][macbook-pro] (Retina, 13-inch, Early 2015) with a 3.1 GHz Dual-Core Intel Core i7 processor and 16 GB of memory, hooked up to a [ViewSonic VX2457-mhd 24" monitor][vx2457-mhd]. I also use an [iPhone XS Max][iphone-xs-max] and an older 12" [iPad Pro][ipad-pro] with an [Apple Pencil][pencil].

Most of the time, I work at my *very small* writing desk in the corner of the living room. Occasionally, though, I'll move to one of the other small offices situated around the house; however, I prefer to work close to my family - despite the noise.

### And what software?

My software list is long, so let me break it out by function:

*Animation*: I mostly use [Moho Pro][moho-pro] or [Spriter][] since they work best for the type of animation work I do. I also play around with [Cartoon Animator][cartoon-animator], but mostly because my mom uses it, so when we create things together, we use that instead.

If you're interested in learning Moho, you can watch my short tutorial series on YouTube: [Introduction to Moho](https://www.youtube.com/watch?v=KIL_c2bOg08 "Tammy's Moho Pro tutorial series on YouTube.").

*Design & Illustration*: My favorite software in this category is [Clip Studio Paint][clip-studio-paint] because the drawing engine feels more like traditional pen and paper than anything else I've used before. For my design work, I use [Affinity Designer][affinity-designer] and [Photoshop][]. On the iPad, I stick with [Procreate][procreate-ios] or [Clip Studio][clip-studio-paint-ios]. In the end, it really depends on what I'm doing and where I'm working.

*Development*: Since I'm a game developer - mostly within the Apple ecosystem -I tend to stick with either [Xcode][] or [Unity][]. If the project calls for 2D, I use Xcode. If a project calls for 3D or cross-platform support, I use Unity.

My favorite frameworks are SpriteKit and GameplayKit. If you're interested in learning more, check out my new book on Apple game development, published by The Pragmatic Bookshelf: [Apple Game Frameworks and Technologies: Build 2D Games with SpriteKit & Swift](https://pragprog.com/titles/tcswift/apple-game-frameworks-and-technologies/ "Tammy's book about Apple's 2D game development frameworks.")

*Writing & Editing*: When it comes to word-smithing, my software of choice is [TextMate][]. It's simple, elegant, and functional. What more could you want, right?

*Audio & Video Editing*: For the audio work, I use [Adobe Audition][audition]. For the video work, I use [Final Cut Pro][final-cut-pro] or [Adobe Premiere Pro][premiere-pro]. Again, it depends on what I'm trying to accomplish.

*Other Software*: I'll run through these quickly... [Discord][] and [Slack][] for communications, [Dropbox][] for cloud space, [Grammarly][] for spellchecking, [Versions][] and [Tower][] for version control, [DuckDuckGo][] for web searches, [Spotify][] for music, and [Trello][] and [Wave][wave.2] to manage my business. I'm sure I'm forgetting a few, but this list covers the software I use every day.

### What would be your dream setup?

I'm not sure that I have a "dream setup." I like what I have now, and I like being able to move around the house. Sure, my devices are a little older than I'd like them to be, but that's OK. They still work! (At least for now.)

[affinity-designer]: https://en.wikipedia.org/wiki/Affinity_Designer "A vector graphics editor."
[audition]: https://creative.adobe.com/products/audition "An audio editing software suite."
[cartoon-animator]: https://www.reallusion.com/cartoon-animator/ "2D animation software."
[clip-studio-paint-ios]: https://itunes.apple.com/us/app/clip-studio-paint-for-manga/id1262985592 "A drawing app focused on manga."
[clip-studio-paint]: http://www.clipstudio.net/en "A drawing program aimed at manga artists."
[discord]: https://discordapp.com/ "A voice and text chat service."
[dropbox]: https://www.dropbox.com/ "Online syncing and storage."
[duckduckgo]: https://duckduckgo.com/ "A new search engine."
[final-cut-pro]: https://en.wikipedia.org/wiki/Final_Cut_Pro "A nonlinear video editor."
[grammarly]: https://www.grammarly.com/ "A writing and grammar service."
[ipad-pro]: https://en.wikipedia.org/wiki/IPad_Pro "An iOS tablet."
[iphone-xs-max]: https://en.wikipedia.org/wiki/IPhone_XS "A 6.46 inch smartphone."
[macbook-pro]: https://www.apple.com/macbook-pro/ "A laptop."
[moho-pro]: https://www.mohoanimation.com/moho-pro.shtml "2D animation software."
[pencil]: https://www.fiftythree.com/pencil "An iPad stylus."
[photoshop]: https://www.adobe.com/products/photoshop.html "A bitmap image editor."
[premiere-pro]: https://en.wikipedia.org/wiki/Adobe_Premiere_Pro "A video editing suite."
[procreate-ios]: https://itunes.apple.com/us/app/procreate/id425073498 "A powerful illustration app."
[slack]: https://slack.com/ "A collaboration service."
[spotify]: https://www.spotify.com/us/ "A music streaming service."
[spriter]: https://brashmonkey.com/ "2D animation software."
[textmate]: https://macromates.com/ "A text editor for the Mac."
[tower]: https://www.git-tower.com/ "A Mac GUI for Git."
[trello]: https://trello.com/ "A project management service."
[unity]: https://unity3d.com/unity/ "A cross-platform game development tool."
[versions]: https://versionsapp.com/ "A Subversion client for the Mac."
[vx2457-mhd]: https://www.viewsonic.com/us/vx2457-mhd.html "A 24 inch monitor."
[wave.2]: https://www.waveapps.com/ "An accounting and invoicing service."
[xcode]: https://en.wikipedia.org/wiki/Xcode "An IDE for Mac developers."


text:
// Dependencies.
import { Router } from "express";

// Logger.
import { Logger } from "../logger";

/**
 * Base route class.
 *
 * @class BaseRoute
 */
export abstract class BaseRoute
{
	// Logger instance.
	protected logger: any;

	// Store router.
	protected router: Router;

	/**
	 * Constructor
	 *
	 * @class BaseRoute
	 * @constructor
	 */
	constructor(router: Router)
	{
		// Get logger instance.
		this.logger = Logger.getInstance();

		// Store router.
		this.router = router;

		// Define routes.
		this.defineRoutes();
	}

	/**
	 * Define routes.
	 *
	 * @class Baseroute
	 * @method defineRoutes
	 * @abstract
	 */
	protected abstract defineRoutes(): void;
}


text:
#include "jsonformatter.h"
#include "settings_storage.h"
#include <QDebug>

/*!
 * \brief Settings_storing::setValue This function is a wrapper around the
 * QSettings:setValue(const QString & key, const QVariant & value) function.  It is created as a wrapper in order to expose
 * the functionality of saving user's settings persistently.
 * \param key A property/key to reference the value saved by the user
 * \param value A value that will be saved in the user's config file.
 */
void Settings_storing::setValue(const QString & key, const QVariant & value){
    QSettings::setValue(key, value);
}

/*!
 * \brief Settings_storing::value This function is a wrapper around the QSettings::value(const QString &key, const QVariant & defaultValue)
 * function.  It is created as a wrapper this way to expose the functionality of the QSettings module to the .qml files which need to
 * display or output settings.
 * \param key The property to look for in the config file
 * \param defaultValue An optional default value to return if the property searched for doesn't exist
 * \return The value returned by a call to QSettings::value(key, defaultvalue).  If QSettings does not
 * find the setting, it will return defaultValue parameter.
 */
QVariant Settings_storing::value(const QString &key, const QVariant & defaultValue) const
{
    return QSettings::value(key, defaultValue);
}

/*!
 * \brief Settings_storing::contains This function is a wrapper around the QSettings::contain(const QString &key)
 * function.  It is created as a wrapper this way to expose the functionality of the QSettings module to the .qml files which need to
 * check for the existence of user settings.
 * \param key
 * \return Returns a boolean value, true if the key exists, false if the key does not exist
 */
bool Settings_storing::contains(const QString &key) const{
    return QSettings::contains(key);
}
/*!
 * \brief Settings_storing::sync This function is a wrapper around the QSettings::sync() function.  It is created as a
 * wrapper to expose the functionality of the QSettings module to the .qml files which may
 * need to force the saving of the user's settings before they are lost.
 *
 * This function also emits a settingsSaved() signal to alert
 * the eapplication that it should send any new/modified settings to the server.
 */
void Settings_storing::sync(){
    QSettings::sync();
    emit settingsSaved();
}
/*!
 * \brief Settings_storing::getAllKeys This function is a wrapper around the QSettings::contain(const QString &key)
 * function.  This function is used to get a QStringList of all property saved in the program's corresponding config file.
 *
 * Note: No values can be obtained by using this function.
 * \return Returns a QStringList of every key found in the program's config file.
 */
QStringList Settings_storing::getAllKeys(){
    return QSettings::allKeys();
}

/*!
 * \brief Settings_storing::settingsSaved This function will get a Json formatted version of the settings file and
 * send it to the server.
 */
void Settings_storing::settingsSaved(){
    JsonFormatter *jsonformatter = new JsonFormatter();
    QByteArray jsonByteSettings = jsonformatter->getJSONSettings();
    QString jsonString(jsonByteSettings);

    /* testing output of JsonFormatter
     *
     */

    //STATUS:  unsure -- output is
    // output bytearray from jsonformatter->getJSONSettings() to file
    QFile tmpfile("json_bytearray_output.txt");
    tmpfile.open(QIODevice::ReadWrite);
    if(!tmpfile.open(QIODevice::ReadWrite | QIODevice::Text)){
        qDebug() << "tmpFile Output:" << "failed";
    }
    //QDataStream in();
    qint64 bytes = tmpfile.write(jsonString.toUtf8());

    qDebug() << "Byte Written to the file:" << bytes;
    qDebug() << "tmpFile Output:" << tmpfile.readAll();
    tmpfile.close();

    // output json from jsonformatter->getJsonSettings to file
    //QJsonDocument tmpJsonDoc = QJsonDocument::fromBinaryData(jsonByteSettings, QJsonDocument::DataValidation::Validate);
    QJsonDocument tmpJsonDoc = QJsonDocument::fromRawData(jsonString.toUtf8(), jsonByteSettings.length()+1, QJsonDocument::DataValidation::Validate);
    QFile tmpfileJson("json_formatted_output.txt");
    tmpfileJson.open(QIODevice::ReadWrite);
    tmpfileJson.write(tmpJsonDoc.toJson());
    tmpfileJson.close();

    /*
     *Testing Output finished
     */
}


text:
angular.module("ehelseEditor").controller("TopicController",["$rootScope", "$scope", "ModalService", "Topic", function($rootScope, $scope, ModalService, Topic){
    $scope.topics = Topic.getAll();

    // Open modal for creating new topic
    $rootScope.showNewTopicModal = function () {
        $rootScope.shouldBeOpen = true;
        $rootScope.openModal("app/components/topic/addTopic/newTopicView.html", "NewTopicModalController");
    };

    // Initialize topic value
    $rootScope.topic = {
        title: "Referansekatalogen"
    };
    /**
     * Handles folder icons view from open to closed and vise versa
     * @param topicId
     */
    $rootScope.toggleTopicIcons = function(topicId){
        var isExpanded = $("#topic" + topicId).attr("aria-expanded");
        var topic = $("#folder" + topicId);
        if(isExpanded == "true"){
            topic.removeClass("fa-folder-open");
            topic.addClass("fa-folder");
        }else{
            topic.removeClass("fa-folder");
            topic.addClass("fa-folder-open");
        }
    };

    /**
     * Sets topic to selected state bu it's id
     * @param topicId
     * @param doc
     */
    $rootScope.setSelectedTopic = function (topicId, doc) {
        if(topicId){
            $rootScope.selected_topic_id = topicId;
            $rootScope.topic.title = Topic.getById(topicId).title;
            Topic.setSelectedById(topicId);
            if(!doc){
                $rootScope.changeContentView("editTopic");
            }
        }
    };

    // Search filter options
    $rootScope.searchOption = "";
    /**
     * Clears search value
     */
    $rootScope.clearSearchFilterText = function () {
        $rootScope.searchQuery = "";
        $rootScope.searchOption = "";
        $rootScope.searchIsFocused = false;
    };
    /**
     * Actions performed when topic gets selected
     * @param topicId
     */
    $rootScope.selectTopicActions = function (topicId) {
        $rootScope.toggleTopicIcons(topicId);
        $rootScope.getDocuments(topicId);
        $rootScope.setSelectedTopic(topicId);
        $rootScope.clearSearchFilterText();
        if($rootScope.childControllers["EditDocumentController"]){
            $rootScope.childControllers["EditorController"].resetForm();
        }
    };
    /**
     * Actions performed when 'new topic' button is clicked
     */
    $rootScope.newTopicActions = function () {
        $rootScope.showNewTopicModal();
        $rootScope.clearSearchFilterText();
        if($rootScope.childControllers["EditDocumentController"]){
            $rootScope.childControllers["EditorController"].resetForm();
        }
    };
    /**
     * Checks document and topic form and prevents loss of unsaved changes
     * @param topicId
     */
    $rootScope.checkDocumentFormAndExecute = function (topicId) {
        if (topicId){
            if ($rootScope.formNotPristine('document')) {
                $rootScope.checkEditTopicForm(topicId, $rootScope.selectTopicActions);
            } else {
                $rootScope.checkEditDocumentForm(topicId, $rootScope.selectTopicActions);
            }
        } else {
            if ($rootScope.formNotPristine('document')) {
                $rootScope.checkEditTopicForm("", $rootScope.newTopicActions);
            } else {
                $rootScope.checkEditDocumentForm("", $rootScope.newTopicActions);
            }
        }
    };
}]);


text:
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq;
//using System.Linq.Expressions;
//using System.Net;
//using System.Reflection;
//using System.Reflection.Emit;
//using System.Threading.Tasks;
//using System.Web;
//using Microsoft.AspNetCore;
//using Microsoft.AspNetCore.Builder;
//using Microsoft.AspNetCore.Hosting;
//using Microsoft.AspNetCore.Http;

//#if NET452
//namespace Microsoft.AspNetCore.Hosting
//{
//    static internal class WebHost
//    {
//         static public WebAppConfig CreateDefaultBuilder(string[] arguments)
//        {
//            return new WebAppConfig();
//        }
//    }

//    internal class WebAppConfig
//    {
//        public WebAppBuilder Configure(Action<IApplicationBuilder> configure)
//        {
//            return new WebAppBuilder();
//        }
//    }

//    internal class WebAppBuilder
//    {
//        public WebAppBuilder UseUrls(params string[] urls)
//        {
//            return this;
//        }

//        public WebApp Build()
//        {
//            return new WebApp();
//        }
//    }

//    internal interface IWebHost : IDisposable
//    {
//        void RunAsync();
//    }

//    internal class WebApp : IWebHost
//    {
//        public void RunAsync()
//        {
//        }

//        public void Dispose()
//        {
//        }
//    }
//}
//namespace Microsoft.AspNetCore.Builder
//{
//    internal interface IApplicationBuilder
//    {
//        IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware);
//        IApplicationBuilder Map(string pathMatch, Action<IApplicationBuilder> configuration);
//        void Run(RequestDelegate handler);
//    }
//}
//namespace Microsoft.AspNetCore.Http
//{
//    internal delegate Task RequestDelegate(HttpContext context);
//}
//#else
//using Microsoft.Extensions.DependencyInjection;
//#endif

//namespace Puresharp
//{
//    public partial class Communication : IDisposable
//    {
//        public enum Verbs
//        {
//            GET,
//            POST,
//            PUT,
//            PATCH,
//            DELETE
//        }

//        public interface IConvention
//        {
//            IMapping this[MethodInfo method] { get; }
//        }

//        public interface IMapping
//        {
//            string Path { get; }
//            Verbs Verb { get; }
//            IFormatter Formatter { get; }
//            IManager Manager { get; }
//        }

//        public interface IManager
//        {
//            int Code(Exception exception);
//        }

//        public interface IDirectory
//        {
//            void Accept(Directory.IVisitor visitor);
//        }

//        public class Directory : IDirectory
//        {
//            public interface IVisitor
//            {
//                void Visit<T>()
//                    where T : class;
//            }

//            private LinkedList<Action<IVisitor>> m_Visitation = new LinkedList<Action<IVisitor>>();

//            public void Add<T>()
//                where T : class
//            {
//                this.m_Visitation.AddLast(new Action<IVisitor>(_Visitor => _Visitor.Visit<T>()));
//            }

//            public void Accept(IVisitor visitor)
//            {
//                foreach (var _action in this.m_Visitation) { _action(visitor); }
//            }
//        }

//        private class Exposition : Directory.IVisitor
//        {
//            private IContainer m_Container;
//            private IConvention m_Convention;
//            private IApplicationBuilder m_Application;

//            public Exposition(IContainer container, IConvention convention, IApplicationBuilder application)
//            {
//                this.m_Container = container;
//                this.m_Convention = convention;
//                this.m_Application = application;
//            }

//            public void Visit<T>()
//                where T : class
//            {
//                Communication.Map<T>(this.m_Application, this.m_Container, this.m_Convention);
//            }
//        }

//        private IContainer m_Container;
//        private IConvention m_Convention;
//        private IDirectory m_Directory;
//        private IWebHost m_Hosting;

//        public Communication(IContainer container, IDirectory directory, IConvention convention)
//        {
//            this.m_Container = container;
//            this.m_Directory = directory;
//            this.m_Convention = convention;
//            this.m_Hosting = WebHost.CreateDefaultBuilder(new string[0]).Configure(_Application => this.m_Directory.Accept(new Exposition(this.m_Container, this.m_Convention, _Application))).UseUrls().Build();
//            this.m_Hosting.RunAsync();
//        }

//        public void Dispose()
//        {
//            var _hosting = this.m_Hosting;
//            this.m_Hosting = null;
//            if (_hosting != null) { _hosting.Dispose(); }
//        }

//        static private ModuleBuilder m_Module = AppDomain.CurrentDomain.DefineDynamicModule("<Puresharp.Communication>");

//        static private Type Argumentation(MethodInfo method, ParameterInfo[] signature)
//        {
//            var _type = Communication.m_Module.DefineType($"<Puresharp.Communication.Argumentation>.<{method.DeclaringType.Module.MetadataToken}.{method.DeclaringType.MetadataToken}.{method.MetadataToken}>", TypeAttributes.Class | TypeAttributes.Serializable | TypeAttributes.Sealed | TypeAttributes.Public, Metadata<object>.Type);
//            foreach (var _parameter in signature) { _type.DefineField(_parameter.Name, _parameter.ParameterType, FieldAttributes.Public); }
//            return _type.CreateType();
//        }

//        static private void Map<T>(IApplicationBuilder application, IContainer container, Communication.IConvention convention)
//            where T : class
//        {
//            if (convention == null) { throw new ArgumentNullException(nameof(convention), "Comminication mapping cannot be null."); }
//            foreach (var _method in Metadata<T>.Type.GetMethods())
//            {
//                var _mapping = convention[_method];
//                var _signature = _method.GetParameters();
//                var _instance = Expression.Parameter(Metadata<T>.Type);
//                var _formatter = Expression.Parameter(Metadata<IFormatter>.Type);
//                var _return = Expression.Parameter(Metadata<Stream>.Type);
//                var _type = Communication.Argumentation(_method, _signature);
//                if (_mapping.Verb == Verbs.GET)
//                {
//                    if (_method.ReturnType == Metadata.Void) { throw new InvalidOperationException("Verb cannot be 'GET' for a method that has no return."); }
//                    if (_signature.Length == 1)
//                    {
//                        var _parameter = _signature[0];
//                        if (_parameter.ParameterType == Metadata<string>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Call
//                                (
//                                    _formatter,
//                                    Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                    _return,
//                                    Expression.Call(_instance, _method, _argument)
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<int>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => int.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<long>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => long.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<short>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => short.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<Guid>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => Guid.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<uint>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => uint.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<ulong>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => ulong.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<ushort>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => ushort.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<bool>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => bool.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<decimal>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => decimal.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<DateTime>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => DateTime.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<TimeSpan>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Block
//                                (
//                                    Expression.IfThen
//                                    (
//                                        Expression.Call(Metadata.Method(() => object.Equals(Metadata<object>.Value, Metadata<object>.Value)), _argument, Expression.Constant(null, Metadata<string>.Type)),
//                                        Expression.Throw(Expression.New(Metadata.Constructor(() => new ArgumentNullException())))
//                                    ),
//                                    Expression.Call
//                                    (
//                                        _formatter,
//                                        Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                        _return,
//                                        Expression.Call
//                                        (
//                                            _instance,
//                                            _method,
//                                            Expression.Call
//                                            (
//                                                Metadata.Method(() => TimeSpan.Parse(Metadata<string>.Value)),
//                                                _argument
//                                            )
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<Uri>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Call
//                                (
//                                    _formatter,
//                                    Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                    _return,
//                                    Expression.Call
//                                    (
//                                        _instance,
//                                        _method,
//                                        Expression.New
//                                        (
//                                            Metadata.Constructor(() => new Uri(Metadata<string>.Value)),
//                                            _argument
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else if (_parameter.ParameterType == Metadata<IPAddress>.Type)
//                        {
//                            var _argument = Expression.Parameter(Metadata<string>.Type);
//                            var _action = Expression.Lambda<Action<T, string, IFormatter, Stream>>
//                            (
//                                Expression.Call
//                                (
//                                    _formatter,
//                                    Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                    _return,
//                                    Expression.Call
//                                    (
//                                        _instance,
//                                        _method,
//                                        Expression.Call
//                                        (
//                                            Metadata.Method(() => IPAddress.Parse(Metadata<string>.Value)),
//                                            _argument
//                                        )
//                                    )
//                                ),
//                                _instance,
//                                _argument,
//                                _formatter,
//                                _return
//                            ).Compile();
//                            application.Map(_mapping.Path, _Application => _Application.Run(new Get<T>(container, _mapping.Formatter, _mapping.Manager, _action).Run));
//                        }
//                        else { throw new InvalidOperationException("'GET' verb only support a single parameter of one of these types: 'string', 'int', 'long', 'short', 'uint', 'ulong', 'ushort', 'Guid', 'bool', 'decimal', 'DateTime', 'TimeSpan', 'Uri', 'IPAddress'"); }
//                    }
//                    else { throw new InvalidOperationException("'GET' verb only support a single parameter."); }
//                }
//                else
//                {
//                    var _argumentation = new
//                    {
//                        Stream = Expression.Parameter(Metadata<Stream>.Type),
//                        Object = Expression.Parameter(_type),
//                    };
//                    var _action = Expression.Lambda<Action<T, IFormatter, Stream, Stream>>
//                    (
//                        Expression.Block
//                        (
//                            new ParameterExpression[] { _argumentation.Object },
//                            Expression.Assign
//                            (
//                                _argumentation.Object,
//                                Expression.Call
//                                (
//                                    _formatter,
//                                    Metadata<IFormatter>.Method(_Formatter => _Formatter.Deserialize<object>(Metadata<Stream>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_type),
//                                    _argumentation.Stream
//                                )
//                            ),
//                            Expression.Call
//                            (
//                                _formatter,
//                                Metadata<IFormatter>.Method(_Formatter => _Formatter.Serialize(Metadata<Stream>.Value, Metadata<object>.Value)).GetGenericMethodDefinition().MakeGenericMethod(_method.ReturnType),
//                                _return,
//                                Expression.Call
//                                (
//                                    _instance,
//                                    _method,
//                                    _signature.Select(_Parameter => Expression.Field(_argumentation.Object, _Parameter.Name))
//                                )
//                            )
//                        ),
//                        _instance,
//                        _formatter,
//                        _argumentation.Stream,
//                        _return
//                    ).Compile();
//                    application.Map(_mapping.Path, _Application => _Application.Run(Operation.Create<T>(container, _mapping, _action)));
//                }
//            }
//        }

//        static private class Operation
//        {
//            static public RequestDelegate Create<T>(IContainer container, IMapping mapping, Action<T, IFormatter, Stream, Stream> action)
//                where T : class
//            {
//                switch (mapping.Verb)
//                {
//                    case Verbs.POST: return new Post<T>(container, mapping.Formatter, mapping.Manager, action).Run;
//                    case Verbs.PUT: return new Put<T>(container, mapping.Formatter, mapping.Manager, action).Run;
//                    case Verbs.PATCH: return new Patch<T>(container, mapping.Formatter, mapping.Manager, action).Run;
//                    case Verbs.DELETE: return new Delete<T>(container, mapping.Formatter, mapping.Manager, action).Run;
//                    default: throw new NotSupportedException();
//                }
//            }
//        }

//        private class Post<T>
//            where T : class
//        {
//            private IContainer m_Container;
//            private IFormatter m_Formatter;
//            private IManager m_Manager;
//            private Action<T, IFormatter, Stream, Stream> m_Action;

//            public Post(IContainer container, IFormatter formatter, IManager manager, Action<T, IFormatter, Stream, Stream> action)
//            {
//                this.m_Container = container;
//                this.m_Formatter = formatter;
//                this.m_Manager = manager;
//                this.m_Action = action;
//            }

//            public Task Run(HttpContext context)
//            {
//                return Task.Run(() =>
//                {
//                    var _module = null as IModule<T>;
//                    var _response = context.Response;
//                    _response.ContentType = "application/json";
//#if NET452
//                    if (context.Request.HttpMethod == "POST")
//#else
//                    if (context.Request.Method == "POST")
//#endif
//                    {
//                        try
//                        {
//                            _module = this.m_Container.Module<T>();
//#if NET452
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.InputStream, _response.OutputStream);
//#else
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.Body, _response.Body);
//#endif
//                        }
//                        catch (Exception exception) { _response.StatusCode = this.m_Manager.Code(exception); }
//                        finally { if (_module != null) { _module.Dispose(); } }
//                    }
//                    else { _response.StatusCode = 405; }
//                });
//            }
//        }

//        private class Put<T>
//            where T : class
//        {
//            private IContainer m_Container;
//            private IFormatter m_Formatter;
//            private IManager m_Manager;
//            private Action<T, IFormatter, Stream, Stream> m_Action;

//            public Put(IContainer container, IFormatter formatter, IManager manager, Action<T, IFormatter, Stream, Stream> action)
//            {
//                this.m_Container = container;
//                this.m_Formatter = formatter;
//                this.m_Manager = manager;
//                this.m_Action = action;
//            }

//            public Task Run(HttpContext context)
//            {
//                return Task.Run(() =>
//                {
//                    var _module = null as IModule<T>;
//                    var _response = context.Response;
//                    _response.ContentType = "application/json";
//#if NET452
//                    if (context.Request.HttpMethod == "PUT")
//#else
//                    if (context.Request.Method == "PUT")
//#endif
//                    {
//                        try
//                        {
//                            _module = this.m_Container.Module<T>();
//#if NET452
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.InputStream, _response.OutputStream);
//#else
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.Body, _response.Body);
//#endif
//                        }
//                        catch (Exception exception) { _response.StatusCode = this.m_Manager.Code(exception); }
//                        finally { if (_module != null) { _module.Dispose(); } }
//                    }
//                    else { _response.StatusCode = 405; }
//                });
//            }
//        }

//        private class Patch<T>
//            where T : class
//        {
//            private IContainer m_Container;
//            private IFormatter m_Formatter;
//            private IManager m_Manager;
//            private Action<T, IFormatter, Stream, Stream> m_Action;

//            public Patch(IContainer container, IFormatter formatter, IManager manager, Action<T, IFormatter, Stream, Stream> action)
//            {
//                this.m_Container = container;
//                this.m_Formatter = formatter;
//                this.m_Manager = manager;
//                this.m_Action = action;
//            }

//            public Task Run(HttpContext context)
//            {
//                return Task.Run(() =>
//                {
//                    var _module = null as IModule<T>;
//                    var _response = context.Response;
//                    _response.ContentType = "application/json";
//#if NET452
//                    if (context.Request.HttpMethod == "PATCH")
//#else
//                    if (context.Request.Method == "PATCH")
//#endif
//                    {
//                        try
//                        {
//                            _module = this.m_Container.Module<T>();
//#if NET452
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.InputStream, _response.OutputStream);
//#else
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.Body, _response.Body);
//#endif
//                        }
//                        catch (Exception exception) { _response.StatusCode = this.m_Manager.Code(exception); }
//                        finally { if (_module != null) { _module.Dispose(); } }
//                    }
//                    else { _response.StatusCode = 405; }
//                });
//            }
//        }

//        private class Delete<T>
//            where T : class
//        {
//            private IContainer m_Container;
//            private IFormatter m_Formatter;
//            private IManager m_Manager;
//            private Action<T, IFormatter, Stream, Stream> m_Action;

//            public Delete(IContainer container, IFormatter formatter, IManager manager, Action<T, IFormatter, Stream, Stream> action)
//            {
//                this.m_Container = container;
//                this.m_Formatter = formatter;
//                this.m_Manager = manager;
//                this.m_Action = action;
//            }

//            public Task Run(HttpContext context)
//            {
//                return Task.Run(() =>
//                {
//                    var _module = null as IModule<T>;
//                    var _response = context.Response;
//                    _response.ContentType = "application/json";
//#if NET452
//                    if (context.Request.HttpMethod == "DELETE")
//#else
//                    if (context.Request.Method == "DELETE")
//#endif
//                    {
//                        try
//                        {
//                            _module = this.m_Container.Module<T>();
//#if NET452
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.InputStream, _response.OutputStream);
//#else
//                            this.m_Action(_module.Value, this.m_Formatter, context.Request.Body, _response.Body);
//#endif
//                        }
//                        catch (Exception exception) { _response.StatusCode = this.m_Manager.Code(exception); }
//                        finally { if (_module != null) { _module.Dispose(); } }
//                    }
//                    else { _response.StatusCode = 405; }
//                });
//            }
//        }

//        private class Get<T>
//            where T : class
//        {
//            private IContainer m_Container;
//            private IFormatter m_Formatter;
//            private IManager m_Manager;
//            private Action<T, string, IFormatter, Stream> m_Action;

//            public Get(IContainer container, IFormatter formatter, IManager manager, Action<T, string, IFormatter, Stream> action)
//            {
//                this.m_Container = container;
//                this.m_Formatter = formatter;
//                this.m_Manager = manager;
//                this.m_Action = action;
//            }

//            public Task Run(HttpContext context)
//            {
//                return Task.Run(() =>
//                {
//                    var _path = context.Request.Path;
//                    var _module = null as IModule<T>;
//                    var _response = context.Response;
//                    _response.ContentType = "application/json";
//#if NET452
//                    if (context.Request.HttpMethod == "GET")
//#else
//                    if (context.Request.Method == "GET")
//#endif
//                    {
//                        try
//                        {
//                            _module = this.m_Container.Module<T>();
//#if NET452
//                            this.m_Action(_module.Value, string.IsNullOrWhiteSpace(_path) ? null : _path.Substring(1), this.m_Formatter, _response.OutputStream);
//#else
//                            this.m_Action(_module.Value, _path.HasValue ? _path.Value.Substring(1) : null, this.m_Formatter, _response.Body);
//#endif
//                        }
//                        catch (Exception exception) { _response.StatusCode = this.m_Manager.Code(exception); }
//                        finally { if (_module != null) { _module.Dispose(); } }
//                    }
//                    else { _response.StatusCode = 405; }
//                });
//            }
//        }

//        public class Mapping : Communication.IMapping
//        {
//            private string m_Path;
//            private Communication.Verbs m_Verb;
//            private IFormatter m_Formatter;
//            private Communication.IManager m_Manager;

//            public Mapping(string path, Communication.Verbs verb, IFormatter formatter, Communication.IManager manager)
//            {
//                this.m_Path = path;
//                this.m_Verb = verb;
//                this.m_Formatter = formatter;
//                this.m_Manager = manager;
//            }

//            public string Path
//            {
//                get { return this.m_Path; }
//            }

//            public Communication.Verbs Verb
//            {
//                get { return this.m_Verb; }
//            }

//            public IFormatter Formatter
//            {
//                get { return this.m_Formatter; }
//            }

//            public Communication.IManager Manager
//            {
//                get { return this.m_Manager; }
//            }
//        }
//    }
//}


text:
class UploadUsersJob < ApplicationJob
  def self.on_complete_js(_status)
    'window.location.reload.bind(window.location)'
  end

  def perform(user_class, data, encoding)
    progress.total = data.lines.count
    user_class.transaction do
      MarkusCsv.parse(data, encoding: encoding, skip_blanks: true, row_sep: :auto) do |row|
        user_data = EndUser::CSV_ORDER.zip(row).to_h
        user = user_class.find_by(user_name: user_data[:user_name]) || user_class.new(user_data)
        user.assign_attributes(user_data)
        raise "#{user_data[:user_name]}: #{user.errors.full_messages.join('; ')}" unless user.save
        progress.increment
      end
    end
  end
end


text:
describe("Detail Controller",function(){

    var scope, ctrl, $httpBackend, catalogService,
        book1 =function(){
            return {
                "id": 1,
                "name": "AngularJS",
                "author": "Brad Green, Shyam Seshadri",
                "price": 15.34,
                "description": "Description...",
                "category": "book",
                "isNew": false,
                "comments": [
                    {
                        "rate": 3,
                        "user": "Test Reader",
                        "comment": "Test comment"
                    }
                ]

            }
        };

    //load our app module
    beforeEach(module('app'));

    // $httpBackend is in module ngMock (angular-mock.js)
    // inject() is used to inject services in our function. (ignores leading and trailing underscores)
    beforeEach(inject(function($rootScope, $controller, _$httpBackend_,$routeParams) {
        $httpBackend = _$httpBackend_;
        scope = $rootScope.$new();
        $routeParams.id = 1;

        $httpBackend.when('GET', 'api/catalog/1')
            .respond(book1());

        ctrl = $controller('DetailController',{$scope: scope});
    }));

    it('should fetch one book', function() {
        expect(scope.product).toEqual({});
        $httpBackend.flush();
        expect(scope.product).toEqual(book1());
    });

    it('getImage() should return the correct url', function() {
        // toMatch: compare a string/regular expression.
        expect(scope.getImage(1)).toEqual('/img/catalog/1.jpg');
    });

    it('getCSSRating() should return the correct css classes', function() {
        //expect(scope.getCSSRating(book1().comments)).toEqual(['rating','two']);
        //test moved to ProductUtilsSpec.js
    });
});


text:
.class public Landroid/app/Instrumentation$ActivityMonitor;
.super Ljava/lang/Object;
.source "Instrumentation.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/app/Instrumentation;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "ActivityMonitor"
.end annotation

# instance fields
.field private final mBlock:Z

.field private final mClass:Ljava/lang/String;

.field mHits:I

.field mLastActivity:Landroid/app/Activity;

.field private final mResult:Landroid/app/Instrumentation$ActivityResult;

.field private final mWhich:Landroid/content/IntentFilter;

# direct methods
.method public constructor <init>(Landroid/content/IntentFilter;Landroid/app/Instrumentation$ActivityResult;Z)V
    .registers 6
    .param p1, "which"    # Landroid/content/IntentFilter;
    .param p2, "result"    # Landroid/app/Instrumentation$ActivityResult;
    .param p3, "block"    # Z

    .prologue
    const/4 v1, 0x0

    .line 456
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 438
    const/4 v0, 0x0

    iput v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mHits:I

    .line 441
    iput-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;

    .line 458
    iput-object p1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mWhich:Landroid/content/IntentFilter;

    .line 459
    iput-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mClass:Ljava/lang/String;

    .line 460
    iput-object p2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mResult:Landroid/app/Instrumentation$ActivityResult;

    .line 461
    iput-boolean p3, p0, Landroid/app/Instrumentation$ActivityMonitor;->mBlock:Z

    .line 457
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;Landroid/app/Instrumentation$ActivityResult;Z)V
    .registers 6
    .param p1, "cls"    # Ljava/lang/String;
    .param p2, "result"    # Landroid/app/Instrumentation$ActivityResult;
    .param p3, "block"    # Z

    .prologue
    const/4 v1, 0x0

    .line 477
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 438
    const/4 v0, 0x0

    iput v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mHits:I

    .line 441
    iput-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;

    .line 479
    iput-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mWhich:Landroid/content/IntentFilter;

    .line 480
    iput-object p1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mClass:Ljava/lang/String;

    .line 481
    iput-object p2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mResult:Landroid/app/Instrumentation$ActivityResult;

    .line 482
    iput-boolean p3, p0, Landroid/app/Instrumentation$ActivityMonitor;->mBlock:Z

    .line 478
    return-void
.end method

# virtual methods
.method public final getFilter()Landroid/content/IntentFilter;
    .registers 2

    .prologue
    .line 489
    iget-object v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mWhich:Landroid/content/IntentFilter;

    return-object v0
.end method

.method public final getHits()I
    .registers 2

    .prologue
    .line 512
    iget v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mHits:I

    return v0
.end method

.method public final getLastActivity()Landroid/app/Activity;
    .registers 2

    .prologue
    .line 520
    iget-object v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;

    return-object v0
.end method

.method public final getResult()Landroid/app/Instrumentation$ActivityResult;
    .registers 2

    .prologue
    .line 497
    iget-object v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mResult:Landroid/app/Instrumentation$ActivityResult;

    return-object v0
.end method

.method public final isBlocking()Z
    .registers 2

    .prologue
    .line 505
    iget-boolean v0, p0, Landroid/app/Instrumentation$ActivityMonitor;->mBlock:Z

    return v0
.end method

.method final match(Landroid/content/Context;Landroid/app/Activity;Landroid/content/Intent;)Z
    .registers 11
    .param p1, "who"    # Landroid/content/Context;
    .param p2, "activity"    # Landroid/app/Activity;
    .param p3, "intent"    # Landroid/content/Intent;

    .prologue
    const/4 v6, 0x1

    const/4 v5, 0x0

    .line 573
    monitor-enter p0

    .line 574
    :try_start_3
    iget-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mWhich:Landroid/content/IntentFilter;

    if-eqz v1, :cond_19

    .line 575
    iget-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mWhich:Landroid/content/IntentFilter;

    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    .line 576
    const-string/jumbo v3, "Instrumentation"

    const/4 v4, 0x1

    .line 575
    invoke-virtual {v1, v2, p3, v4, v3}, Landroid/content/IntentFilter;->match(Landroid/content/ContentResolver;Landroid/content/Intent;ZLjava/lang/String;)I
    :try_end_14
    .catchall {:try_start_3 .. :try_end_14} :catchall_4c

    move-result v1

    if-gez v1, :cond_19

    monitor-exit p0

    .line 577
    return v5

    .line 579
    :cond_19
    :try_start_19
    iget-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mClass:Ljava/lang/String;

    if-eqz v1, :cond_32

    .line 580
    const/4 v0, 0x0

    .line 581
    .local v0, "cls":Ljava/lang/String;
    if-eqz p2, :cond_3b

    .line 582
    invoke-virtual {p2}, Landroid/app/Activity;->getClass()Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v0

    .line 586
    .end local v0    # "cls":Ljava/lang/String;
    :cond_28
    :goto_28
    if-eqz v0, :cond_4a

    iget-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mClass:Ljava/lang/String;

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_4a

    .line 590
    :cond_32
    if-eqz p2, :cond_39

    .line 591
    iput-object p2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;

    .line 592
    invoke-virtual {p0}, Landroid/app/Instrumentation$ActivityMonitor;->notifyAll()V
    :try_end_39
    .catchall {:try_start_19 .. :try_end_39} :catchall_4c

    :cond_39
    monitor-exit p0

    .line 594
    return v6

    .line 583
    .restart local v0    # "cls":Ljava/lang/String;
    :cond_3b
    :try_start_3b
    invoke-virtual {p3}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v1

    if-eqz v1, :cond_28

    .line 584
    invoke-virtual {p3}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/ComponentName;->getClassName()Ljava/lang/String;
    :try_end_48
    .catchall {:try_start_3b .. :try_end_48} :catchall_4c

    move-result-object v0

    .local v0, "cls":Ljava/lang/String;
    goto :goto_28

    .end local v0    # "cls":Ljava/lang/String;
    :cond_4a
    monitor-exit p0

    .line 587
    return v5

    .line 573
    :catchall_4c
    move-exception v1

    monitor-exit p0

    throw v1
.end method

.method public final waitForActivity()Landroid/app/Activity;
    .registers 4

    .prologue
    .line 530
    monitor-enter p0

    .line 531
    :goto_1
    :try_start_1
    iget-object v2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;
    :try_end_3
    .catchall {:try_start_1 .. :try_end_3} :catchall_12

    if-nez v2, :cond_b

    .line 533
    :try_start_5
    invoke-virtual {p0}, Landroid/app/Instrumentation$ActivityMonitor;->wait()V
    :try_end_8
    .catch Ljava/lang/InterruptedException; {:try_start_5 .. :try_end_8} :catch_9
    .catchall {:try_start_5 .. :try_end_8} :catchall_12

    goto :goto_1

    .line 534
    :catch_9
    move-exception v0

    .local v0, "e":Ljava/lang/InterruptedException;
    goto :goto_1

    .line 537
    .end local v0    # "e":Ljava/lang/InterruptedException;
    :cond_b
    :try_start_b
    iget-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;

    .line 538
    .local v1, "res":Landroid/app/Activity;
    const/4 v2, 0x0

    iput-object v2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;
    :try_end_10
    .catchall {:try_start_b .. :try_end_10} :catchall_12

    monitor-exit p0

    .line 539
    return-object v1

    .line 530
    .end local v1    # "res":Landroid/app/Activity;
    :catchall_12
    move-exception v2

    monitor-exit p0

    throw v2
.end method

.method public final waitForActivityWithTimeout(J)Landroid/app/Activity;
    .registers 8
    .param p1, "timeOut"    # J

    .prologue
    const/4 v3, 0x0

    .line 553
    monitor-enter p0

    .line 554
    :try_start_2
    iget-object v2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;
    :try_end_4
    .catchall {:try_start_2 .. :try_end_4} :catchall_18

    if-nez v2, :cond_9

    .line 556
    :try_start_6
    invoke-virtual {p0, p1, p2}, Landroid/app/Instrumentation$ActivityMonitor;->wait(J)V
    :try_end_9
    .catch Ljava/lang/InterruptedException; {:try_start_6 .. :try_end_9} :catch_f
    .catchall {:try_start_6 .. :try_end_9} :catchall_18

    .line 560
    :cond_9
    :goto_9
    :try_start_9
    iget-object v2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;
    :try_end_b
    .catchall {:try_start_9 .. :try_end_b} :catchall_18

    if-nez v2, :cond_11

    monitor-exit p0

    .line 561
    return-object v3

    .line 557
    :catch_f
    move-exception v0

    .local v0, "e":Ljava/lang/InterruptedException;
    goto :goto_9

    .line 563
    .end local v0    # "e":Ljava/lang/InterruptedException;
    :cond_11
    :try_start_11
    iget-object v1, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;

    .line 564
    .local v1, "res":Landroid/app/Activity;
    const/4 v2, 0x0

    iput-object v2, p0, Landroid/app/Instrumentation$ActivityMonitor;->mLastActivity:Landroid/app/Activity;
    :try_end_16
    .catchall {:try_start_11 .. :try_end_16} :catchall_18

    monitor-exit p0

    .line 565
    return-object v1

    .line 553
    .end local v1    # "res":Landroid/app/Activity;
    :catchall_18
    move-exception v2

    monitor-exit p0

    throw v2
.end method


text:
<?php

declare(strict_types=1);

namespace Overblog\GraphQLBundle\Annotation;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
 * Annotation for GraphQL field builders.
 *
 * @Annotation
 * @NamedArgumentConstructor
 * @Target({"PROPERTY", "METHOD"})
 */
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)]
final class FieldBuilder extends Builder
{
}


text:
package org.usc.demo.id;

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;

/**
 * 产生20位后3位数字的订单号(前17位可以是精确到毫秒的)
 */
public class OrderIdGenerator {
    private final long workerId;
    private final long workerIdBits = 3L; // 机器标识位数,最多支持8台
    private final long sequenceBits = 6L; // 毫秒内自增位

    private final long maxWorkerId = -1L ^ -1L << this.workerIdBits;// 机器ID最大值: 7
    private final long sequenceMask = -1L ^ -1L << this.sequenceBits; // 63

    private long sequence = 0L; // 0,并发控制

    private OrderIdGenerator(long workerId) {
        if (workerId > this.maxWorkerId || workerId < 0) {
            throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", this.maxWorkerId));
        }
        this.workerId = workerId;
    }

    public synchronized long nextId() throws Exception {
        this.sequence = this.sequence + 1 & this.sequenceMask;
        return this.workerId << this.sequenceBits | this.sequence;
    }

    public static void main(String[] args) throws Exception {
        OrderIdGenerator idWorker = new OrderIdGenerator(0);

        while (true) {
            System.out.println(DateTime.now().toString("yyyyMMddHHmmssSSS") + StringUtils.leftPad(idWorker.nextId() + "", 3, "0"));
        }
    }

}