text:
"use strict";

describe("Flow To Sequence execution testing", function() {

	var provider;
	var eventName = 'TestEvent';
	var command2Executed = false;
	var command3Executed = false;

	beforeEach(function() {

		command2Executed = false;
		commangular.reset();
		commangular.create('Command1', function() {

			return {

				execute: function() {

					return true;
				}
			};
		},{resultKey:'result1'});

		commangular.create('Command2', function() {

			return {

				execute: function() {

					command2Executed = true;
				}
			};
		});

		commangular.create('Command3', function() {

			return {

				execute: function($log) {

					$log.log('logging');
					command3Executed = true;
				}
			};
		});
	});

	beforeEach(function() {

		module('commangular', function($commangularProvider) {

			provider = $commangularProvider;

		});
		inject();
	});

	it('command 2 and 3 should be executed', function() {

		var commandComplete = false;
		var sequence = provider.asSequence().add('Command2');
		provider.mapTo(eventName)
			.asSequence()
				.add('Command1')
				.add(provider.asFlow()
						.link('result1 == true').to(
							provider.asSequence()
								.add('Command2')
								.add('Command3')));

		dispatch({event:eventName},function(){

			expect(command2Executed).toBe(true);
			expect(command3Executed).toBe(true);
		});
	});
});


text:
package com.thoughtworks.selenium;

import junit.framework.TestCase;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.server.browserlaunchers.BrowserOptions;

public class BrowserConfigurationOptionsTest extends TestCase {

	public void testCanUseWithValidArg() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
		assertTrue(bco.canUse("foobar"));
	}

	public void testCanUseWithNullArg() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
		assertFalse(bco.canUse(null));
	}

	public void testCanUseWithEmptyArg() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
		assertFalse(bco.canUse(""));
	}

	public void testSetProfileWithNullDoesNotSet() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setProfile(null);
		assertFalse(bco.isSet(BrowserConfigurationOptions.PROFILE_NAME));
	}

	public void testSetProfileWithNonNullDoesSet() {
		String profile = "foo";
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setProfile(profile);
		assertTrue(bco.isSet(BrowserConfigurationOptions.PROFILE_NAME));
		assertEquals(profile, bco.getProfile());
	}

	public void testSetSingleWindow() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setSingleWindow();
		assertTrue(bco.isSingleWindow());
		assertTrue(bco.isSet(BrowserConfigurationOptions.SINGLE_WINDOW));
	}

	public void testSetSingleWindowWhenMultiWindowWasAlreadySet() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setMultiWindow().setSingleWindow();
		assertTrue(bco.isSingleWindow());
		assertFalse(bco.isMultiWindow());
		assertTrue(bco.isSet(BrowserConfigurationOptions.SINGLE_WINDOW));
	}

	public void testSetMultiWindow() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setMultiWindow();
		assertTrue(bco.isMultiWindow());
		assertTrue(bco.isSet(BrowserConfigurationOptions.MULTI_WINDOW));
	}

	public void testSetMultiWindowWhenSingleWindowWasAlreadySet() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setSingleWindow().setMultiWindow();
		assertTrue(bco.isMultiWindow());
		assertFalse(bco.isSingleWindow());
		assertTrue(bco.isSet(BrowserConfigurationOptions.MULTI_WINDOW));
	}

	public void testSetBrowserExecutablePathWithNullPath() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setBrowserExecutablePath(null);
		assertFalse(bco.isSet(BrowserConfigurationOptions.BROWSER_EXECUTABLE_PATH));
	}

	public void testSetBrowserExcecutablePathWithValidPath() {
		String path = "c:\\chrome\\is\\cool.exe with_arg";
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setBrowserExecutablePath(path);
		assertTrue(bco.isSet(BrowserConfigurationOptions.BROWSER_EXECUTABLE_PATH));
		assertEquals(path, bco.getBrowserExecutablePath());
	}

	public void testSetTimeoutInSeconds() {
		int timeout = 17;
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setTimeoutInSeconds(timeout);
		assertTrue(bco.isSet(BrowserConfigurationOptions.TIMEOUT_IN_SECONDS));
		assertEquals(timeout, bco.getTimeoutInSeconds());
	}

	public void testGetTimeoutWhenNoneSet() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
		assertEquals(BrowserConfigurationOptions.DEFAULT_TIMEOUT_IN_SECONDS, bco.getTimeoutInSeconds());
	}

	public void testBrowserModeWithNullMode() {
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setBrowserMode(null);
		assertFalse(bco.isSet(BrowserConfigurationOptions.BROWSER_MODE));
	}

	public void testBrowserModeWithNonNullMode() {
		String mode = "hta";
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions().setBrowserMode(mode);
		assertTrue(bco.isSet(BrowserConfigurationOptions.BROWSER_MODE));
		assertEquals(mode, bco.getBrowserMode());
	}

	public void testServerOptionsCanLoadClientOptions() {
		String profile = "foo";
		String execPath = "c:\\simon stewart\\likes\\cheese";
		BrowserConfigurationOptions bco = new BrowserConfigurationOptions()
			.setSingleWindow()
			.setProfile(profile)
			.setBrowserExecutablePath(execPath);
		Capabilities serverOptions = BrowserOptions.newBrowserOptions(bco.toString());
    assertEquals(profile, BrowserOptions.getProfile(serverOptions));
    assertEquals(execPath, BrowserOptions.getExecutablePath(serverOptions));
		assertTrue(BrowserOptions.isSingleWindow(serverOptions));
	}

}

redpajama_set_name: RedPajamaGithub


text: Título de Propiedad


text:
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/scripts/app-bootstrap-systemjs.js"></script>
    </head>
    <body></body>
</html>


text:
package org.home.whatsfordinner.service.ingredient;

import org.home.whatsfordinner.domain.ingredient.IngredientUnit;
import org.home.whatsfordinner.helper.ingredient.IngredientUnitHelper;
import org.home.whatsfordinner.repository.ingredient.IngredientUnitRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityNotFoundException;
import java.util.List;

@Service
public class IngredientUnitService {

    @Autowired
    private IngredientUnitRepository ingredientUnitRepository;

    /**
     * Return the ingredientUnit with the given id or {@literal null} if none found
     *
     * @param id
     * @return the ingredientUnit with the given id or {@literal null} if none found
     */
    public IngredientUnit getIngredientUnit(final Long id) {
        return ingredientUnitRepository.findOne(id);
    }

    /**
     * Get all the ingredientsUnits
     *
     * @return list of all the ingredientsUnits
     */
    public List<IngredientUnit> getAllIngredientUnits() {
        return ingredientUnitRepository.findAll();
    }

    /**
     * Save the ingredientUnit and flushes changes instantly.
     *
     * @param ingredientUnit
     * @return the saved ingredientUnit
     */
    public IngredientUnit saveIngredientUnit(final IngredientUnit ingredientUnit) {
        return ingredientUnitRepository.saveAndFlush(ingredientUnit);
    }

    /**
     * Update the ingredientUnit with id with the data from the newIngredientUnit
     *
     * @param id                   the id of the ingredientUnit that needs to be updated
     * @param newIngredientUnit    the ingredientUnit containing the new data
     * @return the updated ingredientUnit
     * @throws EntityNotFoundException when the ingredientUnit with id is not found
     */
    public IngredientUnit updateIngredientUnit(final Long id, final IngredientUnit newIngredientUnit) {
        final IngredientUnit ingredientUnit = getIngredientUnit(id);
        if (ingredientUnit == null) {
            throw new EntityNotFoundException("Entity with id " + id + " was not found.");
        }
        final IngredientUnit updatedIngredientUnit = IngredientUnitHelper.updateIngredientUnit(ingredientUnit, newIngredientUnit);
        return ingredientUnitRepository.saveAndFlush(updatedIngredientUnit);
    }

}


text:
namespace WebApiSeed.Infrastructure.Mappings
{
    using System;
    using System.Configuration;
    using AutoMapper;
    using Common.Extensions;
    using Data.Domain;
    using Dtos;
    using IObjectMapper = Automapper.IObjectMapper;

    /// <summary>
    ///     User mappers
    /// </summary>
    public class UserMapper : Profile
    {
        /// <summary>
        ///     Apply mappings
        /// </summary>
        public UserMapper()
        {
            CreateMap<User, UserDto>();
            CreateMap<UserDto, User>();
        }
    }
}


text:
namespace Lucene.Net.Util.Mutable
{
    /// <summary>
    /// <seealso cref="MutableValue"/> implementation of type
    /// <seealso cref="String"/>.
    /// </summary>
    public class MutableValueStr : MutableValue
    {
        public BytesRef Value = new BytesRef();

        public override object ToObject()
        {
            return Exists ? Value.Utf8ToString() : null;
        }

        public override void Copy(MutableValue source)
        {
            MutableValueStr s = (MutableValueStr)source;
            Exists = s.Exists;
            Value.CopyBytes(s.Value);
        }

        public override MutableValue Duplicate()
        {
            MutableValueStr v = new MutableValueStr();
            v.Value.CopyBytes(Value);
            v.Exists = this.Exists;
            return v;
        }

        public override bool EqualsSameType(object other)
        {
            MutableValueStr b = (MutableValueStr)other;
            return Value.Equals(b.Value) && Exists == b.Exists;
        }

        public override int CompareSameType(object other)
        {
            MutableValueStr b = (MutableValueStr)other;
            int c = Value.CompareTo(b.Value);
            if (c != 0)
            {
                return c;
            }
            if (Exists == b.Exists)
            {
                return 0;
            }
            return Exists ? 1 : -1;
        }

        public override int GetHashCode()
        {
            return Value.GetHashCode();
        }
    }
}


text:
package treeton.core.util.combinator;

import treeton.core.util.AbsoluteTime;

