text:
package arez.spy;

import arez.AbstractTest;
import arez.Arez;
import arez.ArezContext;
import arez.ComputableValue;
import java.util.HashMap;
import org.realityforge.guiceyloops.shared.ValueUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public final class ComputableValueDeactivateEventTest
  extends AbstractTest
{
  @Test
  public void basicOperation()
  {
    final ArezContext context = Arez.context();
    final ComputableValue<?> computableValue = context.computable( "Foo@1", ValueUtil::randomString );
    final ComputableValueInfo info = context.getSpy().asComputableValueInfo( computableValue );
    final ComputableValueDeactivateEvent event = new ComputableValueDeactivateEvent( info );

    assertEquals( event.getComputableValue(), info );

    final HashMap<String, Object> data = new HashMap<>();
    event.toMap( data );

    assertEquals( data.get( "type" ), "ComputableValueDeactivate" );
    assertEquals( data.get( "name" ), "Foo@1" );
    assertEquals( data.size(), 2 );
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

/*
 * This file is part of the Behat
 *
 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

spl_autoload_register(function($class) {
    if (false !== strpos($class, 'VIPSoft\\CodeCoverageExtension')) {
        require_once(__DIR__.'/src/'.str_replace('\\', '/', $class).'.php');

        return true;
    }
}, true, false);

return new VIPSoft\CodeCoverageExtension\Extension;


text:
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new Cpt\EventBundle\CptEventBundle(),
            new Cpt\MainBundle\CptMainBundle(),
            new Cpt\PublicationBundle\CptPublicationBundle(),
            new Cpt\TestBundle\CptTestBundle(),
            new FOS\UserBundle\FOSUserBundle(),

            new Sonata\IntlBundle\SonataIntlBundle(),
            new Sonata\jQueryBundle\SonatajQueryBundle(),
            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Application\FOS\UserBundle\ApplicationFOSUserBundle(),
            new Sonata\UserBundle\SonataUserBundle('ApplicationFOSUserBundle'),
            new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
            new Sonata\FormatterBundle\SonataFormatterBundle(),
            new Sonata\MarkItUpBundle\SonataMarkItUpBundle(),
            new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
            new Sonata\MediaBundle\SonataMediaBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
            new Application\Ivory\CKEditorBundle\ApplicationIvoryCKEditorBundle(),
            new Cpt\BlogBundle\CptBlogBundle(),
            new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
            new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
        //    new Thrace\FormBundle\ThraceFormBundle(),
         //   new Ivory\GoogleMapBundle\IvoryGoogleMapBundle(),
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
            new FrequenceWeb\Bundle\CalendRBundle\FrequenceWebCalendRBundle(),
            new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
       );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}


text:
/*
 * Minio Java Library for Amazon S3 Compatible Cloud Storage, (C) 2015 Minio, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import io.minio.MinioClient;
import io.minio.errors.ClientException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class PutObject {
  public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
    System.out.println("PutObject app");

    // Set s3 endpoint, region is calculated automatically
    MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");

    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < 11 * 1024 * 1024; i++) {
      builder.append('a');
    }
    // create object
    s3Client.putObject("mybucket", "my/object", "application/octet-stream", 11 * 1024 * 1024, new ByteArrayInputStream(builder.toString().getBytes("UTF-8")));
  }
}


text:
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-php-xdebug.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-php-xdebug)

Installs PHP [XDebug](http://xdebug.org/) on Linux servers.

## Requirements

Prior to running this role, make sure the `php-devel` and `@Development Tools` (for RHEL/CentOS) or `php5-dev` + `build-essential` packages (for Debian/Ubuntu) are present on the system, as they are required for the build of Xdebug.

## Role Variables

Available variables are listed below, along with default values (see `defaults/main.yml`):

    workspace: /root

Where Xdebug setup files will be downloaded and built.

    php_xdebug_version: 2.9.0

The version of Xdebug to be installed (see [Updates](https://xdebug.org/updates.php) for a current listing).

    php_xdebug_default_enable: 1
    php_xdebug_coverage_enable: 1

Whether to enable XDebug coverage and default exception handling or not. Disable these for slightly improved PHP performance, enable these to use XDebug to the fullest extent.

    php_xdebug_module_path: /usr/lib64/php/modules

The path where `xdebug.so` will be installed.

    php_xdebug_remote_enable: "false"

Whether remote debugging is enabled.

    php_xdebug_remote_connect_back: "false"

If this is set to true, Xdebug will respond to any request from any IP address; use only for local development on non-public installations!

    php_xdebug_remote_host: localhost
    php_xdebug_remote_port: "9000"

The host and port on which Xdebug will listen.

    php_xdebug_remote_log: /tmp/xdebug.log

The location of the xdebug log (useful if you're having trouble connecting).

    php_xdebug_idekey: sublime.xdebug

The IDE key to use in the URL when making Xdebug requests (e.g. `http://example.local/?XDEBUG_SESSION_START=sublime.xdebug`).

    php_xdebug_max_nesting_level: 256

The maximimum function nesting level before Xdebug bails and throws a fatal exception.

    php_xdebug_cli_disable: false

(Debian/Ubuntu ONLY) Disable xdebug for the CLI SAPI.

## Dependencies

  - geerlingguy.php

## Example Playbook

    - hosts: webservers
      roles:
        - { role: geerlingguy.php-xdebug }

## License

MIT / BSD

## Author Information

This role was created in 2014 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).


text:
package net.imagej.ops.imagemoments;

import net.imagej.ops.Contingent;
import net.imagej.ops.OpService;
import net.imagej.ops.special.hybrid.AbstractUnaryHybridCF;
import net.imglib2.IterableInterval;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.real.DoubleType;

/**
 * Abstract {@link ImageMomentOp}. Provides {@link OpService} and create the
 * output.
 *
 * @author Daniel Seebacher (University of Konstanz)
 * @author Christian Dietz (University of Konstanz)
 * @param <I> input type
 * @param <O> output type
 */
public abstract class AbstractImageMomentOp<I extends RealType<I>, O extends RealType<O>>
	extends AbstractUnaryHybridCF<IterableInterval<I>, O> implements
	ImageMomentOp<IterableInterval<I>, O>, Contingent
{

	@SuppressWarnings("unchecked")
	@Override
	public O createOutput(IterableInterval<I> input) {
		return (O) new DoubleType();
	}

	@Override
	public boolean conforms() {
		return 2 == in().numDimensions();
	}
}


text:
using System;
using System.Text;
using Leprechaun.Logging;

namespace Leprechaun.Console
{
	public class ConsoleLogger : ILogger
	{
		public void Info(string message)
		{
			System.Console.ForegroundColor = ConsoleColor.White;
			System.Console.WriteLine(message);
			System.Console.ResetColor();
		}

		public void Debug(string message)
		{
			System.Console.ForegroundColor = ConsoleColor.DarkGray;
			System.Console.WriteLine(message);
			System.Console.ResetColor();
		}

		public void Warn(string message)
		{
			System.Console.ForegroundColor = ConsoleColor.Yellow;
			System.Console.WriteLine(message);
			System.Console.ResetColor();
		}

		public void Error(string message)
		{
			System.Console.ForegroundColor = ConsoleColor.Red;
			System.Console.WriteLine(message);
			System.Console.ResetColor();
		}

		public void Error(Exception exception)
		{
			Error(FormatExceptionAsText(exception));
		}

		protected virtual string FormatExceptionAsText(Exception exception)
		{
			var exMessage = new StringBuilder();
			exMessage.AppendFormat("ERROR: {0} ({1})", exception.Message, exception.GetType().FullName);
			exMessage.AppendLine();

			if (exception.StackTrace != null)
				exMessage.Append(exception.StackTrace.Trim());
			else
				exMessage.Append("No stack trace available.");

			exMessage.AppendLine();

			WriteInnerExceptionAsText(exception.InnerException, exMessage);

			return exMessage.ToString();
		}

		protected virtual void WriteInnerExceptionAsText(Exception innerException, StringBuilder exMessage)
		{
			if (innerException == null) return;

			exMessage.AppendLine();
			exMessage.AppendLine("INNER EXCEPTION");
			exMessage.AppendFormat("{0} ({1})", innerException.Message, innerException.GetType().FullName);
			exMessage.AppendLine();

			if (innerException.StackTrace != null)
				exMessage.Append(innerException.StackTrace.Trim());
			else
				exMessage.Append("No stack trace available.");

			WriteInnerExceptionAsText(innerException.InnerException, exMessage);

			exMessage.AppendLine();
		}
	}
}


text:
<?php ?>

About. Ein kurzer Einblick.

            Diese Beispiel-Webseite dient als Anschauungsbeispiel für meine Bachelorarbeit im Studiengang

            "Medienproduktion und Medientechnik" an der Ostbayerischen Technischen Hochschule Amberg-Weiden.
            BaRESS steht für Bachelorarbeit Responsive (Web Design) + Server Side (Components)

            Neben dem Zweck als Anschauungsbeispiel stelle ich ein paar Hintergrundinformation zur Verfügung.
           Die Webseite lädt hauptsächlich ein paar unspektakuläre
            Bilder, ein paar Plugins und ansonsten Text. Soweit, so gut.

        Zusammenfassung meiner Bachelorarbeit:

        Diese Bachelorarbeit beschäftigt sich mit der Optimierung von Webseiten-Performance und den Herausforderungen,
        denen Webentwickler gegenüberstehen. Anhand einer Beispiel-Webseite werden diverse Probleme betrachtet,
        die die Performance mindern. Um diese Probleme möglichst effektiv zu verbessern,
        werden konkrete Lösungsansätze und Techniken untersucht und umgesetzt.
        Die Optimierung wird für geräteunabhängige Webseitenaufrufe durchgeführt;
        im Verlauf der Bachelorarbeit aber speziell im Hinblick auf die Optimierung für mobile Aufrufe.

Techniken.

Die folgenden Techniken werde ich auf dieser Seite bzw. auf den optimierten Versionen dieser Seite
            einsetzen.

Bootstrap als Responsive-Webdesign-Framework.

LESS als CSS Preprocessor.

AdaptiveImages zur automatisierten Bildkompression.

SmartOptimizer für serverseitige Minifizierung und Konkatenierung.

Detector um den Browser und seine Fähigkeiten zu analysieren.

WURFL Cloud um den User Agent String auszuwerten.


text:
import { validate } from "email-validator";
import { allUsers, authProviders, getRandomMockUid, getAuthObservers } from "../state-mgmt";
export function emailExistsAsUserInAuth(email) {
    const emails = allUsers().map(i => i.email);
    return emails.includes(email);
}
export function emailIsValidFormat(email) {
    return validate(email);
}
export function emailHasCorrectPassword(email, password) {
    const config = allUsers().find(i => i.email === email);
    return config ? config.password === password : false;
}
export function emailVerified(email) {
    const user = allUsers().find(i => i.email === email);
    return user ? user.emailVerified || false : false;
}
export function userUid(email) {
    const config = allUsers().find(i => i.email === email);
    return config ? config.uid || getRandomMockUid() : getRandomMockUid();
}
export function emailValidationAllowed() {
    return authProviders().includes("emailPassword");
}
export function loggedIn(user) {
    getAuthObservers().map(o => o(user));
}
export function loggedOut() {
    getAuthObservers().map(o => o(null));
}
//# sourceMappingURL=authMockHelpers.js.map


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dreamaple.quququ">

    <meta-data
        android:name="com.amap.api.v2.apikey"
        android:value="4c8752720dccfb190896b1e95685a292" />
    <!-- 定位需要的服务 -->
    <service android:name="com.amap.api.location.APSService" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

    <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action
                    android:name="android.intent.action.MAIN"
                    android:theme="@android:style/Theme.NoTitleBar" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".mapActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:windowSoftInputMode="adjustResize|stateHidden" />
        <activity
            android:name=".home"
            android:label="@string/title_activity_home"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name=".SettingsActivity"
            android:label="@string/title_activity_settings" />
        <activity
            android:name=".LoginActivity"
            android:label="@string/title_activity_login"
            android:parentActivityName=".home">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.dreamaple.quququ.home" />
        </activity>
        <activity
            android:name=".DingdanScrollingActivity"
            android:label="@string/title_activity_dingdan_scrolling"
            android:parentActivityName=".home"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.dreamaple.quququ.home" />
        </activity>
        <activity android:name=".ZhangHuYuE"></activity>
    </application>

</manifest>


text:
//
//  RKObjectRouter.h
//  RestKit
//
//  Created by Blake Watters on 10/18/10.
//  Copyright 2010 Two Toasters
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//

#import "RKRequest.h"

// TODO: Cleanup the comments in here

/**
 * An implementation of the RKRouter protocol that is suitable for use in either
 * static or dynamic route generation. Static routes are added by simply encoding
 * the resourcePath that the mappable object should be sent to when a GET, POST, PUT
 * or DELETE action is invoked. Dynamic routes are available by encoding key paths into
 * the resourcePath using a single colon delimiter, such as /users/:userID
 */
@interface RKObjectRouter : NSObject {
	NSMutableDictionary* _routes;
}

/**
 * Register a mapping from an object class to a resource path. This resourcePath can be static
 * (i.e. /this/is/the/path) or dynamic (i.e. /users/:userID/:username). Dynamic routes are
 * evaluated against the object being routed using Key-Value coding and coerced into a string.
 * *NOTE* - The pattern matcher fully supports KVM, so /:key1.otherKey normally resolves as it
 * would in any other KVM situation, ... otherKey is a sub-key on a the object represented by
 * key1.  This presents a problem in situations where you might want to build a pattern like
 * /:filename.json, where the dot isn't intended as a sub-key on the dynamic "filename", but
 * rather it is part of the "json" static string.  In these instances, you need to escape the
 * dot with two backslashes, like so: /:filename\\.json
 * @see RKPathMatcher
 */
- (void)routeClass:(Class)objectClass toResourcePath:(NSString*)resourcePath;

/**
 * Register a mapping from an object class to a resource path for a specific HTTP method.
 * @see RKPathMatcher
 */
- (void)routeClass:(Class)objectClass toResourcePath:(NSString*)resourcePath forMethod:(RKRequestMethod)method;

/**
 * Register a mapping from an object class to a resource path for a specific HTTP method,
 * optionally adding url escapes to the path.  This urlEscape flag comes in handy when you want to provide
 * your own fully escaped dynamic resource path via a method/attribute on the object model.
 * For example, if your Person model has a string attribute titled "polymorphicResourcePath" that returns
 * @"/this/is/the/path", you should configure the route with url escapes 'off', otherwise the router will return
 * @"%2Fthis%2Fis%2Fthe%2Fpath".
 * @see RKPathMatcher
 */
- (void)routeClass:(Class)objectClass toResourcePath:(NSString*)resourcePath forMethod:(RKRequestMethod)method escapeRoutedPath:(BOOL)addEscapes;

/**
 * Returns the resource path to send requests for a given object and HTTP method
 */
- (NSString*)resourcePathForObject:(NSObject*)object method:(RKRequestMethod)method;

@end


text:
<html>
	<head>
		<title>Tick Tack Cube - three.js Experiment</title>
		<style>
			body { margin: 0; }
			canvas { width: 100%; height: 100% }
		</style>
	</head>
	<body>
		<script src="js/three.min.js"></script>
		<script src="js/three.min.js"></script>
		<script src="js/tween.js"></script>
		<script src="js/key.js"></script>
		<script src="js/mouse.js"></script>
		<script>
			function Block(size) {
				this.size     = size || 100;
				this.index    = 0;
				this.offColor = 0x006666;
				this.bgColor  = 0xcccccc;
				this.xColor   = 0xcc0000;
				this.oColor   = 0x0000cc;
			};

			Block.prototype = Object.create(THREE.Mesh.prototype);
			Block.prototype.constructor = Block;

			Block.prototype.init = function() {
				this.makeBox();
				this.makeX();
				this.makeO();
			};

			Block.prototype.makeBox = function() {
				var geometry = new THREE.BoxGeometry(this.size, this.size, this.size);

				// Shade the top and bottom face
				[4, 5, 6, 7].forEach(function(f) {
					geometry.faces[f].color.setHex(this.offColor);
				}, this);

				var material = new THREE.MeshLambertMaterial({
					color: this.bgColor,
					vertexColors: THREE.FaceColors
				});
				THREE.Mesh.call(this, geometry, material);
			};

			Block.prototype.makeX = function() {
				this.x = new THREE.Object3D();

				var geometry = new THREE.CylinderGeometry(this.size/10, this.size/10, this.size);
				var material = new THREE.MeshPhongMaterial({color: this.xColor});

				var x1 = new THREE.Mesh(geometry.clone(), material.clone());
				x1.position.x = this.size/2;
				x1.rotation.x = -Math.PI/4;
				this.x.add(x1);

				var x2 = new THREE.Mesh(geometry.clone(), material.clone());
				x2.position.x = this.size/2;
				x2.rotation.x = Math.PI/4;
				this.x.add(x2);

				this.add(this.x);
				this.xFace = 1;
			};

			Block.prototype.makeO = function() {
				var geometry = new THREE.TorusGeometry(this.size/3, this.size/10, 8, 50);
				var material = new THREE.MeshPhongMaterial({color: this.oColor});

				this.o = new THREE.Mesh(geometry, material);
				this.o.position.z = -this.size/2;

				this.add(this.o);
				this.oFace = 2;
			};

			// Determines which face is visible from the origin
			Block.prototype.showing = function(origin) {
				if (!origin) {
					origin = new THREE.Vector3(0, 0, 0);
				}
				var target = new THREE.Vector3();
				target.setFromMatrixPosition(this.matrixWorld).sub(origin).normalize();

				raycaster.set(origin, target);
				var intersection = raycaster.intersectObject(this, true);

				if (!intersection.length) {
					return null;
				}

				var indices = [];
				intersection.forEach(function(i) {
					indices.push(i.faceIndex);
				});
				return indices;
			};

			function Cube(blockSize) {
				this.blockSize = blockSize || 1;
				this.blocks = [];
				THREE.Object3D.call(this);
			}

			Cube.prototype = THREE.Object3D.prototype;

			Cube.prototype.generate = function(scene) {
				var count = 27;

				var holder = new THREE.Object3D();
				holder.position.set(-this.blockSize, -this.blockSize, -this.blockSize);
				this.add(holder);

				for (var i=0; i<count; i++) {
					var shade = i % 2 ? 0xffffff : 0xcccccc;

					var block = new Block(this.blockSize);
					block.bgColor = shade;
					block.index   = i;
					block.init();

					var x = this.blockSize * (i % 3);
					var y = this.blockSize * (Math.floor((i % 9) / 3));
					var z = this.blockSize * (Math.floor(i / 9));

					block.position.set(x, y, z);

					holder.add(block);
					this.blocks.push(block);
				}

				scene.add(this);
			};

			Cube.prototype.getBlockIndex = function(block) {
				for (var i=0; i<this.blocks.length; i++) {
					if (this.blocks[i].id === block.id) {
						return i;
					}
				}
				return -1;
			};

			// Returns 2-d array with 4, 9-item arrays that contain the face indexes
			// for each block on the specified face of this cube.
			Cube.prototype.grids = function() {
				var origin = camera.position.clone();
				var radius = origin.distanceTo(this.position);
				var angle  = 0;

				var grids  = [];
				for (var i=0; i<4; i++) {
					grids.push(this.showing(origin));
					angle += Math.PI/2;
					origin.x = radius * Math.cos(angle);
					origin.z = radius * Math.sin(angle);
				}
				return grids;
			};

			Cube.prototype.showing = function(origin) {
				if (!origin) {
					origin = new THREE.Vector3(0, 0, 0);
				}
				var blocks = [];
				this.blocks.forEach(function(block) {
					var showing = block.showing(origin);
					if (showing !== null) {
						blocks.push({
							object  : block,
							showing : showing
						});
					}
				});

				return blocks;
			};
		</script>
		<script>
			var world = {
				angle     : 60,
				near      : 1,
				far       : 1000,
				blockSize : 100,
				width     : window.innerWidth,
				height    : window.innerHeight
			}

			var cube;

			var scene, camera, renderer, raycaster;

			function init() {
				scene     = new THREE.Scene();
				raycaster = new THREE.Raycaster();
				lights();
				camera();
				action();
			}

			function lights() {
				var toplight = new THREE.HemisphereLight(0xffffff, 0x666666);
				scene.add(toplight);

				var lightbulb = new THREE.PointLight(0xffffff, 1, world.far);
				lightbulb.position.set(world.width/2, world.height/2, world.near);
				scene.add(lightbulb);
			}

			function camera() {
				camera = new THREE.PerspectiveCamera(world.angle, world.width / world.height, world.near, world.far);
				camera.position.z = world.far/2;
			}

			function action() {
				renderer = new THREE.WebGLRenderer();
				renderer.setSize(world.width, world.height);
				document.body.appendChild(renderer.domElement);
				setup();
				loop();
			}

			function setup() {
				cube = new Cube(world.blockSize);
				cube.generate(scene);
			}

			function draw() {
				if (Key.isDown(Key.SPACEBAR)) {
					if (Key.isDown(Key.SHIFT)) {
						camera.position.z += 10;
					}
					else {
						camera.position.z -= 10;
					}
				}
			}

			function loop() {
				requestAnimationFrame(loop);
				draw();
				TWEEN.update();
				renderer.render(scene, camera);
			}

			function turn(object, axis, direction) {
				var radian   = Math.PI/2;
				var current  = object.rotation[axis];
				var rotation = current + (direction * radian);

				// Used to force-fit into right angles
				var index    = Math.round(rotation / radian);
				var target   = index * radian;

				var tween = new TWEEN.Tween({angle: object.rotation[axis]});
				tween.to({angle: target})
					.easing(TWEEN.Easing.Elastic.Out)
					.onUpdate(function() {
						object.rotation[axis] = this.angle;
					})
					.start();
			}

			var horizontal = 'y';
			var vertical   = 'x';

			Key.on('up', function(event) {
				if (event.UP_ARROW) {
					turn(cube, vertical, 1);
					horizontal = horizontal === 'y' ? 'z' : 'y';
				}
				if (event.DOWN_ARROW) {
					turn(cube, vertical, -1);
					horizontal = horizontal === 'y' ? 'z' : 'y';
				}
				if (event.RIGHT_ARROW) {
					turn(cube, horizontal, 1);
				}
				if (event.LEFT_ARROW) {
					turn(cube, horizontal, -1);
				}
			});

			Mouse.on('up', function(event) {
				var mouse = {
					x: ((event.up.x/world.width) * 2) - 1,
					y: -((event.up.y/world.height) * 2) + 1
				};

				raycaster.setFromCamera(mouse, camera);

				var intersected = raycaster.intersectObjects(cube.blocks);

				if (!intersected || !intersected.length) {
					return;
				}

				var direction = mouse.x > 0 ? 1 : -1;
				turn(intersected[0].object, 'y', direction);

				var grids = cube.grids();
				var table = [];
				grids.forEach(function(grid, i) {
					table.push([]);
					grid.forEach(function(b, y) {
						table[i][y] = b.showing.join(',');
					});
				});
				console.table(table);
			});

			window.addEventListener('resize', function() {
				world.width = window.innerWidth;
				world.height = window.innerHeight;
				camera.aspect = world.width / world.height;
				camera.updateProjectionMatrix();
				renderer.setSize(world.width, world.height);
			});

			init();
		</script>
	</body>
</html>


text:
from __future__ import unicode_literals

from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ('osf', '0002_adminlogentry'),
    ]

    operations = [
        migrations.RunSQL(
            [
                """
                CREATE UNIQUE INDEX one_quickfiles_per_user ON public.osf_abstractnode USING btree (creator_id, type, is_deleted) WHERE (((type)::text = 'osf.quickfilesnode'::text) AND (is_deleted = false));
                CREATE INDEX osf_abstractnode_collection_pub_del_type_index ON public.osf_abstractnode USING btree (is_public, is_deleted, type) WHERE ((is_public = true) AND (is_deleted = false) AND ((type)::text = 'osf.collection'::text));
                CREATE INDEX osf_abstractnode_date_modified_ef1e2ad8 ON public.osf_abstractnode USING btree (last_logged);
                CREATE INDEX osf_abstractnode_node_pub_del_type_index ON public.osf_abstractnode USING btree (is_public, is_deleted, type) WHERE ((is_public = true) AND (is_deleted = false) AND ((type)::text = 'osf.node'::text));
                CREATE INDEX osf_abstractnode_registered_date_index ON public.osf_abstractnode USING btree (registered_date DESC);
                CREATE INDEX osf_abstractnode_registration_pub_del_type_index ON public.osf_abstractnode USING btree (is_public, is_deleted, type) WHERE ((is_public = true) AND (is_deleted = false) AND ((type)::text = 'osf.registration'::text));
                CREATE INDEX fileversion_date_created_desc ON public.osf_fileversion USING btree (created DESC);
                CREATE INDEX fileversion_metadata_sha_arch_vault_index ON public.osf_fileversion USING btree (((metadata -> 'sha256'::text)), ((metadata -> 'archive'::text)), ((metadata -> 'vault'::text)));
                CREATE INDEX nodelog__node_id_date_desc ON public.osf_nodelog USING btree (node_id, date DESC);
                CREATE INDEX osf_nodelog_should_hide_nid ON public.osf_nodelog USING btree (should_hide, node_id);
                CREATE UNIQUE INDEX osf_noderequest_target_creator_non_accepted ON public.osf_noderequest USING btree (target_id, creator_id) WHERE ((machine_state)::text <> 'accepted'::text);
                CREATE INDEX lowercase_tag_index ON public.osf_tag USING btree (lower((name)::text), system);
                """
            ],
            []
        ),
    ]


text:
<?php
echo $model->body;

echo "

The exported answers are below:

";

echo $model->stack;
?>

--------------------------------------------------------------------------

This E-Mail was sent by <?php echo Yii::app()->user->getState('email') ?>


text:
import Ember from 'ember';

var w = Ember.String.w;
var computed = Ember.computed;

var toArray = function (value) {
  if (typeof value === 'string') {
    value = w(value);
  }
  return Ember.A(value);
};

export default function(defaultValue) {
  defaultValue = defaultValue || [];
  return computed({
    get() {
      return toArray(defaultValue);
    },
    set(key, value) {
      return toArray(value);
    }
  });
}


text:
<?php

/*
  Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
  Description: Parses input from a file according to a format
*/

/* Test fscanf() to scan resource type using different float format types */

$file_path = dirname(__FILE__);

echo "*** Test fscanf(): different float format types with resource ***\n";

// create a file
$filename = "$file_path/fscanf_variation10.tmp";
$file_handle = fopen($filename, "w");
if($file_handle == false)
  exit("Error:failed to open file $filename");

// resource type variable
$fp = fopen (__FILE__, "r");
$dfp = opendir ( dirname(__FILE__) );

// array of resource types
$resource_types = array (
  $fp,
  $dfp
);

$float_formats = array( "%f",
                      "%hf", "%lf", "%Lf",
                      " %f", "%f ", "% f",
                      "\t%f", "\n%f", "%4f",
                      "%30f", "%[0-9]", "%*f"
               );

$counter = 1;

// writing to the file
foreach($resource_types as $value) {
  @fprintf($file_handle, $value);
  @fprintf($file_handle, "\n");
}
// closing the file
fclose($file_handle);

// opening the file for reading
$file_handle = fopen($filename, "r");
if($file_handle == false) {
  exit("Error:failed to open file $filename");
}

$counter = 1;
// reading the values from file using different formats formats
foreach($float_formats as $float_format) {
  // rewind the file so that for every foreach iteration the file pointer starts from bof
  rewind($file_handle);
  echo "\n-- iteration $counter --\n";
  while( !feof($file_handle) ) {
    var_dump( fscanf($file_handle,$float_format) );
  }
  $counter++;
}

// closing the resources
fclose($fp);
closedir($dfp);

echo "\n*** Done ***";
?>


text:
import StackTest

main :: IO ()
main = do
    stack ["build", "async"]
    stackErr ["build", "zlib-bindings"]
    stack ["build", "--stack-yaml", "stack-modify-lts.yaml", "async"]
    stackErr ["build", "--stack-yaml", "stack-modify-lts.yaml", "zlib-bindings"]


text:
{% load i18n %}
{% blocktrans %}
<p>
	You may create a group to share images.
</p>
{% endblocktrans %}


text:
package org.jboss.resteasy.test.finegrain;

import org.jboss.resteasy.core.ExtendedCacheControl;
import org.jboss.resteasy.plugins.delegates.CacheControlDelegate;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import javax.ws.rs.core.CacheControl;
import javax.ws.rs.ext.RuntimeDelegate;

import static org.junit.Assert.*;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
public class CacheControlTest
{
   @BeforeClass
   public static void before()
   {
      ResteasyProviderFactory.setInstance(new ResteasyProviderFactory());
   }

   @Test
   public void cacheControlSerialization()
   {
      RuntimeDelegate.HeaderDelegate<CacheControl> hdcc = ResteasyProviderFactory.getInstance()
              .createHeaderDelegate(CacheControl.class);
      CacheControl control = new CacheControl();
      control.setMaxAge(1000);
      control.setSMaxAge(500);
      control.setNoTransform(false);
      control.setPrivate(true);

      String toString = hdcc.toString(control);
      System.out.println(toString);
      CacheControl serialized = hdcc.fromString(toString);

      Assert.assertTrue(serialized.getMaxAge() == 1000);
      Assert.assertTrue(serialized.getSMaxAge() == 500);
      Assert.assertTrue(!serialized.isNoTransform());
      Assert.assertTrue(serialized.isPrivate());
   }

   void assertEqual(CacheControl first, CacheControl second)
   {
      Assert.assertEquals(first.isMustRevalidate(), second.isMustRevalidate());
      Assert.assertEquals(first.isNoCache(), second.isNoCache());
      Assert.assertEquals(first.isNoStore(), second.isNoStore());
      Assert.assertEquals(first.isNoTransform(), second.isNoTransform());
      Assert.assertEquals(first.isPrivate(), second.isPrivate());
      Assert.assertEquals(first.isProxyRevalidate(), second.isProxyRevalidate());
      Assert.assertEquals(first.isPrivate(), second.isPrivate());
      Assert.assertEquals(first.getMaxAge(), second.getMaxAge());
      Assert.assertEquals(first.getSMaxAge(), second.getSMaxAge());
      Assert.assertEquals(first.getNoCacheFields().size(), second.getNoCacheFields().size());
      Assert.assertEquals(first.getPrivateFields().size(), second.getPrivateFields().size());
      for (int i = 0; i < first.getNoCacheFields().size(); i++)
         Assert.assertEquals(first.getNoCacheFields().get(i), second.getNoCacheFields().get(i));
      for (int i = 0; i < first.getPrivateFields().size(); i++)
         Assert.assertEquals(first.getPrivateFields().get(i), second.getPrivateFields().get(i));
      Assert.assertEquals(first.getCacheExtension().size(), second.getCacheExtension().size());
      for (String key : first.getCacheExtension().keySet()) {
         Assert.assertEquals(first.getCacheExtension().get(key), second.getCacheExtension().get(key));
      }
   }

   @Test
   public void testCacheControl()
   {
      CacheControlDelegate delegate = new CacheControlDelegate();

      {
         CacheControl cc = new CacheControl();
         cc.setNoCache(false);
         cc.setNoTransform(true);
         cc.setPrivate(true);
         cc.setMustRevalidate(true);
         cc.setProxyRevalidate(true);
         System.out.println(delegate.toString(cc));
         CacheControl cc2 = delegate.fromString(delegate.toString(cc));
         assertEqual(cc, cc2);

      }

      {
         CacheControl cc = new CacheControl();
         cc.setNoCache(true);
         cc.getNoCacheFields().add("bill");
         cc.getNoCacheFields().add("marc");
         cc.setPrivate(true);
         cc.getPrivateFields().add("yo");
         cc.getCacheExtension().put("foo", "bar");
         cc.setMaxAge(25);
         cc.setSMaxAge(25);
         System.out.println(delegate.toString(cc));
         CacheControl cc2 = delegate.fromString(delegate.toString(cc));
         assertEqual(cc, cc2);

      }
   }

   @Test
   public void testEveryDirectiveAppearsInStringifiedVersion() // TCK requires this
   {
      CacheControl cc = new CacheControl();
      cc.setNoCache(true);
      cc.setPrivate(true);
      cc.setNoStore(true);
      String value = cc.toString();
      assertTrue(value.contains("no-cache"));
      assertTrue(value.contains("no-store"));
      assertTrue(value.contains("private"));
   }

   @Test
   public void testExtendedCacheControl()
   {
      ExtendedCacheControl cc = new ExtendedCacheControl();
      cc.setNoCache(true);
      cc.setPublic(true);
      cc.setNoStore(true);
      String value = cc.toString();
      assertTrue(value.contains("no-cache"));
      assertTrue(value.contains("no-store"));
      assertTrue(value.contains("public"));
   }

}


text:
package tcl.lang;

/*
 * Implements the built-in "java::getinterp" command.
 */

class JavaGetInterpCmd implements Command {

/*----------------------------------------------------------------------
 *
 * cmdProc --
 *
 * 	This procedure is invoked to process the "java::getInterp" Tcl
 * 	command. See the user documentation for details on what it
 * 	does.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	A standard Tcl result is stored in the interpreter.
 *
 *----------------------------------------------------------------------
 */

public void
cmdProc(
    Interp interp,			// Current interpreter.
    TclObject argv[])			// Argument list.
throws
    TclException			// A standard Tcl exception.
{
    interp.setResult(ReflectObject.newInstance(interp, Interp.class, interp));
}

} // end JavaGetInterpCmd


text:
<?php

$_config = array();

// ----------------------------  CONFIG DB  ----------------------------- //
$_config['db']['1']['dbhost'] = 'localhost';
$_config['db']['1']['dbuser'] = 'root';
$_config['db']['1']['dbpw'] = 'gansutianqi2016';
$_config['db']['1']['dbcharset'] = 'utf8';
$_config['db']['1']['pconnect'] = '0';
$_config['db']['1']['dbname'] = 'dz';
$_config['db']['1']['tablepre'] = 'pre_';
$_config['db']['slave'] = '';
$_config['db']['common']['slave_except_table'] = '';

// --------------------------  CONFIG MEMORY  --------------------------- //
$_config['memory']['prefix'] = '6jQyMV_';
$_config['memory']['redis']['server'] = '';
$_config['memory']['redis']['port'] = 6379;
$_config['memory']['redis']['pconnect'] = 1;
$_config['memory']['redis']['timeout'] = '0';
$_config['memory']['redis']['requirepass'] = '';
$_config['memory']['redis']['serializer'] = 1;
$_config['memory']['memcache']['server'] = '';
$_config['memory']['memcache']['port'] = 11211;
$_config['memory']['memcache']['pconnect'] = 1;
$_config['memory']['memcache']['timeout'] = 1;
$_config['memory']['apc'] = 1;
$_config['memory']['xcache'] = 1;
$_config['memory']['eaccelerator'] = 1;
$_config['memory']['wincache'] = 1;

// --------------------------  CONFIG SERVER  --------------------------- //
$_config['server']['id'] = 1;

// -------------------------  CONFIG DOWNLOAD  -------------------------- //
$_config['download']['readmod'] = 2;
$_config['download']['xsendfile']['type'] = '0';
$_config['download']['xsendfile']['dir'] = '/down/';

// --------------------------  CONFIG OUTPUT  --------------------------- //
$_config['output']['charset'] = 'utf-8';
$_config['output']['forceheader'] = 1;
$_config['output']['gzip'] = '0';
$_config['output']['tplrefresh'] = 1;
$_config['output']['language'] = 'zh_cn';
$_config['output']['staticurl'] = 'static/';
$_config['output']['ajaxvalidate'] = '0';
$_config['output']['iecompatible'] = '0';

// --------------------------  CONFIG COOKIE  --------------------------- //
$_config['cookie']['cookiepre'] = '8F6k_';
$_config['cookie']['cookiedomain'] = '';
$_config['cookie']['cookiepath'] = '/';

// -------------------------  CONFIG SECURITY  -------------------------- //
$_config['security']['authkey'] = '76ad290Sr6TBcuqd';
$_config['security']['urlxssdefend'] = 1;
$_config['security']['attackevasive'] = '0';
$_config['security']['querysafe']['status'] = 1;
$_config['security']['querysafe']['dfunction']['0'] = 'load_file';
$_config['security']['querysafe']['dfunction']['1'] = 'hex';
$_config['security']['querysafe']['dfunction']['2'] = 'substring';
$_config['security']['querysafe']['dfunction']['3'] = 'if';
$_config['security']['querysafe']['dfunction']['4'] = 'ord';
$_config['security']['querysafe']['dfunction']['5'] = 'char';
$_config['security']['querysafe']['daction']['0'] = '@';
$_config['security']['querysafe']['daction']['1'] = 'intooutfile';
$_config['security']['querysafe']['daction']['2'] = 'intodumpfile';
$_config['security']['querysafe']['daction']['3'] = 'unionselect';
$_config['security']['querysafe']['daction']['4'] = '(select';
$_config['security']['querysafe']['daction']['5'] = 'unionall';
$_config['security']['querysafe']['daction']['6'] = 'uniondistinct';
$_config['security']['querysafe']['dnote']['0'] = '/*';
$_config['security']['querysafe']['dnote']['1'] = '*/';
$_config['security']['querysafe']['dnote']['2'] = '#';
$_config['security']['querysafe']['dnote']['3'] = '--';
$_config['security']['querysafe']['dnote']['4'] = '"';
$_config['security']['querysafe']['dlikehex'] = 1;
$_config['security']['querysafe']['afullnote'] = '0';

// --------------------------  CONFIG ADMINCP  -------------------------- //
// -------- Founders: $_config['admincp']['founder'] = '1,2,3'; --------- //
$_config['admincp']['founder'] = '1';
$_config['admincp']['forcesecques'] = '0';
$_config['admincp']['checkip'] = 1;
$_config['admincp']['runquery'] = '0';
$_config['admincp']['dbimport'] = 1;

// --------------------------  CONFIG REMOTE  --------------------------- //
$_config['remote']['on'] = '0';
$_config['remote']['dir'] = 'remote';
$_config['remote']['appkey'] = '62cf0b3c3e6a4c9468e7216839721d8e';
$_config['remote']['cron'] = '0';

// ---------------------------  CONFIG INPUT  --------------------------- //
$_config['input']['compatible'] = 1;
$_config['plugindeveloper'] = 1

// -------------------  THE END  -------------------- //

?>


text:
package com.nisoft.inspectortools.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * Created by Administrator on 2017/7/11.
 */

public class GsonUtil {
    public static Gson getDateFormatGson() {
        return new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm").create();
    }
}


text:
* {
  color:#000080;
  background-color:#ffffff;
}
a {
  color:#800080;
}
a:visited {
  color:#ff0000;
}
Header {
   font-weight:bold;
   text-align:center;
   border-bottom: 1px solid gray;
   padding-bottom: 15px;
   font:#00080;
}
#one {
  font-size:1.15em;
  text-transform: uppercase;
  }
