text:
import { RSAA } from 'redux-api-middleware';

import constants from '../../constants/AppConstants';
import {
  buildAPIUrl,
  createTransformFunction,
  getErrorTypeDescriptor,
  getHeadersCreator,
  getRequestTypeDescriptor,
  getSearchParamsString,
  getSuccessTypeDescriptor,
} from '../apiUtils';
import schemas from '../../store/middleware/Schemas';

describe('Utils: apiUtils', () => {
  describe('buildAPIUrl', () => {
    const endpoint = 'some/endpoint';

    test('returns API_URL + given endpoint if params is empty', () => {
      const expected = `${constants.API_URL}/${endpoint}/`;

      expect(buildAPIUrl(endpoint)).toBe(expected);
    });

    test('rejects params with empty values', () => {
      const params = { empty: '' };
      const expected = `${constants.API_URL}/${endpoint}/`;

      expect(buildAPIUrl(endpoint, params)).toBe(expected);
    });

    test('appends search params at the end if params is not empty', () => {
      const params = { param: 'hello_world' };
      const expected = `${constants.API_URL}/${endpoint}/?param=hello_world`;

      expect(buildAPIUrl(endpoint, params)).toBe(expected);
    });
  });

  describe('createTransformFunction', () => {
    test('returns a function', () => {
      expect(typeof createTransformFunction()).toBe('function');
    });

    describe('the returned function', () => {
      test('camelizes object keys', () => {
        const transformFunction = createTransformFunction();
        const initial = {
          some_key: {
            nested_key: 'value',
          },
        };
        const expected = {
          someKey: {
            nestedKey: 'value',
          },
        };

        expect(transformFunction(initial)).toEqual(expected);
      });

      describe('if normalizr Schema is provided', () => {
        test('uses the Schema to normalize data', () => {
          const transformFunction = createTransformFunction(schemas.resourceSchema);
          const initialResourceData = {
            id: 'r-1',
            unit: {
              id: 'u-1',
            },
          };
          const expectedResourceData = {
            entities: {
              resources: {
                'r-1': { id: 'r-1', unit: 'u-1' },
              },
              units: {
                'u-1': { id: 'u-1' },
              },
            },
            result: 'r-1',
          };

          expect(transformFunction(initialResourceData)).toEqual(expectedResourceData);
        });
      });
    });
  });

  describe('getErrorTypeDescriptor', () => {
    const actionType = 'SOME_GET_ERROR';

    test('returns an object', () => {
      expect(typeof getErrorTypeDescriptor(actionType)).toBe('object');
    });

    test('contains the given action type', () => {
      const actual = getErrorTypeDescriptor(actionType).type;

      expect(actual).toBe(actionType);
    });

    test('contains a meta function', () => {
      expect(typeof getErrorTypeDescriptor(actionType).meta).toBe('function');
    });

    describe('the meta function', () => {
      const mockAction = {
        [RSAA]: {
          types: [{ type: 'SOME_GET_REQUEST' }],
        },
      };

      test('returns an object with correct properties', () => {
        const typeDescriptor = getErrorTypeDescriptor(actionType);
        const actual = typeDescriptor.meta(mockAction);
        const expected = {
          API_ACTION: {
            apiRequestFinish: true,
            countable: undefined,
            type: 'SOME_GET_REQUEST',
          },
        };

        expect(actual).toEqual(expected);
      });

      test('supports adding a countable property', () => {
        const typeDescriptor = getErrorTypeDescriptor(actionType, { countable: true });
        const actual = typeDescriptor.meta(mockAction);
        const expected = {
          API_ACTION: {
            apiRequestFinish: true,
            countable: true,
            type: 'SOME_GET_REQUEST',
          },
        };

        expect(actual).toEqual(expected);
      });

      test('supports adding extra meta properties', () => {
        const typeDescriptor = getErrorTypeDescriptor(actionType, { meta: { test: 'test' } });
        const actual = typeDescriptor.meta(mockAction);
        const expected = {
          API_ACTION: {
            apiRequestFinish: true,
            countable: undefined,
            type: 'SOME_GET_REQUEST',
          },
          test: 'test',
        };

        expect(actual).toEqual(expected);
      });
    });
  });

  describe('getHeadersCreator', () => {
    test('returns a function', () => {
      expect(typeof getHeadersCreator()).toBe('function');
    });

    describe('the returned function', () => {
      describe('when user is logged in', () => {
        const state = {
          auth: {
            token: 'mock-token',
          },
        };
        const authorizationHeader = { Authorization: 'JWT mock-token' };

        describe('if no additional headers are specified', () => {
          test('returns the required headers and Authorization header', () => {
            const creator = getHeadersCreator();
            const expected = Object.assign(
              {},
              constants.REQUIRED_API_HEADERS,
              authorizationHeader,
            );

            expect(creator(state)).toEqual(expected);
          });
        });

        describe('if additional headers are specified', () => {
          test('returns the required, the additional and Authorization headers', () => {
            const additionalHeaders = {
              header: 'value',
            };
            const creator = getHeadersCreator(additionalHeaders);
            const expected = Object.assign(
              {},
              constants.REQUIRED_API_HEADERS,
              additionalHeaders,
              authorizationHeader,
            );

            expect(creator(state)).toEqual(expected);
          });
        });
      });

      describe('when user is logged out', () => {
        const state = {
          auth: {},
        };

        describe('if no additional headers are specified', () => {
          test('returns the just the required headers', () => {
            const creator = getHeadersCreator();

            expect(creator(state)).toEqual(constants.REQUIRED_API_HEADERS);
          });
        });

        describe('if additional headers are specified', () => {
          test('returns the required headers and the additional headers', () => {
            const additionalHeaders = {
              header: 'value',
            };
            const creator = getHeadersCreator(additionalHeaders);
            const expected = Object.assign({}, constants.REQUIRED_API_HEADERS, additionalHeaders);

            expect(creator(state)).toEqual(expected);
          });
        });
      });
    });
  });

  describe('getRequestTypeDescriptor', () => {
    const actionType = 'SOME_GET_REQUEST';

    test('returns an object', () => {
      expect(typeof getRequestTypeDescriptor(actionType)).toBe('object');
    });

    test('contains the given action type', () => {
      const actual = getRequestTypeDescriptor(actionType).type;

      expect(actual).toBe(actionType);
    });

    test('contains a meta object with correct properties', () => {
      const actual = getRequestTypeDescriptor(actionType).meta;
      const expected = {
        API_ACTION: {
          apiRequestStart: true,
          countable: undefined,
          type: 'SOME_GET_REQUEST',
        },
      };

      expect(actual).toEqual(expected);
    });

    test('supports adding coutable property to meta object', () => {
      const actual = getRequestTypeDescriptor(actionType, { countable: true }).meta;
      const expected = {
        API_ACTION: {
          apiRequestStart: true,
          countable: true,
          type: 'SOME_GET_REQUEST',
        },
      };

      expect(actual).toEqual(expected);
    });

    test('supports adding extra meta properties', () => {
      const actual = getRequestTypeDescriptor(actionType, { meta: { test: 'test' } }).meta;
      const expected = {
        API_ACTION: {
          apiRequestStart: true,
          countable: undefined,
          type: 'SOME_GET_REQUEST',
        },
        test: 'test',
      };

      expect(actual).toEqual(expected);
    });
  });

  describe('getSearchParamsString', () => {
    test('returns key and value of the param with "=" in between', () => {
      const params = { param: 'hello' };
      const expected = 'param=hello';

      expect(getSearchParamsString(params)).toBe(expected);
    });

    test('returns multiple params separated with "&"', () => {
      const params = { param: 'hello', other: 'world' };
      const expected = 'param=hello&other=world';

      expect(getSearchParamsString(params)).toBe(expected);
    });

    test('uses encodeURIComponent to both keys and values', () => {
      const params = { päräm: 'hellö' };
      const expected = `${encodeURIComponent('päräm')}=${encodeURIComponent('hellö')}`;

      expect(getSearchParamsString(params)).toBe(expected);
    });

    test('decamelizes keys of the given params', () => {
      const params = { camelizedParam: 'hello' };
      const expected = 'camelized_param=hello';

      expect(getSearchParamsString(params)).toBe(expected);
    });
  });

  describe('getSuccessTypeDescriptor', () => {
    const actionType = 'SOME_GET_SUCCESS';

    test('returns an object', () => {
      expect(typeof getSuccessTypeDescriptor(actionType)).toBe('object');
    });

    test('contains the given action type', () => {
      const actual = getSuccessTypeDescriptor(actionType).type;

      expect(actual).toBe(actionType);
    });

    test('contains a payload function', () => {
      expect(typeof getSuccessTypeDescriptor(actionType).payload).toBe('function');
    });

    test('contains a meta function', () => {
      expect(typeof getSuccessTypeDescriptor(actionType).meta).toBe('function');
    });

    describe('the meta function', () => {
      const mockAction = {
        [RSAA]: {
          types: [{ type: 'SOME_GET_REQUEST' }],
        },
      };

      test('returns an object with correct properties', () => {
        const typeDescriptor = getSuccessTypeDescriptor(actionType);
        const actual = typeDescriptor.meta(mockAction);
        const expected = {
          API_ACTION: {
            apiRequestFinish: true,
            countable: undefined,
            type: 'SOME_GET_REQUEST',
          },
        };

        expect(actual).toEqual(expected);
      });

      test('supports adding a countable property', () => {
        const typeDescriptor = getSuccessTypeDescriptor(actionType, { countable: true });
        const actual = typeDescriptor.meta(mockAction);
        const expected = {
          API_ACTION: {
            apiRequestFinish: true,
            countable: true,
            type: 'SOME_GET_REQUEST',
          },
        };

        expect(actual).toEqual(expected);
      });

      test('supports adding payload property', () => {
        const typeDescriptor = getSuccessTypeDescriptor(actionType, { payload: 'mock-payload' });

        expect(typeDescriptor.payload).toBe('mock-payload');
      });

      test('supports adding extra meta properties', () => {
        const typeDescriptor = getSuccessTypeDescriptor(actionType, { meta: { test: 'test' } });
        const actual = typeDescriptor.meta(mockAction);
        const expected = {
          API_ACTION: {
            apiRequestFinish: true,
            countable: undefined,
            type: 'SOME_GET_REQUEST',
          },
          test: 'test',
        };

        expect(actual).toEqual(expected);
      });
    });
  });
});


