text:
import React from 'react';

import {General} from '@constants';
import {renderWithIntlAndTheme} from '@test/intl-test-helper';

import UserStatus from './';

describe('UserStatus', () => {
    const baseProps = {
        size: 32,
    };

    test('should match snapshot, should default to offline status', () => {
        const wrapper = renderWithIntlAndTheme(
            <UserStatus {...baseProps}/>,
        );

        expect(wrapper.toJSON()).toMatchSnapshot();
    });

    test('should match snapshot, away status', () => {
        const wrapper = renderWithIntlAndTheme(
            <UserStatus
                {...baseProps}
                status={General.AWAY}
            />,
        );

        expect(wrapper.toJSON()).toMatchSnapshot();
    });

    test('should match snapshot, dnd status', () => {
        const wrapper = renderWithIntlAndTheme(
            <UserStatus
                {...baseProps}
                status={General.DND}
            />,
        );

        expect(wrapper.toJSON()).toMatchSnapshot();
    });

    test('should match snapshot, online status', () => {
        const wrapper = renderWithIntlAndTheme(
            <UserStatus
                {...baseProps}
                status={General.ONLINE}
            />,
        );

        expect(wrapper.toJSON()).toMatchSnapshot();
    });
});


text:
using EyeInTheSky.Model.Interfaces;

namespace EyeInTheSky.Services.Interfaces
{
    public interface ITemplateFactory : IConfigFactory<ITemplate>
    {
    }
}

redpajama_set_name: RedPajamaGithub


text:
Represents references of reflections to their defining source files. see [[DeclarationReflection.sources]]

## Index