#B {
  font-size:1.75em;
  }
#H {
  font-size:1.75em;
  }
#Inc {
  font-size:.75em;
  text-transform:uppercase;
  }
#two-three {
  font-size: .8em;
}
#four {
  font-size: 1em;
}
main {
  display:inline-block;
}
#wrap {
  width:90%;
  margin:0px  auto;
  text-align:left;
  margin-top:15px;
}
#wrap li {
  margin-bottom: 25px;
}
main ul div span {
  font-size:0.6em;
}
#left {
  float:left;
  width:45%;
}
#right {
  float:right;
  width:45%;
}
#advert {
text-align: center;
clear:both;
line-height:40%;
border-top: 1px solid gray;
border-bottom: 1px solid gray;
text-transform: uppercase;
font-size: .6em;
padding-top: 10px;
padding-bottom: 10px;
}
footer {
   padding-top: 15px;
   padding-bottom: 15px;
   clear:both;
   text-align:left;
font-size: .8em;
border-bottom: 1px solid gray;
}
#legal {
   display:inline-block;
   text-align:left;
}
#copyright {
   display:inline-block;
   text-align:left;
   font-size:.6em;
   line-height: 50%;
}
#copyright span {
  font-weight:bold;
  text-align: left;
}
/*
-What is important to know when linking an external file (like a stylesheet) to an HTML file?

It's important to know the generic formula but also the name and location of the stylesheet on your computer.

-What tricks did you use to help you with positioning? How hard was it to get the site as you wanted it?

It was pretty difficult to get the site exactly as I wanted.  I always had to be careful of exactly what in the html file each selector corresponded to, so I knew what sections I was moving around.  I often made the mistake of moving a subsection of a section rather than the entire section at once.  For most of my positioning I made sure the larger sections were inline-blocks if they needed to be then checked the text alignment.  From here I could adjust height and width, use margins and padding, floats, and line-height.

-What CSS did you use to modify the element style (like size, color, etc.)

Besides borders, I really only modified the size, color, etc. of the text using the font, font-size, color, font-weight, and text-transform properties.

-Did you modify the HTML to include classes or ids? If so, which did you choose and why? If you didn't, how would you know which one to add to your HTML?

I used ids primarily because HTML5 already comes with some useful default classes like header, footer, main, etc.  I didn't have to define any other classes and I think this helped keep my stylsheet relatively clean and simple.  Ids were useful enough for selecting groups of elements within sections and I used the parent > child selectors a couple times as well.

-When you compared your site to the actual code base, which do you think had cleaner code that followed best practices and why?

I'm not entirely sure how to read the page source and how, if at all, it's different from looking at a simple html document, but it seemed like the real berkshire site didn't link to a stylesheet at all.  From what I can tell, they used internal formatting which may seem easier/more straigthforward at first, but makes it harder to make larger changes to the styling of the entire .html file, not to mention it makes the code a lot more difficult to read and generally sloppier looking.
*/