text:
package qub;

public interface JavaClockTests
{
    static void test(TestRunner runner)
    {
        runner.testGroup(JavaClock.class,
            (TestResources resources) -> Tuple.create(resources.getParallelAsyncRunner()),
            (AsyncRunner parallelAsyncRunner) ->
        {
            ClockTests.test(runner, () -> JavaClock.create(parallelAsyncRunner));

            runner.testGroup("scheduleAfter(Duration,Action0)", () ->
            {
                runner.test("with positive Duration", (Test test) ->
                {
                    final JavaClock clock = JavaClock.create(parallelAsyncRunner);
                    final IntegerValue counter = IntegerValue.create(0);
                    final DateTime startTime = clock.getCurrentDateTime();
                    final Duration delay = Duration.milliseconds(50);

                    clock.scheduleAfter(delay, counter::increment).await();

                    final DateTime endTime = clock.getCurrentDateTime();
                    final Duration duration = endTime.minus(startTime);
                    test.assertEqual(1, counter.get());
                    test.assertGreaterThanOrEqualTo(duration, delay, Duration.microseconds(1));
                });
            });

            runner.testGroup("scheduleAt(DateTime,Action0)", () ->
            {
                runner.test("with Datetime after now", (Test test) ->
                {
                    final JavaClock clock = JavaClock.create(parallelAsyncRunner);
                    final IntegerValue counter = IntegerValue.create(0);
                    final DateTime startTime = clock.getCurrentDateTime();
                    final Duration delay = Duration.milliseconds(50);

                    clock.scheduleAt(startTime.plus(delay), counter::increment).await();

                    final DateTime endTime = clock.getCurrentDateTime();
                    final Duration duration = endTime.minus(startTime);
                    test.assertEqual(1, counter.get());
                    test.assertGreaterThanOrEqualTo(duration, delay, Duration.microseconds(1));
                });
            });
        });
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace app {
namespace Android {
namespace android {
namespace animation {

struct TimeAnimator;

extern jclass TimeAnimator___javaClass_4;
extern jmethodID TimeAnimator__setTimeListener_378_ID;
extern jmethodID TimeAnimator__start_377_ID;
extern jmethodID TimeAnimator__TimeAnimator_376_ID_c;

struct TimeAnimator__uType : ::app::Android::android::animation::ValueAnimator__uType
{
};

TimeAnimator__uType* TimeAnimator__typeof();

void TimeAnimator___Init_4(::uStatic* __this);
void TimeAnimator___ObjInit_8(TimeAnimator* __this);
TimeAnimator* TimeAnimator__New_7(::uStatic* __this);
void TimeAnimator__setTimeListener(TimeAnimator* __this, ::uObject* arg0);
void TimeAnimator__setTimeListener_IMPL_378(::uStatic* __this, bool arg0_, jobject arg1_, ::uObject* arg2_);
void TimeAnimator__start(TimeAnimator* __this);
void TimeAnimator__start_IMPL_377(::uStatic* __this, bool arg0_, jobject arg1_);

struct TimeAnimator : ::app::Android::android::animation::ValueAnimator
{
    void _ObjInit_8() { TimeAnimator___ObjInit_8(this); }
    void setTimeListener(::uObject* arg0) { TimeAnimator__setTimeListener(this, arg0); }
    void start() { TimeAnimator__start(this); }
};

}}}}

#endif


text:
proyecto sitio web riviera arquitectos

[visita mi facebok](https://www.facebook.com/WilsonIsain)


text:
{-# LANGUAGE
    EmptyDataDecls
  , OverloadedStrings
  , GeneralizedNewtypeDeriving
  , FlexibleInstances
  #-}
module Clay.Size
(

-- * Size type.
  Size
, Abs
, Rel

-- * Size constructors.

, px
, pt
, em
, ex
, pct

-- * Shorthands for mutli size-valued properties.

, sym
, sym2
, sym3

-- * Angle type.

, Angle
, Deg
, Rad

-- * Constructing angles.

, deg
, rad

)
where

import Data.Monoid
import Data.Text (pack)

import Clay.Common
import Clay.Property
import Clay.Stylesheet

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

-- | Sizes can be relative like percentages.
data Rel

-- | Sizes can be absolute like pixels, points, etc.
data Abs

newtype Size a = Size Value
  deriving (Val, Auto, Normal, Inherit, None, Other)

-- | Size in pixels.

px :: Integer -> Size Abs
px i = Size (value (pack (show i) <> "px"))

-- | Size in points.

pt :: Double -> Size Abs
pt i = Size (value (pack (show i) <> "pt"))

-- | Size in em's.

em :: Double -> Size Abs
em i = Size (value (pack (show i) <> "em"))

-- | Size in ex'es.

ex :: Double -> Size Abs
ex i = Size (value (pack (show i) <> "ex"))

-- | Size in percentages.

pct :: Double -> Size Rel
pct i = Size (value (pack (show i) <> "%"))

instance Num (Size Abs) where
  fromInteger = px
  (+)    = error   "plus not implemented for Size"
  (*)    = error  "times not implemented for Size"
  abs    = error    "abs not implemented for Size"
  signum = error "signum not implemented for Size"

instance Fractional (Size Abs) where
  fromRational = em . fromRational

instance Num (Size Rel) where
  fromInteger = pct . fromInteger
  (+)    = error   "plus not implemented for Size"
  (*)    = error  "times not implemented for Size"
  abs    = error    "abs not implemented for Size"
  signum = error "signum not implemented for Size"

instance Fractional (Size Rel) where
  fromRational = pct . fromRational

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

sym :: (Size a -> Size a -> Size a -> Size a -> Css) -> Size a -> Css
sym k a = k a a a a

sym3 :: (Size a -> Size a -> Size a -> Size a -> Css) -> Size a -> Size a -> Size a -> Css
sym3 k tb l r = k tb l tb r

sym2 :: (Size a -> Size a -> Size a -> Size a -> Css) -> Size a -> Size a -> Css
sym2 k tb lr = k tb lr tb lr

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

data Deg
data Rad

newtype Angle a = Angle Value
  deriving (Val, Auto, Inherit, Other)

-- | Angle in degrees.

deg :: Double -> Angle Deg
deg i = Angle (value (pack (show i) <> "deg"))

-- | Angle in radians.

rad :: Double -> Angle Rad
rad i = Angle (value (pack (show i) <> "rad"))

instance Num (Angle Deg) where
  fromInteger = deg . fromInteger
  (+)    = error   "plus not implemented for Angle"
  (*)    = error  "times not implemented for Angle"
  abs    = error    "abs not implemented for Angle"
  signum = error "signum not implemented for Angle"

instance Fractional (Angle Deg) where
  fromRational = deg . fromRational

instance Num (Angle Rad) where
  fromInteger = rad . fromInteger
  (+)    = error   "plus not implemented for Angle"
  (*)    = error  "times not implemented for Angle"
  abs    = error    "abs not implemented for Angle"
  signum = error "signum not implemented for Angle"

instance Fractional (Angle Rad) where
  fromRational = rad . fromRational


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.esupportail.smsuapi.dao.beans">
	<class name="Sms" table="sms" lazy="false">
		<meta attribute="sync-DAO">false</meta>
		<id name="Id" type="integer" column="SMS_ID">
			<generator class="native"/>
		</id>
		<property name="InitialId" column="SMS_INITIAL_ID" type="integer" not-null="false" length="10"/>
		<property name="SenderId" column="SMS_SENDER_ID" type="integer" not-null="false" length="10"/>
		<property name="BrokerId" column="BROKER_SMS_ID" type="integer" not-null="false" length="10"/>
		<property name="State" column="SMS_STATE" type="string" not-null="true" length="32"/>
		<property name="Date" column="SMS_DATE" type="timestamp" not-null="true"/>
		<property name="Phone" column="SMS_PHONE" type="string" not-null="false" length="255"/>
		<many-to-one name="App" column="APP_ID" class="Application" not-null="true">
		</many-to-one>
		<many-to-one name="Acc" column="ACC_ID" class="Account" not-null="true">
		</many-to-one>
	</class>
</hibernate-mapping>


text: sub { return shift;}


text:
package com.petukhovsky.jvaluer.units;

import com.petukhovsky.jvaluer.JValuer;
import com.petukhovsky.jvaluer.JValuerBuilder;
import com.petukhovsky.jvaluer.commons.compiler.CloneCompiler;
import com.petukhovsky.jvaluer.commons.compiler.RunnableCompiler;
import com.petukhovsky.jvaluer.commons.lang.Language;
import com.petukhovsky.jvaluer.commons.lang.Languages;
import com.petukhovsky.jvaluer.commons.local.OSRelatedValue;
import com.petukhovsky.jvaluer.invoker.CustomInvoker;
import com.petukhovsky.jvaluer.lang.LanguagesImpl;
import org.junit.Before;
import org.junit.Test;

import java.nio.file.Paths;

import static org.junit.Assert.assertEquals;

/**
 * Created by Arthur Petukhovsky on 5/22/2016.
 */
public class JValuerTest {
    public JValuer loadJValuer() {
        return new JValuerBuilder()
                .addLanguage(new Language("GNU C++", new RunnableCompiler("g++", "{defines} -O2 -o {output} {source}")),
                        new String[]{}, new String[]{"c++", "cpp"})
                .addLanguage(new Language("GNU C++11", new RunnableCompiler("g++", "{defines} -O2 -o {output} {source}")),
                        new String[]{"cpp"}, new String[]{"c++11", "cpp11"})
                .addLanguage(new Language("Python 3", new CloneCompiler(),
                                new CustomInvoker(new OSRelatedValue<String>()
                                        .windows("c:/Programs/Python-3/python.exe").orElse("python3"), "{exe} {args}")),
                        new String[]{"py"}, new String[]{"python", "py", "python3"})
                .setPath(Paths.get("/tmp/jvaluer/"))
                .build();
    }

    @Test
    public void testLanguages() {
        Languages languages = loadJValuer().getLanguages();
        assertEquals(languages.findByExtension("py").name(), "Python 3");
        assertEquals(languages.findByName("c++11").name(), "GNU C++11");
    }
}


text:
package org.zstack.sdk;

public class GetInterdependentL3NetworksBackupStoragesResult {
    public java.util.List inventories;
    public void setInventories(java.util.List inventories) {
        this.inventories = inventories;
    }
    public java.util.List getInventories() {
        return this.inventories;
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>IteratorWrapper</title>
<meta name="date" content="2015-02-13">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

gameshop.advance.utility

Class IteratorWrapper<T1>

java.lang.Object

java.rmi.server.RemoteObject

java.rmi.server.RemoteServer

java.rmi.server.UnicastRemoteObject

gameshop.advance.utility.IteratorWrapper<T1>

Type Parameters:

T1 -

All Implemented Interfaces:

IIteratorWrapperRemote<T1>, java.io.Serializable, java.rmi.Remote, java.util.Iterator<T1>

public class IteratorWrapper<T1>
extends java.rmi.server.UnicastRemoteObject
implements IIteratorWrapperRemote<T1>, java.util.Iterator<T1>

Classe che consente di Wrappare un iteratore

See Also:

Serialized Form

Field Summary

Fields inherited from class java.rmi.server.RemoteObject

ref

Constructor Summary

Constructors

Constructor and Description

IteratorWrapper(java.util.Iterator<T1> iter)

Method Summary

Methods

Modifier and Type
Method and Description

boolean
hasNext()

T1
next()

void
remove()

Methods inherited from class java.rmi.server.UnicastRemoteObject

clone, exportObject, exportObject, exportObject, unexportObject

Methods inherited from class java.rmi.server.RemoteServer

getClientHost, getLog, setLog

Methods inherited from class java.rmi.server.RemoteObject

equals, getRef, hashCode, toString, toStub

Methods inherited from class java.lang.Object

finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

IteratorWrapper

public IteratorWrapper(java.util.Iterator<T1> iter)
                throws java.rmi.RemoteException

Throws:

java.rmi.RemoteException

Method Detail

hasNext

public boolean hasNext()

Specified by:

hasNext in interface IIteratorWrapperRemote<T1>

Specified by:

hasNext in interface java.util.Iterator<T1>

next

public T1 next()

Specified by:

next in interface IIteratorWrapperRemote<T1>

Specified by:

next in interface java.util.Iterator<T1>

Returns:

L'oggetto wrappato

remove

public void remove()

Specified by:

remove in interface IIteratorWrapperRemote<T1>

Specified by:

remove in interface java.util.Iterator<T1>

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>bugfree</groupId>
    <artifactId>BugFreeExample</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>1.6.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>ste.test</groupId>
            <artifactId>xtest</artifactId>
            <version>1.14.1-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.14.1</version>
                <configuration>
                    <includes>
                        <include>**/BG*.java</include>
                        <include>**/BugFree*.java</include>
                        <include>**/*BugFree.java</include>
                        <include>**/*BF.java</include>
                    </includes>
                    <forkMode>always</forkMode>
                    <parallel>classes</parallel>
                    <threadCountClasses>1</threadCountClasses>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
</project>


text:
namespace FluentKnockoutHelpers.Core.AttributeBuilding
{
    /// <summary>
    /// This class contains an attribute with a single value (no pairs, inner keys and values)
    /// </summary>
    public class NoInnerKeyValue : HtmlAttribute
    {
        /// <summary>
        /// the attribute value
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// Constructs a new attribute with the key and single value (no inner key/values)
        /// </summary>
        /// <param name="attrKey">the attribute key</param>
        /// <param name="attrValue">the attribute value</param>
        public NoInnerKeyValue(string attrKey, string attrValue)
        {
            Key = attrKey;
            Value = attrValue;
        }

        /// <summary>
        /// Returns the string of the attribute with value
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format("{0}=\"{1}\"", Key, Value);
        }
    }
}


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * String.prototype.indexOf(searchString, position)
 *
 * @path ch15/15.5/15.5.4/15.5.4.7/S15.5.4.7_A1_T10.js
 * @description Call indexOf(searchString, position) function with object arguments
 */

var __obj = {toString:function(){return "\u0041B";}}
var __obj2 = {valueOf:function(){return true;}}
var __str = "ABB\u0041BABAB";

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
with(__str){
    if (indexOf(__obj, __obj2) !== 3) {
      $ERROR('#1: var x; var __obj = {toString:function(){return "\u0041B";}}; var __obj2 = {valueOf:function(){return true;}}; var __str = "ABB\u0041BABAB"; indexOf(__obj, __obj2) === 3. Actual: '+indexOf(__obj, __obj2) );
    }
}
//
//////////////////////////////////////////////////////////////////////////////

var x;


text:
package com.gs.fw.common.mithra.test.domain;

import java.sql.*;

public class BitemporalOrderStatusFilter extends BitemporalOrderStatusFilterAbstract
{
	public BitemporalOrderStatusFilter(Timestamp businessDate
	, Timestamp processingDate
	)
	{
		super(businessDate
		,processingDate
		);
		// You must not modify this constructor. Mithra calls this internally.
		// You can call this constructor. You can also add new constructors.
	}

	public BitemporalOrderStatusFilter(Timestamp businessDate)
	{
		super(businessDate);
	}
}


text:
import pytest

from selenium.webdriver.common.by import By

def test_should_be_able_to_determine_the_location_of_an_element(driver, pages):
    pages.load("xhtmlTest.html")
    location = driver.find_element(By.ID, "username").location_once_scrolled_into_view
    assert location["x"] > 0
    assert location["y"] > 0

@pytest.mark.parametrize('page', (
    'coordinates_tests/simple_page.html',
    'coordinates_tests/page_with_empty_element.html',
    'coordinates_tests/page_with_transparent_element.html',
    'coordinates_tests/page_with_hidden_element.html'),
    ids=('basic', 'empty', 'transparent', 'hidden'))
@pytest.mark.xfail_safari
def test_should_get_coordinates_of_an_element(page, driver, pages):
    pages.load(page)
    element = driver.find_element(By.ID, "box")
    _check_location(element.location_once_scrolled_into_view, x=10, y=10)
    _check_location(element.location, x=10, y=10)

@pytest.mark.xfail_safari
def test_should_get_coordinates_of_an_invisible_element(driver, pages):
    pages.load("coordinates_tests/page_with_invisible_element.html")
    element = driver.find_element(By.ID, "box")
    _check_location(element.location_once_scrolled_into_view, x=0, y=0)
    _check_location(element.location, x=0, y=0)

def test_should_scroll_page_and_get_coordinates_of_an_element_that_is_out_of_view_port(driver, pages):
    pages.load("coordinates_tests/page_with_element_out_of_view.html")
    element = driver.find_element(By.ID, "box")
    windowHeight = driver.get_window_size()["height"]
    _check_location(element.location_once_scrolled_into_view, x=10)
    assert 0 <= element.location_once_scrolled_into_view["y"] <= (windowHeight - 100)
    _check_location(element.location, x=10, y=5010)

@pytest.mark.xfail_chrome
@pytest.mark.xfail_chromiumedge
@pytest.mark.xfail_firefox
@pytest.mark.xfail_remote
@pytest.mark.xfail_safari
def test_should_get_coordinates_of_an_element_in_aframe(driver, pages):
    pages.load("coordinates_tests/element_in_frame.html")
    driver.switch_to.frame(driver.find_element(By.NAME, "ifr"))
    element = driver.find_element(By.ID, "box")
    _check_location(element.location_once_scrolled_into_view, x=25, y=25)
    _check_location(element.location, x=10, y=10)

@pytest.mark.xfail_chrome
@pytest.mark.xfail_chromiumedge
@pytest.mark.xfail_firefox
@pytest.mark.xfail_remote
@pytest.mark.xfail_safari
def test_should_get_coordinates_of_an_element_in_anested_frame(driver, pages):
    pages.load("coordinates_tests/element_in_nested_frame.html")
    driver.switch_to.frame(driver.find_element(By.NAME, "ifr"))
    driver.switch_to.frame(driver.find_element(By.NAME, "ifr"))
    element = driver.find_element(By.ID, "box")
    _check_location(element.location_once_scrolled_into_view, x=40, y=40)
    _check_location(element.location, x=10, y=10)

def test_should_get_coordinates_of_an_element_with_fixed_position(driver, pages):
    pages.load("coordinates_tests/page_with_fixed_element.html")
    element = driver.find_element(By.ID, "fixed")
    _check_location(element.location_once_scrolled_into_view, y=0)
    _check_location(element.location, y=0)

    driver.find_element(By.ID, "bottom").click()
    _check_location(element.location_once_scrolled_into_view, y=0)
    assert element.location["y"] > 0

def test_should_correctly_identify_that_an_element_has_width_and_height(driver, pages):
    pages.load("xhtmlTest.html")
    shrinko = driver.find_element(By.ID, "linkId")
    size = shrinko.size
    assert size["width"] > 0
    assert size["height"] > 0

def _check_location(location, **kwargs):
    try:
        # python 2.x
        expected = kwargs.viewitems()
        actual = location.viewitems()
    except AttributeError:
        # python 3.x
        expected = kwargs.items()
        actual = location.items()
    assert expected <= actual


text:
`git stash` is useful for pausing in-progress work that isn't ready to be
commited yet.

## Snapshotting and Stashing Changes

`git stash`
Without any arguments, this command will record a snapshot of the staged and
unstaged changes and then clear the working directory.

`git stash -p`
Passing the `--patch` flag to the command will iterate through each changed hunk
in the working dir and ask if it should be stashed.

### Hunk Commands

`?`
Help, used to view full list of hunk commands.

`/`
Search for a hunk with regex

`n`
Don't stash current hunk

`q`
Quit iterating through hunks and stash all selected hunks

`s`
Split hunk into smaller hunks

`y`
Stash this hunk

## View Stashed Snapshots

`git stash list`
This command lists all saved snapshots in the stash stack.

`git stash show`
This command will show diffs for the stash and the current working dir.
Use the patch `-p` flag to view the full diff of a stash.

## Applying Stashed Changes

`git stash pop`
This command will applies the most recently stashed changes to the working
directory and remove it from the stash stack.

`git stash apply <stash name>`
This command applies the named stash to the working dir, but does not remove the
snapshot from the stash stack. If no name is given, then the most recent
snapshot is appiled.

### Creating a New Branch from a Stashed Snapshot

`git stash branch <branch-name> <stash-name>`
This command checks out a new branch based on the commit the stash was created
on top of, then pops the specified stash changes on top.

## Removing a Snapshot from the Stack

`git stash drop <stash name>`
This command will remove the <named> snapshot from the stash stack.

`git stash clear`
This command removes all snapshots from the stash stack.


text:
<?php
/**
 * Custom functions that act independently of the theme templates
 *
 * Eventually, some of the functionality here could be replaced by core features
 *
 * @package WpSkeleton
 */

/**
 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
 *
 * @param array $args Configuration arguments.
 * @return array
 */
function wpskeleton_page_menu_args( $args ) {
	$args['show_home'] = true;
	return $args;
}
add_filter( 'wp_page_menu_args', 'wpskeleton_page_menu_args' );

/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function wpskeleton_body_classes( $classes ) {
	// Adds a class of group-blog to blogs with more than 1 published author.
	if ( is_multi_author() ) {
		$classes[] = 'group-blog';
	}

	return $classes;
}
add_filter( 'body_class', 'wpskeleton_body_classes' );

/**
 * Filters wp_title to print a neat <title> tag based on what is being viewed.
 *
 * @param string $title Default title text for current view.
 * @param string $sep Optional separator.
 * @return string The filtered title.
 */
function wpskeleton_wp_title( $title, $sep ) {
	if ( is_feed() ) {
		return $title;
	}

	global $page, $paged;

	// Add the blog name
	$title .= get_bloginfo( 'name', 'display' );

	// Add the blog description for the home/front page.
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) ) {
		$title .= " $sep $site_description";
	}

	// Add a page number if necessary:
	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
		$title .= " $sep " . sprintf( __( 'Page %s', 'wpskeleton' ), max( $paged, $page ) );
	}

	return $title;
}
add_filter( 'wp_title', 'wpskeleton_wp_title', 10, 2 );

/**
 * Sets the authordata global when viewing an author archive.
 *
 * This provides backwards compatibility with
 * http://core.trac.wordpress.org/changeset/25574
 *
 * It removes the need to call the_post() and rewind_posts() in an author
 * template to print information about the author.
 *
 * @global WP_Query $wp_query WordPress Query object.
 * @return void
 */
function wpskeleton_setup_author() {
	global $wp_query;

	if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
		$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
	}
}
add_action( 'wp', 'wpskeleton_setup_author' );


text:
layout: api
title: stdlib
---

We're working on revamping the API with a new style and much better contents. For now, please refer to the [old site](http://jetbrains.github.io/kotlin/versions/snapshot/apidocs/index.html)


text:
function [theta, J_history] = gradientDescentMulti(X, y, theta, alpha, num_iters)
%GRADIENTDESCENTMULTI Performs gradient descent to learn theta
%   theta = GRADIENTDESCENTMULTI(x, y, theta, alpha, num_iters) updates theta by
%   taking num_iters gradient steps with learning rate alpha

% Initialize some useful values
m = length(y); % number of training examples
J_history = zeros(num_iters, 1);

for iter = 1:num_iters