### Properties
* [character](td.models.isourcereference.md#character)
* [file](td.models.isourcereference.md#file)
* [fileName](td.models.isourcereference.md#filename)
* [line](td.models.isourcereference.md#line)
* [url](td.models.isourcereference.md#url)

## Properties

### character: number

* Defined in [td/models/reflections/DeclarationReflection.ts:49](https://github.com/kimamula/typedoc/blob/HEAD/src/td/models/reflections/DeclarationReflection.ts#L49)

### Optional file: [SourceFile](../classes/td.models.sourcefile.md)
A reference to the corresponding file instance.
* Defined in [td/models/reflections/DeclarationReflection.ts:37](https://github.com/kimamula/typedoc/blob/HEAD/src/td/models/reflections/DeclarationReflection.ts#L37)

### fileName: string
The filename of the source file.
* Defined in [td/models/reflections/DeclarationReflection.ts:42](https://github.com/kimamula/typedoc/blob/HEAD/src/td/models/reflections/DeclarationReflection.ts#L42)

### line: number
The number of the line that emitted the declaration.
* Defined in [td/models/reflections/DeclarationReflection.ts:47](https://github.com/kimamula/typedoc/blob/HEAD/src/td/models/reflections/DeclarationReflection.ts#L47)

### Optional url: string
URL for displaying the source file.
* Defined in [td/models/reflections/DeclarationReflection.ts:54](https://github.com/kimamula/typedoc/blob/HEAD/src/td/models/reflections/DeclarationReflection.ts#L54)

Generated using [TypeDoc](http://typedoc.io)


text:
mp_lexer_t *mp_lexer_new_from_file(const char *filename);

void mp_import_set_directory(const char *dir);


text:
#ifndef __NSUndoManager_h_OBJECTS_INCLUDE
#define __NSUndoManager_h_OBJECTS_INCLUDE
#import	<GNUstepBase/GSVersionMacros.h>

#if	OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)

#import	<Foundation/NSObject.h>

#if	defined(__cplusplus)
extern "C" {
#endif

@class NSArray;
@class NSString;
@class NSMutableArray;
@class NSInvocation;

/** Defines run loop ordering for closing undo groupings. */
enum {
  NSUndoCloseGroupingRunLoopOrdering = 350000
};

/* Public notification */

/**
 *  Notification posted whenever [NSUndoManager] opens or closes an undo
 *  group.  The undo manager itself is the notification object, with no
 *  userInfo dictionary.
 */
GS_EXPORT NSString* const NSUndoManagerCheckpointNotification;

/**
 * Notification posted after an [NSUndoManager] opens an undo group.
 */
GS_EXPORT NSString* const NSUndoManagerDidOpenUndoGroupNotification;

/**
 * Notification posted after an [NSUndoManager] executes a redo operation.
 */
GS_EXPORT NSString* const NSUndoManagerDidRedoChangeNotification;

/**
 * Notification posted after an [NSUndoManager] executes an undo operation.
 */
GS_EXPORT NSString* const NSUndoManagerDidUndoChangeNotification;

/**
 * Notification posted before an [NSUndoManager] closes an undo group.
 */
GS_EXPORT NSString* const NSUndoManagerWillCloseUndoGroupNotification;

/**
 * Notification posted before an [NSUndoManager] will execute a redo operation.
 */
GS_EXPORT NSString* const NSUndoManagerWillRedoChangeNotification;

/**
 * Notification posted before an [NSUndoManager] will execute an undo operation.
 */
GS_EXPORT NSString* const NSUndoManagerWillUndoChangeNotification;

@interface NSUndoManager : NSObject
{
#if	GS_EXPOSE(NSUndoManager)
@private
  NSMutableArray	*_redoStack;
  NSMutableArray	*_undoStack;
  id			_group;
  id			_nextTarget;
  NSArray		*_modes;
  BOOL			_isRedoing;
  BOOL			_isUndoing;
  BOOL			_groupsByEvent;
  BOOL			_runLoopGroupingPending;
  unsigned		_disableCount;
  unsigned		_levelsOfUndo;
#endif
#if     GS_NONFRAGILE
#else
  /* Pointer to private additional data used to avoid breaking ABI
   * when we don't have the non-fragile ABI available.
   * Use this mechanism rather than changing the instance variable
   * layout (see Source/GSInternal.h for details).
   */
  @private id _internal GS_UNUSED_IVAR;
#endif
}

- (void) beginUndoGrouping;
- (BOOL) canRedo;
- (BOOL) canUndo;
- (void) disableUndoRegistration;
- (void) enableUndoRegistration;
- (void) endUndoGrouping;
- (void) forwardInvocation: (NSInvocation*)anInvocation;
- (NSInteger) groupingLevel;
- (BOOL) groupsByEvent;
- (BOOL) isRedoing;
- (BOOL) isUndoing;
- (BOOL) isUndoRegistrationEnabled;
- (NSUInteger) levelsOfUndo;
- (id) prepareWithInvocationTarget: (id)target;
- (void) redo;
- (NSString*) redoActionName;
- (NSString*) redoMenuItemTitle;
- (NSString*) redoMenuTitleForUndoActionName: (NSString*)actionName;
- (void) registerUndoWithTarget: (id)target
		       selector: (SEL)aSelector
			 object: (id)anObject;
- (void) removeAllActions;
- (void) removeAllActionsWithTarget: (id)target;
- (NSArray*) runLoopModes;
- (void) setActionName: (NSString*)name;
- (void) setGroupsByEvent: (BOOL)flag;
- (void) setLevelsOfUndo: (NSUInteger)num;
- (void) setRunLoopModes: (NSArray*)newModes;
- (void) undo;
- (NSString*) undoActionName;
- (NSString*) undoMenuItemTitle;
- (NSString*) undoMenuTitleForUndoActionName: (NSString*)actionName;
- (void) undoNestedGroup;

@end

#if	defined(__cplusplus)
}
#endif

#endif	/* GS_API_MACOSX */

#endif /* __NSUndoManager_h_OBJECTS_INCLUDE */


text:
import {
  IWorkflowMessage,
  Milestone,
  NetworkAwareWorkflowCard,
  NetworkAwareWorkflowMessage,
  PostableCollection,
  Workflow,
  WorkflowCard,
  WorkflowMessage,
  WorkflowName,
  WorkflowPostable,
  conditionalCancelationMessage,
} from '@cardstack/web-client/models/workflow';
import Layer1Network from '@cardstack/web-client/services/layer1-network';
import Layer2Network from '@cardstack/web-client/services/layer2-network';
import { inject as service } from '@ember/service';
import { currentNetworkDisplayInfo as c } from '@cardstack/web-client/utils/web3-strategies/network-display-info';
import { capitalize } from '@ember/string';
import BN from 'bn.js';
import { tracked } from '@glimmer/tracking';
import { taskFor } from 'ember-concurrency-ts';
import {
  rawTimeout,
  TaskGenerator,
  waitForProperty,
  waitForQueue,
} from 'ember-concurrency';
import { task } from 'ember-concurrency-decorators';
import { formatWeiAmount } from '@cardstack/web-client/helpers/format-wei-amount';
import { action } from '@ember/object';
import { standardCancelationPostables } from '@cardstack/web-client/models/workflow/cancelation-helpers';
import RestorableWorkflowComponent from '../restorable-workflow-component';

const FAILURE_REASONS = {
  DISCONNECTED: 'DISCONNECTED',
  ACCOUNT_CHANGED: 'ACCOUNT_CHANGED',
  RESTORATION_L1_ADDRESS_CHANGED: 'RESTORATION_L1_ADDRESS_CHANGED',
  RESTORATION_L1_DISCONNECTED: 'RESTORATION_L1_DISCONNECTED',
  RESTORATION_L2_ADDRESS_CHANGED: 'RESTORATION_L2_ADDRESS_CHANGED',
  RESTORATION_L2_DISCONNECTED: 'RESTORATION_L2_DISCONNECTED',
} as const;

export const MILESTONE_TITLES = [
  `Connect ${c.layer1.conversationalName} wallet`,
  `Check ${c.layer1.nativeTokenSymbol} balance`,
  `Connect ${c.layer2.conversationalName} wallet`,
  `Withdraw from ${c.layer2.conversationalName}`,
  `Bridge tokens to ${c.layer1.conversationalName}`,
  `Claim tokens on ${c.layer1.conversationalName}`,
];

export const WORKFLOW_VERSION = 5;

class CheckBalanceWorkflowMessage
  extends WorkflowPostable
  implements IWorkflowMessage
{
  @tracked minimumBalanceForWithdrawalClaim: BN | undefined;

  cardName = 'CHECK_BALANCE_MESSAGE';

  constructor() {
    super();
    taskFor(this.fetchMininumBalanceForWithdrawalClaimTask).perform();
  }

  @task
  *fetchMininumBalanceForWithdrawalClaimTask() {
    yield waitForQueue('afterRender'); // avoid error from using and setting workflow in the render queue
    yield waitForProperty(this, 'layer1Network', Boolean);
    // couldn't use waitForProperty for the layer1Network.defaultTokenBalance because waitForProperty is not reliable for tracked properties
    yield taskFor(this.waitUntilTask).perform(
      () => !!this.layer1Network.defaultTokenBalance
    );
    // HACK: We are passing "DAI" in the next line, but the user hasn't actually specified what token they will be withdrawing yet.
    let minimum: BN =
      yield this.layer1Network.getEstimatedGasForWithdrawalClaim('DAI');
    this.minimumBalanceForWithdrawalClaim = minimum;
    this.workflow?.session.setValue(
      'minimumBalanceForWithdrawalClaim',
      minimum
    );

    this.isComplete = true;
  }

  get message() {
    let { layer1Network, minimumBalanceForWithdrawalClaim } = this;
    if (
      layer1Network.defaultTokenBalance === undefined ||
      minimumBalanceForWithdrawalClaim === undefined
    ) {
      return 'Checking your balance...';
    }
    if (
      layer1Network.defaultTokenBalance!.gte(minimumBalanceForWithdrawalClaim)!
    ) {
      return `Checking your balance...

      It looks like you have enough ${
        c.layer1.nativeTokenSymbol
      } in your account on ${
        c.layer1.fullName
      } to perform the last step of this withdrawal workflow, which requires ~${formatWeiAmount(
        minimumBalanceForWithdrawalClaim,
        false
      )} ${c.layer1.nativeTokenSymbol}.`;
    } else {
      return `Checking your balance...

      The last step of this withdrawal requires that you have at least **~${formatWeiAmount(
        minimumBalanceForWithdrawalClaim,
        false
      )} ${c.layer1.nativeTokenSymbol}**.
      You only have **${formatWeiAmount(
        layer1Network.defaultTokenBalance,
        false
      )} ${c.layer1.nativeTokenSymbol}**. You will need to deposit more
      ${
        c.layer1.nativeTokenSymbol
      } to your account shown below to continue the withdrawal.`;
    }
  }

  get layer1Network() {
    let workflow = this.workflow as WithdrawalWorkflow;
    return workflow?.layer1Network;
  }

  @task *waitUntilTask(
    predicate: () => boolean,
    delayMs = 1000
  ): TaskGenerator<void> {
    while (!predicate()) {
      yield rawTimeout(delayMs);
    }
  }
}

export class WithdrawalWorkflow extends Workflow {
  @service declare layer1Network: Layer1Network;
  @service declare layer2Network: Layer2Network;

  name = 'WITHDRAWAL' as WorkflowName;
  version = WORKFLOW_VERSION;

  milestones = [
    new Milestone({
      title: MILESTONE_TITLES[0],
      editableIf(session) {
        return !session.getValue('relayTokensTxnHash');
      },
      postables: [
        new WorkflowMessage({
          message: 'Hi there, it's good to see you!',
        }),
        new WorkflowMessage({
          message: `In order to make a withdrawal, you need to connect two wallets:

  * **${c.layer1.fullName} wallet:**

      Linked to the ${c.layer1.shortName} blockchain on ${c.layer1.conversationalName}
  * **${c.layer2.fullName} wallet:**

      Linked to the ${c.layer2.shortName} blockchain for low-cost transactions
`,
        }),
        new NetworkAwareWorkflowMessage({
          message: `Looks like you've already connected your ${c.layer1.fullName} wallet, which you can see below.
          Please continue with the next step of this workflow.`,
          includeIf() {
            return this.hasLayer1Account;
          },
        }),
        new NetworkAwareWorkflowCard({
          cardName: 'LAYER1_CONNECT',
          componentName: 'card-pay/layer-one-connect-card',
        }),
      ],
      completedDetail: `${capitalize(
        c.layer1.conversationalName
      )} wallet connected`,
    }),
    new Milestone({
      title: MILESTONE_TITLES[1],
      editableIf(session) {
        return !session.getValue('relayTokensTxnHash');
      },
      postables: [
        new CheckBalanceWorkflowMessage(),
        new WorkflowCard({
          cardName: 'CHECK_BALANCE',
          componentName: 'card-pay/withdrawal-workflow/check-balance',
        }),
      ],
      completedDetail: `${c.layer1.nativeTokenSymbol} balance checked`,
    }),
    new Milestone({
      title: MILESTONE_TITLES[2],
      editableIf(session) {
        return !session.getValue('relayTokensTxnHash');
      },
      postables: [
        new NetworkAwareWorkflowMessage({
          message: `Looks like you've already connected your ${c.layer2.fullName} wallet, which you can see below.
Please continue with the next step of this workflow.`,
          includeIf() {
            return this.hasLayer2Account;
          },
        }),
        new NetworkAwareWorkflowMessage({
          message: `You have connected your ${c.layer1.fullName} wallet. Now it's time to connect your ${c.layer2.fullName}
wallet via your Cardstack Wallet mobile app. If you don't have the app installed, please do so now.`,
          includeIf() {
            return !this.hasLayer2Account;
          },
        }),
        new NetworkAwareWorkflowMessage({
          message: `Once you have installed the app, open the app and add an existing wallet/account or create a
new wallet/account. Use your account to scan this QR code, which will connect your account
with Card Pay.`,
          includeIf() {
            return !this.hasLayer2Account;
          },
        }),
        new WorkflowCard({
          cardName: 'LAYER2_CONNECT',
          componentName: 'card-pay/layer-two-connect-card',
        }),
      ],
      completedDetail: `${c.layer2.conversationalName} wallet connected`,
    }),
    new Milestone({
      title: MILESTONE_TITLES[3],
      postables: [
        new WorkflowMessage({
          message: `Please choose the asset you would like to withdraw.`,
        }),
        new WorkflowCard({
          cardName: 'CHOOSE_BALANCE',
          componentName: 'card-pay/withdrawal-workflow/choose-balance',
          editableIf(session) {
            return !session.getValue('relayTokensTxnHash');
          },
        }),
        new WorkflowMessage({
          message: 'How much would you like to withdraw from your balance?',
        }),
        new WorkflowCard({
          cardName: 'TRANSACTION_AMOUNT',
          componentName: 'card-pay/withdrawal-workflow/transaction-amount',
        }),
      ],
      completedDetail: `Withdrawn from ${c.layer2.conversationalName}`,
    }),
    new Milestone({
      title: MILESTONE_TITLES[4],
      postables: [
        new WorkflowMessage({
          message: `Now that you have withdrawn funds from the ${c.layer2.fullName},
          your tokens will be bridged to ${c.layer1.fullName}. You can check the status below.`,
        }),
        new WorkflowCard({
          cardName: 'TRANSACTION_STATUS',
          componentName: 'card-pay/withdrawal-workflow/transaction-status',
        }),
      ],
      completedDetail: `Tokens bridged to ${c.layer1.conversationalName}`,
    }),
    new Milestone({
      title: MILESTONE_TITLES[5],
      postables: [
        new WorkflowMessage({
          message: `As a final step, please sign this transaction to claim the bridged tokens into your
          ${c.layer1.fullName} wallet. You will have to pay ${c.layer1.conversationalName} gas fee for this operation.`,
        }),
        new WorkflowCard({
          cardName: 'TOKEN_CLAIM',
          componentName: 'card-pay/withdrawal-workflow/token-claim',
        }),
      ],
      completedDetail: `Tokens claimed on ${c.layer1.conversationalName}`,
    }),
  ];
  epilogue = new PostableCollection([
    new WorkflowMessage({
      message: `Congrats! Your withdrawal is complete.`,
    }),
    new WorkflowCard({
      cardName: 'TRANSACTION_CONFIRMED',
      componentName: 'card-pay/withdrawal-workflow/transaction-confirmed',
    }),
    new WorkflowMessage({
      message: `This is the remaining balance in your ${c.layer2.fullName} wallet:`,
    }),
    new WorkflowCard({
      cardName: 'EPILOGUE_SAFE_BALANCE_CARD',
      componentName: 'card-pay/safe-balance-card',
      config: {
        safeAddressKey: 'withdrawalSafe',
      },
    }),
    new WorkflowCard({
      cardName: 'EPILOGUE_NEXT_STEPS',
      componentName: 'card-pay/withdrawal-workflow/next-steps',
    }),
  ]);
  cancelationMessages = new PostableCollection([
    conditionalCancelationMessage({
      forReason: FAILURE_REASONS.DISCONNECTED,
      message:
        'It looks like your wallet(s) got disconnected. If you still want to withdraw tokens, please start again by connecting your wallet(s).',
    }),
    conditionalCancelationMessage({
      forReason: FAILURE_REASONS.ACCOUNT_CHANGED,
      message:
        'It looks like you changed accounts in the middle of this workflow. If you still want to withdraw funds, please restart the workflow.',
    }),
    conditionalCancelationMessage({
      forReason: FAILURE_REASONS.RESTORATION_L1_ADDRESS_CHANGED,
      message:
        'You attempted to restore an unfinished workflow, but you changed your Layer 1 wallet address. Please restart the workflow.',
    }),
    conditionalCancelationMessage({
      forReason: FAILURE_REASONS.RESTORATION_L2_ADDRESS_CHANGED,
      message:
        'You attempted to restore an unfinished workflow, but you changed your Cardstack Wallet address. Please restart the workflow.',
    }),
    conditionalCancelationMessage({
      forReason: FAILURE_REASONS.RESTORATION_L2_DISCONNECTED,
      message:
        'You attempted to restore an unfinished workflow, but your Cardstack Wallet got disconnected. Please restart the workflow.',
    }),
    conditionalCancelationMessage({
      forReason: FAILURE_REASONS.RESTORATION_L1_DISCONNECTED,
      message:
        'You attempted to restore an unfinished workflow, but your Layer 1 wallet got disconnected. Please restart the workflow.',
    }),
    ...standardCancelationPostables(),
  ]);

  restorationErrors() {
    let { layer1Network, layer2Network } = this;

    let errors = super.restorationErrors();

    if (!layer1Network.isConnected) {
      errors.push(FAILURE_REASONS.RESTORATION_L1_DISCONNECTED);
    }

    let persistedLayer1Address = this.session.getValue<string>(
      'layer1WalletAddress'
    );
    if (
      layer1Network.isConnected &&
      persistedLayer1Address &&
      layer1Network.walletInfo.firstAddress !== persistedLayer1Address
    ) {
      errors.push(FAILURE_REASONS.RESTORATION_L1_ADDRESS_CHANGED);
    }

    if (!layer2Network.isConnected) {
      errors.push(FAILURE_REASONS.RESTORATION_L2_DISCONNECTED);
    }

    let persistedLayer2Address = this.session.getValue<string>(
      'layer2WalletAddress'
    );
    if (
      layer2Network.isConnected &&
      persistedLayer2Address &&
      layer2Network.walletInfo.firstAddress !== persistedLayer2Address
    ) {
      errors.push(FAILURE_REASONS.RESTORATION_L2_ADDRESS_CHANGED);
    }

    return errors;
  }

  beforeRestorationChecks() {
    return [this.layer1Network.waitForAccount];
  }

  constructor(owner: unknown, workflowPersistenceId?: string) {
    super(owner, workflowPersistenceId);
    this.attachWorkflow();
  }
}

export default class WithdrawalWorkflowComponent extends RestorableWorkflowComponent<WithdrawalWorkflow> {
  @service declare layer1Network: Layer1Network;
  @service declare layer2Network: Layer2Network;

  get workflowClass() {
    return WithdrawalWorkflow;
  }

  @action onDisconnect() {
    this.workflow?.cancel(FAILURE_REASONS.DISCONNECTED);
  }

  @action onAccountChanged() {
    this.workflow?.cancel(FAILURE_REASONS.ACCOUNT_CHANGED);
  }
}


text:
from flask import Flask, jsonify, abort, request, send_from_directory, redirect, url_for
import json
import os

application = Flask(__name__, static_url_path='')

@application.after_request
def after_request(response):
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers['Cache-Control'] = 'public, max-age=0'
    return response

@application.route('/active')
def active():
    if os.path.exists('/dev/ttyACM0'):
        return jsonify({"active": True})
    return jsonify({"active": False})

@application.route('/upload', methods=['POST'])
def upload():
    data = request.get_json()
    if data is None or 'bitmap' not in data:
        abort(400)

    with open('dmatrix/dmatrix.ino.tmpl', 'r') as f:
        content = f.read();
        content = content.replace('///BITMAP///', data['bitmap'])
    with open('dmatrix/dmatrix.ino', 'w') as f:
        f.write(content)

    res= os.system('arduino --verbose-upload --port /dev/ttyACM0 --upload dmatrix/dmatrix.ino')
    return jsonify({"result":res})

@application.route('/html/<path:path>')
def send_js(path):
    return send_from_directory('../', path)

@application.route('/')
def root():
    return redirect('/html/index.html')

if __name__ == '__main__':
    application.run(debug=True,host='0.0.0.0', port=5000)


text:
#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_
#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_

#include "absl/container/flat_hash_set.h"
#include "llvm/ADT/StringRef.h"
#include "mlir/IR/MLIRContext.h"  // from @llvm-project
#include "mlir/IR/Module.h"  // from @llvm-project
#include "mlir/IR/Operation.h"  // from @llvm-project
#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h"
#include "tensorflow/core/framework/function.h"
#include "tensorflow/core/framework/graph.pb.h"
#include "tensorflow/core/framework/node_def.pb.h"
#include "tensorflow/core/graph/graph.h"
#include "tensorflow/stream_executor/lib/statusor.h"

namespace tensorflow {
using stream_executor::port::StatusOr;

// Given an MLIR module, returns a GraphDef.
StatusOr<std::unique_ptr<GraphDef>> ConvertMlirToGraphdef(
    mlir::ModuleOp module, const GraphExportConfig& configs);

// Converts an MLIR module to TensorFlow graph and FunctionLibraryDefinition.
// The "main" function of the module is stored in the graph and the rest of
// functions are stored in the library. Control ret nodes are stored separately
// in `control_ret_nodes`.
stream_executor::port::Status ConvertMlirToGraph(
    mlir::ModuleOp module, const GraphExportConfig& configs,
    std::unique_ptr<Graph>* graph, FunctionLibraryDefinition* flib_def,
    absl::flat_hash_set<Node*>* control_ret_nodes);

// Converts an MLIR module to TensorFlow graph and FunctionLibraryDefinition.
// The "main" function of the module is stored in the graph and the rest of
// functions are stored in the library.
stream_executor::port::Status ConvertMlirToGraph(
    mlir::ModuleOp module, const GraphExportConfig& configs,
    std::unique_ptr<Graph>* graph, FunctionLibraryDefinition* flib_def);
}  // namespace tensorflow

#endif  // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
-->
<resources>

  <!-- Material bridge themes (day/night versions) for dialogs. -->
  <style name="Theme.MaterialComponents.DayNight.Dialog.Bridge" parent="Theme.MaterialComponents.Dialog.Bridge"/>

  <style name="Theme.MaterialComponents.DayNight.Dialog.Alert.Bridge" parent="Theme.MaterialComponents.Dialog.Alert.Bridge"/>

  <style name="Theme.MaterialComponents.DayNight.Dialog.MinWidth.Bridge" parent="Theme.MaterialComponents.Dialog.MinWidth.Bridge"/>

  <style name="Theme.MaterialComponents.DayNight.Dialog.FixedSize.Bridge" parent="Theme.MaterialComponents.Dialog.FixedSize.Bridge"/>

</resources>


text:
<!DOCTYPE html>

	<title>edit - @@name@@</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<meta charset="utf-8" />
	<link rel="stylesheet" type="text/css" href="/edit.css" />

preview source

WebEdit - @@name@@

	<form action="/cgi-bin/save" method="post"
	    enctype="application/x-www-form-urlencoded">
		<input type="hidden" name="path" value="@@name@@" />
		<textarea id="editor" name="content"
		    onkeyup="view(this.value)">@@source@@</textarea>
		<input type="submit" />
	</form>

	<textarea id="source"></textarea>


text:
package com.sensepost.yeti.models;

import java.util.ArrayList;
import com.sensepost.yeti.results.ReverseLookupResult;

/**
 *
 * @author willemm
 */
public class ReverseLookupModel extends BaseModel {

    public ReverseLookupModel() {
        super();
        this.setColumnNames(new String[]{"IP Address", "Hostname", "Domain", "Keep"});
        this.setTypes(new Class[]{
            java.lang.String.class,
            java.lang.String.class,
            java.lang.String.class,
            java.lang.Boolean.class
        }
        );
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        ReverseLookupResult row = (ReverseLookupResult) this.data.get(rowIndex);
        if (row == null) {
            return null;
        }
        switch (columnIndex) {
            case 0:
                return row.getIpAddress();
            case 1:
                return row.getHostName();
            case 2:
                return row.getDomainName();
            case 3:
                return row.getKeep();
            default:
                return null;
        }
    }

    @Override
    public void setValueAt(Object value, int row, int col) {
        ReverseLookupResult rowData = (ReverseLookupResult) this.data.get(row);
        if (rowData == null) {
            return;
        }
        switch (col) {
            case 0:
                rowData.setIpAddress(value.toString());
            case 1:
                rowData.setHostName(value.toString());
            case 2:
                rowData.setDomainName(value.toString());
            case 3:
                rowData.setKeep((Boolean) value);

        }
        fireTableCellUpdated(row, col);
    }

    @Override
    public void addRow(Object item) {
        this.data.add((ReverseLookupResult) item);
        fireTableDataChanged();
    }

    @Override
    public void addRows(ArrayList<Object> items) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}


text:
package com.github.izhangzhihao.SpringMVCSeedProject.Service;

import com.github.izhangzhihao.SpringMVCSeedProject.Model.User;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.github.izhangzhihao.SpringMVCSeedProject.Utils.SHAUtils.getSHA_256;

@Service
public class UserService extends BaseService<User> {

    /**
     * 创建加盐的密码SHA256值
     *
     * @param user 用户实体
     * @return 密码加盐后的实体
     */
    public static User makeSHA256PasswordWithSalt(@NotNull User user) {
        user.setPassWord(
                getSHA_256(
                        getSHA_256(
                                user.getUserName() + user.getPassWord()
                        )
                )
        );
        return user;
    }

    /**
     * 保存对象
     *
     * @param user 需要添加的对象
     */
    @Override
    public void save(@NotNull User user){
        super.save(makeSHA256PasswordWithSalt(user));
    }

    /**
     * 批量保存对象
     *
     * @param userList 需要增加的对象的集合
     *                  失败会抛异常
     */
    @Override
    public void saveAll(@NotNull List<User> userList){
        userList.forEach(
                UserService::makeSHA256PasswordWithSalt
        );
        super.saveAll(userList);
    }

    /**
     * 更新或保存对象的PassWord
     *
     * @param user 需要更新的对象
     *              失败会抛出异常
     */
    public void updatePassWord(@NotNull User user){
        super.saveOrUpdate(makeSHA256PasswordWithSalt(user));
    }

    /**
     * 批量更新或保存对象的PassWord
     *
     * @param userList 需要更新或保存的对象
     *                  失败会抛出异常
     */
    public void updateAllPassWord(@NotNull List<User> userList){
        userList.forEach(
                UserService::makeSHA256PasswordWithSalt
        );
        super.saveOrUpdateAll(userList);
    }

    /**
     * 更新或保存对象,不允许通过此方法修改密码!
     *
     * @param user 需要更新的对象
     *              失败会抛出异常
     */
    @Override
    public void saveOrUpdate(@NotNull User user){
        super.saveOrUpdate(user);
    }

    /**
     * 批量更新或保存对象,不允许通过此方法修改密码!
     *
     * @param userList 需要更新或保存的对象
     *                  失败会抛出异常
     */
    @Override
    public void saveOrUpdateAll(@NotNull List<User> userList){
        super.saveOrUpdateAll(userList);
    }
}


text:
"use strict";
var $ = require("jquery"),
    commonUtils = require("../../core/utils/common"),
    SelectionStrategy = require("./selection.strategy"),
    errors = require("../widget/ui.errors"),
    dataQuery = require("../../data/query");
module.exports = SelectionStrategy.inherit({
    getSelectedItems: function() {
        return this._loadFilteredData(this.options.selectionFilter)
    },
    getSelectedItemKeys: function() {
        var d = $.Deferred(),
            that = this,
            key = this.options.key(),
            select = commonUtils.isString(key) ? [key] : key;
        this._loadFilteredData(this.options.selectionFilter, null, select).done(function(items) {
            var keys = items.map(function(item) {
                return that.options.keyOf(item)
            });
            d.resolve(keys)
        }).fail(d.reject);
        return d.promise()
    },
    selectedItemKeys: function(keys, preserve, isDeselect, isSelectAll) {
        if (isSelectAll) {
            var filter = this.options.filter();
            if (!filter) {
                this._setOption("selectionFilter", isDeselect ? [] : null)
            } else {
                this._addSelectionFilter(isDeselect, filter, false)
            }
        } else {
            if (!preserve) {
                this._setOption("selectionFilter", [])
            }
            for (var i = 0; i < keys.length; i++) {
                if (isDeselect) {
                    this.removeSelectedItem(keys[i])
                } else {
                    this.addSelectedItem(keys[i])
                }
            }
        }
        this.onSelectionChanged();
        return $.Deferred().resolve()
    },
    setSelectedItems: function(keys) {
        this._setOption("selectionFilter", null);
        for (var i = 0; i < keys.length; i++) {
            this.addSelectedItem(keys[i])
        }
    },
    isItemDataSelected: function(itemData) {
        return this.isItemKeySelected(itemData)
    },
    isItemKeySelected: function(itemData) {
        var selectionFilter = this.options.selectionFilter;
        if (!selectionFilter) {
            return true
        }
        return !!dataQuery([itemData]).filter(selectionFilter).toArray().length
    },
    _processSelectedItem: function(key) {
        var keyField = this.options.key(),
            filter = [keyField, "=", key];
        if ($.isArray(keyField)) {
            filter = [];
            for (var i = 0; i < keyField.length; i++) {
                filter.push([keyField[i], "=", key[keyField[i]]]);
                if (i !== keyField.length - 1) {
                    filter.push("and")
                }
            }
        }
        return filter
    },
    addSelectedItem: function(key) {
        var filter = this._processSelectedItem(key);
        this._addSelectionFilter(false, filter, true)
    },
    removeSelectedItem: function(key) {
        var filter = this._processSelectedItem(key);
        this._addSelectionFilter(true, filter, true)
    },
    validate: function() {
        var key = this.options.key;
        if (key && void 0 === key()) {
            throw errors.Error("E1042")
        }
    },
    _hasSameFilter: function(selectionFilter, currentFilter) {
        return this._findSubFilter(selectionFilter, currentFilter) >= 0
    },
    _findSubFilter: function(selectionFilter, filter) {
        if (!selectionFilter) {
            return -1
        }
        var filterString = JSON.stringify(filter);
        for (var index = 0; index < selectionFilter.length; index++) {
            var subFilter = selectionFilter[index];
            if (subFilter && JSON.stringify(subFilter) === filterString) {
                return index
            }
        }
        return -1
    },
    _isLastSubFilter: function(selectionFilter, filter) {
        if (selectionFilter && filter) {
            return this._findSubFilter(selectionFilter, filter) === selectionFilter.length - 1
        }
        return false
    },
    _addFilterOperator: function(selectionFilter, filterOperator) {
        if (selectionFilter.length > 1 && commonUtils.isString(selectionFilter[1]) && selectionFilter[1] !== filterOperator) {
            selectionFilter = [selectionFilter]
        }
        if (selectionFilter.length) {
            selectionFilter.push(filterOperator)
        }
        return selectionFilter
    },
    _denormalizeFilter: function(filter) {
        if (filter && commonUtils.isString(filter[0])) {
            filter = [filter]
        }
        return filter
    },
    _addSelectionFilter: function(isDeselect, filter, isUnique) {
        var that = this,
            needAddFilter = true,
            currentFilter = isDeselect ? ["!", filter] : filter,
            selectionFilter = that.options.selectionFilter || [];
        selectionFilter = that._denormalizeFilter(selectionFilter);
        if (selectionFilter && selectionFilter.length) {
            if (that._hasSameFilter(selectionFilter, currentFilter)) {
                return
            }
            if (that._removeInvertedFilter(selectionFilter, isDeselect, filter)) {
                needAddFilter = !isUnique
            }
            if (needAddFilter) {
                selectionFilter = that._addFilterOperator(selectionFilter, isDeselect ? "and" : "or")
            }
        }
        if (needAddFilter) {
            selectionFilter.push(currentFilter)
        }
        selectionFilter = that._normalizeFilter(selectionFilter);
        that._setOption("selectionFilter", !isDeselect && !selectionFilter.length ? null : selectionFilter)
    },
    _normalizeFilter: function(filter) {
        if (filter && 1 === filter.length) {
            filter = filter[0]
        }
        return filter
    },
    _removeInvertedFilter: function(selectionFilter, isDeselect, filter) {
        filter = isDeselect ? filter : ["!", filter];
        var filterIndex = this._findSubFilter(selectionFilter, filter);
        if (JSON.stringify(filter) === JSON.stringify(selectionFilter)) {
            selectionFilter.splice(0, selectionFilter.length);
            return true
        }
        if (filterIndex >= 0) {
            if (filterIndex > 0) {
                selectionFilter.splice(filterIndex - 1, 2)
            } else {
                selectionFilter.splice(filterIndex, 2)
            }
            return true
        }
        return false
    },
    getSelectAllState: function() {
        var filter = this.options.filter(),
            selectionFilter = this.options.selectionFilter;
        if (!selectionFilter) {
            return true
        }
        if (!selectionFilter.length) {
            return false
        }
        if (!filter || !filter.length) {
            return
        }
        selectionFilter = this._denormalizeFilter(selectionFilter);
        if (this._isLastSubFilter(selectionFilter, filter)) {
            return true
        }
        if (this._isLastSubFilter(selectionFilter, ["!", filter])) {
            return false
        }
        return
    }
});


text:
#ifndef __ARRAYMEM_H
#define __ARRAYMEM_H

#include <stdlib.h>

#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])

#define ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])

#define NEW_ARRAY(type,count) (type *) malloc((count) * sizeof(type))

#define DELETE_ARRAY(array) free((void *) (array))

#define GROW_ARRAY(array,newSize) realloc((void *) (array), (newSize) * sizeof (array)[0])

#endif


text:
namespace Microsoft.JScript
{

using System;
using System.CodeDom;
using Microsoft.JScript.Vsa;
using Microsoft.Vsa;

internal sealed class VsaCodeItem : VsaItem, IVsaCodeItem
{
	// Internal state.
	private String sourceText;
	private JNode parsed;

	// Constructor.
	internal VsaCodeItem(VsaEngine engine, String name, VsaItemFlag flag)
			: base(engine, name, VsaItemType.Code, flag)
			{
				sourceText = null;
				parsed = null;
			}

	// Implement the "IVsaCodeItem" interface.
#if CONFIG_CODEDOM
	public CodeObject CodeDOM
			{
				get
				{
					lock(this)
					{
						CheckForClosed();
						throw new VsaException(VsaError.CodeDOMNotAvailable);
					}
				}
			}
#endif
	public String SourceText
			{
				get
				{
					lock(this)
					{
						CheckForClosed();
						return sourceText;
					}
				}
				set
				{
					lock(this)
					{
						CheckForClosed();
						sourceText = value;
					}
				}
			}
	public void AddEventSource(String eventSourceName, String eventSourceType)
			{
				lock(this)
				{
					CheckForClosed();
					throw new NotSupportedException();
				}
			}
	public void AppendSourceText(String text)
			{
				lock(this)
				{
					CheckForClosed();
					sourceText += text;
				}
			}
	public void RemoveEventSource(String eventSourceName)
			{
				lock(this)
				{
					CheckForClosed();
					throw new NotSupportedException();
				}
			}

	// Reset the compiled state of this item.
	internal override void Reset()
			{
				parsed = null;
			}

	// Compile this item.
	internal override bool Compile()
			{
				if(parsed == null && sourceText != null)
				{
					Context context = new Context(sourceText);
					context.codebase = new CodeBase(codebaseOption, this);
					context.codebase.site = engine.Site;
					JSParser parser = new JSParser(context);
					parser.printSupported = engine.printSupported;
					try
					{
						parsed = parser.ParseSource(false);
					}
					catch(JScriptException e)
					{
#if !CONFIG_SMALL_CONSOLE
						ScriptStream.Error.WriteLine(e.Message);
#else
						ScriptStream.WriteLine(e.Message);
#endif
						return false;
					}
					if(parser.numErrors > 0)
					{
						// There were errors that were partially recovered.
						parsed = null;
						return false;
					}
				}
				return true;
			}

	// Run this item.
	internal override void Run()
			{
				if(parsed != null)
				{
					int size = engine.ScriptObjectStackSize();
					try
					{
						parsed.Eval(engine);
					}
					finally
					{
						// Make sure we return to the global level, even if
						// some aberrant exception caused us to miss any
						// of the scope pops.  This is just paranoia.
						engine.ScriptObjectStackSetSize(size);
					}
				}
			}

}; // class VsaCodeItem

}; // namespace Microsoft.JScript


text:
<?php

namespace ZF\ApiProblem\Factory;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZF\ApiProblem\Listener\RenderErrorListener;

class RenderErrorListenerFactory implements FactoryInterface
{
    /**
     * {@inheritDoc}
     * @return RenderErrorListener
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config            = $serviceLocator->get('Config');
        $displayExceptions = false;

        if (isset($config['view_manager'])
            && isset($config['view_manager']['display_exceptions'])
        ) {
            $displayExceptions = (bool) $config['view_manager']['display_exceptions'];
        }

        $listener = new RenderErrorListener();
        $listener->setDisplayExceptions($displayExceptions);

        return $listener;
    }
}


text:
using System;
using System.Collections.Generic;

namespace Daisy.Terminal
{
    public class MultiDictionary<T, K> : Dictionary<T, List<K>>
    {
        public void AddValue(T key, K newItem)
        {
            InitKey(key);
            this[key].Add(newItem);
        }

        public void AddValues(T key, IEnumerable<K> newItems)
        {
            InitKey(key);
            this[key].AddRange(newItems);
        }

        public bool RemoveValue(T key, K value)
        {
            if (!ContainsKey(key))
            {
                return false;
            }

            this[key].Remove(value);

            if (this[key].Count == 0)
            {
                Remove(key);
            }

            return true;
        }

        public bool RemoveValues(T key, Predicate<K> match)
        {
            if (!ContainsKey(key))
            {
                return false;
            }

            this[key].RemoveAll(match);

            if (this[key].Count == 0)
            {
                Remove(key);
            }

            return true;
        }

        private void InitKey(T key)
        {
            if (!ContainsKey(key))
            {
                this[key] = new List<K>();
            }
        }
    }
}


text:
package org.apache.beam.runners.core.construction;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;

import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import javax.annotation.Nullable;
import org.apache.beam.model.pipeline.v1.RunnerApi;
import org.apache.beam.model.pipeline.v1.RunnerApi.ReadPayload;
import org.apache.beam.sdk.coders.AtomicCoder;
import org.apache.beam.sdk.coders.ByteArrayCoder;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.CoderException;
import org.apache.beam.sdk.coders.StringUtf8Coder;
import org.apache.beam.sdk.io.BoundedSource;
import org.apache.beam.sdk.io.CountingSource;
import org.apache.beam.sdk.io.Read;
import org.apache.beam.sdk.io.Source;
import org.apache.beam.sdk.io.UnboundedSource;
import org.apache.beam.sdk.io.UnboundedSource.CheckpointMark;
import org.apache.beam.sdk.options.PipelineOptions;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

/**
 * Tests for {@link ReadTranslation}.
 */
@RunWith(Parameterized.class)
public class ReadTranslationTest {

  @Parameters(name = "{index}: {0}")
  public static Iterable<Source<?>> data() {
    return ImmutableList.of(
        CountingSource.unbounded(),
        CountingSource.upTo(100L),
        new TestBoundedSource(),
        new TestUnboundedSource());
  }

  @Parameter(0)
  public Source<?> source;

  @Test
  public void testToFromProtoBounded() throws Exception {
    // TODO: Split into two tests.
    assumeThat(source, instanceOf(BoundedSource.class));
    BoundedSource<?> boundedSource = (BoundedSource<?>) this.source;
    Read.Bounded<?> boundedRead = Read.from(boundedSource);
    ReadPayload payload = ReadTranslation.toProto(boundedRead, SdkComponents.create());
    assertThat(payload.getIsBounded(), equalTo(RunnerApi.IsBounded.Enum.BOUNDED));
    BoundedSource<?> deserializedSource = ReadTranslation.boundedSourceFromProto(payload);
    assertThat(deserializedSource, Matchers.equalTo(source));
  }

  @Test
  public void testToFromProtoUnbounded() throws Exception {
    assumeThat(source, instanceOf(UnboundedSource.class));
    UnboundedSource<?, ?> unboundedSource = (UnboundedSource<?, ?>) this.source;
    Read.Unbounded<?> unboundedRead = Read.from(unboundedSource);
    ReadPayload payload = ReadTranslation.toProto(unboundedRead, SdkComponents.create());
    assertThat(payload.getIsBounded(), equalTo(RunnerApi.IsBounded.Enum.UNBOUNDED));
    UnboundedSource<?, ?> deserializedSource = ReadTranslation.unboundedSourceFromProto(payload);
    assertThat(deserializedSource, Matchers.equalTo(source));
  }

  private static class TestBoundedSource extends BoundedSource<String> {
    @Override
    public List<? extends BoundedSource<String>> split(
        long desiredBundleSizeBytes, PipelineOptions options) throws Exception {
      throw new UnsupportedOperationException();
    }

    @Override
    public long getEstimatedSizeBytes(PipelineOptions options) throws Exception {
      throw new UnsupportedOperationException();
    }

    @Override
    public BoundedReader<String> createReader(PipelineOptions options) throws IOException {
      throw new UnsupportedOperationException();
    }

    @Override
    public Coder<String> getOutputCoder() {
      return StringUtf8Coder.of();
    }

    @Override
    public boolean equals(Object other) {
      return other != null && other.getClass().equals(TestBoundedSource.class);
    }

    @Override
    public int hashCode() {
      return TestBoundedSource.class.hashCode();
    }
  }

  private static class TestUnboundedSource extends UnboundedSource<byte[], CheckpointMark> {
    @Override
    public Coder<byte[]> getOutputCoder() {
      return ByteArrayCoder.of();
    }

    @Override
    public List<? extends UnboundedSource<byte[], CheckpointMark>> split(
        int desiredNumSplits, PipelineOptions options) throws Exception {
      throw new UnsupportedOperationException();
    }

    @Override
    public UnboundedReader<byte[]> createReader(
        PipelineOptions options, @Nullable CheckpointMark checkpointMark) throws IOException {
      throw new UnsupportedOperationException();
    }

    @Override
    public Coder<CheckpointMark> getCheckpointMarkCoder() {
      return new TestCheckpointMarkCoder();
    }

    @Override
    public boolean equals(Object other) {
      return other != null && other.getClass().equals(TestUnboundedSource.class);
    }

    @Override
    public int hashCode() {
      return TestUnboundedSource.class.hashCode();
    }

    private static class TestCheckpointMarkCoder extends AtomicCoder<CheckpointMark> {
      @Override
      public void encode(CheckpointMark value, OutputStream outStream)
          throws CoderException, IOException {
        throw new UnsupportedOperationException();
      }

      @Override
      public CheckpointMark decode(InputStream inStream) throws CoderException, IOException {
        throw new UnsupportedOperationException();
      }
    }
  }
}


text:
var assert = require("assert"),
  should = require('should'),
  auth = require('../lib/authentication-strategy-factory');

describe('stevedore authentication module', function() {

  describe('instance', function() {

    it('should throw error when authentication type is not provided', function() {
      var options = {
        type: null
      };
      try {
        auth.instance(options);
        assert.fail("instance method should have thrown error as authentication type is not provided");
      } catch (e) {
        assert.equal(e.message, "authentication type must be provided");
      }
    });

    it('should throw error when authentication type is not supported', function() {
      var options = {
        type: 'unsupported'
      };
      try {
        auth.instance(options);
        assert.fail("instance method should have thrown error");
      } catch (e) {
        assert.equal(e.message, "requested authentication type [unsupported] is not supported");
      }
    });

    it('should throw error when authentication provider is not provided', function() {
      var options = {
        type: 'basic'
      };
      try {
        auth.instance(options);
        assert.fail("instance method should have thrown error as authentication provider is not defined");
      } catch (e) {
        assert.equal(e.message, "authentication provider must be provided");
      }
    });

    it('should throw error when authentication provider module is not defined', function() {
      var options = {
        type: 'basic',
        provider: {
          "function": "my-function"
        }
      };
      try {
        auth.instance(options);
        assert.fail("instance method should have thrown error as authentication provider module is not defined");
      } catch (e) {
        assert.equal(e.message, "authentication provider should be provided using the form: module and function");
      }
    });

    it('should throw error when authentication provider function is not defined', function() {
      var options = {
        type: 'basic',
        provider: {
          "module": "my-module"
        }
      };
      try {
        auth.instance(options);
        assert.fail("instance method should have thrown error as authentication provider function is not defined");
      } catch (e) {
        assert.equal(e.message, "authentication provider should be provided using the form: module and function");
      }
    });

    it('should create a valid authenticator', function() {
      var options = {
        type: 'basic',
        provider: {
          "module": "../test/fixtures/authentication",
          "function": "basic"
        }
      };
      var authenticator = auth.instance(options);
      assert.notEqual(authenticator, null);
    });

    it('authenticator should use defined authentication provider', function() {
      var options = {
        type: 'basic',
        provider: {
          "module": "../test/fixtures/authentication",
          "function": "basic"
        }
      };
      var authenticator = auth.instance(options);
      assert.notEqual(authenticator, null);
      authenticator.success = function(actual) {
        actual.should.be.true;
      };
      authenticator.authenticate({
        "headers": {
          "authorization": "Basic dGVzdDpzdGV2ZWRvcmU="
        }
      });
    });

    it('authenticator should use client certificate defined authentication provider', function() {
      var options = {
        type: 'client-cert',
        provider: {
          "module": "../test/fixtures/authentication",
          "function": "clientCertificate"
        }
      };
      var authenticator = auth.instance(options);
      assert.notEqual(authenticator, null);
      authenticator.success = function(actual) {
        actual.should.be.true;
      };
      authenticator.authenticate({
        'client': {
          'authorized': true
        },
        "connection": {
          getPeerCertificate: function() {
            return {
              'subject': {
                'cn': 'valid cn'
              }
            };
          }
        }
      });
    });
  });
});


text:
RenderTarget::RenderTarget() {
    mClearBuffersBits = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
    mClearColor = Vector4(0.5f, 0.5f, 0.5f, 1.f);
    mWidth = mHeight = 0;
    mViewports.clear();
}

RenderTarget::~RenderTarget() {
    for (ViewportMap::iterator iter = mViewports.begin();
         iter != mViewports.end(); ++iter) {
        delete iter->second;
    }
    mViewports.clear();
}

void RenderTarget::set(const uint _fboId, const uint _colorId, const uint _depthId) {
    fboId = _fboId;
    colorId = _colorId;
    depthId = _depthId;
}

void RenderTarget::setDimension(const int w, const int h) {
    mWidth = w;
    mHeight = h;
}

void RenderTarget::clearFrameBuffer(uint clearBuffers, const Vector4& color) {
    GL_clearColor(color.x, color.y, color.z, color.w);
    GL_clear(clearBuffers);
}

void RenderTarget::setupDefaultViewport(const int left, const int top,
                                        const int width, const int height) {
    setDimension(width, height);
    if (mViewports.empty()) {
        addViewport(0, left, top, mWidth, mHeight);
    }
}

Viewport* RenderTarget::getDefaultViewport() const {
    assert(!mViewports.empty() && "Error: default viewport is not set up properly.");
    return mViewports.begin()->second;
}

Viewport* RenderTarget::addViewport(int ZOrder, float left, float top,
                                    float width, float height) {
    // Check that no existing viewport with this Z-order.
    ViewportMap::iterator it = mViewports.find(ZOrder);
    if (it != mViewports.end()) {
        LOGD("Cannot create another viewport because another viewport with the z order %d already exists\n", ZOrder);
        return NULL;
    }
    // Add viewport to list. Order based on Z-Order
    Viewport* vp = new Viewport(this, Rect(left, top, width, height), ZOrder);
    mViewports.insert(ViewportMap::value_type(ZOrder, vp));
    return vp;
}


text:
Zulip uses a variant of GitHub Flavored Markdown (GFM) to allow you to easily format your messages.

## Summary

For a summary of message formatting in Zulip, click the ![A](/static/images/help/formatting.png) icon located at the bottom left of your messaging box or the cog (![cog](/static/images/help/cog.png)) in the upper right corner of the right sidebar and choose "Message formatting" from the drop-down menu.

The following modal window will appear.

![Message formatting modal](/static/images/help/message-formatting-summary.png)

## Emphasis

You can surround your test with a combination of asterisks `*` and tildes `~` to emphasize words or phrases in your messages.

### Italics

For italics, surround your text with `*asterisks*`.

![Italicized text](/static/images/help/italics-screenshot.png)

### Bold

For bold text, surround your text with `**two asterisks**`.

![Bold text](/static/images/help/bold-screenshot.png)

### Strikethrough

For strikethrough text, surround your text with `~~two tildes~~`.

![Strikethrough text](/static/images/help/strikethrough-screenshot.png)

### Extra emphasis

To add more variety, flavor, and emphasis to your messages, you can combine different styles of formatting.

![Extra emphasized text](/static/images/help/extra-emphasis-screenshot.png)

## Links

To include hyperlinks in your messages, you can either enter the link's url address directly or surround the link's display text with`[brackets]` and the url address of the link in `(parentheses)` immediately after.

![Link](/static/images/help/link-screenshot.png)

Zulip currently does not support image embedding through links.

## Lists

Begin each item in your list with `* an asterisk followed by a space` to include lists in your messages.

![Lists](/static/images/help/lists-screenshot.png)

## Emojis

Zulip features a variety of emojis provided by the [Noto Project](https://code.google.com/p/noto/). To include emojis in your messages, surround the emoji phrase with `:colons:`.

A dropdown will appear with suggested emojis as you enter the emoji phrase.

![Emojis](/static/images/help/emojis-screenshot.png)

A complete list of emojis can be found [here](http://www.webpagefx.com/tools/emoji-cheat-sheet/).

## Mentions

To call the attention of another member, you can alert other users by typing `@**username**"`

If you type `@` and then begin typing their email address or one of their names, and the system will offer you auto-completion suggestions.

![Mentions](/static/images/help/mention-screenshot.png)

Typing `@**all**` will alert all users in the stream, and a confirmation message will appear.

![Mention All](/static/images/help/all-confirm.png)

For more information on mentions, visit [here](/help/mention-a-team-member.md) for more information.

## Code

You can surround a portion of code with ``
`back-ticks`
`` to display it as inline code.

![Inline code](/static/images/help/inline-code-screenshot.png)

Multi-line blocks of code are either fenced by lines with <code>`````` three back-ticks```<code>```</code></code> or indented with four spaces.

![No code syntax highlighting](/static/images/help/no-syntax.png)

In addition, to highlight language syntax, add the file extension of the language (for example, Python would be **.py**) right after the first set of back-ticks.

![Python syntax highlighting](/static/images/help/python-syntax.png)

![JavaScript syntax highlighting](/static/images/help/javascript-syntax.png)

## Quotes

To insert quotes, you can either add a greater-than symbol ```>``` and a space before your phrase or submit it as a quote block by following the code syntax highlighting format.

![Quotes](/static/images/help/quotes-screenshot.png)


text:
package com.tasomaniac.muzei.tvshows.data;

import java.lang.annotation.Retention;

import javax.inject.Qualifier;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Qualifier
@Retention(RUNTIME)
public @interface OnlyUnwatched {
}


text:
package speakman.whatsshakingnz;

import android.test.AndroidTestCase;

import org.joda.time.DateTime;

/**
 * Created by Adam on 2016-03-17.
 */
public class InternalPreferencesTest extends AndroidTestCase {

    @Override
    public void setUp() throws Exception {
        super.setUp();
        clearPreferences();
    }

    @Override
    public void tearDown() throws Exception {
        super.tearDown();
        clearPreferences();
    }

    private void clearPreferences() {
        InternalPreferences prefs = new InternalPreferences(getContext());
        prefs.saveMostRecentUpdateTime(null);
        prefs.saveMostRecentlySeenEventOriginTime(null);
    }

    public void testMostRecentUpdateTimeIsStored() throws Exception {
        InternalPreferences prefs = new InternalPreferences(getContext());
        DateTime time = DateTime.now();
        prefs.saveMostRecentUpdateTime(time);
        assertEquals(time, prefs.getMostRecentUpdateTime());
    }

    public void testMotRecentUpdateTimeIsCleared() throws Exception {
        InternalPreferences prefs = new InternalPreferences(getContext());
        prefs.saveMostRecentUpdateTime(DateTime.now());
        prefs.saveMostRecentUpdateTime(null);
        assertNull(prefs.getMostRecentUpdateTime());
    }

    public void testMostRecentlySeenTimeIsStored() throws Exception {
        InternalPreferences prefs = new InternalPreferences(getContext());
        DateTime time = DateTime.now();
        prefs.saveMostRecentlySeenEventOriginTime(time);
        assertEquals(time, prefs.getMostRecentlySeenEventOriginTime());
    }

    public void testMostRecentlySeenTimeIsCleared() throws Exception {
        InternalPreferences prefs = new InternalPreferences(getContext());
        prefs.saveMostRecentlySeenEventOriginTime(DateTime.now());
        prefs.saveMostRecentlySeenEventOriginTime(null);
        assertNull(prefs.getMostRecentlySeenEventOriginTime());
    }
}


text:
package edu.virginia.psyc.templeton.persistence;

import org.mindtrails.persistence.QuestionnaireRepository;

public interface WhatIBelieveRepository extends QuestionnaireRepository<WhatIBelieve> {}


text:
/**
 * @file    debug.h
 * @brief   Global debugging flags
 * @author  Richard Roberts
 * @date    Feb 1, 2011
 */

#include <gtsam/base/FastMap.h>
#include <gtsam/global_includes.h>
#include <string>

// This file defines granular debugging flags that may be switched on and off
// at run time.  Typical usage is 'if(ISDEBUG("myFunction"))' to check if the
// 'myFunction' flag is enabled, and SETDEBUG("myFunction", true) to enable
// this flag, or SETDEBUG("myFunction", false) to disable it.
//
// Debug flags are created automatically as they are accessed, so they can be
// used immediately without explicitly creating them.  Each flag defaults to
// 'false', i.e. disabled.
//
// For these macro to have any effect, granular debugging must be enabled by
// defining GTSAM_ENABLE_DEBUG.  If NDEBUG is not defined, then
// GTSAM_ENABLE_DEBUG will be automatically defined and thus granular
// debugging enabled.

#ifndef NDEBUG
#ifndef GTSAM_ENABLE_DEBUG
#define GTSAM_ENABLE_DEBUG
#endif
#endif

namespace gtsam {
  GTSAM_EXTERN_EXPORT FastMap<std::string, ValueWithDefault<bool,false> > debugFlags;
}

#undef ISDEBUG
#undef SETDEBUG

#ifdef GTSAM_ENABLE_DEBUG

#define ISDEBUG(S) (gtsam::debugFlags[S])
#define SETDEBUG(S,V) ((void)(gtsam::debugFlags[S] = (V)))

#else

#define ISDEBUG(S) (false)
#define SETDEBUG(S,V) ((void)false)

#endif


text:
/*! HTML5 Boilerplate v4.3.0 | MIT License | http://h5bp.com/ */

/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html,
button,
input,
select,
textarea {
    color: #222;
}

html {
    font-size: 1em;
    line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight: h5bp.com/i
 * These selection rule sets have to be separate.
 * Customize the background color to match your design.
 */

::-moz-selection {
    background: #b3d4fc;
    text-shadow: none;
}

::selection {
    background: #b3d4fc;
    text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}

/*
 * Remove the gap between images, videos, audio and canvas and the bottom of
 * their containers: h5bp.com/i/440
 */

audio,
canvas,
img,
video {
    vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
    resize: vertical;
}

/* ==========================================================================
   Browse Happy prompt
   ========================================================================== */

.browsehappy {
    margin: 0.2em 0;
    background: #ccc;
    color: #000;
    padding: 0.2em 0;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

::selection {
    background: none;
}

body {
    background: #FFF;
    text-align: center;
    font-family: "Microsoft Yahei", sans-serif;
    font-size: 14px;
}

#preload {
    width: 31px;
    margin-left: -15px;
    position: absolute;
    left: 50%;
    top:35%;
    color: #FFF;
}
#loading-img img{
    width: 31px;
}
.container {
    width: 100%;
    max-width: 750px;
    margin: 0 auto;
}
.post {
    background-color: #FFF;
    color: #FFF;

    min-height: 280px;
    height: 280px;
    position: relative;

}
.post-content {
    font-size: 1.4em;
    line-height: 1.2em;
    position: relative;
    width: 80%;
    margin: 0px auto;
    text-align: center;
    padding-top: 2.5em;
    padding-bottom: 2.5em;

}
.post-meta {
    font-size: 1.2em;
    position: absolute;
    bottom: 0.5em;
    width: 100%;
    left: 0;
}

.post-location {
    float: left;
    width: 44%;
    text-align: left;
    padding-left: 5%;

}
.post-info {
    float: right;
    width: 44%;
    text-align: right;
    padding-right: 5%;
}
.post-commentsCount {
    float: left;
    width: 50%;
    display: inline-block;
}
.post-lovesCount {
    width: 49%;
    float: left;
    display: inline-block;
}
.post-mask {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background-size: 100% 100%;
    opacity: 0.6;

}
.insetShadow {
   -moz-box-shadow:    inset 0 0 100px rgba(0,0,0,0.3);
   -webkit-box-shadow: inset 0 0 100px rgba(0,0,0,0.3);
   box-shadow:         inset 0 0 100px rgba(0,0,0,0.3);
}
.boxShadow {
   -moz-box-shadow:    0 0 10px rgba(0,0,0,0.5);
   -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.5);
   box-shadow:         0 0 10px rgba(0,0,0,0.5);
}
.comments,.comment {
    list-style: none;
    margin: 0;
    padding: 0;
}
.comment {
    background: #cdcdcd;
    padding: 1.5em 0;
    border-bottom: 1px dashed #dadada;
}
.comment-download {
    position: relative;
    padding: 20px 0 5px;
    margin-bottom: 10px;
}
.comment-download-footer {
    height: 15px;
    background: url(../../app/img/bottom.png) repeat-x left top;
    width: 100%;
    position: absolute;
    bottom: -10px;
}
.comment-col-1, .comment-col-2 {

    display: inline-block;
}
.comment-col-1 {
    width: 40px;
    padding-left: 5%;
    float: left;
}
.comment-col-2 {
    width: 74%;
    padding-right: 5%;
    float: right;
}
.comment-content {
    text-align: left;
    font-size: 1.2em;
    line-height: 1.5em;
    padding: 2px 0;
}
.comment-more {
    color: #999;
    font-size: 0.8em;
}
.avatar {
    width: 24px;
    height: 24px;
    padding: 6px;
    border-radius: 18px;
    position: relative;
}
.avatarBackground {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    left: 0;
    top: 0;
    opacity: 0.6;
}
.avatar img {
    width: 100%;
    height: 100%;
    position: relative;
}

.icon-comment,.icon-heart {
    width: 18px;
    height: 1.4em;
    vertical-align: top;
    background: url(../../app/img/secret/icon-heart-fill@2x.png) no-repeat center center;
    background-size: 18px 18px;
    display: inline-block;
    margin-right: 10px;
}
.icon-comment {
    background-image: url(../../app/img/secret/icon-comment-fill@2x.png);
}

.topBanner {
    height: 64px;
    position: relative;
    display: block;

}
a {
    text-decoration: none;
    color: #444;
}
.topBanner-content {
    line-height: 64px;
    position: relative;

    color: #434343;
}
.topBanner img {
    max-width: 100%;
    max-height: 100%;
}
.logo-right {
    position: absolute;
    right: 0;
    top:0;
}
.qrcode {

   width: 140px;
   height: 140px;
   margin: 0 auto;
   border:1px solid #dedede;
   margin-bottom: 40px;
}
.qrcode img {
    width: 100%;
    height: 100%;
}
#foxhole{
    width: 48px;
}
#download {
    width: 100px;
    margin-bottom: 20px;
}
/*Cobalt Skyfall Aquamarine Olive Cash EmeraldSea Hopscotch Lavender Burst Cupid Peony Midnight  Vanilla */

.backgroundColor-Cobalt,
.backgroundColor-Skyfall,
.backgroundColor-Aquamarine,
.backgroundColor-Olive,
.backgroundColor-Cash,
.backgroundColor-EmeraldSea,
.backgroundColor-Hopscotch,
.backgroundColor-Lavender,
.backgroundColor-Burst,
.backgroundColor-Cupid,
.backgroundColor-Peony,
.backgroundColor-Midnight
 {
    background-color: #434343;
    color: #FFF;
}
.backgroundColor-Vanilla {
    background-color: #FFF;
    color: #434343;
}

.backgroundColor-Cobalt {
    background-color: #0047AB;
}
.backgroundColor-Skyfall {
    background-color: #00bfff;
}
.backgroundColor-Aquamarine {
    background-color: #66ddaa;
}
.backgroundColor-Olive {
    background-color: #808000;
}
.backgroundColor-Cash {
    background-color: #556b2f;
}
.backgroundColor-EmeraldSea {
    background-color: #0abab5;
}
.backgroundColor-Hopscotch {
    background-color: #b19cd9;
}
.backgroundColor-Lavender {
    background-color: #734f96;
}
.backgroundColor-Burst {
    background-color: #e9692c;
}
.backgroundColor-Burst {
    background-color: #e9692c;
}
.backgroundColor-Cupid {
    background-color: #ae3532;
}
.backgroundColor-Peony{
    background-color: #df6880;
}
.backgroundColor-Vanilla .icon-comment {
    background-image: url(../../app/img/secret/icon-comment-collectible-gray@2x.png);
}

.backgroundColor-Vanilla .icon-heart {
    background-image: url(../../app/img/secret/icon-heart-collectible-gray@2x.png);
}
/*Carbon Timber Disco  Haze Twilight Distressed Metal Tweed Grime Dream Denim Glow Plain Concrete */
.backgroundMask-Carbon,
.backgroundMask-Timber,
.backgroundMask-Disco,
.backgroundMask-Haze,
.backgroundMask-Twilight,
.backgroundMask-Distressed,
.backgroundMask-Metal,
.backgroundMask-Tweed,
.backgroundMask-Grime,
.backgroundMask-Dream,
.backgroundMask-Denim,
.backgroundMask-Glow,
.backgroundMask-Concrete,
.backgroundMask-Custom
{
    color: #FFF;
}
.backgroundMask-Plain {
    background-image: none;
}
.backgroundMask-Carbon {
    background-image: url(../../app/img/secret/mask-carbon.png);
}
.backgroundMask-Timber {
    background-image: url(../../app/img/secret/mask-wood.png);
}
.backgroundMask-Disco {
    background-image: url(../../app/img/secret/mask-techno.png);
}
.backgroundMask-haze {
    background-image: url(../../app/img/secret/mask-ethereal.png);
}
.backgroundMask-Twilight {
    background-image: url(../../app/img/secret/mask-twilight.png);
}
.backgroundMask-Distressed {
    background-image: url(../../app/img/secret/mask-metal.png);
}
.backgroundMask-Metal {
    background-image: url(../../app/img/secret/mask-metallic.png);
}
.backgroundMask-Tweed {
    background-image: url(../../app/img/secret/mask-tweed.png);
}
.backgroundMask-Grime {
    background-image: url(../../app/img/secret/mask-grime.png);
}
.backgroundMask-Dream {
    background-image: url(../../app/img/secret/mask-ethereal.png);
}
.backgroundMask-Denim {
    background-image: url(../../app/img/secret/mask-denim.png);
}
.backgroundMask-Glow {
    background-image: url(../../app/img/secret/mask-smoke.png);
}
.backgroundMask-Concrete {
    background-image: url(../../app/img/secret/mask-concrete.png);
}
.backgroundMask-Custom {
    background-position: center center;
    background-size: 100% auto;
    height: 100%;
    width: 100%;
    overflow: hidden;
}
.postBackground {
    position: absolute;
    left: 50%;
    top:50%;
    width: 120%;
}
.postIcon {
    width: 1px;
    height: 1px;
    overflow: hidden;
    position: absolute;
    left: 0;
    top: 0;
}
.pull-left {
    float: left;
    display: inline-block;
}
#bottomBanner {
    width: 160px;
    padding: 10px 15px;
    display: block;
    margin: 0 auto;
    text-align: left;
    font-size: 18px;
    vertical-align: top;
}
#bottomBanner img {
    margin-right: 15px;
    width: 35px;
}
#bottomBanner p {
    margin: 0;
}
.comment-download {
    border-radius: 0 0 10px 10px;
}
.comment-caret {
    width: 0;
    height: 0;
    border-left-width: 20px;
    border-right-width: 20px;
    border-top-width: 20px;
    border-bottom-width: 0;
    font-size: 1;
    line-height: 0;
    border-style: solid;
    border-color:#FFFFFF transparent transparent transparent;
    position: absolute;
    bottom: -20px;
    left: 50%;
    margin-left: -20px;
}
.btn {
    padding: 10px 15px;
    background-color: #333;
    color: #FFF;
    border-radius: 5px;
}
.btn-block {
    display: block;
    width: 80%;
    max-width: 400px;
    margin: 0 auto;
    margin-bottom: 20px;
}
.post-subTitle {
    width: 100%;
    position: absolute;
    top: 30%;
    text-align: center;
    font-size: 14px;
    left: 0;
}
#btnLink {
    position: relative;
    background-image: url(../../app/img/apple.png);
    background-size: 24px 30px;
    background-position: 16px center;
    background-repeat: no-repeat;
    line-height: 30px;
    font-size: 18px;
}
#btnLink-fox {
    position: absolute;
    right: -10px;
    top: 0;
    height: 100%;
}

.overlay {
    position: absolute;
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: rgba(255,255,255,0.7);
    color: #444;
    line-height: 22px;
    font-size: 16px;
    display: none;
}
#downloadArrow {
    float: right;
    width: 110px;
    height: 90px;
    margin-right: 20px;

}
.blur {
    -webkit-filter: blur(4px);
}
/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Image replacement
 */

.ir {
    background-color: transparent;
    border: 0;
    overflow: hidden;
    /* IE 6/7 fallback */
    *text-indent: -9999px;
}

.ir:before {
    content: "";
    display: block;
    width: 0;
    height: 150%;
}

/*
 * Hide from both screenreaders and browsers: h5bp.com/u
 */

.hidden {
    display: none !important;
    visibility: hidden;
}

/*
 * Hide only visually, but have it available for screenreaders: h5bp.com/v
 */

.visuallyhidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

/*
 * Extends the .visuallyhidden class to allow the element to be focusable
 * when navigated to via the keyboard: h5bp.com/p
 */

.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    width: auto;
}

/*
 * Hide visually and from screenreaders, but maintain layout
 */

.invisible {
    visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * For modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *    `contenteditable` attribute is included anywhere else in the document.
 *    Otherwise it causes space to appear at the top and bottom of elements
 *    that receive the `clearfix` class.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */

.clearfix:before,
.clearfix:after {
    content: " "; /* 1 */
    display: table; /* 2 */
}

.clearfix:after {
    clear: both;
}

/*
 * For IE 6/7 only
 * Include this rule to trigger hasLayout and contain floats.
 */

.clearfix {
    *zoom: 1;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
    /* Style adjustments for viewports that meet the condition */
     .post-content {
        font-size: 1.6em;
        line-height: 1.5em;
        padding-top: 4em;
        padding-bottom: 4em;

    }
    .post {
        min-height: 280px;
        height: 280px;
    }
    #download {
        width: 160px;
    }
}

@media print,
       (-o-min-device-pixel-ratio: 5/4),
       (-webkit-min-device-pixel-ratio: 1.25),
       (min-resolution: 120dpi) {
    /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid required HTTP connection: h5bp.com/r
   ========================================================================== */

@media print {
    * {
        background: transparent !important;
        color: #000 !important; /* Black prints faster: h5bp.com/s */
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    abbr[title]:after {
        content: " (" attr(title) ")";
    }

    /*
     * Don't show links for images, or javascript/internal links
     */

    .ir a:after,
    a[href^="javascript:"]:after,
    a[href^="#"]:after {
        content: "";
    }

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group; /* h5bp.com/t */
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    img {
        max-width: 100% !important;
    }

    @page {
        margin: 0.5cm;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}


text:
* [`rtcninja` Module API](rtcninja.md)
* [`rtcninja.RTCPeerConnection` Class API](RTCPeerConnection.md)


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace ManagementGui.View.ViewConverter
{
    /// <summary>
    /// Keeps two lists synchronized.
    /// </summary>
    public class TwoListSynchronizer : IWeakEventListener
    {
        private static readonly IListItemConverter DefaultConverter = new DoNothingListItemConverter();
        private readonly IList _masterList;
        private readonly IListItemConverter _masterTargetConverter;
        private readonly IList _targetList;

        /// <summary>
        /// Initializes a new instance of the <see cref="TwoListSynchronizer"/> class.
        /// </summary>
        /// <param name="masterList">The master list.</param>
        /// <param name="targetList">The target list.</param>
        /// <param name="masterTargetConverter">The master-target converter.</param>
        public TwoListSynchronizer(IList masterList, IList targetList, IListItemConverter masterTargetConverter)
        {
            _masterList = masterList;
            _targetList = targetList;
            _masterTargetConverter = masterTargetConverter;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TwoListSynchronizer"/> class.
        /// </summary>
        /// <param name="masterList">The master list.</param>
        /// <param name="targetList">The target list.</param>
        public TwoListSynchronizer(IList masterList, IList targetList)
            : this(masterList, targetList, DefaultConverter)
        {
        }

        private delegate void ChangeListAction(IList list, NotifyCollectionChangedEventArgs e, Converter<object, object> converter);

        /// <summary>
        /// Starts synchronizing the lists.
        /// </summary>
        public void StartSynchronizing()
        {
            ListenForChangeEvents(_masterList);
            ListenForChangeEvents(_targetList);

            // Update the Target list from the Master list
            SetListValuesFromSource(_masterList, _targetList, ConvertFromMasterToTarget);

            // In some cases the target list might have its own view on which items should included:
            // so update the master list from the target list
            // (This is the case with a ListBox SelectedItems collection: only items from the ItemsSource can be included in SelectedItems)
            if (!TargetAndMasterCollectionsAreEqual())
            {
                SetListValuesFromSource(_targetList, _masterList, ConvertFromTargetToMaster);
            }
        }

        /// <summary>
        /// Stop synchronizing the lists.
        /// </summary>
        public void StopSynchronizing()
        {
            StopListeningForChangeEvents(_masterList);
            StopListeningForChangeEvents(_targetList);
        }

        /// <summary>
        /// Receives events from the centralized event manager.
        /// </summary>
        /// <param name="managerType">The type of the <see cref="T:System.Windows.WeakEventManager"/> calling this method.</param>
        /// <param name="sender">Object that originated the event.</param>
        /// <param name="e">Event data.</param>
        /// <returns>
        /// true if the listener handled the event. It is considered an error by the <see cref="T:System.Windows.WeakEventManager"/> handling in WPF to register a listener for an event that the listener does not handle. Regardless, the method should return false if it receives an event that it does not recognize or handle.
        /// </returns>
        public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
        {
            HandleCollectionChanged(sender as IList, e as NotifyCollectionChangedEventArgs);

            return true;
        }

        /// <summary>
        /// Listens for change events on a list.
        /// </summary>
        /// <param name="list">The list to listen to.</param>
        protected void ListenForChangeEvents(IList list)
        {
            if (list is INotifyCollectionChanged)
            {
                CollectionChangedEventManager.AddListener(list as INotifyCollectionChanged, this);
            }
        }

        /// <summary>
        /// Stops listening for change events.
        /// </summary>
        /// <param name="list">The list to stop listening to.</param>
        protected void StopListeningForChangeEvents(IList list)
        {
            if (list is INotifyCollectionChanged)
            {
                CollectionChangedEventManager.RemoveListener(list as INotifyCollectionChanged, this);
            }
        }

        private void AddItems(IList list, NotifyCollectionChangedEventArgs e, Converter<object, object> converter)
        {
            int itemCount = e.NewItems.Count;

            for (int i = 0; i < itemCount; i++)
            {
                int insertionPoint = e.NewStartingIndex + i;

                if (insertionPoint > list.Count)
                {
                    list.Add(converter(e.NewItems[i]));
                }
                else
                {
                    list.Insert(insertionPoint, converter(e.NewItems[i]));
                }
            }
        }

        private object ConvertFromMasterToTarget(object masterListItem)
        {
            return _masterTargetConverter == null ? masterListItem : _masterTargetConverter.Convert(masterListItem);
        }

        private object ConvertFromTargetToMaster(object targetListItem)
        {
            return _masterTargetConverter == null ? targetListItem : _masterTargetConverter.ConvertBack(targetListItem);
        }

        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            IList sourceList = sender as IList;

            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    PerformActionOnAllLists(AddItems, sourceList, e);
                    break;
                case NotifyCollectionChangedAction.Move:
                    PerformActionOnAllLists(MoveItems, sourceList, e);
                    break;
                case NotifyCollectionChangedAction.Remove:
                    PerformActionOnAllLists(RemoveItems, sourceList, e);
                    break;
                case NotifyCollectionChangedAction.Replace:
                    PerformActionOnAllLists(ReplaceItems, sourceList, e);
                    break;
                case NotifyCollectionChangedAction.Reset:
                    UpdateListsFromSource(sender as IList);
                    break;
                default:
                    break;
            }
        }

        private void MoveItems(IList list, NotifyCollectionChangedEventArgs e, Converter<object, object> converter)
        {
            RemoveItems(list, e, converter);
            AddItems(list, e, converter);
        }

        private void PerformActionOnAllLists(ChangeListAction action, IList sourceList, NotifyCollectionChangedEventArgs collectionChangedArgs)
        {
            if (sourceList == _masterList)
            {
                PerformActionOnList(_targetList, action, collectionChangedArgs, ConvertFromMasterToTarget);
            }
            else
            {
                PerformActionOnList(_masterList, action, collectionChangedArgs, ConvertFromTargetToMaster);
            }
        }

        private void PerformActionOnList(IList list, ChangeListAction action, NotifyCollectionChangedEventArgs collectionChangedArgs, Converter<object, object> converter)
        {
            StopListeningForChangeEvents(list);
            action(list, collectionChangedArgs, converter);
            ListenForChangeEvents(list);
        }

        private void RemoveItems(IList list, NotifyCollectionChangedEventArgs e, Converter<object, object> converter)
        {
            int itemCount = e.OldItems.Count;

            // for the number of items being removed, remove the item from the Old Starting Index
            // (this will cause following items to be shifted down to fill the hole).
            for (int i = 0; i < itemCount; i++)
            {
                list.RemoveAt(e.OldStartingIndex);
            }
        }

        private void ReplaceItems(IList list, NotifyCollectionChangedEventArgs e, Converter<object, object> converter)
        {
            RemoveItems(list, e, converter);
            AddItems(list, e, converter);
        }

        private void SetListValuesFromSource(IList sourceList, IList targetList, Converter<object, object> converter)
        {
            StopListeningForChangeEvents(targetList);

            targetList.Clear();

            foreach (object o in sourceList)
            {
                targetList.Add(converter(o));
            }

            ListenForChangeEvents(targetList);
        }

        private bool TargetAndMasterCollectionsAreEqual()
        {
            return _masterList.Cast<object>().SequenceEqual(_targetList.Cast<object>().Select(item => ConvertFromTargetToMaster(item)));
        }

        /// <summary>
        /// Makes sure that all synchronized lists have the same values as the source list.
        /// </summary>
        /// <param name="sourceList">The source list.</param>
        private void UpdateListsFromSource(IList sourceList)
        {
            if (sourceList == _masterList)
            {
                SetListValuesFromSource(_masterList, _targetList, ConvertFromMasterToTarget);
            }
            else
            {
                SetListValuesFromSource(_targetList, _masterList, ConvertFromTargetToMaster);
            }
        }

        /// <summary>
        /// An implementation that does nothing in the conversions.
        /// </summary>
        internal class DoNothingListItemConverter : IListItemConverter
        {
            /// <summary>
            /// Converts the specified master list item.
            /// </summary>
            /// <param name="masterListItem">The master list item.</param>
            /// <returns>The result of the conversion.</returns>
            public object Convert(object masterListItem)
            {
                return masterListItem;
            }

            /// <summary>
            /// Converts the specified target list item.
            /// </summary>
            /// <param name="targetListItem">The target list item.</param>
            /// <returns>The result of the conversion.</returns>
            public object ConvertBack(object targetListItem)
            {
                return targetListItem;
            }
        }
    }
}


text:
package com.paypal.selion.elements;

import com.paypal.selion.elements.MobileSeLionElementSet.MobileSeLionElement;
import com.paypal.selion.plugins.CodeGeneratorLoggerFactory;
import com.paypal.selion.plugins.CodeGeneratorSimpleLogger;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static org.testng.Assert.*;

public class MobileSeLionElementSetTest {
    @BeforeClass
    public void before() {
        CodeGeneratorLoggerFactory.setLogger(new CodeGeneratorSimpleLogger());
    }

    @Test
    public void testGet() {
        SeLionElementSet elementSet = MobileSeLionElementSet.getInstance();
        assertNotNull(elementSet);
        // 10 is the min required from the construction of MobileSeLionElementSet
        assertTrue(elementSet.size() >= 10);
        assertTrue(elementSet.contains(MobileSeLionElement.BUTTON));
    }
}


text:
(function() {

  'use strict';

    // Pass the staticsRoute to the app
	angular
	    .module('<%= appname %>')
	    .run(staticsRoute);

	// Define the staticsRoute
    function staticsRoute(routerHelper) {

		// Inject with ng-annotate
		"ngInject";

    	// Intercept all the states and add them to the routing
    	routerHelper.configureStates(getStates());
    }

    // Define the getStates
    function getStates() {

		return [{

		    state: 'statics-home',
		    config: {
		        url: '/',
		        templateUrl: 'app/modules/statics/home/statics.home.html',
		        controller: 'staticsHomeCtrl',
		        controllerAs: 'staticsHome'
		    }
		}];
	}

})();


text:
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
        <group>
            <file>file:/D:/GitHub/Ejercicios-1-DAW/Tema%203/6%20-%20Repetición/EntradaAprobadoRepeticion/src/org/japo/java/main/Main.java</file>
        </group>
    </open-files>
</project-private>


text:
package net.dvt32.jdbc;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import net.dvt32.entity.Person;

@Repository
public class PersonJdbcDao {

	@Autowired
	JdbcTemplate jdbcTemplate;

	class PersonRowMapper implements RowMapper<Person> {
		@Override
		public Person mapRow(ResultSet rs, int rowNum) throws SQLException {
			Person person = new Person();

			person.setId( rs.getInt("id") );
			person.setName( rs.getString("name") );
			person.setLocation( rs.getString("location") );
			person.setBirthDate( rs.getTimestamp("birth_date") );

			return person;
		}
	}

	// SELECT * FROM PERSON;
	public List<Person> findAll() {
		return jdbcTemplate.query(
			"SELECT * FROM PERSON",
			new PersonRowMapper()
		);
	}

	public Person findById(int id) {
		return (Person) jdbcTemplate.queryForObject(
			"SELECT * FROM Person WHERE id = ?",
			new Object[] { id },
			new BeanPropertyRowMapper(Person.class)
		);
	}

	public int deleteById(int id) {
		return jdbcTemplate.update(
			"DELETE FROM Person WHERE id = ?",
			new Object[] { id }
		);
	}

	public int insert(Person person) {
		return jdbcTemplate.update(
			"INSERT INTO Person (id, name, location, birth_date) VALUES (?, ?, ?, ?)",
			new Object[] {
				person.getId(),
				person.getName(),
				person.getLocation(),
				new Timestamp( person.getBirthDate().getTime() )
			}
		);
	}

	public int update(Person person) {
		return jdbcTemplate.update(
			"UPDATE Person " +
		    "SET name = ?, location = ?, birth_date = ? " +
			"WHERE Id = ?",
			new Object[] {
				person.getName(),
				person.getLocation(),
				new Timestamp( person.getBirthDate().getTime() ),
				person.getId()
			}
		);
	}

}


text:
Architecture
======================
Hyperledger Fabric is a unique implementation of distributed ledger
technology (DLT) that ensures data integrity and consistency while
delivering accountability, transparency, and efficiencies unmatched by
other blockchain or DLT technology.

Hyperledger Fabric implements a specific type of
`permissioned <glossary.rst#permissioned-network>`__ `blockchain
network <glossary.md#blockchain-network>`__ on which members can track,
exchange and interact with digitized assets using
`transactions <glossary.rst#transactions>`__ that are governed by smart
contracts - what we call `chaincode <glossary.rst#chaincode>`__ - in a
secure and robust manner while enabling
`participants <glossary.rst#participants>`__ in the network to interact
in a manner that ensures that their transactions and data can be
restricted to an identified subset of network participants - something
we call a `channel <glossary.rst#channel>`__.

The blockchain network supports the ability for members to establish
shared ledgers that contain the source of truth about those digitized
assets, and recorded transactions, that is replicated in a secure manner
only to the set of nodes participating in that channel.

The Hyperledger Fabric architecture is comprised of the following
components: peer nodes, ordering nodes and the clients applications that
are likely leveraging one of the language-specific Fabric SDKs. These
components have identities derived from certificate authorities.
Hyperledger Fabric also offers a certificate authority service,
*fabric-ca* but, you may substitute that with your own.

All peer nodes maintain the ledger/state by committing transactions. In
that role, the peer is called a `committer <glossary.rst#committer>`__.
Some peers are also responsible for simulating transactions by executing
chaincodes (smart contracts) and endorsing the result. In that role the
peer is called an `endorser <glossary.rst#endorser>`__. A peer may be an
endorser for certain types of transactions and just a ledger maintainer
(committer) for others.

The `orderers <glossary.rst#orderer>`__ consent on the order of
transactions in a block to be committed to the ledger. In common
blockchain architectures (including earlier versions of the Hyperledger
Fabric) the roles played by the peer and orderer nodes were unified (cf.
validating peer in Hyperledger Fabric v0.6). The orderers also play a
fundamental role in the creation and management of channels.

Two or more `participants <glossary.rst#participant>`__ may create and
join a channel, and begin to interact. Among other things, the policies
governing the channel membership and chaincode lifecycle are specified
at the time of channel creation. Initially, the members in a channel
agree on the terms of the chaincode that will govern the transactions.
When consensus is reached on the `proposal <glossary.rst#proposal>`__ to
deploy a given chaincode (as governed by the life cycle policy for the
channel), it is committed to the ledger.

Once the chaincode is deployed to the peer nodes in the channel, `end
users <glossary.rst#end-users>`__ with the right privileges can propose
transactions on the channel by using one of the language-specific client
SDKs to invoke functions on the deployed chaincode.

The proposed transactions are sent to endorsers that execute the
chaincode (also called "simulated the transaction"). On successful
execution, endorse the result using the peer's identity and return the
result to the client that initiated the proposal.

The client application ensures that the results from the endorsers are
consistent and signed by the appropriate endorsers, according to the
endorsement policy for that chaincode and, if so, the application then
sends the transaction, comprised of the result and endorsements, to the
ordering service.

Ordering nodes order the transactions - the result and endorsements
received from the clients - into a block which is then sent to the peer
nodes to be committed to the ledger. The peers then validate the
transaction using the endorsement policy for the transaction's chaincode
and against the ledger for consistency of result.

Some key capabilities of Hyperledger Fabric include:

-  Allows for complex query for applications that need ability to handle
   complex data structures.

-  Implements a permissioned network, also known as a consortia network,
   where all members are known to each other.

-  Incorporates a modular approach to various capabilities, enabling
   network designers to plug in their preferred implementations for
   various capabilities such as consensus (ordering), identity
   management, and encryption.

-  Provides a flexible approach for specifying policies and pluggable
   mechanisms to enforce them.

-  Ability to have multiple channels, isolated from one another, that
   allows for multi-lateral transactions amongst select peer nodes,
   thereby ensuring high degrees of privacy and confidentiality required
   by competing businesses and highly regulated industries on a common
   network.

-  Network scalability and performance are achieved through separation
   of chaincode execution from transaction ordering, which limits the
   required levels of trust and verification across nodes for
   optimization.

For a deeper dive into the details, please visit `this
document <arch-deep-dive.rst>`__.


text:
module SequelRails
  module Railties

    class LogSubscriber < ActiveSupport::LogSubscriber

      def self.runtime=(value)
        Thread.current["sequel_sql_runtime"] = value
      end

      def self.runtime
        Thread.current["sequel_sql_runtime"] ||= 0
      end

      def self.reset_runtime
        rt, self.runtime = runtime, 0
        rt
      end

      def sql(event)
        self.class.runtime += event.duration
        return unless logger.debug?

        payload = event.payload

        name = '%s (%.1fms)' % [payload[:name], event.duration]
        sql  = payload[:sql].squeeze(' ')
        binds = nil

        unless (payload[:binds] || []).empty?
          binds = "  " + payload[:binds].map { |col,v|
            [col.name, v]
          }.inspect
        end

        if odd?
          name = color(name, :cyan, true)
          sql  = color(sql, nil, true)
        else
          name = color(name, :magenta, true)
        end

        debug "  #{name}  #{sql}#{binds}"
      end

      def odd?
        @odd_or_even = !@odd_or_even
      end

      def logger
        ::SequelRails.configuration.logger
      end

    end

  end
end


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Nínive</logradouro><bairro>Passarinho</bairro><cidade>Recife</cidade><uf>PE</uf><cep>52170420</cep></feed>