text:
namespace ash {
namespace internal {

WorkspaceEventFilterTestHelper::WorkspaceEventFilterTestHelper(
    WorkspaceEventFilter* filter)
    : filter_(filter) {
}

WorkspaceEventFilterTestHelper::~WorkspaceEventFilterTestHelper() {
}

}  // namespace internal
}  // namespace ash


text:
var utils = require('../utils') || require.cache[require.resolve('../utils')];
var inherits = utils.inherits;
var helpers = utils.helpers;
var context = helpers.context;
try {
    //first load only
    //if (process.argv[3]) {
    //    context.configure( JSON.parse(process.argv[3]) );
    //}

} catch (err) {
    throw new Error('no context found !\n'+ err.stack)
}

var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true;
var mainPath = './controller';
var frameworkPath = './controller.framework';

if (cacheless) {
    delete require.cache[require.resolve(mainPath)];
    delete require.cache[require.resolve(frameworkPath)];
}

var Controller = require(mainPath);
Controller.prototype.framework = require(frameworkPath);

module.exports = Controller


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>CSS DESK</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="apple-touch-icon" href="apple-touch-icon.png">

        <link rel="stylesheet" href="js/bower_components/reveal.js/css/reveal.css">
        <link rel="stylesheet" href="js/bower_components/reveal.js/css/theme/black.css">
        <link rel="stylesheet" href="js/bower_components/reveal.js/lib/css/zenburn.css">

        <link rel="stylesheet" href="css/main.css">