public abstract class AbstractEntry<T> implements Entry<T> {
    private int id;
    private T object;
    private AbstractEntry<T> left;
    private AbstractEntry<T> right;
    private AbstractEntry<T> parent;
    private boolean color;
    private int creationTime;
    private int index;
    private Entry<T> successor;
    private Entry<T> predecessor;

    public AbstractEntry(T object, int id, Entry<T> parent) {
        this.object = object;
        this.id = id;
        this.parent = (AbstractEntry<T>) parent;

        creationTime = AbsoluteTime.tick();
    }

    public int getId() {
        return id;
    }

    private void appendIndent(StringBuffer buf, int indent) {
        while (indent-- > 0) {
            buf.append(" ");
        }
    }

    public void append(StringBuffer buf, int indent) {
        appendIndent(buf, indent);
        buf.append(id);
        buf.append(": ");
        buf.append(object);
        buf.append("\n");
        appendIndent(buf, indent);
        buf.append("left ");
        if (left != null) {
            buf.append("(\n");
            left.append(buf, indent + 1);
            appendIndent(buf, indent);
            buf.append(")\n");
        } else {
            buf.append("()\n");
        }
        appendIndent(buf, indent);
        buf.append("right ");
        if (right != null) {
            buf.append("(\n");
            right.append(buf, indent + 1);
            appendIndent(buf, indent);
            buf.append(")\n");
        } else {
            buf.append("()\n");
        }
    }

    public int getCreationTime() {
        return creationTime;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public T getObject() {
        return object;
    }

    public String toString() {
        return id + " : " + object;
    }

    public Entry<T> getLeft() {
        return left;
    }

    public void setLeft(Entry<T> left) {
        this.left = (AbstractEntry<T>) left;
    }

    public Entry<T> getRight() {
        return right;
    }

    public void setRight(Entry<T> right) {
        this.right = (AbstractEntry<T>) right;
    }

    public Entry<T> getParent() {
        return parent;
    }

    public void setParent(Entry<T> parent) {
        this.parent = (AbstractEntry<T>) parent;
    }

    public Entry<T> getSuccessor() {
        return successor;
    }

    public void setSuccessor(Entry<T> successor) {
        this.successor = successor;
    }

    public Entry<T> getPredecessor() {
        return predecessor;
    }

    public void setPredecessor(Entry<T> predecessor) {
        this.predecessor = predecessor;
    }

    public boolean isColor() {
        return color;
    }

    public void setColor(boolean color) {
        this.color = color;
    }
}


text:
import Component from '@glimmer/component';
import EmailPreviewModal from './modals/email-preview';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';

export default class GhEmailPreviewLink extends Component {
    @service modals;

    @action
    openPreview(event) {
        event.preventDefault();
        return this.modals.open(EmailPreviewModal, this.args.data);
    }
}


text:
import React, { Component } from 'react'
import { Link } from 'react-router-dom'

class SidebarMenu extends Component {
    render() {
        return (

Navigation

<Link to="/"> Home</Link>

                {/*
 Another Link
*/}

                     Company

<Link to="/company/list">List All Companies</Link>

<Link to="/company/add">Add New Company</Link>

                     Staff

<Link to="/staff/list">List All Staff</Link>

<Link to="/staff/add">Add New Staff</Link>

                     Belonging

List All Belongings

Add New Belonging

                     Multilevel

Link in level 2

Link in level 2

        )
    }
}

export default SidebarMenu


text:
namespace os {

// Creates a temporary directory using the specified path
// template. The template may be any path with _6_ `Xs' appended to
// it, for example /tmp/temp.XXXXXX. The trailing `Xs' are replaced
// with a unique alphanumeric combination.
inline Try<std::string> mkdtemp(const std::string& path = "/tmp/XXXXXX")
{
  char* temp = new char[path.size() + 1];
  if (::mkdtemp(::strcpy(temp, path.c_str())) != NULL) {
    std::string result(temp);
    delete[] temp;
    return result;
  } else {
    delete[] temp;
    return ErrnoError();
  }
}

} // namespace os {

#endif // __STOUT_OS_POSIX_MKDTEMP_HPP__


text:
import os
from collections import namedtuple

Request = namedtuple('Request', 'id proxy_id function args kwargs')
Response = namedtuple('Response', 'id exception return_value')
ProxyHandle = namedtuple('ProxyHandle', 'id obj_type exposed')
DispatcherState = namedtuple('DispatcherState', 'state')

def generate_id(obj=None):
    if obj and hasattr(obj, 'id'):
        return obj.id
    return os.urandom(32)   # 256bit random numbers


text:
from __future__ import print_function

import aerospike
import sys

from optparse import OptionParser

##########################################################################
# Options Parsing
##########################################################################

usage = "usage: %prog [options] key bin_names"

optparser = OptionParser(usage=usage, add_help_option=False)

optparser.add_option(
    "--help", dest="help", action="store_true",
    help="Displays this message.")

optparser.add_option(
    "-U", "--username", dest="username", type="string", metavar="<USERNAME>",
    help="Username to connect to database.")

optparser.add_option(
    "-P", "--password", dest="password", type="string", metavar="<PASSWORD>",
    help="Password to connect to database.")

optparser.add_option(
    "-h", "--host", dest="host", type="string", default="127.0.0.1", metavar="<ADDRESS>",
    help="Address of Aerospike server.")

optparser.add_option(
    "-p", "--port", dest="port", type="int", default=3000, metavar="<PORT>",
    help="Port of the Aerospike server.")

optparser.add_option(
    "-n", "--namespace", dest="namespace", type="string", default="test", metavar="<NS>",
    help="Port of the Aerospike server.")

optparser.add_option(
    "-s", "--set", dest="set", type="string", default="demo", metavar="<SET>",
    help="Port of the Aerospike server.")

(options, args) = optparser.parse_args()

if options.help:
    optparser.print_help()
    print()
    sys.exit(1)

if len(args) < 2:
    optparser.print_help()
    print()
    sys.exit(1)

##########################################################################
# Client Configuration
##########################################################################

config = {
    'hosts': [(options.host, options.port)]
}

##########################################################################
# Application
##########################################################################

exitCode = 0

try:

    # ----------------------------------------------------------------------------
    # Connect to Cluster
    # ----------------------------------------------------------------------------

    client = aerospike.client(config).connect(
        options.username, options.password)

    # ----------------------------------------------------------------------------
    # Perform Operation
    # ----------------------------------------------------------------------------

    try:

        namespace = options.namespace if options.namespace and options.namespace != 'None' else None
        set = options.set if options.set and options.set != 'None' else None

        pk = args.pop(0)
        bin_names = args
        status = client.remove_bin((namespace, set, pk), bin_names)
        print("Status of bin removal is: %d" % (status))
        print("OK, bins removed from the record at", (namespace, set, pk))

    except Exception as exception:
        if exception.code == 602:
            print("error: Record not found")
        else:
            print("error: {0}".format(
                (exception.code, exception.msg, file, exception.line)), file=sys.stderr)
            rc = 1

    # ----------------------------------------------------------------------------
    # Close Connection to Cluster
    # ----------------------------------------------------------------------------