    % ====================== YOUR CODE HERE ======================
    % Instructions: Perform a single gradient step on the parameter vector
    %               theta.
    %
    % Hint: While debugging, it can be useful to print out the values
    %       of the cost function (computeCostMulti) and gradient here.
    %

    htheta = X * theta;
    tmp = zeros(3, 1);
    for r = 1:size(theta, 1)
        tmp(r) = theta(r) - alpha / m * sum((htheta - y) .* X(:,r));
    end
    theta = tmp;

    % ============================================================

    % Save the cost J in every iteration
    J_history(iter) = computeCostMulti(X, y, theta);

end

end


text:
package msgp

import (
	"io/ioutil"
	"os"
)

// MarshalSizer is the combination
// of the Marshaler and Sizer
// interfaces.
type MarshalSizer interface {
	Marshaler
	Sizer
}

func ReadFile(dst Unmarshaler, file *os.File) error {
	if u, ok := dst.(Decodable); ok {
		return u.DecodeMsg(NewReader(file))
	}

	data, err := ioutil.ReadAll(file)
	if err != nil {
		return err
	}
	_, err = dst.UnmarshalMsg(data)
	return err
}

func WriteFile(src MarshalSizer, file *os.File) error {
	if e, ok := src.(Encodable); ok {
		w := NewWriter(file)
		err := e.EncodeMsg(w)
		if err == nil {
			err = w.Flush()
		}
		return err
	}

	raw, err := src.MarshalMsg(nil)
	if err != nil {
		return err
	}
	_, err = file.Write(raw)
	return err
}


text:
import type Http from "http";
import type Https from "https";
import type Http2 from "http2";
import {InjectorService} from "@tsed/di";
import {getHostInfoFromPort} from "@tsed/core";

export function listenServer(
  injector: InjectorService,
  server: Http.Server | Https.Server | Http2.Http2Server,
  hostInfo: ReturnType<typeof getHostInfoFromPort>
): Promise<ReturnType<typeof getHostInfoFromPort>> {
  const {protocol, address, port} = hostInfo;
  const url = `${protocol}://${address}:${port}`;
  injector.logger.debug(`Start server on ${url}`);

  const promise = new Promise((resolve, reject) => {
    server.on("listening", resolve);
    server.on("error", reject);
  }).then(() => {
    const port = (server.address() as any).port;
    const info = {...hostInfo, port};

    injector.logger.info(`Listen server on ${info.toString()}`);

    return info;
  });

  server.listen(port, address as any);

  return promise;
}


text:
/*
 * Fast snippets that run before the all HTML gets loaded.
 */