CSS Desk

CSS Playground for Modern Web

Flexbox


text:
<!doctype html>
<html>
<head>
<title>Asset Preview</title>
<meta charset="utf-8">
<script src="threejs/three.js"></script>
<script src="threejs/NodeMaterial.js"></script>
<script src="threejs/OrbitControls.js"></script>
<script src="ammo.js"></script>
<script src="ammo.three.js"></script>
<script src="SEA3D.js"></script>
<script src="SEA3DLZMA.js"></script>
<script src="SEA3DLoader.js"></script>
<script src="SEA3DNodeMaterial.js"></script>
<script src="SEA3DAmmoLoader.js"></script>
<script src="utils/uil.js"></script>
<script src="utils/stats.min.js"></script>
<script src="utils/Detector.js"></script>
<style>
body {
	font-family: Monospace;
	background-color: #333;
	color: #fff;
	margin: 0px;
	overflow: hidden;
}
</style>
</head>
<body>
<script>

THREE.AMMO.init(); // init physics engine

var container = document.createElement( 'div' );
document.body.appendChild( container );

var clock = new THREE.Clock();
var scene = new THREE.Scene();

var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );

var controls;

var renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( 0x333333, 1 );
container.appendChild( renderer.domElement );

var stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );

var container3d = new THREE.Object3D();
scene.add( container3d );