    client.close()

except Exception as eargs:
    print("error: {0}".format(eargs), file=sys.stderr)
    exitCode = 3

##########################################################################
# Exit
##########################################################################

sys.exit(exitCode)


text:
#import <Foundation/Foundation.h>

#import "YapDatabaseExtension.h"
#import "YapDatabaseExtensionConnection.h"
#import "YapDatabaseExtensionTransaction.h"

#import "YapDatabase.h"
#import "YapDatabaseConnection.h"
#import "YapDatabaseTransaction.h"

#import "YapCollectionKey.h"

#ifdef SQLITE_HAS_CODEC
  #import <SQLCipher/sqlite3.h>
#else
  #import "sqlite3.h"
#endif

typedef NS_OPTIONS(NSUInteger, YapDatabaseConnectionFlushMemoryFlags_Extension) {
//	YapDatabaseConnectionFlushMemoryFlags_None       = 0,
//	YapDatabaseConnectionFlushMemoryFlags_Caches     = 1 << 0,
//	YapDatabaseConnectionFlushMemoryFlags_Statements = 1 << 1,
//	YapDatabaseConnectionFlushMemoryFlags_Internal   = 1 << 2,
//	YapDatabaseConnectionFlushMemoryFlags_All        = (YapDatabaseConnectionFlushMemoryFlags_Caches     |
//																		 YapDatabaseConnectionFlushMemoryFlags_Statements |
//																		 YapDatabaseConnectionFlushMemoryFlags_Internal   ),

	/**
	 * Some extensions may store certain "state" information that was read from the database
	 * when the extension was being prepared for use. This state information is expected to be
	 * in-sync with what's on disk.
	 *
	 * However, when multiple processes are writing to the database,
	 * there may be scenarios where the changeset from process A doesn't get propogated to process B.
	 * If this happens, the `_flushMemoryWithFlags` method is invoked,
	 * and this flag is passed to warn the extension that it's cached state may be invalid.
	 */
	YapDatabaseConnectionFlushMemoryFlags_Extension_State = 1 << 3,
};

@interface YapDatabaseExtension ()

/**
 * See YapDatabaseExtension.m for discussion of these methods.
 */

+ (void)dropTablesForRegisteredName:(NSString *)registeredName
                    withTransaction:(YapDatabaseReadWriteTransaction *)transaction
                      wasPersistent:(BOOL)wasPersistent;

+ (NSArray *)previousClassNames;

@property (atomic, copy, readwrite) NSString *registeredName;
@property (atomic, weak, readwrite) YapDatabase *registeredDatabase;

- (NSSet *)dependencies;
- (BOOL)isPersistent;

- (BOOL)supportsDatabaseWithRegisteredExtensions:(NSDictionary<NSString*, YapDatabaseExtension*> *)registeredExtensions;
- (void)didRegisterExtension;

- (YapDatabaseExtensionConnection *)newConnection:(YapDatabaseConnection *)databaseConnection;

- (void)processChangeset:(NSDictionary *)changeset;
- (void)noteCommittedChangeset:(NSDictionary *)changeset registeredName:(NSString *)extName;

@end

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

@interface YapDatabaseExtensionConnection ()

/**
 * See YapDatabaseExtensionConnection.m for discussion of these methods
 */

- (YapDatabaseExtension *)extension;

- (id)newReadTransaction:(YapDatabaseReadTransaction *)databaseTransaction;
- (id)newReadWriteTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction;

- (void)_flushMemoryWithFlags:(YapDatabaseConnectionFlushMemoryFlags)flags;

- (void)getInternalChangeset:(NSMutableDictionary **)internalPtr
           externalChangeset:(NSMutableDictionary **)externalPtr
              hasDiskChanges:(BOOL *)hasDiskChangesPtr;

- (void)processChangeset:(NSDictionary *)changeset;
- (void)noteCommittedChangeset:(NSDictionary *)changeset registeredName:(NSString *)registeredName;

@end

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

@interface YapDatabaseExtensionTransaction ()

/**
 * See YapDatabaseExtensionTransaction.m for discussion of these methods
 */

- (YapDatabaseExtensionConnection *)extensionConnection;
- (YapDatabaseReadTransaction *)databaseTransaction;

- (BOOL)createIfNeeded;
- (BOOL)prepareIfNeeded;

- (BOOL)flushPendingChangesToMainDatabaseTable;
- (void)flushPendingChangesToExtensionTables;

- (void)didCommitTransaction;
- (void)didRollbackTransaction;

#pragma mark Hooks

/**
 * See YapDatabaseExtensionTransaction.m for discussion of these methods
 */

- (void)didInsertObject:(id)object
       forCollectionKey:(YapCollectionKey *)collectionKey
           withMetadata:(id)metadata
                  rowid:(int64_t)rowid;

- (void)didUpdateObject:(id)object
       forCollectionKey:(YapCollectionKey *)collectionKey
           withMetadata:(id)metadata
                  rowid:(int64_t)rowid;

- (void)didReplaceObject:(id)object
        forCollectionKey:(YapCollectionKey *)collectionKey
               withRowid:(int64_t)rowid;

- (void)didReplaceMetadata:(id)metadata
          forCollectionKey:(YapCollectionKey *)collectionKey
                 withRowid:(int64_t)rowid;

- (void)didTouchObjectForCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid;
- (void)didTouchMetadataForCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid;
- (void)didTouchRowForCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid;

- (void)didRemoveObjectForCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid;

- (void)didRemoveObjectsForKeys:(NSArray *)keys inCollection:(NSString *)collection withRowids:(NSArray *)rowids;

- (void)didRemoveAllObjectsInAllCollections;

// Pre-op versions

- (void)willInsertObject:(id)object
        forCollectionKey:(YapCollectionKey *)collectionKey
            withMetadata:(id)metadata;

- (void)willUpdateObject:(id)object
        forCollectionKey:(YapCollectionKey *)collectionKey
            withMetadata:(id)metadata
                   rowid:(int64_t)rowid;

- (void)willReplaceObject:(id)object
         forCollectionKey:(YapCollectionKey *)collectionKey
                withRowid:(int64_t)rowid;

- (void)willReplaceMetadata:(id)metadata
           forCollectionKey:(YapCollectionKey *)collectionKey
                  withRowid:(int64_t)rowid;

- (void)willRemoveObjectForCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid;

- (void)willRemoveObjectsForKeys:(NSArray *)keys inCollection:(NSString *)collection withRowids:(NSArray *)rowids;

- (void)willRemoveAllObjectsInAllCollections;

#pragma mark Configuration Values

/**
 * See YapDatabaseExtensionTransaction.m for discussion of these methods
 */

- (BOOL)getBoolValue:(BOOL *)valuePtr forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (BOOL)boolValueForExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (void)setBoolValue:(BOOL)value forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;

- (BOOL)getIntValue:(int *)valuePtr forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (int)intValueForExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (void)setIntValue:(int)value forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;

- (BOOL)getDoubleValue:(double *)valuePtr forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (double)doubleValueForExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (void)setDoubleValue:(double)value forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;

- (NSString *)stringValueForExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (void)setStringValue:(NSString *)value forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;

- (NSData *)dataValueForExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;
- (void)setDataValue:(NSData *)value forExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;

- (void)removeValueForExtensionKey:(NSString *)key persistent:(BOOL)inDatabaseOrMemoryTable;

@end


text:
<template name="Header">

        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-nav">
          Toggle navigation

        </button>
        Textbook Mania

              Students

              ...

              Textbooks

              ...

              Buy Orders

              ...

              Sell Orders

              ...

Matches

Help

</template>


text:
// Packages necessary library files for in-browser usage.

var fs = require("fs");

var out = [
  "/**",
  " * Bundled library components for in-browser usage.",
  " * @module assemblyscript/library",
  " */",
  ""
];
out.push(
  "/** AssemblyScript version. */",
  "export const version: string = " + JSON.stringify(require("../package.json").version) + ";",
  ""
);

var files = {};
[
  "assembly.d.ts", // must be first
  "std/array.ts",
  "std/string.ts",
  "std/console.ts",
].forEach(file => {
  files[file] = fs.readFileSync(__dirname + "/../" + file).toString().replace(/\r?\n/g, "\n");
});
out.push(
  "/** Library sources for in-browser usage. */",
  "export const files: { [key: string]: string } = " + JSON.stringify(files, null, 2) + ";",
  ""
);

var runtimeBlob;
try {
  runtimeBlob = fs.readFileSync(__dirname + "/../lib/runtime/dist/runtime.wasm").toString("base64");
} catch (e) {
  console.error("Runtime submodule (lib/runtime) has not been built. Reusing existing binary instead.");
  var libSource = fs.readFileSync(__dirname + "/../src/library.ts").toString();
  var match = /const runtime: string = "([a-zA-Z0-9\+\/]+[=]*)/.exec(libSource);
  if (!match)
    throw Error("failed to parse library.ts");
  runtimeBlob = match[1];
}
out.push(
  "/** Precompiled memory management runtime as a base64-encoded string. */",
  "export const runtime: string = " + JSON.stringify(runtimeBlob) + ";",
  ""
);

fs.writeFileSync(__dirname + "/../src/library.ts", out.join("\n"), "utf8");


text:
#pragma once
#include <aws/connect/Connect_EXPORTS.h>
#include <aws/connect/model/ClaimedPhoneNumberSummary.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace Connect
{
namespace Model
{
  class AWS_CONNECT_API DescribePhoneNumberResult
  {
  public:
    DescribePhoneNumberResult();
    DescribePhoneNumberResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    DescribePhoneNumberResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
Information about a phone number that's been claimed to your Amazon Connect
     * instance.

     */
    inline const ClaimedPhoneNumberSummary& GetClaimedPhoneNumberSummary() const{ return m_claimedPhoneNumberSummary; }

    /**
     *
Information about a phone number that's been claimed to your Amazon Connect
     * instance.

     */
    inline void SetClaimedPhoneNumberSummary(const ClaimedPhoneNumberSummary& value) { m_claimedPhoneNumberSummary = value; }

    /**
     *
Information about a phone number that's been claimed to your Amazon Connect
     * instance.

     */
    inline void SetClaimedPhoneNumberSummary(ClaimedPhoneNumberSummary&& value) { m_claimedPhoneNumberSummary = std::move(value); }

    /**
     *
Information about a phone number that's been claimed to your Amazon Connect
     * instance.

     */
    inline DescribePhoneNumberResult& WithClaimedPhoneNumberSummary(const ClaimedPhoneNumberSummary& value) { SetClaimedPhoneNumberSummary(value); return *this;}

    /**
     *
Information about a phone number that's been claimed to your Amazon Connect
     * instance.

     */
    inline DescribePhoneNumberResult& WithClaimedPhoneNumberSummary(ClaimedPhoneNumberSummary&& value) { SetClaimedPhoneNumberSummary(std::move(value)); return *this;}

  private:

    ClaimedPhoneNumberSummary m_claimedPhoneNumberSummary;
  };

} // namespace Model
} // namespace Connect
} // namespace Aws


text:
from setuptools import setup, find_packages

__version__ = "1.12"

setup(
    name="awsenv",
    version=__version__,
    description="AWS profile and session management from the CLI",
    author="Location Labs",
    author_email="info@locationlabs.com",
    url="http://locationlabs.com",
    packages=find_packages(exclude=["*.tests"]),
    setup_requires=[
        "nose>=1.3.7"
    ],
    install_requires=[
        "botocore>=1.3.1",
    ],
    tests_require=[
        "PyHamcrest>=1.8.5",
        "mock>=1.0.1",
        "coverage>=4.0.1",
    ],
    test_suite="awsenv.tests",
    entry_points={
        "console_scripts": [
            "awsenv = awsenv.main:main",
        ]
    }
)


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Skybrud.Essentials.Strings;

namespace UnitTestProject1.Strings {

    [TestClass]
    public class StringToInt32Tests {

        [TestMethod]
        public void TryParse() {

            var samples = new[] {
                new { Input = default(string), Output = false, Result = 0 },
                new { Input = string.Empty, Output = false, Result = 0 },
                new { Input = "1", Output = true, Result = 1 },
                new { Input = "2", Output = true, Result = 2 },
                new { Input = "3", Output = true, Result = 3 },
                new { Input = "3.00", Output = true, Result = 3 },
                new { Input = "3.14", Output = false, Result = 0 },
                new { Input = " 1 ", Output = true, Result = 1 },
                new { Input = "2147483647", Output = true, Result = int.MaxValue },
                new { Input = "2147483648", Output = false, Result = 0 },
                new { Input = "aaa", Output = false, Result = 0 },
            };

            int n = 1;

            foreach (var sample in samples) {

                bool output = StringUtils.TryParseInt32(sample.Input, out int result);

                Assert.AreEqual(sample.Output, output, $"#{n} Output ({sample.Input ?? "NULL"})");
                Assert.AreEqual(sample.Result, result, $"#{n} Result ({sample.Input ?? "NULL"})");

                n++;

            }

        }