 /**
  * Set the supplied navbar class, retrieving its last value from local storage
  */
function navInit(name: string): void {
    if (JSON.parse(localStorage.getItem(name) || 'false')) document.body.classList.add(name)
}

navInit('dark')
navInit('showInfo')
navInit('showDone')
document.body.setAttribute('data-view', JSON.parse(localStorage.getItem('view') || '0'))
const brnd = document.getElementById('brand')
if (brnd) brnd.innerHTML = document.title = (localStorage.getItem('titleAction') || 'Check') + ' PCR'


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;

namespace SR_PluginLoader
{
    public class DebugHUD_Renderer : MonoBehaviour
    {
        private const float PANEL_WIDTH = 500f;
        private List<string> lines = new List<string>();
        private Dictionary<string, int> stacks = new Dictionary<string, int>();
        //private String lines_joined = "";
        private GUIContent console_lines = new GUIContent();
        private GUIContent alert_content = new GUIContent();
        private GUIContent alert_sub_content = new GUIContent();
        private GUIContent watermark_content = new GUIContent();
        private GUIContent watermark_text_content = new GUIContent();
        private GUIContent player_pos_text = new GUIContent();

        private bool needs_layout = true;

        private Rect screen_area, console_area, console_inner_area, console_inner_text_area, fade_area, watermark_text_area, watermark_area, player_pos_area;

        private const float alert_size = 32f;
        private const float alert_icon_offset = 10f;
        private Rect alertPos = new Rect(alert_icon_offset, alert_icon_offset, alert_size, alert_size);
        private Rect alert_txtPos = new Rect(0f, 0f, 0f, 0f);
        private Rect alert_sub_txtPos = new Rect(0f, 0f, 0f, 0f);
        private Vector2 alert_txtSz = new Vector2();
        private Vector2 alert_sub_txtSz = new Vector2();
        private Vector2 console_scroll = Vector2.zero;

        private static bool dirty_styles = true;// do the styles need to be updated?

        private static Texture2D bg_fade = null;
        private static GUIStyle blackout = new GUIStyle();
        private static GUIStyle text_style = new GUIStyle();
        private static GUIStyle subtext_style = new GUIStyle();
        private static GUIStyle console_text_style = new GUIStyle();
        private static GUIStyle watermark_style = new GUIStyle();

        private const float scrollbar_width = 6f;

        private static GUISkin skin = null;

        private bool open = false;
        private int new_count = 0;
        private int id = 0;

        private KeyCode OPEN_KEY = KeyCode.Tab;

        public void Awake()
        {
            this.Clear();
        }

        public void Clear()
        {
            this.lines.Clear();
            this.stacks.Clear();
        }

        public void Add_Line(string str)
        {
            this.new_count++;
            this.lines.Add(str);

            this.console_lines.text = String.Join("\n", this.lines.ToArray());
            string msg = String.Format("{0} new log{1}", this.new_count, this.new_count>1 ? "s" : "");
            alert_content.text = msg;
            alert_sub_content.text = String.Format("Press {0} to open the plugins console.", this.OPEN_KEY);
            this.needs_layout = true;
        }

        public void Add_Tally(string str, int cnt=1)
        {
            int tmp = 0;
            if (!this.stacks.TryGetValue(str, out tmp)) this.stacks[str] = 0;

            this.stacks[str] += cnt;
        }