var loader = new THREE.SEA3D( { container : container3d, runScripts : true, autoPlay : false } );

function focusScene() {

	var minX, minY, minZ, maxX, maxY, maxZ;

	minX = minY = minZ = Infinity;
	maxX = maxY = maxZ = - Infinity;

	if ( scene instanceof THREE.Object3D )
	{

		scene.traverse( function( mesh )
		{

			if ( mesh instanceof THREE.Mesh )
			{

				var bBox = mesh.geometry.boundingBox;

				var pos = new THREE.Vector3();
				var qua = new THREE.Quaternion();
				var slc = new THREE.Vector3();

				mesh.matrixWorld.decompose( pos, qua, slc );

				if ( mesh.parent != container3d )
				{

					slc.x *= mesh.scale.x;
					slc.y *= mesh.scale.y;
					slc.z *= mesh.scale.z;

				}
				else
				{

					slc = mesh.scale;

				}

				if ( bBox )
				{

					minX = Math.min( minX, pos.x + ( bBox.min.x * slc.x ) );
					minY = Math.min( minY, pos.y + ( bBox.min.y * slc.y ) );
					minZ = Math.min( minZ, pos.z + ( bBox.min.z * slc.z ) );
					maxX = Math.max( maxX, pos.x + ( bBox.max.x * slc.x ) );
					maxY = Math.max( maxY, pos.y + ( bBox.max.y * slc.y ) );
					maxZ = Math.max( maxZ, pos.z + ( bBox.max.z * slc.z ) );

				}

			}

		} );

		if ( isFinite( minX ) )
		{

			var cx = minX + ( maxX - minX ) * .5;
			var cy = minY + ( maxY - minY ) * .5;
			var cz = minZ + ( maxZ - minZ ) * .5;

			var d = maxX - minX;
			var y = maxY - minY;
			var z = maxZ - minZ;

			if ( y > d ) d = y;
			if ( z > d ) d = z;

			var r = d * Math.sqrt( .5 );

			camera.near = d / 1000;
			camera.far = d * 100;
			camera.updateProjectionMatrix();

			camera.position.set( r, r, - r );

			container3d.position.set( - cx, - cy, - cz );

		}

	}

}