        [TestMethod]
        public void TryParseNullable() {

            var samples = new[] {
                new { Input = default(string), Output = false, Result = default(int?) },
                new { Input = string.Empty, Output = false, Result = default(int?) },
                new { Input = "1", Output = true, Result = (int?) 1 },
                new { Input = "2", Output = true, Result = (int?) 2 },
                new { Input = "3", Output = true, Result = (int?) 3 },
                new { Input = "3.00", Output = true, Result = (int?) 3 },
                new { Input = "3.14", Output = false, Result = default(int?) },
                new { Input = " 1 ", Output = true, Result = (int?) 1 },
                new { Input = "2147483647", Output = true, Result = (int?) int.MaxValue },
                new { Input = "2147483648", Output = false, Result = default(int?) },
                new { Input = "aaa", Output = false, Result = default(int?) },
            };

            int n = 1;

            foreach (var sample in samples) {

                bool output = StringUtils.TryParseInt32(sample.Input, out int? result);

                Assert.AreEqual(sample.Output, output, $"#{n} Output ({sample.Input ?? "NULL"})");
                Assert.AreEqual(sample.Result, result, $"#{n} Result ({sample.Input ?? "NULL"})");

                n++;

            }

        }

    }

}


text:
import styled from "styled-components"

interface DropdownMenuProps {
  showMenu: boolean
}

interface CircleProps {
  full: boolean
}

export const Button = styled.button`
  width: 84px;
  height: 32px;
  border-radius: 3px;
  font-size: 0.75rem;
`

export const SignInButton = styled(Button)`
  background-color: ${({ theme }) => theme.accents.primary.base};
  color: ${({ theme }) => theme.white};
  &:hover {
    background-color: ${({ theme }) => theme.accents.primary.darker};
  }
`
export const LoadingButton = styled(SignInButton)`
  width: 32px;
  padding-top: 3px;
`

export const DropdownWrapper = styled.div`
  position: relative;
`
export const DropdownButton = styled(Button)`
  background-color: ${({ theme }) => theme.primary.base};
  color: ${({ theme }) => theme.textColor};
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  &:hover {
    background-color: ${({ theme }) => theme.accents.primary.base};
    color: ${({ theme }) => theme.white};
  }
`
export const UserWrapper = styled.div`
  position: relative;
`
export const UserContainer = styled(Button)`
  color: ${({ theme }) => theme.textColor};
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  border-left: 1px solid ${({ theme }) => theme.core.dividerColor};
  border-radius: 0;
  height: 24px;
  padding-left: 5px;
`

export const UserAvatar = styled.img`
  width: 24px;
  height: 24px;
  filter: grayscale(1);
  ${DropdownButton}:hover & {
    filter: grayscale(0);
  }
`
export const DropdownMenu = styled.div<DropdownMenuProps>`
  background: ${({ theme }) => theme.primary[1]};
  display: ${({ showMenu }) => (showMenu ? "flex" : "none")};
  flex-direction: column;
  position: absolute;
  right: 0;
  border-radius: 3px;
  font-size: 0.75rem;
  padding: 6px;
  width: max-content;
`
export const Option = styled.button`
  width: 100px;
  height: 26px;
  text-align: left;
  padding: 3px 9px;
  &:hover {
    background-color: ${({ theme }) => theme.primary.base};
    text-decoration: underline;
  }
`
export const Title = styled.div`
  width: 100px;
  height: 26px;
  text-align: left;
  padding: 6px 9px;
`
export const Separator = styled.hr`
  color: ${({ theme }) => theme.primary.base};
  margin: 8px 0;
`
export const Circle = styled.div<CircleProps>`
  display: inline-block;
  width: 9px;
  height: 9px;
  background-color: ${({ theme, full }) =>
    full ? theme.secondary.base : "transparent"};
  border: ${({ theme, full }) =>
    full ? "1px solid transparent" : `1px solid ${theme.primary[5]}`};
  border-radius: 50%;
  margin-right: 2px;
`


text:
import React, { Component } from 'react';
import Link from 'gatsby-link';
import styled from 'styled-components';

import particlesConfig from '../json/particles-config.json';

import '../css/particle-styles.css';
import { animateBackground, animateShake } from '../css/animations';

const Header = styled.header`
  ${animateBackground} ${animateShake} height: ${props =>
      props.isPost ? '15vh' : '25vh'};
  background-color: #ffa81f;
  color: blue;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(#ffa81f, #d85d15);
  background-size: 250% 250%;
  animation: animateBg 10s ease infinite;
  font-weight: 400;
  transition: height 250ms ease-in-out;
  user-select: none;
  @media only screen and (min-width: 768px) {
    height: ${props => (props.isPost ? '30vh' : '45vh')};
  }
`;

const Name = styled.h1`
  display: flex;
  flex-wrap: wrap;
  font-size: 2rem;
  text-transform: uppercase;
  font-weight: 700;
  align-items: center;
  transition: font-size 250ms ease-in-out, padding 150ms ease-in;
  background-color: #002635;
  color: white;
  padding: 0.5rem 1rem;
  margin: 0;
  width: auto;
  user-select: text;
  .wf-active & {
    font-family: 'Montserrat', sans-serif;
  }
  @media only screen and (min-width: 375px) {
    font-size: 2.5rem;
  }
  @media only screen and (min-width: 768px) {
    font-size: 4.5rem;
    padding: 1rem 2rem;
  }
`;

const Letter = styled.span`
  display: inline-block;
  position: relative;
  z-index: 3;
  &:hover {
    animation: shake 1000ms ease-in-out;
  }
`;

const First = styled.span`
  padding-right: 2vw;
  font-weight: 700;
  white-space: nowrap;
`;

const Last = styled.span`
  font-weight: 400;
  white-space: nowrap;
`;

const NoWrap = styled.span`white-space: nowrap;`;

const StyledLink = styled(Link)`
  color: inherit;
`;

class BlogHeader extends Component {
  componentDidMount() {
    if (window) {
      require.ensure('particles.js', () => {
        this.Particles = require('particles.js');
        this.Particles(`blog-header`, particlesConfig);
      }, 'particles.js');
    }
  }

  componentWillUnmount() {
    if (this.Particles) {
      this.Particles.destroy();
    }
  }

  render() {
    return (
      <Header id="blog-header" {...this.props}>
        <Name className="name">
          <StyledLink to="/">
            <First>
              {'Dustin'.split('').map((letter, index) =>
                <Letter key={`${letter}-${index}`}>
                  {letter}
                </Letter>
              )}
            </First>
            <Last>
              {'Schau'.split('').map((letter, index) =>
                <Letter key={`${letter}-${index}`}>
                  {letter}
                </Letter>
              )}
            </Last>
          </StyledLink>
        </Name>
      </Header>
    );
  }
}

export default BlogHeader;


text:
  #my-contacts #letter-strip
  {
    flow:horizontal;
  }

  #my-contacts #letter-strip widget
  {
    color: white;
    border:none;
    margin:0 1px;
    padding:4px;
    background-image:url(images/bback-normal.png);
    background-repeat:expand stretch-left stretch-right stretch-middle;
	  background-position:3px 3px 3px 3px;
    width:100%%;
    text-align:center;
  }

 #my-contacts #letter-strip widget:hover
  {
	  color: #ffe598;
    transition:blend;
	  background-image:url(images/bback-hover.png);
  }

  #my-contacts #letter-strip widget:active
  {
	  color: #ffe598;
    transition:blend;
	  background-image:url(images/bback-pressed.png);
  }

  #my-contacts #contact-details
  {
    padding:4px;
    background-color: #f8f8f8;
    border:1px solid #006e9b;
  }

  #my-contacts widget[name="contact-info-next-contact"]
  {
    width:6px;
    height:100%%;
  }
  #my-contacts widget[name="contact-info-prev-contact"]
  {
    width:6px;
    height:100%%;
  }


text:
class CategoryListController
{
	/**
	 *
	 * @param {ContentService} ContentService
	 * @param {RoutingService} RoutingService
	 * @param $rootScope
	 * @param $scope
	 * @param $state
	 */
	constructor( ContentService,
	             RoutingService,
	             $rootScope,
	             $scope,
	             $state )
	{
		'ngInject';

		//
		this.ContentService = ContentService;
		this.RoutingService = RoutingService;

		this.$rootScope = $rootScope;
		this.$scope = $scope;
		this.$state = $state;
	}

	//
	$onInit()
	{
		this.setContent( this.ContentService.categoryList );

		// ------------- //

		let onContentChanged = this.$rootScope.$on( "contentChanged", ( event ) =>
		{
			this.setContent( this.ContentService.categoryList );
		} );

		this.$scope.$on( '$destroy', () =>
		{
			onContentChanged();
		} );
	}

	//
	setContent( categoryList )
	{
		this.categories = categoryList;
	}

	//
	goCategory( category )
	{
		if( category.slug === 'providers')
		{
			this.RoutingService.goProvider( 'all' );
		}
		else
		{
			this.RoutingService.goContent( category, null );
		}
	}

	//
	getURL( category )
	{
		if( category.slug === 'providers')
		{
			return this.RoutingService.getProviderURL( 'all' );
		}
		else
		{
			return this.RoutingService.getContentURL( category, null );
		}
	}

	//
	isLoading()
	{
		let offerList = this.ContentService.offerList;

		let hasCategories = this.categories && this.categories.length > 0;
		let hasOffers = offerList && offerList.length > 0;

		return this.$rootScope.isLoading && !hasCategories && !hasOffers;
	}
}