        private void Init_Styles()
        {
            dirty_styles = false;
            DebugHUD_Renderer.bg_fade = Util.Get_Gradient_Texture(400, GRADIENT_DIR.LEFT_RIGHT, new Color(0f,0f,0f,1f), new Color(0f,0f,0f,0f), true, 1.5f);
            Util.Set_BG_Color(DebugHUD_Renderer.blackout.normal, 0.1f, 0.1f, 0.1f, 0.7f);

            DebugHUD_Renderer.text_style.normal.textColor = Color.white;
            DebugHUD_Renderer.text_style.active.textColor = Color.white;
            DebugHUD_Renderer.text_style.hover.textColor = Color.white;
            DebugHUD_Renderer.text_style.fontSize = 16;
            DebugHUD_Renderer.text_style.fontStyle = FontStyle.Bold;

            DebugHUD_Renderer.subtext_style = new GUIStyle(DebugHUD_Renderer.text_style);
            DebugHUD_Renderer.subtext_style.fontSize = 12;
            DebugHUD_Renderer.subtext_style.fontStyle = FontStyle.Normal;
            DebugHUD_Renderer.subtext_style.richText = true;

            DebugHUD_Renderer.skin = ScriptableObject.CreateInstance<GUISkin>();
            skin.name = "DebugHUD_Renderer";

            skin.verticalScrollbar = new GUIStyle();
            skin.verticalScrollbar.fixedWidth = scrollbar_width;
            Util.Set_BG_Color(skin.verticalScrollbar.normal, new Color32(16, 16, 16, 200));

            skin.verticalScrollbarThumb = new GUIStyle();
            skin.verticalScrollbarThumb.fixedWidth = scrollbar_width;
            Util.Set_BG_Color(skin.verticalScrollbarThumb.normal, new Color32(80, 80, 80, 255));

            skin.horizontalScrollbar = null;
            skin.horizontalScrollbarLeftButton = null;
            skin.horizontalScrollbarRightButton = null;
            skin.horizontalScrollbarThumb = null;

            DebugHUD_Renderer.console_text_style.normal.textColor = Color.white;
            DebugHUD_Renderer.console_text_style.normal.textColor = Color.white;
            DebugHUD_Renderer.console_text_style.active.textColor = Color.white;
            DebugHUD_Renderer.console_text_style.hover.textColor = Color.white;
            DebugHUD_Renderer.console_text_style.fontSize = 14;
            DebugHUD_Renderer.console_text_style.fontStyle = FontStyle.Normal;
            DebugHUD_Renderer.console_text_style.richText = true;

            watermark_style = new GUIStyle(GUI.skin.GetStyle("label"));
            watermark_style.normal.textColor = new Color(1f, 1f, 1f, 0.6f);
            watermark_style.fontSize = 16;
            watermark_style.fontStyle = FontStyle.Bold;
            //title_style.normal.textColor = this.blue_clr;
            watermark_style.padding = new RectOffset(3, 3, 3, 3);
            watermark_style.normal.background = null;

            watermark_text_content.text = Loader.TITLE;
            watermark_content = new GUIContent(TextureHelper.icon_logo);
        }

        private void Update()
        {
            if (Player.gameObject != null)
            {
                update_player_pos_display();
            }

            if (Input.GetKeyUp(KeyCode.Tab) || (Input.GetKeyUp(KeyCode.Escape) && this.open))
            {
                this.open = (!this.open);
                if (this.open)
                {
                    this.new_count = 0;
                }
                this.onVisibility_Change(this.open);
            }
        }

        private void update_player_pos_display()
        {
            var pos = Player.gameObject.transform.position;
            player_pos_text.text = String.Format("Player: {0}, {1}, {2}", pos.x, pos.y, pos.z);

            float X = 2f;
            float Y = 2f;

            Vector2 posSz = console_text_style.CalcSize(player_pos_text);
            player_pos_area = new Rect(X, Y, posSz.x, posSz.y);
        }

        private void onVisibility_Change(bool is_vis)
        {
            if (is_vis == true) GameTime.Pause();
            else GameTime.Unpause();
        }

        private void doLayout()
        {
            this.needs_layout = false;
            float offsetH = 50f;
            float offsetBottom = 20f;
            float cPad = 5f;

            screen_area = new Rect(0f, 0f, Screen.width, Screen.height);
            fade_area = new Rect(0f, 0f, Screen.width, Screen.height);
            console_area = new Rect(cPad, offsetH, Screen.width - (cPad*2f), (Screen.height - offsetH - offsetBottom));

            float console_width = (console_area.width + scrollbar_width);//lest I ever change the width and neglect to also change the below text height calculation's width.
            float text_height = console_text_style.CalcHeight(console_lines, console_width);
            console_inner_area = new Rect(0f, 0f, console_width, text_height);
            console_inner_text_area = new Rect(console_inner_area.x+scrollbar_width+3f, console_inner_area.y, console_inner_area.width - scrollbar_width - 2f, text_height);
            //console_scrollbar_area = new Rect(0f, 0f, scrollbar_width, Screen.height);

            alertPos = new Rect(alert_icon_offset, alert_icon_offset, alert_size, alert_size);

            alert_txtSz = DebugHUD_Renderer.text_style.CalcSize(alert_content);
            alert_txtPos = new Rect(alertPos.x + alertPos.width + 3f, alertPos.y + (alertPos.height * 0.5f) - (alert_txtSz.y * 0.5f), alert_txtSz.x, alert_txtSz.y);
            alert_sub_txtSz = DebugHUD_Renderer.subtext_style.CalcSize(alert_sub_content);
            alert_sub_txtPos = new Rect(alert_txtPos.xMin, alert_txtPos.yMax + 3f, alert_sub_txtSz.x, alert_sub_txtSz.y);

            float hw = (Screen.width / 2f);
            var txtSZ = watermark_style.CalcSize(watermark_text_content);

            float logo_size = 36f;

            float pad = 2f;
            float X = pad;
            float Y = (Screen.height - (logo_size+pad));

            watermark_area = new Rect(X, Y, logo_size, logo_size);
            watermark_text_area = new Rect(watermark_area.xMax + 1f, watermark_area.yMax - (txtSZ.y - 2f), 300f, 25f);

        }
        ///
        /// Uses all of the system mouse movement, hover, and input events so we can prevent all controls under this one from getting them.
        /// Because this is a fullscreen overlay.
        ///
        private bool handleEvents()
        {
            id = GUIUtility.GetControlID(id, FocusType.Keyboard, screen_area);
            var evt = Event.current.GetTypeForControl(id);
            switch(evt)
            {
                case EventType.Layout:
                    this.doLayout();
                    return false;
                case EventType.Ignore:
                case EventType.Used:
                    return false;
                case EventType.Repaint:
                    break;
                case EventType.MouseDrag:
                case EventType.MouseMove:
                case EventType.MouseDown:
                case EventType.MouseUp:
                        //Event.current.Use();
                    return false;
                    break;
                default:
                        //Event.current.Use();
                    break;
            }

            return true;
        }

        private void OnGUI()
        {
            if (dirty_styles) this.Init_Styles();
            if(Event.current.GetTypeForControl(id) == EventType.Layout || this.needs_layout)
            {
                this.doLayout();
                return;
            }

            //this.Render_Loader_Watermark();
            if (!this.open)
            {
                if (this.new_count > 0)
                {
                    var clr = new Color(1f, 1f, 1f, 0.85f);

                    //GUI.Label(alert_txtPos, alert_content, DebugHUD_Renderer.text_style);
                    DebugHUD_Renderer.text_style.Draw(alert_txtPos, alert_content, id);
                    DebugHUD_Renderer.subtext_style.Draw(alert_sub_txtPos, alert_sub_content, id);

                    var prevClr = GUI.color;
                    GUI.color = clr;

                    GUI.DrawTexture(alertPos, TextureHelper.icon_alert, ScaleMode.ScaleToFit);
                    GUI.color = prevClr;
                }
            }
            else
            {
                var prev_depth = GUI.depth;
                GUI.depth = 100;
                if (!this.handleEvents()) return;

                // darken the entire screen
                DebugHUD_Renderer.blackout.Draw(screen_area, GUIContent.none, id);
                // draw a black fade
                GUI.DrawTexture(fade_area, DebugHUD_Renderer.bg_fade, ScaleMode.StretchToFill);

                var prev_skin = GUI.skin;
                GUI.skin = skin;
                // draw the debug console text
                console_scroll = GUI.BeginScrollView(console_area, console_scroll, console_inner_area, false, false);
                    console_text_style.Draw(console_inner_text_area, console_lines, id);
                //PLog.Info("{0} {1} {2}", console_inner_area.height, console_inner_text_area.height, console_scrollbar_area.height);
                GUI.EndScrollView(true);

                GUI.depth = prev_depth;
                GUI.skin = prev_skin;

                console_text_style.Draw(player_pos_area, player_pos_text, false, false, false, false);
            }
        }

        private void Render_Loader_Watermark()
        {
            var prevClr = GUI.color;
            GUI.color = watermark_style.normal.textColor;
            GUI.DrawTexture(watermark_area, TextureHelper.icon_logo, ScaleMode.ScaleToFit);
            GUI.color = prevClr;
            //watermark_style.Draw(watermark_area, watermark_content, false, false, false, false);
            watermark_style.Draw(watermark_text_area, watermark_text_content, false, false, false, false);
        }

    }
}


text:
import angular from 'angular';
import uiRouter from 'angular-ui-router';
import storagelokerComponent from './storageloker.component';
import storagelokerModal from './storageloker.modal.controller';

let storagelokerModule = angular.module('app.components.storageloker', [
  uiRouter
])
.config(($stateProvider) => {
  "ngInject";
  $stateProvider
    .state('storageloker', {
      url: '/storageloker',
      component: 'storageloker',
      data: {
        requiresAuth: true
      }
    });
})
.component('storageloker', storagelokerComponent)
.controller('storagelokerModal', storagelokerModal)
.name;

export default storagelokerModule;


text:
import tornado.web

class FlandersHandler(tornado.web.RequestHandler):
    def get(self):
        self.finish("Hi-dilly-ho, neighborino!")


text:
package com.github.crazcalm.LearnAlgo.Chapter1.Excercises.Section1;

import edu.princeton.cs.introcs.StdOut;

/**
 * Created by marcuswillock on 5/23/15.
 */
public class Problem3 {
    public static void main(String[] args){
        String question = "Write a program that takes three integers command-line arguments" +
                            "and prints equal if all the are equal and not equal otherwise";

        if (args.length < 3){
            StdOut.println("There is not enough args!");
        }else{
            StdOut.println("args list: ");
            for(String i: args){
                StdOut.println(i);
            }

            StdOut.print("\nAsnwer: ");
            if(args[0] == args[1] && args[1] == args[2]){
                StdOut.println("equal");
            }else{
                StdOut.println("not equal");
            }
        }

    }
}


text:
token_t *expand_lambda( stack_frame_t *frame, token_t *tokens );
stack_frame_t *expand_procedure( stack_frame_t *frame, token_t *tokens );
token_t *expand_if_expr( stack_frame_t *frame, token_t *tokens );
token_t *expand_syntax_rules( stack_frame_t *frame, token_t *tokens );
token_t *expand_vector( stack_frame_t *frame, token_t *tokens );

#endif


text:
namespace RouteExtreme.Web.Controllers
{
    using System.Linq;
    using System.Threading.Tasks;
    using System.Web;
    using System.Web.Mvc;
    using Microsoft.AspNet.Identity;
    using Microsoft.AspNet.Identity.Owin;
    using Microsoft.Owin.Security;
    using RouteExtreme.Web.Models;
    using Services;
    using Services.Contracts;
    using Models.AccountViewModels;
    using System.IO;
    using RouteExtreme.Models;