var enabled = true;

loader.onComplete = function( e ) {

	//loader.domain.run();

/*
	var domain = loader.clone( { lights : false, scripts : true, enabledPhysics : false } );
	domain.container.position.x -= 200;
	domain.applyContainerTransform();
	domain.enabledPhysics( true );
	scene.add( domain.container );
*/

	if ( loader.lights == undefined ) {

		var p1 = new THREE.PointLight( 0xFFFFFF, 1 );
		var p2 = new THREE.PointLight( 0xFFFFFF, .5 );
		var p3 = new THREE.PointLight( 0xFFFFFF, .3 );

		p1.position.set( - 100000, 100000, - 100000 );
		p2.position.set( 100000, 100000, 100000 );
		p3.position.set( 100000, - 100000, 100000 );

		container3d.add( p1 );
		container3d.add( p2 );
		container3d.add( p3 );

		loader.updateScene();

	}

	focusScene();

	controls = new THREE.OrbitControls( camera );

	console.log( "sea3d complete" );

};

loader.load("mascot.tjs.sea");

var offset = 0;

var ui = new UIL.Gui( { css:'top:0px; left:calc(100%-330px);', size:300, center:true, height:27 } );
ui.add('button', { name:'clone', callback:function() {

	var domain = loader.clone( { lights : false, dummys : false, runScripts : false, autoPlay: true, enabledPhysics : false } );
	offset -= 300;
	domain.container.position.x += offset;
	//domain.applyContainerTransform();
	//domain.enabledPhysics( true );
	scene.add( domain.container );

	//loader.domain.runScripts();

} });

function onWindowResize() {

	camera.aspect = window.innerWidth / window.innerHeight;
	camera.updateProjectionMatrix();

	renderer.setSize( window.innerWidth, window.innerHeight );

}

window.addEventListener( 'resize', onWindowResize, false );

function animate() {

	var delta = clock.getDelta();

	requestAnimationFrame( animate );

	if (enabled) THREE.AMMO.update( delta );

	THREE.SEA3D.SCRIPT.dispatchUpdate( delta );

	THREE.SEA3D.AnimationHandler.update( delta );

	renderer.render( scene, camera );

	//loader.container.rotation.x += .02;

	stats.update();

}

animate();
</script>
</body>
</html>


text:
package actionClass;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import actionForm.Emp_Login;
import daoImpl.Emp_Login_DaoImpl;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class Emp_Login_Action extends ActionSupport implements
		ModelDriven<Object>, SessionAware {

	private static final long serialVersionUID = -6898596256321736746L;
	private Map<String, Object> session;
	private Emp_Login login = null;
	private Emp_Login_DaoImpl loginDAO = new Emp_Login_DaoImpl();
	private Emp_Login chpw;
	private Emp_Login_DaoImpl xyz = new Emp_Login_DaoImpl();

	@Override
	public String execute() {

		return SUCCESS;

	}

	/**
	 * @return Employee Login
	 */
	public String checkLogin() {

		if (login.getUserName().equals("") || login.getPassword().equals("")
				|| login.getBank_id().equals("")) {
			addActionError("Please Enter All Values");

			return ERROR;

		} else {

			login = loginDAO.checkLogin(login);

			if (null != login.getBank_id()) {

				String abcd = login.getUserName();
				String uname =login.getUserName();
				String other = login.getBank_id();
				System.out.println(abcd);

				session.put("user", "emp");
				session.put("user0", uname);
				session.put("user1", other);

				return SUCCESS;

			} else {

				addActionError("Invalid user Id/Password/ Employee Id");

				return ERROR;

			}

		}

	}

	/**
	 * @return Employee change own password
	 */
	public String changepw()

	{
		String a = chpw.getOldpw();
		String b = chpw.getNewpw();
		String c = chpw.getCnewpw();
		if(a.equals("") || b.equals("") ||c.equals(""))
		{
			addActionError("Please Enter All Values");
			return ERROR;
		}
		else
		{
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);

		if (b.equals(c)) {

			xyz.changepw(chpw);

			String ss = chpw.getTest();

			System.out.println("From Action Class:  " + ss);
			if (chpw.getTest() == "not") {
				addActionError("Old Password not matching ");
				return ERROR;

			}
			if (chpw.getTest() == "good") {
				addActionMessage("Password changed Successfully. Account will be Logout");
			}

		} else {
			addActionError("Password not matching");
			return ERROR;
		}
		return SUCCESS;
	}
	}

	public String logout() throws Exception {

		Map<String, Object> session = ActionContext.getContext().getSession();
		session.remove("user");
		session.remove("user0");
		session.remove("user1");
		session.remove("user2");
		return SUCCESS;
	}

	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

	public Emp_Login_DaoImpl getLoginDAO() {
		return loginDAO;
	}

	public void setLoginDAO(Emp_Login_DaoImpl loginDAO) {
		this.loginDAO = loginDAO;
	}

	public Emp_Login getChpw() {
		return chpw;
	}

	public void setChpw(Emp_Login chpw) {
		this.chpw = chpw;
	}

	public Emp_Login_DaoImpl getXyz() {
		return xyz;
	}

	public void setXyz(Emp_Login_DaoImpl xyz) {
		this.xyz = xyz;
	}

	public Object getModel() {

		login = new Emp_Login();

		return login;

	}

	public Emp_Login getLogin() {

		return login;

	}

	public void setLogin(Emp_Login login) {

		this.login = login;

	}

}


text:
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using Microsoft.Azure;

namespace CRP.Controllers.Helpers
{
    public static class HtmlHelperExtensions
    {
        //public static CustomGridBuilder<T> Grid<T>(this HtmlHelper htmlHelper, IEnumerable<T> dataModel) where T : class
        //{
        //    var builder = htmlHelper.Telerik().Grid(dataModel);

        //    return new CustomGridBuilder<T>(builder);
        //}

        //public static string GenerateCaptcha(this HtmlHelper helper)
        //{

        //    var captchaControl = new Recaptcha.RecaptchaControl
        //    {
        //        ID = "recaptcha",
        //        Theme = "clean",
        //        PublicKey = CloudConfigurationManager.GetSetting("RecaptchaPublicKey"),
        //        PrivateKey = CloudConfigurationManager.GetSetting("RecaptchaPrivateKey")
        //    };

        //    var htmlWriter = new HtmlTextWriter(new StringWriter());

        //    captchaControl.RenderControl(htmlWriter);

        //    return htmlWriter.InnerWriter.ToString();
        //}

        private const string HtmlTag = @"<{0}>";
        private const string Span = "span";
        private const string SpanEncodedStyled = @"<span style="{0}">";
        private const string SpanStyled = @"";
        // ReSharper disable InconsistentNaming
        private const string Underline = "text-decoration: underline;";
        private const string XXSmallText = "font-size: xx-small;";
        private const string XSmallText = "font-size: x-small;";
        private const string SmallText = "font-size: small;";
        private const string MediumText = "font-size: medium;";
        private const string LargeText = "font-size: large;";
        private const string XLargeText = "font-size: x-large;";
        private const string XXLargeText = "font-size: xx-large;";
        // ReSharper restore InconsistentNaming