//
export const CategoryListComponent = {
	template: require( './category-list.component.html' ),
	controller: CategoryListController,
	controllerAs: 'vm',
	bindings: {}
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Interface IContainer
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Interface IContainer
   ">
    <meta name="generator" content="docfx 2.9.3.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Interface IContainer

Defines a container for resolving types

Namespace:Bifrost.Execution

Assembly:Bifrost.dll

Syntax

public interface IContainer

Properties

                |
                Improve this Doc

                View Source

DefaultLifecycle

Gets or sets the BindingLifecycle for objects.
This property usually guides the implementing container for default bindings it may create for types that
does not have an explicit binding and is not abstract or an interface

Declaration

BindingLifecycle DefaultLifecycle { get; set; }

Property Value

                    Type
                    Description

                    BindingLifecycle

Methods

                |
                Improve this Doc

                View Source

Bind(Type, Func<Type, Object>)

Bind a service type to a callback that can resolve the instance

Declaration

void Bind(Type service, Func<Type, object> resolveCallback)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Func<System.Type, System.Object>
                    resolveCallback

Callback that gets called to resolve the instance

                |
                <a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Execution_IContainer_Bind_System_Type_System_Func_System_Type_System_Object__Bifrost_Execution_BindingLifecycle_.md&value=---%0Auid%3A%20Bifrost.Execution.IContainer.Bind(System.Type%2CSystem.Func%7BSystem.Type%2CSystem.Object%7D%2CBifrost.Execution.BindingLifecycle)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

                View Source

Bind(Type, Func<Type, Object>, BindingLifecycle)

Bind a service type to a callback that can resolve the instance

Declaration

void Bind(Type service, Func<Type, object> resolveCallback, BindingLifecycle lifecycle)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Func<System.Type, System.Object>
                    resolveCallback

Callback that gets called to resolve the instance

                    BindingLifecycle
                    lifecycle

Lifecycle of the service

                |
                Improve this Doc

                View Source

Bind(Type, Func<Type>)

Bind a service type to a callback that can resolve it

Declaration

void Bind(Type service, Func<Type> resolveCallback)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Func<System.Type>
                    resolveCallback

Callback that gets called to resolve it

                |
                <a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Execution_IContainer_Bind_System_Type_System_Func_System_Type__Bifrost_Execution_BindingLifecycle_.md&value=---%0Auid%3A%20Bifrost.Execution.IContainer.Bind(System.Type%2CSystem.Func%7BSystem.Type%7D%2CBifrost.Execution.BindingLifecycle)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

                View Source

Bind(Type, Func<Type>, BindingLifecycle)

Bind a service type to a callback that can resolve it with given lifecycle

Declaration

void Bind(Type service, Func<Type> resolveCallback, BindingLifecycle lifecycle)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Func<System.Type>
                    resolveCallback

Callback that gets called to resolve it

                    BindingLifecycle
                    lifecycle

Lifecycle of the service

                |
                Improve this Doc

                View Source

Bind(Type, Object)

Bind a service to a specific instance

Declaration

void Bind(Type service, object instance)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Object
                    instance

Instance to bind to

                |
                Improve this Doc

                View Source

Bind(Type, Type)

Bind a service to a specific type

Declaration

void Bind(Type service, Type type)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Type
                    type

Target type to bind to

                |
                <a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Execution_IContainer_Bind_System_Type_System_Type_Bifrost_Execution_BindingLifecycle_.md&value=---%0Auid%3A%20Bifrost.Execution.IContainer.Bind(System.Type%2CSystem.Type%2CBifrost.Execution.BindingLifecycle)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

                View Source

Bind(Type, Type, BindingLifecycle)

Bind a service to a specific type with given lifecycle

Declaration

void Bind(Type service, Type type, BindingLifecycle lifecycle)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    service

Service to bind

                    System.Type
                    type

Target type to bind to

                    BindingLifecycle
                    lifecycle

Lifecycle of the service

                |
                Improve this Doc

                View Source

Bind<T>(T)

Bind a service to a specific instance

Declaration

void Bind<T>(T instance)

Parameters

                    Type
                    Name
                    Description

                    T
                    instance

Instance to bind to

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                Improve this Doc

                View Source

Bind<T>(Func<T>)

Bind a service type to a callback that can resolve the instance

Declaration

void Bind<T>(Func<T> resolveCallback)

Parameters

                    Type
                    Name
                    Description

                    System.Func<T>
                    resolveCallback

Callback that gets called to resolve the instance

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                <a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Execution_IContainer_Bind__1_System_Func___0__Bifrost_Execution_BindingLifecycle_.md&value=---%0Auid%3A%20Bifrost.Execution.IContainer.Bind%60%601(System.Func%7B%60%600%7D%2CBifrost.Execution.BindingLifecycle)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

                View Source

Bind<T>(Func<T>, BindingLifecycle)

Bind a service type to a callback that can resolve the instance

Declaration

void Bind<T>(Func<T> resolveCallback, BindingLifecycle lifecycle)

Parameters

                    Type
                    Name
                    Description

                    System.Func<T>
                    resolveCallback

Callback that gets called to resolve the instance

                    BindingLifecycle
                    lifecycle

Lifecycle of the service

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                Improve this Doc

                View Source

Bind<T>(Func<Type>)

Bind a service type to a callback that can resolve it

Declaration

void Bind<T>(Func<Type> resolveCallback)

Parameters

                    Type
                    Name
                    Description

                    System.Func<System.Type>
                    resolveCallback

Callback that gets called to resolve it

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                <a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Execution_IContainer_Bind__1_System_Func_System_Type__Bifrost_Execution_BindingLifecycle_.md&value=---%0Auid%3A%20Bifrost.Execution.IContainer.Bind%60%601(System.Func%7BSystem.Type%7D%2CBifrost.Execution.BindingLifecycle)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

                View Source

Bind<T>(Func<Type>, BindingLifecycle)

Bind a service type to a callback that can resolve it with given lifecycle

Declaration

void Bind<T>(Func<Type> resolveCallback, BindingLifecycle lifecycle)

Parameters

                    Type
                    Name
                    Description

                    System.Func<System.Type>
                    resolveCallback

Callback that gets called to resolve it

                    BindingLifecycle
                    lifecycle

Lifecycle of the service

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                Improve this Doc

                View Source

Bind<T>(Type)

Bind a service to a specific type

Declaration

void Bind<T>(Type type)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    type

Target type to bind to

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                Improve this Doc

                View Source

Bind<T>(Type, BindingLifecycle)

Bind a service to a specific type with given lifecycle

Declaration

void Bind<T>(Type type, BindingLifecycle lifecycle)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    type

Target type to bind to

                    BindingLifecycle
                    lifecycle

Lifecycle of the service

Type Parameters

                    Name
                    Description

                    T
                    Service to bind

                |
                Improve this Doc

                View Source

Get(Type)

Get an instance of a specific type

Declaration

object Get(Type type)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    type

Type to get instance of

Returns

                    Type
                    Description

                    System.Object

Instance of the type

                |
                Improve this Doc

                View Source

Get(Type, Boolean)

Get an instance of a specific type

Declaration

object Get(Type type, bool optional = false)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    type

Type to get instance of

                    System.Boolean
                    optional

If the binding is optional, return null and not throw an exception

Returns

                    Type
                    Description

                    System.Object

Instance of the type

                |
                Improve this Doc

                View Source

Get<T>()

Get an instance of a specific type

Declaration

T Get<T>()

Returns

                    Type
                    Description

                    T

Instance of the type

Type Parameters

                    Name
                    Description

                    T
                    Type to get instance of

                |
                Improve this Doc

                View Source

Get<T>(Boolean)

Get an instance of a specific type

Declaration

T Get<T>(bool optional)

Parameters

                    Type
                    Name
                    Description

                    System.Boolean
                    optional

If the binding is optional, return null and not throw an exception

Returns

                    Type
                    Description

                    T

Instance of the type

Type Parameters

                    Name
                    Description

                    T
                    Type to get instance of

                |
                Improve this Doc

                View Source

GetAll(Type)

Get all instances of a specific type

Declaration

IEnumerable<object> GetAll(Type type)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    type

Type to get instances for

Returns

                    Type
                    Description

                    System.Collections.Generic.IEnumerable<System.Object>

Instances of the type

                |
                Improve this Doc

                View Source

GetAll<T>()

Get all instances of a specific type

Declaration

IEnumerable<T> GetAll<T>()

Returns

                    Type
                    Description

                    System.Collections.Generic.IEnumerable<T>

Instances of the type

Type Parameters

                    Name
                    Description

                    T
                    Type to get instances of

                |
                Improve this Doc

                View Source

GetBoundServices()

Get all services that have been bound

Declaration

IEnumerable<Type> GetBoundServices()

Returns

                    Type
                    Description

                    System.Collections.Generic.IEnumerable<System.Type>

System.Collections.Generic.IEnumerable<T> containing all bound services

                |
                Improve this Doc

                View Source

HasBindingFor(Type)

Gets wether or not a specific service has a binding

Declaration

bool HasBindingFor(Type type)

Parameters

                    Type
                    Name
                    Description

                    System.Type
                    type

Type of service to check

Returns

                    Type
                    Description

                    System.Boolean

True if service has binding, false if not

                |
                Improve this Doc

                View Source

HasBindingFor<T>()

Gets wether or not a specific service has a binding

Declaration

bool HasBindingFor<T>()

Returns

                    Type
                    Description

                    System.Boolean

True if service has binding, false if not

Type Parameters

                    Name
                    Description

                    T
                    Type of service to check

Extension Methods

                  ConceptExtensions.IsConcept(Object)

                  ConceptExtensions.GetConceptValue(Object)

                  DynamicExtensions.AsExpandoObject(Object)

                  MethodCalls.CallGenericMethod<TOut, T, T1, T2, T3>(T, Expression<Func<T, Func<T1, T2, T3, TOut>>>, T1, T2, T3, Type[])

                  MethodCalls.CallGenericMethod<TOut, T, T1, T2>(T, Expression<Func<T, Func<T1, T2, TOut>>>, T1, T2, Type[])

                  MethodCalls.CallGenericMethod<TOut, T, T1>(T, Expression<Func<T, Func<T1, TOut>>>, T1, Type[])

                  MethodCalls.CallGenericMethod<TOut, T>(T, Expression<Func<T, Func<TOut>>>, Type[])

                  MethodCalls.Generics<T>(T)

                    Improve this Doc

                    View Source

              Back to top

            Copyright © 2008-2017 Dolittle


text:
namespace crashpad {
namespace test {

//! \brief A test ModuleSnapshot that can carry arbitrary data for testing
//!     purposes.
class TestModuleSnapshot final : public ModuleSnapshot {
 public:
  TestModuleSnapshot();

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

  ~TestModuleSnapshot() override;

  void SetName(const std::string& name) { name_ = name; }
  void SetAddressAndSize(uint64_t address, uint64_t size) {
    address_ = address;
    size_ = size;
  }
  void SetTimestamp(time_t timestamp) { timestamp_ = timestamp; }
  void SetFileVersion(uint16_t file_version_0,
                      uint16_t file_version_1,
                      uint16_t file_version_2,
                      uint16_t file_version_3) {
    file_version_[0] = file_version_0;
    file_version_[1] = file_version_1;
    file_version_[2] = file_version_2;
    file_version_[3] = file_version_3;
  }
  void SetSourceVersion(uint16_t source_version_0,
                        uint16_t source_version_1,
                        uint16_t source_version_2,
                        uint16_t source_version_3) {
    source_version_[0] = source_version_0;
    source_version_[1] = source_version_1;
    source_version_[2] = source_version_2;
    source_version_[3] = source_version_3;
  }
  void SetModuleType(ModuleType module_type) { module_type_ = module_type; }
  void SetUUIDAndAge(const crashpad::UUID& uuid, uint32_t age) {
    uuid_ = uuid;
    age_ = age;
  }
  void SetBuildID(const std::vector<uint8_t>& build_id) {
    build_id_ = build_id;
  }
  void SetDebugFileName(const std::string& debug_file_name) {
    debug_file_name_ = debug_file_name;
  }
  void SetAnnotationsVector(
      const std::vector<std::string>& annotations_vector) {
    annotations_vector_ = annotations_vector;
  }
  void SetAnnotationsSimpleMap(
      const std::map<std::string, std::string>& annotations_simple_map) {
    annotations_simple_map_ = annotations_simple_map;
  }
  void SetAnnotationObjects(
      const std::vector<AnnotationSnapshot>& annotations) {
    annotation_objects_ = annotations;
  }
  void SetExtraMemoryRanges(
      const std::set<CheckedRange<uint64_t>>& extra_memory_ranges) {
    extra_memory_ranges_ = extra_memory_ranges;
  }

  // ModuleSnapshot:

  std::string Name() const override;
  uint64_t Address() const override;
  uint64_t Size() const override;
  time_t Timestamp() const override;
  void FileVersion(uint16_t* version_0,
                   uint16_t* version_1,
                   uint16_t* version_2,
                   uint16_t* version_3) const override;
  void SourceVersion(uint16_t* version_0,
                     uint16_t* version_1,
                     uint16_t* version_2,
                     uint16_t* version_3) const override;
  ModuleType GetModuleType() const override;
  void UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const override;
  std::string DebugFileName() const override;
  std::vector<uint8_t> BuildID() const override;
  std::vector<std::string> AnnotationsVector() const override;
  std::map<std::string, std::string> AnnotationsSimpleMap() const override;
  std::vector<AnnotationSnapshot> AnnotationObjects() const override;
  std::set<CheckedRange<uint64_t>> ExtraMemoryRanges() const override;
  std::vector<const UserMinidumpStream*> CustomMinidumpStreams() const override;

 private:
  std::string name_;
  uint64_t address_;
  uint64_t size_;
  time_t timestamp_;
  uint16_t file_version_[4];
  uint16_t source_version_[4];
  ModuleType module_type_;
  uint32_t age_;
  crashpad::UUID uuid_;
  std::vector<uint8_t> build_id_;
  std::string debug_file_name_;
  std::vector<std::string> annotations_vector_;
  std::map<std::string, std::string> annotations_simple_map_;
  std::vector<AnnotationSnapshot> annotation_objects_;
  std::set<CheckedRange<uint64_t>> extra_memory_ranges_;
};

}  // namespace test
}  // namespace crashpad

#endif  // CRASHPAD_SNAPSHOT_TEST_TEST_MODULE_SNAPSHOT_H_


text:
'use strict'

// TODO:
// 	 Change cors config to have whitelist for client url

// Require packages
const express = require('express')
const dotenv = require('dotenv')
const bodyParser = require('body-parser')
const cors = require('cors')

// Require routes, gathered in index.js file
const routes = require('./routes/')

// Init app
const app = express()

// Config
dotenv.config()
let PORT = process.env.PORT || 8000
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}))
app.use(cors())