    [Authorize]
    public class ManageController : BaseController
    {
        private ApplicationSignInManager _signInManager;
        private ApplicationUserManager _userManager;
        private IUserService userService;
        private IChatRoomService chatRoomService;

        public ManageController(IUserService userService, IChatRoomService chatRoom)
            : base(userService, chatRoom)
        {
            this.userService = userService;
            this.chatRoomService = chatRoom;
        }

        public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IUserService userService, IChatRoomService chatRoom)
            : this(userService, chatRoom)
        {
            UserManager = userManager;
            SignInManager = signInManager;
        }

        public ApplicationSignInManager SignInManager
        {
            get
            {
                return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
            }
            private set
            {
                _signInManager = value;
            }
        }

        public ApplicationUserManager UserManager
        {
            get
            {
                return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
            }
            private set
            {
                _userManager = value;
            }
        }

        public ActionResult EditProfile()
        {
            return View();
        }

        [HttpPost]
        public ActionResult EditProfile(EditProfileViewModel model)
        {
            var user = this.userService.GetById(this.User.Identity.GetUserId())
                                              .FirstOrDefault();

            if (!string.IsNullOrEmpty(model.FirstName))
            {
                user.FirstName = model.FirstName;
            }

            if (!string.IsNullOrEmpty(model.LastName))
            {
                user.LastName = model.LastName;
            }

            if (!string.IsNullOrEmpty(model.Email))
            {
                user.Email = model.Email;
            }

            if (model.ProfilePic != null)
            {
                using (var memory = new MemoryStream())
                {
                    model.ProfilePic.InputStream.CopyTo(memory);
                    var content = memory.GetBuffer();

                    var image = new Image
                    {
                        Content = content,
                        FileExtension = model.ProfilePic.FileName.Split(new[] { '.' }).Last()
                    };

                    user.ProfilePic = image;
                }
            }

            this.userService.UpdateUser(user);
            return this.RedirectToAction("UserDetails","Account");
        }
        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var model = new IndexViewModel
            {
                HasPassword = HasPassword(),
                PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };
            return View(model);
        }

        //
        // POST: /Manage/RemoveLogin
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> RemoveLogin(string loginProvider, string providerKey)
        {
            ManageMessageId? message;
            var result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));
            if (result.Succeeded)
            {
                var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
                if (user != null)
                {
                    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                }
                message = ManageMessageId.RemoveLoginSuccess;
            }
            else
            {
                message = ManageMessageId.Error;
            }
            return RedirectToAction("ManageLogins", new { Message = message });
        }

        //
        // GET: /Manage/AddPhoneNumber
        public ActionResult AddPhoneNumber()
        {
            return View();
        }

        //
        // POST: /Manage/AddPhoneNumber
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }
            // Generate the token and send it
            var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
            if (UserManager.SmsService != null)
            {
                var message = new IdentityMessage
                {
                    Destination = model.Number,
                    Body = "Your security code is: " + code
                };
                await UserManager.SmsService.SendAsync(message);
            }
            return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number });
        }

        //
        // POST: /Manage/EnableTwoFactorAuthentication
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> EnableTwoFactorAuthentication()
        {
            await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), true);
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
            if (user != null)
            {
                await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
            }
            return RedirectToAction("Index", "Manage");
        }

        //
        // POST: /Manage/DisableTwoFactorAuthentication
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> DisableTwoFactorAuthentication()
        {
            await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), false);
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
            if (user != null)
            {
                await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
            }
            return RedirectToAction("Index", "Manage");
        }

        //
        // GET: /Manage/VerifyPhoneNumber
        public async Task<ActionResult> VerifyPhoneNumber(string phoneNumber)
        {
            var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), phoneNumber);
            // Send an SMS through the SMS provider to verify the phone number
            return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
        }

        //
        // POST: /Manage/VerifyPhoneNumber
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }
            var result = await UserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code);
            if (result.Succeeded)
            {
                var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
                if (user != null)
                {
                    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                }
                return RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess });
            }
            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "Failed to verify phone");
            return View(model);
        }

        //
        // GET: /Manage/RemovePhoneNumber
        public async Task<ActionResult> RemovePhoneNumber()
        {
            var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null);
            if (!result.Succeeded)
            {
                return RedirectToAction("Index", new { Message = ManageMessageId.Error });
            }
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
            if (user != null)
            {
                await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
            }
            return RedirectToAction("Index", new { Message = ManageMessageId.RemovePhoneSuccess });
        }

        //
        // GET: /Manage/ChangePassword
        public ActionResult ChangePassword()
        {
            return View();
        }

        //
        // POST: /Manage/ChangePassword
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> ChangePassword(ChangePasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }
            var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
            if (result.Succeeded)
            {
                var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
                if (user != null)
                {
                    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                }
                return this.RedirectToAction("UserDetails", "Account");
            }
            AddErrors(result);
            return View(model);
        }

        //
        // GET: /Manage/SetPassword
        public ActionResult SetPassword()
        {
            return View();
        }

        //
        // POST: /Manage/SetPassword
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> SetPassword(SetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
                if (result.Succeeded)
                {
                    var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
                    if (user != null)
                    {
                        await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                    }
                    return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess });
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }

        //
        // GET: /Manage/ManageLogins
        public async Task<ActionResult> ManageLogins(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
                : message == ManageMessageId.Error ? "An error has occurred."
                : "";
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
            if (user == null)
            {
                return View("Error");
            }
            var userLogins = await UserManager.GetLoginsAsync(User.Identity.GetUserId());
            var otherLogins = AuthenticationManager.GetExternalAuthenticationTypes().Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList();
            ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1;
            return View(new ManageLoginsViewModel
            {
                CurrentLogins = userLogins,
                OtherLogins = otherLogins
            });
        }

        //
        // POST: /Manage/LinkLogin
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult LinkLogin(string provider)
        {
            // Request a redirect to the external login provider to link a login for the current user
            return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId());
        }

        //
        // GET: /Manage/LinkLoginCallback
        public async Task<ActionResult> LinkLoginCallback()
        {
            var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
            if (loginInfo == null)
            {
                return RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
            }
            var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login);
            return result.Succeeded ? RedirectToAction("ManageLogins") : RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && _userManager != null)
            {
                _userManager.Dispose();
                _userManager = null;
            }

            base.Dispose(disposing);
        }

        #region Helpers
        // Used for XSRF protection when adding external logins
        private const string XsrfKey = "XsrfId";

        private IAuthenticationManager AuthenticationManager
        {
            get
            {
                return HttpContext.GetOwinContext().Authentication;
            }
        }

        private void AddErrors(IdentityResult result)
        {
            foreach (var error in result.Errors)
            {
                ModelState.AddModelError("", error);
            }
        }

        private bool HasPassword()
        {
            var user = UserManager.FindById(User.Identity.GetUserId());
            if (user != null)
            {
                return user.PasswordHash != null;
            }
            return false;
        }

        private bool HasPhoneNumber()
        {
            var user = UserManager.FindById(User.Identity.GetUserId());
            if (user != null)
            {
                return user.PhoneNumber != null;
            }
            return false;
        }

        public enum ManageMessageId
        {
            AddPhoneSuccess,
            ChangePasswordSuccess,
            SetTwoFactorSuccess,
            SetPasswordSuccess,
            RemoveLoginSuccess,
            RemovePhoneSuccess,
            Error
        }

        #endregion
    }
}


text:
'use strict';
var bcrypt = require('bcryptjs');
var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

var schema = new Schema({
    email: { type: String, unique: true, lowercase: true },
    password: { type: String, select: false },
    displayName: String,
    picture: String,
    facebook: String,
    foursquare: String,
    google: String,
    github: String,
    linkedin: String,
    live: String,
    yahoo: String,
    twitter: String,
    phone: String,
    fullName: String,
    address1:String,
    address2:String,
    city:String,
    region:String,
    postal:String

});
schema.pre('save', function(next) {
    var user = this;
    if (!user.isModified('password')) {
        return next();
    }
    bcrypt.genSalt(10, function(err, salt) {
        bcrypt.hash(user.password, salt, function(err, hash) {
            user.password = hash;
            next();
        });
    });
});

schema.methods.comparePassword = function(password, done) {
    bcrypt.compare(password, this.password, function(err, isMatch) {
        done(err, isMatch);
    });
};

module.exports = mongoose.model('User', schema);


text:
using GAP, Hecke, Printf, ArgParse

include(joinpath(Hecke.pkgdir,"examples/FieldEnumeration.jl"))

###############################################################################
#
#  Read-Write
#
###############################################################################

function _write_fields(list::Vector{Tuple{AnticNumberField, fmpz}}, filename::String)
  f=open(filename, "a")
  for L in list
    x=([coeff(L[1].pol, i) for i=0:degree(L[1].pol)], L[2])
    Base.write(f, "$x\n")
  end
  close(f)
end

function _read_fields(filename::String)
  f=open(filename, "r")
  Qx,x=PolynomialRing(FlintQQ,"x")
  pols=Tuple{fmpq_poly, fmpz}[]
  for s in eachline(f)
    a=eval(parse(s))
    push!(pols,(Qx(a[1]), a[2]))
  end
  close(f)
  return pols
end

function parse_commandline()
  s = ArgParseSettings()

  @add_arg_table s begin
    "--order", "-o"
      help = "Order of the group"
      arg_type = Int
      default = -1
    "--id", "-i"
      help = "Id of the group"
      arg_type = Int
      default = -1
    "--number", "-n"
      help = "Number of the group"
      arg_type = Int
      default = -1
    "--tamely-ramified"
      help = "Only tamely ramified fields"
      action = :store_true
    "--only-real"
      help = "Only totally real fields"
      action = :store_true
    "--disc-bound"
      help = "Discriminant bound"
      arg_type = fmpz
      default = fmpz(-1)
  end

  return parse_args(s)