        ///
        /// This allows limited html encoding, while still encoding the rest of the string
        ///
        /// <remarks>
        /// The selected tags are what have been allowed with the TinyMce Text Editor
        ///
        /// Allows:
        ///

        ///
        ///
        ///         // based on what is generated by TinyMce
        ///

        ///

        ///

        ///

        ///
        ///     <address></address>
        /// </remarks>
        /// <param name="helper"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string HtmlEncode(this HtmlHelper helper, string text)
        {
            // encode the string
            string encodedText = HttpUtility.HtmlEncode(text);

            // put the text in a string builder
            StringBuilder formattedEncodedText = new StringBuilder(encodedText);

            // replace the escaped characters with the correct strings to allow formatting
            ReplaceTagContents(formattedEncodedText, "p");
            ReplaceTagContents(formattedEncodedText, "strong");
            ReplaceTagContents(formattedEncodedText, "em");
            ReplaceTagContents(formattedEncodedText, "ul");
            ReplaceTagContents(formattedEncodedText, "ol");
            ReplaceTagContents(formattedEncodedText, "li");
            ReplaceTagContents(formattedEncodedText, "address");
            ReplaceTagContents(formattedEncodedText, "h1");
            ReplaceTagContents(formattedEncodedText, "h2");
            ReplaceTagContents(formattedEncodedText, "h3");
            ReplaceTagContents(formattedEncodedText, "h4");
            ReplaceTagContents(formattedEncodedText, "h5");
            ReplaceTagContents(formattedEncodedText, "h6");
            ReplaceSingleTagContents(formattedEncodedText, "br");

            formattedEncodedText = formattedEncodedText.Replace(@"&nbsp;", @" ");
            formattedEncodedText = formattedEncodedText.Replace(@"&mdash;", @"—");

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, Underline),
                              string.Format(SpanStyled, Underline));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, XXSmallText),
                              string.Format(SpanStyled, XXSmallText));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, XSmallText),
                              string.Format(SpanStyled, XSmallText));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, SmallText),
                              string.Format(SpanStyled, SmallText));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, MediumText),
                              string.Format(SpanStyled, MediumText));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, LargeText),
                              string.Format(SpanStyled, LargeText));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, XLargeText),
                              string.Format(SpanStyled, XLargeText));

            //
            ReplaceComplexTag(formattedEncodedText, Span,
                              string.Format(SpanEncodedStyled, XXLargeText),
                              string.Format(SpanStyled, XXLargeText));

            formattedEncodedText = formattedEncodedText.Replace(@"&", @"&"); //Last thing so it doesn't break complex tags.

            return formattedEncodedText.ToString();
        }

        public static void ReplaceTagContents(StringBuilder formattedText, string tag)
        {
            // opening tag
            formattedText.Replace(string.Format(HtmlTag, tag), @"<"+tag+">");
            // closing tag
            formattedText.Replace(string.Format(HtmlTag, @"/" + tag), @"</"+tag+">");
        }
        public static void ReplaceSingleTagContents(StringBuilder formattedText, string tag)
        {
            // opening tag
            formattedText.Replace(string.Format(HtmlTag, tag + @" /"), @"<" + tag + @" />");
        }

        ///
        ///
        ///
        /// <param name="formattedText">The formatted text string for final output</param>
        /// <param name="tag">Tag name we are searching for, only the tag name</param>
        /// <param name="searchTag">Tag we are searching for, with all properties included (html encoded)</param>
        /// <param name="replacementTag">Formatted tag to be replaced in so it shows correctly.</param>
        public static void ReplaceComplexTag(StringBuilder formattedText, string tag, string searchTag, string replacementTag)
        {
            var closingTag = string.Format(HtmlTag, @"/" + tag);

            // replace html encoded tag with the correct formatted tag
            formattedText.Replace(searchTag, replacementTag);

            // determine information needed to replace correctly
            var map = MapOpeningTags(formattedText.ToString(), replacementTag, tag, closingTag);
            var stack = CalculateStack(map);

            // process and replace closing tags
            while (stack.Count > 0)
            {
                var tm = stack.Pop();

                var tmpFormattedText = formattedText.ToString();

                // get the location of the nth opening tag
                var openIndex = FindNthIndex(tmpFormattedText, replacementTag, 0, tm.Count);

                // get the location of the matching closing tag
                var closingIndex = FindNthIndex(tmpFormattedText, closingTag, openIndex, tm.OffSet);

                // replace the tag

                formattedText.Remove(closingIndex, closingTag.Length);
                formattedText.Insert(closingIndex, @"</" + tag + ">");
            }
        }

        public static Stack<TagMarker> CalculateStack(string[] map)
        {
            var stack = new Stack<TagMarker>();
            var count = 1;

            for (int i = 0; i < map.Length; i++)
            {
                // found a valid opening tag, push a new marker on to the stack
                if (map[i] == "o")
                {
                    stack.Push(new TagMarker(count));
                    count++;
                }
                // found a misc open tag that we shouldn't replace, update the stack to reflect the offset
                else if (map[i] == "m")
                {
                    // go top down and add offset until we come accros a completed marker
                    foreach (var tm in stack.Reverse())
                    {
                        // completed marker, cheese it!
                        if (tm.Completed) break;

                        // increase the offset count
                        tm.OffSet++;
                    }
                }
                else if (map[i] == "c")
                {
                    // go top down to find the highest not completed object, then mark completed
                    foreach (var tm in stack.Reverse())
                    {
                        if (!tm.Completed)
                        {
                            // increment the misc closing found
                            tm.MiscClosingFound++;

                            // once misc closing found > offset, mark completed and we can exit the loop, otherwise we just go down until we hit bottom
                            //  or find one that meets the criteria
                            if (tm.MiscClosingFound > tm.OffSet)
                            {
                                tm.Completed = true;
                                break;
                            }
                        }
                    }
                }
            }

            return stack;
        }

        ///
        /// Finds the locations of all opening tags and misc tags with matching tag name
        ///
        /// <param name="searchText"></param>
        /// <param name="replacementTag"></param>
        /// <param name="tag"></param>
        /// <param name="closingTag"></param>
        /// <returns></returns>
        public static string[] MapOpeningTags(string searchText, string replacementTag, string tag, string closingTag)
        {
            var openingTags = searchText.IndexOfAll(replacementTag);
            var miscOpeningTag = searchText.IndexOfAll(@"<" + tag);
            var closingTags = searchText.IndexOfAll(closingTag);

            var map = new string[searchText.Length];
            foreach (int a in miscOpeningTag) map[a] = "m";
            foreach (int a in openingTags) map[a] = "o";
            foreach (int a in closingTags) map[a] = "c";

            return map;
        }

        ///
        /// Finds the nth instance of a search string
        ///
        /// <param name="searchText">String we are searching</param>
        /// <param name="searchString">String we are searching for in the searchText</param>
        /// <param name="startLocation">Start location</param>
        /// <param name="offset">Nth instance to find</param>
        /// <returns></returns>
        public static int FindNthIndex(string searchText, string searchString, int startLocation, int offset)
        {
            var offsetCounter = 0;
            var currentLocation = startLocation;

            do
            {
                currentLocation = searchText.IndexOf(searchString, currentLocation);
                offsetCounter++;
            } while (offsetCounter < offset);

            return currentLocation;
        }
    }

    public class TagMarker
    {
        public TagMarker(int count)
        {
            Count = count;

            Completed = false;
            OffSet = 0;
            MiscClosingFound = 0;
        }

        public int Count { get; set; }
        public int OffSet { get; set; } // # of closing tags to skip before replacing

        // used during discovery algorithm
        public bool Completed { get; set; }         // signifies if we discovered the closing one or not
        // used during replacement
        public int MiscClosingFound { get; set; }   // # of closing tags skipped so far, when this matches offset we found the closing tag for this, so skip that
    }

}


text:
<!doctype html>

    <title>Angular Widgets</title>
    <meta content="IE=EDGE" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="bower_components/angular-ui-select/dist/select.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="bower_components/select2/select2.css">

    <link href="styles/angular-click2edit.css" rel="stylesheet" type="text/css" />
    <link href="styles/app.css" rel="stylesheet" type="text/css" />

Click to Edit

                Below are various implementation of the `click to edit` directive. Mouse over and click to see in action.
                UI-SELECT was used to demonstrate complex `edit` and `display` modes. UI-SELECT is not part of `click2edit`.

            Sprint Desc:
            <click-to-edit>
                {{widgets.dummy.sprint.desc}}
                <input edit-mode type="text" ng-model="widgets.dummy.sprint.desc"/>
            </click-to-edit>

            Assigned Person:
            <click-to-edit>
                {{widgets.dummy.sprint.assignedPerson.name}}
                <ui-select edit-mode ng-model="widgets.dummy.sprint.assignedPerson" theme="select2" ng-disabled="disabled" style="min-width: 250px;">
                    <ui-select-match class="clickMe" placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
                    <ui-select-choices repeat="person in widgets.dummy.people | propsFilter: {name: $select.search, age: $select.search}">

                            email: {{person.email}}
                            age:

                    </ui-select-choices>
                </ui-select>
            </click-to-edit>

            Completed:
            <click-to-edit>

                <ui-select edit-mode class="select2-no-search" ng-model="widgets.dummy.sprint.completed" theme="select2" ng-disabled="disabled" style="min-width: 75px;">
                    <ui-select-match class="clickMe" placeholder="Yes/No...">

                        {{$select.selected.label}}
                    </ui-select-match>
                    <ui-select-choices repeat="option.status as option in widgets.dummy.statusOptions">

                    </ui-select-choices>
                </ui-select>
            </click-to-edit>