// API routes
app.use('/api/', routes)

app.use((err,req,res,next) => {
  console.log("error catcher: ", err)
  res.header('Access-Control-Allow-Origin', '*')
  res.status(err.status || 500)
  res.json({
    message: err.message,
    error: err
  })
})

if(process.env.NODE_ENV === 'test') PORT = 9001
app.listen(PORT, function() {
	console.log(`back end application listening on port ${PORT}`)
})

module.exports = app


text:
using System;
using NClang.Natives;

namespace NClang
{
	public class ClangCursorSet : ClangObject, IDisposable
	{
		public ClangCursorSet (IntPtr handle)
			: base (handle)
		{
		}

		public void Dispose ()
		{
			LibClang.clang_disposeCXCursorSet (Handle);
		}

		public bool Contains (ClangCursor cursor)
		{
			return LibClang.clang_CXCursorSet_contains (Handle, cursor.Source) != 0;
		}

		public bool Insert (ClangCursor cursor)
		{
			return LibClang.clang_CXCursorSet_insert (Handle, cursor.Source) != 0;
		}
	}
}


text:
from flask import session, redirect, request
from webViews.view import normalView
from webViews.log import logger
from webViews.checkname import checkname
from webViews.dockletrequest import dockletRequest
from utils import env
import json

class batchAdminListView(normalView):
    template_path = "batch/batch_admin_list.html"

    @classmethod
    def get(self):
        masterips = dockletRequest.post_to_all()
        job_list = {}
        for ipname in masterips:
            ip = ipname.split("@")[0]
            result = dockletRequest.post("/batch/job/listall/",{},ip)
            job_list[ip] = result.get("data")
            logger.debug("job_list[%s]: %s" % (ip,job_list[ip]))
        if True:
            return self.render(self.template_path, masterips=masterips, job_list=job_list)
        else:
            return self.error()

class batchJobListView(normalView):
    template_path = "batch/batch_list.html"

    @classmethod
    def get(self):
        masterips = dockletRequest.post_to_all()
        job_list = {}
        for ipname in masterips:
            ip = ipname.split("@")[0]
            result = dockletRequest.post("/batch/job/list/",{},ip)
            job_list[ip] = result.get("data")
            logger.debug("job_list[%s]: %s" % (ip,job_list[ip]))
        if True:
            return self.render(self.template_path, masterips=masterips, job_list=job_list)
        else:
            return self.error()

class createBatchJobView(normalView):
    template_path = "batch/batch_create.html"

    @classmethod
    def get(self):
        masterips = dockletRequest.post_to_all()
        images = {}
        for master in masterips:
            images[master.split("@")[0]] = dockletRequest.post("/image/list/",{},master.split("@")[0]).get("images")
        logger.info(images)

        data = {
            "user": session['username'],
        }
        allresult = dockletRequest.post_to_all('/monitor/listphynodes/', data)
        allmachines = {}
        for master in allresult:
            allmachines[master.split("@")[0]] = []
            iplist = allresult[master].get('monitor').get('allnodes')
            for ip in iplist:
                result = dockletRequest.post('/monitor/hosts/%s/gpuinfo/'%(ip), data, master.split("@")[0])
                gpuinfo = result.get('monitor').get('gpuinfo')
                allmachines[master.split("@")[0]].append(gpuinfo)

        pending_gpu_tasks = {}
        for master in masterips:
            pending_gpu_tasks[master.split("@")[0]] = dockletRequest.post("/monitor/pending_gpu_tasks/",{},master.split("@")[0]).get("monitor").get("pending_tasks")

        return self.render(self.template_path, user=session['username'], masterips=masterips, images=images, allmachines=allmachines, pending_gpu_tasks=pending_gpu_tasks)

class infoBatchJobView(normalView):
    template_path = "batch/batch_info.html"
    error_path = "error.html"
    masterip = ""
    jobid = ""

    @classmethod
    def get(self):
        data = {
            'jobid':self.jobid
        }
        result = dockletRequest.post("/batch/job/info/",data,self.masterip)
        data = result.get("data")
        logger.info(str(data))
        #logger.debug("job_list: %s" % job_list)
        if result.get('success',"") == "true":
            return self.render(self.template_path, masterip=self.masterip, jobinfo=data)
        else:
            return self.render(self.error_path, message = result.get('message'))

class addBatchJobView(normalView):
    template_path = "batch/batch_list.html"
    error_path = "error.html"

    @classmethod
    def post(self):
        masterip = self.masterip
        result = dockletRequest.post("/batch/job/add/", self.job_data, masterip)
        if result.get('success', None) == "true":
            return redirect('/batch_jobs/')
        else:
            return self.render(self.error_path, message = result.get('message'))