end

function main()
  parsed_args = parse_commandline()

  local grp_order::Int
  local grp_id::Int
  local dbound::fmpz
  local only_real::Bool
  local only_tame::Bool
  local grp_no::Int

  for (arg, val) in parsed_args
    println("$arg => $val")
    if arg == "order"
      grp_order = val
    elseif arg == "id"
      grp_id = val
    elseif arg == "disc-bound"
      dbound = val
    elseif arg == "only-real"
      only_real = val
    elseif arg == "tamely-ramified"
      only_tame = val
    elseif arg == "number"
      grp_no = val
    end
  end

  sprint_formatted(fmt, args...) = @eval @sprintf($fmt, $(args...))

  if grp_id != -1
    @assert grp_order != -1
    n = grp_order
    i = grp_id
    grp_no = findfirst(isequal((n, i)), small_solvable_groups)
  else
    @assert grp_no != -1
    n, i = small_solvable_groups[grp_no]
  end

  file = sprint_formatted("%0$(length(string(length(small_solvable_groups))))d", grp_no) * "-$n-$i."* "log"

  @show grp_order
  @show grp_id
  @show grp_no
  @show dbound
  @show only_real
  @show only_tame
  @show file

  if isfile(file)
    throw(error("File $file does already exist"))
  end

  println("========================================")
  println("Group: $grp_no: $n $i")
  println("========================================")

  if dbound == -1
    dbound = Hecke.lower_discriminant_bound(n, n)
  end

  dbound = 10 * dbound

  println("========================================")
  println("Discriminant bound: $dbound")
  println("========================================")

  set_verbose_level(:FieldsNonFancy, 1)

  l = []

  complex_fields = []
  real_fields = []
  all = []

  found_complex = false
  found_real = false

  if mod(n, 2) != 0
    found_complex = true
  end

  while true

    @show only_real

    l = fields(n, i, dbound, only_real = only_real)

    for v in l
      x = v.field
      if !found_complex
        if signature(x)[2] != 0
          push!(complex_fields, v)
        end
      end

      if !found_real
        if signature(x)[2] == 0
          push!(real_fields, v)
        end
      end
    end

    if !found_complex && length(complex_fields) > 0
      append!(all, complex_fields)
      found_complex = true
      println("== FOUND SOMETHING COMPLEX ==")
      empty!(complex_fields)
    end

    if !found_real && length(real_fields) > 0
      append!(all, real_fields)
      found_real = true
      println("== FOUND SOMETHING REAL ==")
      empty!(real_fields)
    end

    if found_complex
      if !found_real
        only_real = true
        println("== I AM IN ONLY_REAL = TRUE MODE ==")
      else
        println("== EXITING ==")
        break
      end
    end

    dbound = 100 * dbound
    println("========================================")
    println("Increasing discriminant bound: $dbound")
    println("========================================")
    println("only_real = $only_real")
    println("found_complex = $found_complex")
    println("found_real = $found_real")
  end

  l = all

  ll = map(v -> v.field, l)
  ffields = [ (x, discriminant(maximal_order(x))) for x in ll ]
  sort!(ffields, lt = (x, y) -> abs(x[2]) <= abs(y[2]))

  @show length(ffields)

  _write_fields(ffields, file)
end

main()


text:
/*
 * =====================================================================================
 *
 *       Filename:  ili9341_msp430_amperture.h
 *
 *        Version:  0.1
 *        Created:  09/09/2015 11:36:11 PM
 *       Revision:  none
 *       Compiler:  msp430-gcc
 *
 *         Author:  W. Alex Best (mn), theamp@gmail.com
 *        Company:  Amperture Engineering
 *
 * =====================================================================================
 */

#ifndef ILI9341_AMP_H
#define ILI9341_AMP_H

#include <msp430.h>
#include <stdint.h>

// Port & Pin Definitions
#define ILI9341_CS_PORT P1OUT
#define ILI9341_CS_PIN  BIT4

#define ILI9341_RESET_PORT P1OUT
#define ILI9341_RESET_PIN BIT3

#define ILI9341_DC_PORT P1OUT
#define ILI9341_DC_PIN BIT0

// Data/Command Macros
#define LCD_ENABLE_DATA ILI9341_DC_PORT |= ILI9341_DC_PIN
#define LCD_ENABLE_COMMAND ILI9341_DC_PORT &= ~ILI9341_DC_PIN

// Chip Select Macro
#define LCD_CHIP_SELECT ILI9341_CS_PORT |= ILI9341_CS_PIN
#define LCD_CHIP_DESELECT ILI9341_CS_PORT &= ~ILI9341_CS_PIN

// Function Prototypes
void lcdSendCommand(uint8_t);
void lcdSendData(uint8_t);

#endif // ILI9341_AMP_H

/* The MIT License (MIT)
 *
 * Copyright (c) 2015 Amperture Engineering
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */


text:
<?php

namespace Tests\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $table = 'test_users';

    protected $appends = ['full_name', 'position'];

    public function profile()
    {
        return $this->hasOne(Profile::class, 'user_id');
    }

    public function getFullNameAttribute()
    {
        return "{$this->profile->first_name} {$this->profile->last_name}";
    }

    public function getPositionAttribute()
    {
        return "{$this->profile->latitude} {$this->profile->longitude}";
    }

    public function tags()
    {
        return $this->belongsToMany(Tag::class, 'test_user_tags', 'user_id', 'tag_id');
    }
}


text:
'use strict';

//Install jQuery and Moment.js using npm or
//if using require.js manage the paths as you see fit

//Notes
//Could use ES6 promises (and polyfill)
//rather than jQuery