text:
module LinkedIn
  class Position < LinkedIn::Base

    def positions
      @arry ||= begin
        @arry = []
        @doc.children.each do |position|
          @arry << Resource.new(position) unless position.blank?
        end
        @arry
      end
    end

    class Resource

      def initialize(position)
        @position = position
      end

      %w[id title summary is_current].each do |f|
        define_method(f.to_sym) do
          @position.xpath("./#{f.gsub(/_/,'-')}").text
        end
      end

      def start_month
        @position.xpath('./start-date/month').text.to_i
      end

      def start_year
        @position.xpath('./start-date/year').text.to_i
      end

      def end_month
        @position.xpath('./end-date/month').text.to_i
      end

      def end_year
        @position.xpath('./end-date/year').text.to_i
      end

      def company
        @company ||= Company.new(@position.xpath('./company'))
      end

    end # resource

  end # class
end # module


text:
"""Utils to run subprocesses."""

import subprocess
import sys

from typing import List

def run_command(command: List[str]) -> str:
    """Runs a command and returns the output.

    Raises an exception and prints the command output if the command fails."""
    try:
        run_result = subprocess.run(command,
                                    capture_output=True,
                                    text=True,
                                    check=True)
    except subprocess.CalledProcessError as e:
        print(f'{command} failed with code {e.returncode}.', file=sys.stderr)
        print(f'\nSTDERR:\n{e.stderr}', file=sys.stderr)
        print(f'\nSTDOUT:\n{e.stdout}', file=sys.stderr)
        raise
    return run_result.stdout


text:
//
//  MHzTopicCell.h
//  百思不得姐
//
//  Created by Minghe on 10/16/15.
//  Copyright © 2015 project. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MHzTopic.h"

@interface MHzTopicCell : UITableViewCell

@property (strong, nonatomic) MHzTopic *topic;/**< cell的topic模型属性 */

@end


text:
bool LogEntryFilter::apply(const LogEntry &item) const {
    bool result = false;
    if (conditionOperator == nullOperator) {
        result = doApply(item);
    } else if (conditionOperator == andOperator) {
        for (auto child : children) {
            if (!(result = child->apply(item))) {
                goto exit;
            }
        }
    } else if (conditionOperator == orOperator) {
        for (auto child : children) {
            if ((result = child->apply(item))) {
                goto exit;
            }
        }
    }
    exit:
    return reverse == !result;
}

void LogEntryFilter::addChildren(const LogEntryFilter &child) {
    children.push_back(&child);
}

void LogEntryFilter::init(const json &j) {
    auto find = j.find("operator");
    if (find != j.end()) {
        conditionOperator = (ConditionOperator) find.value().get<int>();
    }
    find = j.find("children");
    if (find != j.end() && find.value().is_array()) {
        for (const json &child : find.value()) {
            LogEntryFilter *blocker = LogEntryFilterFactory::create(child);
            if (blocker->enabled) {
                children.push_back(blocker);
            }
        }
    }

    find = j.find("reverse");
    if (find != j.end()) {
        reverse = find.value();
    }

    find = j.find("enabled");
    if (find != j.end()) {
        enabled = find.value();
    }

    parseJson(j);
}


text:
/* For copying and distribution information, see the file COPYING. */

/* primitive to run a command in a shell */

#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "icb.h"
#include "externs.h"
#define _BSD
#include <sys/wait.h>
#include <signal.h>
c_shell(TARGLIST)
TARGDEFS
{
	static char *usage = "usage: c_shell [command]";
	int w, pid;
	int shellout = 0;
	int status;
	char *shell, *getenv();

	/* disallow use if restricted mode set */
	if (gv.restricted)
		TRETURNERR("c_shell: no shell commands in restricted mode")

	/* is this a shellout or a command? */
	if (argc == 1 || !*argv[1])
		shellout++;

	/* get shell to use */
	if ((shell = getenv("SHELL")) == NULL)
		shell = "/bin/sh";

	/* announce what we are doing */
	if (shellout) {
		sprintf(mbuf, "[%s]\r\n", shell);
		putl(mbuf, PL_SCR);
	} else {
		sprintf(mbuf, "%s", catargs(&argv[1]));
		sprintf(mbuf2, "[%s]\r\n", mbuf);
		putl(mbuf2, PL_SCR);
	}

	/* restore the terminal for the duration */
	restoreterm();

	if ((pid = fork()) == 0) {
		if (shellout)
			execlp(shell, shell, 0);
		else
			execlp(shell, shell, "-c", mbuf, 0);

		/* exec failed if we make it here */
		sprintf(mbuf, "c_shell: can't run shell \"%s\"", shell);
		putl(mbuf, PL_SL);
		putl(usage, PL_SCR);
		exit(-1);
	}

	/* trap signals that might mess ICB */
	signal(SIGINT, SIG_IGN);
	signal(SIGQUIT, SIG_IGN);

	/* wait for the child(ren) to die */
	while ((w = wait(&status)) != pid && w != -1);

	/* restore the terminal */
	icbterm();

	/* restore signal processing */
	signal(SIGINT, askquit);
	signal(SIGQUIT, SIG_DFL);

	/* clean up a little */
	if (shellout)
	{
		write(1, "\r", 1);
	}

	if (gv.pauseonshell) {
		pauseprompt("[=Hit return to continue=]", 0, '\n', 0, 0);
	} else
		puts("[=returning to icb=]");
	return(TCL_OK);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<TransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://ws.valutec.net/">
  <RawOutput>%02BAL%3a++++++0.00%1c7474e0746q%03e%00</RawOutput>
  <TerminalID>000000</TerminalID>
  <IPaddress>127.0.0.2</IPaddress>
  <Authorized>true</Authorized>
  <AuthorizationCode />
  <TransactionType>Gift</TransactionType>
  <Balance>0.00</Balance>
  <PointBalance />
  <RewardLevel />
  <Refund />
  <CardAmountUsed />
  <AmountDue />
  <TotalSales />
  <TotalSales_Amount />
  <TotalActivations />
  <TotalActivations_Amount />
  <TotalAddValues />
  <TotalAddValues_Amount />
  <TotalVoids />
  <TotalVoids_Amount />
  <TotalDeactivations />
  <TotalDeactivations_Amount />
  <Identifier>7474e0746q</Identifier>
  <ErrorMsg />
  <CardNumber />
  <CardPIN />
</TransactionResponse>


text:
#import <Foundation/Foundation.h>

@interface SC2DVector : NSObject<NSCopying>

@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign, readonly) CGPoint point;

+ (instancetype)vectorWithPoint:(CGPoint)point;

- (instancetype)initWithX:(CGFloat)x y:(CGFloat)y;
- (instancetype)initWithCGPoint:(CGPoint)point;

- (SC2DVector *)addVector:(SC2DVector *)vector;
- (SC2DVector *)multiplyByScalar:(CGFloat)scalar;

- (CGFloat)dotProductWithVector:(SC2DVector *)vector;

- (CGFloat)length;
- (SC2DVector *)normalisedToLength:(CGFloat)length;

- (SC2DVector *)perpendicularVector;
- (SC2DVector *)perpendicularVectorOfLength:(CGFloat)length;

@end


text:
using DocFunctions.Markdown.Transformers;
using docsFunctions.Shared.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace DocFunctions.Markdown.Unit.Transformers
{
    public class MediaUrlTransformerTests
    {
        [Fact]
        public void Vaidate_Tranform_Produces_Correct_Url()
        {
            var meta = new Blog
            {
                Url = "/rfc-weekly-17th-October-2016",
                Published = DateTime.Now,
                Modified = DateTime.Now,
                Title = "RFC Weekly - 17th October 2016",
                Enabled = true
            };
            var markdown = @"
This bit should still ALLOW UPPERCASE<\p>";

            var uat = new MediaUrlTransformer("https://www.example.com/blog");

            var result = uat.TransformMarkdown(meta, markdown);

            Assert.Equal(@"
This bit should still ALLOW UPPERCASE<\p>", result);
        }

        [Fact]
        public void Validate_Tranform_Produces_Correct_Url_For_Mutliple()
        {
            var meta = new Blog
            {
                Url = "/rfc-weekly-17th-October-2016",
                Published = DateTime.Now,
                Modified = DateTime.Now,
                Title = "RFC Weekly - 17th October 2016",
                Enabled = true
            };
            var markdown = @"";

            var uat = new MediaUrlTransformer("https://www.example.com/blog");

            var result = uat.TransformMarkdown(meta, markdown);

            Assert.Equal(@"", result);
        }

    }
}