class stopBatchJobView(normalView):
    template_path = "batch/batch_list.html"
    error_path = "error.html"

    @classmethod
    def get(self):
        masterip = self.masterip
        data = {'jobid':self.jobid}
        result = dockletRequest.post("/batch/job/stop/", data, masterip)
        if result.get('success', None) == "true":
            return redirect('/batch_jobs/')
        else:
            return self.render(self.error_path, message = result.get('message'))

class adminStopBatchJobView(normalView):
    template_path = "batch/batch_admin_list.html"
    error_path = "error.html"

    @classmethod
    def get(self):
        masterip = self.masterip
        data = {'jobid':self.jobid}
        result = dockletRequest.post("/batch/job/stop/", data, masterip)
        if result.get('success', None) == "true":
            return redirect('/admin_batch_list/')
        else:
            return self.render(self.error_path, message = result.get('message'))

class outputBatchJobView(normalView):
    template_path = "batch/batch_output.html"
    masterip = ""
    jobid = ""
    taskid = ""
    vnodeid = ""
    issue = ""

    @classmethod
    def get(self):
        data = {
            'jobid':self.jobid,
            'taskid':self.taskid,
            'vnodeid':self.vnodeid,
            'issue':self.issue
        }
        result = dockletRequest.post("/batch/job/output/",data,self.masterip)
        output = result.get("data")
        #logger.debug("job_list: %s" % job_list)
        if result.get('success',"") == "true":
            return self.render(self.template_path, masterip=self.masterip, jobid=self.jobid,
                               taskid=self.taskid, vnodeid=self.vnodeid, issue=self.issue, output=output)
        else:
            return self.error()


text:
<?php
/**
 * ConsignmentLeg
 *
 * PHP version 5
 *
 * @category Class
 * @package  ChrisHemmings\Electio
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * Electio API
 *
 * A minimal Electio client
 *
 * OpenAPI spec version: 1.0.12
 * Contact: chris@hemmin.gs
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.19
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace ChrisHemmings\Electio\Client\Model;

use \ArrayAccess;
use \ChrisHemmings\Electio\ObjectSerializer;

/**
 * ConsignmentLeg Class Doc Comment
 *
 * @category Class
 * @package  ChrisHemmings\Electio
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ConsignmentLeg implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $swaggerModelName = 'ConsignmentLeg';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'leg' => 'int',
        'tracking_references' => 'string[]',
        'carrier_reference' => 'string',
        'carrier_name' => 'string',
        'carrier_service_reference' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'leg' => null,
        'tracking_references' => null,
        'carrier_reference' => null,
        'carrier_name' => null,
        'carrier_service_reference' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerTypes()
    {
        return self::$swaggerTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerFormats()
    {
        return self::$swaggerFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'leg' => 'Leg',
        'tracking_references' => 'TrackingReferences',
        'carrier_reference' => 'CarrierReference',
        'carrier_name' => 'CarrierName',
        'carrier_service_reference' => 'CarrierServiceReference'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'leg' => 'setLeg',
        'tracking_references' => 'setTrackingReferences',
        'carrier_reference' => 'setCarrierReference',
        'carrier_name' => 'setCarrierName',
        'carrier_service_reference' => 'setCarrierServiceReference'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'leg' => 'getLeg',
        'tracking_references' => 'getTrackingReferences',
        'carrier_reference' => 'getCarrierReference',
        'carrier_name' => 'getCarrierName',
        'carrier_service_reference' => 'getCarrierServiceReference'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$swaggerModelName;
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['leg'] = isset($data['leg']) ? $data['leg'] : null;
        $this->container['tracking_references'] = isset($data['tracking_references']) ? $data['tracking_references'] : null;
        $this->container['carrier_reference'] = isset($data['carrier_reference']) ? $data['carrier_reference'] : null;
        $this->container['carrier_name'] = isset($data['carrier_name']) ? $data['carrier_name'] : null;
        $this->container['carrier_service_reference'] = isset($data['carrier_service_reference']) ? $data['carrier_service_reference'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }

    /**
     * Gets leg
     *
     * @return int
     */
    public function getLeg()
    {
        return $this->container['leg'];
    }

    /**
     * Sets leg
     *
     * @param int $leg leg
     *
     * @return $this
     */
    public function setLeg($leg)
    {
        $this->container['leg'] = $leg;

        return $this;
    }

    /**
     * Gets tracking_references
     *
     * @return string[]
     */
    public function getTrackingReferences()
    {
        return $this->container['tracking_references'];
    }

    /**
     * Sets tracking_references
     *
     * @param string[] $tracking_references tracking_references
     *
     * @return $this
     */
    public function setTrackingReferences($tracking_references)
    {
        $this->container['tracking_references'] = $tracking_references;

        return $this;
    }

    /**
     * Gets carrier_reference
     *
     * @return string
     */
    public function getCarrierReference()
    {
        return $this->container['carrier_reference'];
    }

    /**
     * Sets carrier_reference
     *
     * @param string $carrier_reference carrier_reference
     *
     * @return $this
     */
    public function setCarrierReference($carrier_reference)
    {
        $this->container['carrier_reference'] = $carrier_reference;

        return $this;
    }

    /**
     * Gets carrier_name
     *
     * @return string
     */
    public function getCarrierName()
    {
        return $this->container['carrier_name'];
    }

    /**
     * Sets carrier_name
     *
     * @param string $carrier_name carrier_name
     *
     * @return $this
     */
    public function setCarrierName($carrier_name)
    {
        $this->container['carrier_name'] = $carrier_name;

        return $this;
    }

    /**
     * Gets carrier_service_reference
     *
     * @return string
     */
    public function getCarrierServiceReference()
    {
        return $this->container['carrier_service_reference'];
    }

    /**
     * Sets carrier_service_reference
     *
     * @param string $carrier_service_reference carrier_service_reference
     *
     * @return $this
     */
    public function setCarrierServiceReference($carrier_service_reference)
    {
        $this->container['carrier_service_reference'] = $carrier_service_reference;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


text:
package com.google.errorprone.bugpatterns;

import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** {@link UnnecessaryAnonymousClass}Test */
@RunWith(JUnit4.class)
public class UnnecessaryAnonymousClassTest {

  private final BugCheckerRefactoringTestHelper testHelper =
      BugCheckerRefactoringTestHelper.newInstance(UnnecessaryAnonymousClass.class, getClass());

  @Test
  public void variable_instance() {
    testHelper
        .addInputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  private final Function<String, String> camelCase = new Function<String, String>() {",
            "    public String apply(String x) {",
            "      return \"hello \" + x;",
            "    }",
            "  };",
            "  void g() {",
            "    Function<String, String> f = camelCase;",
            "    System.err.println(camelCase.apply(\"world\"));",
            "  }",
            "}")
        .addOutputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  private String camelCase(String x) {",
            "    return \"hello \" + x;",
            "  }",
            "  void g() {",
            "    Function<String, String> f = this::camelCase;",
            "    System.err.println(camelCase(\"world\"));",
            "  }",
            "}")
        // Make sure the method body is still reformatted correctly.
        .doTest(TEXT_MATCH);
  }

  @Test
  public void variable_static() {
    testHelper
        .addInputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  private static final Function<String, String> F = new Function<String, String>() {",
            "    public String apply(String x) {",
            "      return \"hello \" + x;",
            "    }",
            "  };",
            "  void g() {",
            "    Function<String, String> l = Test.F;",
            "    System.err.println(F.apply(\"world\"));",
            "  }",
            "}")
        .addOutputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  private static String f(String x) {",
            "    return \"hello \" + x;",
            "  }",
            "  void g() {",
            "    Function<String, String> l = Test::f;",
            "    System.err.println(f(\"world\"));",
            "  }",
            "}")
        .doTest();
  }

  @Test
  public void abstractClass() {
    testHelper
        .addInputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  static abstract class Impl implements Function<String, String> {",
            "    public String apply(String input) {",
            "      return input;",
            "    }",
            "    public abstract void f(String input);",
            "  }",
            "  private final Function<String, String> camelCase = new Impl() {",
            "    public void f(String input) {}",
            "  };",
            "  void g() {",
            "    Function<String, String> f = camelCase;",
            "    System.err.println(camelCase.apply(\"world\"));",
            "  }",
            "}")
        .expectUnchanged()
        .doTest();
  }

  @Test
  public void recursive() {
    testHelper
        .addInputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  private static final Function<Object, Object> STRINGIFY =",
            "      new Function<Object, Object>() {",
            "        @Override",
            "        public Object apply(Object input) {",
            "          return transform(STRINGIFY);",
            "        }",
            "      };",
            "  public static Object transform(Function<Object, Object> f) {",
            "    return f.apply(\"a\");",
            "  }",
            "}")
        .addOutputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  private static Object stringify(Object input) {",
            "    return transform(Test::stringify);",
            "  }",
            "  public static Object transform(Function<Object, Object> f) {",
            "    return f.apply(\"a\");",
            "  }",
            "}")
        .doTest();
  }

  @Test
  public void invokingDefaultMethod() {
    testHelper
        .addInputLines(
            "Test.java",
            "import java.util.function.Function;",
            "class Test {",
            "  interface Foo {",
            "    int foo(int a);",
            "    default void bar() {",
            "      foo(1);",
            "    }",
            "  }",
            "  private static final Foo FOO = new Foo() {",
            "    @Override public int foo(int a) {",
            "      return 2 * a;",
            "    }",
            "  };",
            "  public static void test() {",
            "    FOO.bar();",
            "    useFoo(FOO);",
            "  }",
            "  public static void useFoo(Foo foo) {}",
            "}")
        .expectUnchanged()
        .doTest();
  }

  @Test
  public void mockitoSpy() {
    testHelper
        .addInputLines(
            "Test.java",
            "import java.util.function.Function;",
            "import org.mockito.Spy;",
            "class Test {",
            "  interface Foo {",
            "    int foo(int a);",
            "  }",
            "  @Spy",
            "  private static final Foo FOO = new Foo() {",
            "    @Override",
            "    public int foo(int a) {",
            "      return 2 * a;",
            "    }",
            "  };",
            "  public static void test() {",
            "    FOO.foo(2);",
            "  }",
            "}")
        .expectUnchanged()
        .doTest();
  }
}