(function(root, factory) {
	if (typeof define === 'function' && define.amd) {
		// AMD. Register as an anonymous module.
		define(['moment', 'es6-promise'], function(moment) {
			return (root.ForecastIO = factory(moment));
		});
	} else if (typeof module === 'object' && module.exports) {
		// Node. Does not work with strict CommonJS, but
		// only CommonJS-like environments that support module.exports,
		// like Node.
		module.exports = (root.ForecastIO = factory(require('moment'), require('es6-promise').Promise));
	} else {
		// Browser globals (root is window)
		root.ForecastIO = factory(root.moment);
	}
}(this, function(moment) {

	/* 	By Ian Tearle
		github.com/iantearle

		Other contributors
		Richard Bultitude
		github.com/rjbultitude
		Brandon Love
		github.com/brandonlove
	*/

	//Error strings
	var fioServiceError = 'There was a problem accessing forecast.io. Make sure you have a valid key';

	//Forecast Class
	/**
	 * Will construct a new ForecastIO object
	 *
	 * @param string $config
	 * @return boolean
	 */
	function ForecastIO(config) {
		//var PROXY_SCRIPT = '/proxy.php';
		if (!config) {
			console.log('You must pass ForecastIO configurations');
		}
		if (!config.PROXY_SCRIPT) {
			if (!config.API_KEY) {
				console.log('API_KEY or PROXY_SCRIPT must be set in ForecastIO config');
			}
		}
		this.API_KEY = config.API_KEY;
		this.url = (typeof config.PROXY_SCRIPT !== 'undefined') ? config.PROXY_SCRIPT + '?url=': 'https://api.forecast.io/forecast/' + config.API_KEY + '/';
	}

	function makeRequest(method, url) {
		return new Promise(function(resolve, reject) {
			var xhr = new XMLHttpRequest();
			xhr.open(method, url);
			xhr.onload = function() {
				if (this.status >= 200 && this.status < 300) {
					resolve(xhr.response);
				} else {
					reject({
						status: this.status,
						statusText: xhr.statusText
					});
				}
			};
			xhr.onerror = function() {
				reject({
					status: this.status,
					statusText: xhr.statusText
				});
			};
			xhr.send();
		});
	}

	/**
	 * Checks the location object
	 * passed into the app
	 * and wraps it in an array
	 * if it wasn't one already
	 *
	 * @param object $locObject
	 * @return array
	 */
	function checkObject(locObject) {
		var locationsObjWrap = [];
		if (!Array.isArray(locObject)) {
			//console.log('locations was not an array');
			locationsObjWrap.push(locObject);
			return locationsObjWrap;
		}
		else {
			return locObject;
		}
	}

	/**
	 * Will build a url string from the lat long coords
	 * and return a promise with the json
	 *
	 * @param number $latitude
	 * @param number $longitude
	 * @return promise object
	 */
	ForecastIO.prototype.requestData = function requestData(latitude, longitude) {
		var requestUrl = this.url + latitude + ',' + longitude;
		return makeRequest('GET', requestUrl);
	};

	ForecastIO.prototype.requestAllLocData = function requestAllLocData(locations) {
		var locDataArr = [];
		for (var i = 0; i < locations.length; i++) {
			var content = this.requestData(locations[i].latitude, locations[i].longitude);
			locDataArr.push(content);
		}
		return locDataArr;
	};

	/**
	 * Will take a locations object and a callback function
	 * and pass the current conditions into the callback
	 *
	 * @param object $locations
	 * @param function $appFn
	 * @return boolean
	 */
	ForecastIO.prototype.getCurrentConditions = function getCurrentConditions(locations, appFn) {
		var locationsArr = checkObject(locations);
		var allLocDataArr = this.requestAllLocData(locationsArr);
		Promise.all(allLocDataArr).then(function(values) {
			if (values.length === 0 || values[0] === '' || values[0] === null || values[0] === undefined) {
				console.log(fioServiceError);
				return;
			}
			else {
				var dataSets = [];
				for (var i = 0; i < values.length; i++) {
						var jsonData = JSON.parse(values[i]);
						var currently = new ForecastIOConditions(jsonData.currently);
						dataSets.push(currently);
					}
				appFn(dataSets);
				return dataSets;
			}
		}, function(rejectObj) {
			console.log(rejectObj.status);
			console.log(rejectObj.statusText);
		});
	};

	/**
	 * Will take a locations object and a callback function
	 * and pass the conditions on hourly basis for today into the callback
	 *
	 * @param object $locations
	 * @param function $appFn
	 * @return boolean
	 */
	ForecastIO.prototype.getForecastToday = function getForecastToday(locations, appFn) {
		var locationsArr = checkObject(locations);
		var allLocDataArr = this.requestAllLocData(locationsArr);
		Promise.all(allLocDataArr).then(function(values) {
				if (values.length === 0 || values[0] === '' || values[0] === null || values[0] === undefined) {
					console.log(fioServiceError);
					return;
				}
				else {
					var dataSets = [];
					for (var i = 0; i < values.length; i++) {
						var today = moment().format('YYYY-MM-DD');
						var jsonData = JSON.parse(values[i]);
						for (var j = 0; j < jsonData.hourly.data.length; j++) {
							var hourlyData = jsonData.hourly.data[j];
							if (moment.unix(hourlyData.time).format('YYYY-MM-DD') === today) {
								dataSets.push(new ForecastIOConditions(hourlyData));
							}
						}
					}
					appFn(dataSets);
					return dataSets;
				}
			}, function(rejectObj) {
				console.log(rejectObj.status);
				console.log(rejectObj.statusText);
		});
	};

	/**
	 * Will take a locations object and a callback function
	 * and pass the daily conditions for next seven days into the callback
	 *
	 * @param object $locations
	 * @param function $appFn
	 * @return boolean
	 */
	ForecastIO.prototype.getForecastWeek = function getForecastWeek(locations, appFn) {
		var locationsArr = checkObject(locations);
		var allLocDataArr = this.requestAllLocData(locationsArr);
		Promise.all(allLocDataArr).then(function(values) {
				if (values.length === 0 || values[0] === '' || values[0] === null || values[0] === undefined) {
					console.log(fioServiceError);
					return;
				}
				else {
					var dataSets = [];
					for (var i = 0; i < values.length; i++) {
						var jsonData = JSON.parse(values[i]);
						for (var j = 0; j < jsonData.daily.data.length; j++) {
							var dailyData = jsonData.daily.data[j];
							dataSets.push(new ForecastIOConditions(dailyData));
						}
					}
					appFn(dataSets);
					return dataSets;
				}
			}, function(rejectObj) {
				console.log(rejectObj.status);
				console.log(rejectObj.statusText);
		});
	};

	function ForecastIOConditions(rawData) {
		ForecastIOConditions.prototype = {
			rawData: rawData
		};
		/**
		 * Will return the temperature
		 *
		 * @return String
		 */
		this.getTemperature = function() {
			return rawData.temperature;
		};
		/**
		 * Will return the apparent temperature
		 *
		 * @return String
		 */
		this.getApparentTemperature = function() {
			return rawData.apparentTemperature;
		};
		/**
		 * Get the summary of the conditions
		 *
		 * @return String
		 */
		this.getSummary = function() {
			return rawData.summary;
		};
		/**
		 * Get the icon of the conditions
		 *
		 * @return String
		 */
		this.getIcon = function() {
			return rawData.icon;
		};
		/**
		 * Get the time, when $format not set timestamp else formatted time
		 *
		 * @param String $format
		 * @return String
		 */
		this.getTime = function(format) {
			if (!format) {
				return rawData.time;
			} else {
				return moment.unix(rawData.time).format(format);
			}
		};
		/**
		 * Get the pressure
		 *
		 * @return String
		 */
		this.getPressure = function() {
			return rawData.pressure;
		};
		/**
		 * get humidity
		 *
		 * @return String
		 */
		this.getHumidity = function() {
			return rawData.humidity;
		};
		/**
		 * Get the wind speed
		 *
		 * @return String
		 */
		this.getWindSpeed = function() {
			return rawData.windSpeed;
		};
		/**
		 * Get wind direction
		 *
		 * @return type
		 */
		this.getWindBearing = function() {
			return rawData.windBearing;
		};
		/**
		 * get precipitation type
		 *
		 * @return type
		 */
		this.getPrecipitationType = function() {
			return rawData.precipType;
		};
		/**
		 * get the probability 0..1 of precipitation type
		 *
		 * @return type
		 */
		this.getPrecipitationProbability = function() {
			return rawData.precipProbability;
		};
		/**
		 * Get the cloud cover
		 *
		 * @return type
		 */
		this.getCloudCover = function() {
			return rawData.cloudCover;
		};
		/**
		 * get the min temperature
		 *
		 * only available for week forecast
		 *
		 * @return type
		 */
		this.getMinTemperature = function() {
			return rawData.temperatureMin;
		};
		/**
		 * get max temperature
		 *
		 * only available for week forecast
		 *
		 * @return type
		 */
		this.getMaxTemperature = function() {
			return rawData.temperatureMax;
		};
		/**
		 * get sunrise time
		 *
		 * only available for week forecast
		 *
		 * @return type
		 */
		this.getSunrise = function() {
			return rawData.sunriseTime;
		};
		/**
		 * get sunset time
		 *
		 * only available for week forecast
		 *
		 * @return type
		 */
		this.getSunset = function() {
			return rawData.sunsetTime;
		};
		/**
		 * get precipitation intensity
		 *
		 * @return number
		 */
		this.getPrecipIntensity = function() {
			return rawData.precipIntensity;
		};
		/**
		 * get dew point
		 *
		 * @return number
		 */
		this.getDewPoint = function() {
			return rawData.dewPoint;
		};
		/**
		 * get the ozone
		 *
		 * @return number
		 */
		this.getOzone = function() {
			return rawData.ozone;
		};
	}

	return ForecastIO;
}));


text:
class Solution:
    def reverseOnlyLetters(self, S: str) -> str:
        result = list(S)
        start = 0
        end = len(S) - 1
        while start < end:
            while start < end and not result[start].isalpha():
                start += 1
            while start < end and not result[end].isalpha():
                end -= 1
            if start < end:
                result[start], result[end] = result[end], result[start]
                start += 1
                end -= 1
        return ''.join(result)


text:
package org.apache.commons.math3.ml.neuralnet;

/**
 * Defines neighbourhood types.
 *
 * @version $Id: SquareNeighbourhood.java 1566092 2014-02-08 18:48:29Z tn $
 * @since 3.3
 */
public enum SquareNeighbourhood {
    /**
     * <a href="http://en.wikipedia.org/wiki/Von_Neumann_neighborhood"
     *  Von Neumann neighbourhood: in two dimensions, each (internal)
     * neuron has four neighbours.
     */
    VON_NEUMANN,
    /**
     * <a href="http://en.wikipedia.org/wiki/Moore_neighborhood"
     *  Moore neighbourhood: in two dimensions, each (internal)
     * neuron has eight neighbours.
     */
    MOORE,
}


text:
package demo.Planets;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import rajawali.RajawaliFragment;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: marshal
 * Date: 13-9-5
 * Time: 下午8:37
 * To change this template use File | Settings | File Templates.
 */
public class PlanetsFragment extends RajawaliFragment {

    private static Map<String, MapItem> typeMap = new HashMap<String, MapItem>();

    private static class MapItem {
        public int surface, normal;

        public MapItem(int surface, int normal) {
            this.surface = surface;
            this.normal = normal;
        }
    }

    static {
        typeMap.put("earth", new MapItem(R.drawable.earth_surface, R.drawable.earth_normal));
        typeMap.put("mars", new MapItem(R.drawable.mars_surface, R.drawable.mars_normal));
    }

    private PlanetsRenderer renderer;

    private MapItem mapItem;

    public PlanetsFragment(String type) {
        this.mapItem=typeMap.get(type);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        renderer = new PlanetsRenderer(this.getActivity());
        renderer.setSurfaceView(mSurfaceView);
        renderer.setMap(mapItem.surface,mapItem.normal);
        setRenderer(renderer);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mLayout = (FrameLayout) inflater.inflate(R.layout.planets,
                container, false);
        mLayout.addView(mSurfaceView);

        return mLayout;
    }

    @Override
    public void onDestroy() {
        try {
            super.onDestroy();
        } catch (Exception e) {
        }
        renderer.onSurfaceDestroyed();
    }
}


text: Android App for help in workout


text:
\hypertarget{class_streamable_in_global}{}\section{Streamable\+In\+Global Class Reference}
\label{class_streamable_in_global}\index{Streamable\+In\+Global@{Streamable\+In\+Global}}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
virtual \hyperlink{class_streamable_in_global_a20cd7676e22a7a8bbad17c42681d46bf}{$\sim$\+Streamable\+In\+Global} ()
\end{DoxyCompactItemize}

\subsection{Detailed Description}

Definition at line 113 of file gtest-\/printers\+\_\+test.\+cc.

\subsection{Constructor \& Destructor Documentation}
\index{Streamable\+In\+Global@{Streamable\+In\+Global}!````~Streamable\+In\+Global@{$\sim$\+Streamable\+In\+Global}}
\index{````~Streamable\+In\+Global@{$\sim$\+Streamable\+In\+Global}!Streamable\+In\+Global@{Streamable\+In\+Global}}
\subsubsection[{\texorpdfstring{$\sim$\+Streamable\+In\+Global()}{~StreamableInGlobal()}}]{\setlength{\rightskip}{0pt plus 5cm}virtual Streamable\+In\+Global\+::$\sim$\+Streamable\+In\+Global (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}\hypertarget{class_streamable_in_global_a20cd7676e22a7a8bbad17c42681d46bf}{}\label{class_streamable_in_global_a20cd7676e22a7a8bbad17c42681d46bf}

Definition at line 115 of file gtest-\/printers\+\_\+test.\+cc.

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
/home/bhargavi/\+Documents/\+S\+D\+R/\+Copy\+\_\+\+Exam\+\_\+808\+X/vendor/googletest/googletest/test/\hyperlink{gtest-printers__test_8cc}{gtest-\/printers\+\_\+test.\+cc}\end{DoxyCompactItemize}


text:
<!DOCTYPE html>

        <link href='http://fonts.googleapis.com/css?family=Belleza' rel='stylesheet' type='text/css'>
        <link href='/style/style.css' rel='stylesheet' type='text/css'>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="Content-Language" content="da">
        <title>Er det kaffetid???</title>

Fejl

Der mangler at blive indtastet en Google Maps API nøgle.

Hvis du endnu ikke har en sådan, så kig her.

 Copyright 2012-<?php print date('Y');?> © Jesper Skytte Hansen - Info