text:
from qingcloud.cli.iaas_client.actions.base import BaseAction

class ChangeWanAccessBandwidthAction(BaseAction):

    action = 'ChangeWanAccessBandwidth'
    command = 'change-wan-access-bandwidth'
    usage = '%(prog)s -a <wan_access_id> -b <bandwidth> [-f <conf_file>]'

    @classmethod
    def add_ext_arguments(cls, parser):
        parser.add_argument('-a', '--wan_access', dest='wan_access',
                            action='store', type=str, default=None,
                            help='the ID of wan_access you want to change bandwidth.')

        parser.add_argument('-t', '--bandwidth_type', dest='bandwidth_type',
                            action="store", type=str,  default='elastic',
                            help='bandwidth type, such as elastic.')

        parser.add_argument('-b', '--bandwidth', dest='bandwidth',
                            action="store", type=int, default=None,
                            help='the new bandwidth for wan_access, unit in Mbps.')

    @classmethod
    def build_directive(cls, options):
        if options.wan_access is None:
            print('error: wan_access should be specified.')
            return None

        directive = {
            "wan_access": options.wan_access,
            "bandwidth_type": options.bandwidth_type,
            "bandwidth": options.bandwidth}

        return directive


text:
package gv
package isi
package io

import java.nio.channels.{ WritableByteChannel, ReadableByteChannel }
import java.nio.file.{ StandardOpenOption ⇒ opt, Files ⇒ JFiles, Path ⇒ JPath }

trait File extends Any {

  @inline
  final def exists(path: JPath): Boolean =
    JFiles exists path

  @inline
  final def create(path: JPath): WritableByteChannel =
    JFiles newByteChannel (path, opt.CREATE_NEW, opt.WRITE)

  @inline
  final def open(path: JPath): ReadableByteChannel =
    JFiles newByteChannel (path, opt.CREATE, opt.READ)

  @inline
  final def append(path: JPath): WritableByteChannel =
    JFiles newByteChannel (path, opt.CREATE, opt.WRITE, opt.APPEND)

  @inline
  final def truncate(path: JPath): WritableByteChannel =
    JFiles newByteChannel (path, opt.CREATE, opt.WRITE, opt.TRUNCATE_EXISTING)

  @inline
  final def remove(path: JPath): Unit =
    JFiles delete path
}

object File extends File


text:
<?php

namespace CommerceGuys\Intl\Language;

interface LanguageInterface
{
    /**
     * Gets the two-letter language code.
     *
     * @return string
     */
    public function getLanguageCode();

    /**
     * Sets the two-letter language code.
     *
     * @param string $languageCode The two-letter language code.
     */
    public function setLanguageCode($languageCode);

    /**
     * Gets the language name.
     *
     * Note that certain locales have incomplete translations, in which
     * case the english version of the language name is used instead.
     *
     * @return string
     */
    public function getName();

    /**
     * Sets the language name.
     *
     * @param string $name The language name.
     */
    public function setName($name);
}


text:
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_self
 *= require font-awesome
 *= require animate/animate.css
 //= require chosen/chosen.css
 //= require steps/jquery.steps.css
 //= require toastr/toastr.min.css
 //= require jquery-ui/jquery-ui-1.10.4.custom.min.css
 //= require awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css
 //= require datapicker/datepicker3.css
 //= require iCheck/custom.css
 //= require switchery/switchery.css
 //= require fullcalendar/fullcalendar.css
 //= require jit-spacetree.css
 //= require tutorialize/tutorialize.css
 //= require tables
 //= require style
 *= require dataTables/jquery.dataTables
  */


text:
package org.jasig.cas.authentication.handler.support;

import java.net.URL;
import java.security.GeneralSecurityException;

import javax.security.auth.login.FailedLoginException;
import javax.validation.constraints.NotNull;

import org.jasig.cas.authentication.AbstractAuthenticationHandler;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.DefaultHandlerResult;
import org.jasig.cas.authentication.HandlerResult;
import org.jasig.cas.authentication.HttpBasedServiceCredential;
import org.jasig.cas.util.http.HttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Class to validate the credential presented by communicating with the web
 * server and checking the certificate that is returned against the hostname,
 * etc.
 *

 * This class is concerned with ensuring that the protocol is HTTPS and that a
 * response is returned. The SSL handshake that occurs automatically by opening
 * a connection does the heavy process of authenticating.
 *
 * @author Scott Battaglia

 * @since 3.0.0
 */
public final class HttpBasedServiceCredentialsAuthenticationHandler extends AbstractAuthenticationHandler {

    /** Log instance. */
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /** Instance of Apache Commons HttpClient. */
    @NotNull
    private HttpClient httpClient;

    @Override
    public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException {
        final HttpBasedServiceCredential httpCredential = (HttpBasedServiceCredential) credential;
        if (!httpCredential.getService().getProxyPolicy().isAllowedProxyCallbackUrl(httpCredential.getCallbackUrl())) {
            logger.warn("Proxy policy for service [{}] cannot authorize the requested callbackurl [{}]",
                    httpCredential.getService(), httpCredential.getCallbackUrl());
            throw new FailedLoginException(httpCredential.getCallbackUrl() + " cannot be authorized");
        }

        logger.debug("Attempting to authenticate {}", httpCredential);
        final URL callbackUrl = httpCredential.getCallbackUrl();
        if (!this.httpClient.isValidEndPoint(callbackUrl)) {
            throw new FailedLoginException(callbackUrl.toExternalForm() + " sent an unacceptable response status code");
        }
        return new DefaultHandlerResult(this, httpCredential, this.principalFactory.createPrincipal(httpCredential.getId()));
    }

    /**
     * {@inheritDoc}
     * @return true if the credential provided are not null and the credential
     * are a subclass of (or equal to) HttpBasedServiceCredential.
     */
    @Override
    public boolean supports(final Credential credential) {
        return credential instanceof HttpBasedServiceCredential;
    }

    /**
     * Sets the HttpClient which will do all of the connection stuff.
     * @param httpClient http client instance to use
     **/
    public void setHttpClient(final HttpClient httpClient) {
        this.httpClient = httpClient;
    }

    /**
     * @deprecated As of 4.1. Endpoint security is handled by service proxy policies
     *
     *
Set whether a secure url is required or not.

     *
     * @param requireSecure true if its required, false if not. Default is true.
     */
    @Deprecated
    public void setRequireSecure(final boolean requireSecure) {
         logger.warn("setRequireSecure() is deprecated and will be removed. Callback url validation is controlled by the proxy policy");
    }
}


text:
/**
 * @file    PPC/chcore.c
 * @brief   PowerPC architecture port code.
 *
 * @addtogroup PPC_CORE
 * @{
 */

#include "ch.h"

/**
 * @brief   Kernel port layer initialization.
 * @details IVOR4 and IVOR10 initialization.
 */
void port_init(void) {
#if PPC_SUPPORTS_IVORS
    /* The CPU supports IVOR registers, the kernel requires IVOR4 and IVOR10
       and the initialization is performed here.*/
    asm volatile ("li          %%r3, _IVOR4@l       \t\n"
                  "mtIVOR4     %%r3                 \t\n"
                  "li          %%r3, _IVOR10@l      \t\n"
                  "mtIVOR10    %%r3" : : : "memory");
#endif
}

/**
 * @brief   Halts the system.
 * @details This function is invoked by the operating system when an
 *          unrecoverable error is detected (for example because a programming
 *          error in the application code that triggers an assertion while
 *          in debug mode).
 */
void port_halt(void) {

  port_disable();
  while (TRUE) {
  }
}

/**
 * @brief   Performs a context switch between two threads.
 * @details This is the most critical code in any port, this function
 *          is responsible for the context switch between 2 threads.
 * @note    The implementation of this code affects <b>directly</b> the context
 *          switch performance so optimize here as much as you can.
 */
#if !defined(__DOXYGEN__)
__attribute__((naked))
#endif
void port_dummy1(void) {

  asm (".global _port_switch");
  asm ("_port_switch:");
  asm ("subi        %sp, %sp, 80");     /* Size of the intctx structure.    */
  asm ("mflr        %r0");
  asm ("stw         %r0, 84(%sp)");     /* LR into the caller frame.        */
  asm ("mfcr        %r0");
  asm ("stw         %r0, 0(%sp)");      /* CR.                              */
  asm ("stmw        %r14, 4(%sp)");     /* GPR14...GPR31.                   */

  asm ("stw         %sp, 12(%r4)");     /* Store swapped-out stack.         */
  asm ("lwz         %sp, 12(%r3)");     /* Load swapped-in stack.           */

  asm ("lmw         %r14, 4(%sp)");     /* GPR14...GPR31.                   */
  asm ("lwz         %r0, 0(%sp)");      /* CR.                              */
  asm ("mtcr        %r0");
  asm ("lwz         %r0, 84(%sp)");     /* LR from the caller frame.        */
  asm ("mtlr        %r0");
  asm ("addi        %sp, %sp, 80");     /* Size of the intctx structure.    */
  asm ("blr");
}

/**
 * @brief   Start a thread by invoking its work function.
 * @details If the work function returns @p chThdExit() is automatically
 *          invoked.
 */
#if !defined(__DOXYGEN__)
__attribute__((naked))
#endif
void port_dummy2(void) {

  asm (".global _port_thread_start");
  asm ("_port_thread_start:");
  chSysUnlock();
  asm ("mr          %r3, %r31");        /* Thread parameter.                */
  asm ("mtctr       %r30");
  asm ("bctrl");                        /* Invoke thread function.          */
  asm ("bl          chThdExit");        /* Thread termination on exit.      */
}

/** @} */


text: console.log('hi from /static/fun/js/index.js');