text:
package com.google.inject;

import static com.google.inject.Asserts.assertContains;
import static com.google.inject.name.Names.named;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Runnables;
import com.google.inject.internal.Annotations;
import com.google.inject.matcher.Matchers;
import com.google.inject.name.Named;
import com.google.inject.spi.InjectionPoint;
import com.google.inject.spi.TypeEncounter;
import com.google.inject.spi.TypeListener;

import junit.framework.TestCase;

/*if[AOP]*/
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
/*end[AOP]*/

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;

/**
 * @author crazybob@google.com (Bob Lee)
 */
public class BindingTest extends TestCase {

  static class Dependent {
    @Inject A a;
    @Inject Dependent(A a, B b) {}
    @Inject void injectBob(Bob bob) {}
  }

  public void testExplicitCyclicDependency() {
    Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(A.class);
                bind(B.class);
              }
            })
        .getInstance(A.class);
  }

  static class A { @Inject B b; }
  static class B { @Inject A a; }

  static class Bob {}

  static class MyModule extends AbstractModule {

    @Override
    protected void configure() {
      // Linked.
      bind(Object.class).to(Runnable.class).in(Scopes.SINGLETON);

      // Instance.
      bind(Runnable.class).toInstance(Runnables.doNothing());

      // Provider instance.
      bind(Foo.class)
          .toProvider(
              new Provider<Foo>() {
                @Override
                public Foo get() {
                  return new Foo();
                }
              })
          .in(Scopes.SINGLETON);

      // Provider.
      bind(Foo.class)
          .annotatedWith(named("provider"))
          .toProvider(FooProvider.class);

      // Class.
      bind(Bar.class).in(Scopes.SINGLETON);

      // Constant.
      bindConstant().annotatedWith(named("name")).to("Bob");
    }
  }

  static class Foo {}

  public static class FooProvider implements Provider<Foo> {
    @Override
    public Foo get() {
      throw new UnsupportedOperationException();
    }
  }

  public static class Bar {}

  public void testBindToUnboundLinkedBinding() {
    try {
      Guice.createInjector(
          new AbstractModule() {
            @Override
            protected void configure() {
              bind(Collection.class).to(List.class);
            }
          });
      fail();
    } catch (CreationException expected) {
      assertContains(expected.getMessage(), "No implementation for java.util.List was bound.");
    }
  }

  /**
   * This test ensures that the asEagerSingleton() scoping applies to the key,
   * not to what the key is linked to.
   */
  public void testScopeIsAppliedToKeyNotTarget() {
    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(Integer.class).toProvider(Counter.class).asEagerSingleton();
                bind(Number.class).toProvider(Counter.class).asEagerSingleton();
              }
            });

    assertNotSame(injector.getInstance(Integer.class), injector.getInstance(Number.class));
  }

  static class Counter implements Provider<Integer> {
    static AtomicInteger next = new AtomicInteger(1);
    @Override
    public Integer get() {
      return next.getAndIncrement();
    }
  }

  public void testAnnotatedNoArgConstructor() {
    assertBindingSucceeds(PublicNoArgAnnotated.class);
    assertBindingSucceeds(ProtectedNoArgAnnotated.class);
    assertBindingSucceeds(PackagePrivateNoArgAnnotated.class);
    assertBindingSucceeds(PrivateNoArgAnnotated.class);
  }

  static class PublicNoArgAnnotated {
    @Inject public PublicNoArgAnnotated() { }
  }

  static class ProtectedNoArgAnnotated {
    @Inject protected ProtectedNoArgAnnotated() { }
  }

  static class PackagePrivateNoArgAnnotated {
    @Inject PackagePrivateNoArgAnnotated() { }
  }

  static class PrivateNoArgAnnotated {
    @Inject private PrivateNoArgAnnotated() { }
  }

  public void testUnannotatedNoArgConstructor() throws Exception{
    assertBindingSucceeds(PublicNoArg.class);
    assertBindingSucceeds(ProtectedNoArg.class);
    assertBindingSucceeds(PackagePrivateNoArg.class);
    assertBindingSucceeds(PrivateNoArgInPrivateClass.class);
    assertBindingFails(PrivateNoArg.class);
  }

  static class PublicNoArg {
    public PublicNoArg() { }
  }

  static class ProtectedNoArg {
    protected ProtectedNoArg() { }
  }

  static class PackagePrivateNoArg {
    PackagePrivateNoArg() { }
  }

  private static class PrivateNoArgInPrivateClass {
    PrivateNoArgInPrivateClass() { }
  }

  static class PrivateNoArg {
    private PrivateNoArg() { }
  }

  private void assertBindingSucceeds(final Class<?> clazz) {
    assertNotNull(Guice.createInjector().getInstance(clazz));
  }

  private void assertBindingFails(final Class<?> clazz) throws NoSuchMethodException {
    try {
      Guice.createInjector().getInstance(clazz);
      fail();
    } catch (ConfigurationException expected) {
      assertContains(expected.getMessage(),
          "Could not find a suitable constructor in " + PrivateNoArg.class.getName(),
          "at " + PrivateNoArg.class.getName() + ".class(BindingTest.java:");
    }
  }

  public void testTooManyConstructors() {
    try {
      Guice.createInjector().getInstance(TooManyConstructors.class);
      fail();
    } catch (ConfigurationException expected) {
      assertContains(expected.getMessage(),
          TooManyConstructors.class.getName() + " has more than one constructor annotated with "
              + "@Inject. Classes must have either one (and only one) constructor",
          "at " + TooManyConstructors.class.getName() + ".class(BindingTest.java:");
    }
  }

  @SuppressWarnings("InjectMultipleAtInjectConstructors")
  static class TooManyConstructors {
    @Inject
    TooManyConstructors(Injector i) {}

    @Inject
    TooManyConstructors() {}
  }

  public void testToConstructorBinding() throws NoSuchMethodException {
    final Constructor<D> constructor = D.class.getConstructor(Stage.class);

    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(Object.class).toConstructor(constructor);
              }
            });

    D d = (D) injector.getInstance(Object.class);
    assertEquals(Stage.DEVELOPMENT, d.stage);
  }

  public void testToConstructorBindingsOnParameterizedTypes() throws NoSuchMethodException {
    final Constructor<C> constructor = C.class.getConstructor(Stage.class, Object.class);
    final Key<Object> s = new Key<Object>(named("s")) {};
    final Key<Object> i = new Key<Object>(named("i")) {};

    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(s).toConstructor(constructor, new TypeLiteral<C<Stage>>() {});
                bind(i).toConstructor(constructor, new TypeLiteral<C<Injector>>() {});
              }
            });

    C<Stage> one = (C<Stage>) injector.getInstance(s);
    assertEquals(Stage.DEVELOPMENT, one.stage);
    assertEquals(Stage.DEVELOPMENT, one.t);
    assertEquals(Stage.DEVELOPMENT, one.anotherT);

    C<Injector> two = (C<Injector>) injector.getInstance(i);
    assertEquals(Stage.DEVELOPMENT, two.stage);
    assertEquals(injector, two.t);
    assertEquals(injector, two.anotherT);
  }

  public void testToConstructorBindingsFailsOnRawTypes() throws NoSuchMethodException {
    final Constructor constructor = C.class.getConstructor(Stage.class, Object.class);

    try {
      Guice.createInjector(
          new AbstractModule() {
            @Override
            protected void configure() {
              bind(Object.class).toConstructor(constructor);
            }
          });
      fail();
    } catch (CreationException expected) {
      assertContains(expected.getMessage(),
          "1) T cannot be used as a key; It is not fully specified.",
          "at " + C.class.getName() + ".<init>(BindingTest.java:",
          "2) T cannot be used as a key; It is not fully specified.",
          "at " + C.class.getName() + ".anotherT(BindingTest.java:");
    }
  }

/*if[AOP]*/
  public void testToConstructorAndMethodInterceptors() throws NoSuchMethodException {
    final Constructor<D> constructor = D.class.getConstructor(Stage.class);
    final AtomicInteger count = new AtomicInteger();
    final MethodInterceptor countingInterceptor =
        new MethodInterceptor() {
          @Override
          public Object invoke(MethodInvocation methodInvocation) throws Throwable {
            count.incrementAndGet();
            return methodInvocation.proceed();
          }
        };

    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(Object.class).toConstructor(constructor);
                bindInterceptor(Matchers.any(), Matchers.any(), countingInterceptor);
              }
            });

    D d = (D) injector.getInstance(Object.class);
    d.hashCode();
    d.hashCode();
    assertEquals(2, count.get());
  }
/*end[AOP]*/

  public void testInaccessibleConstructor() throws NoSuchMethodException {
    final Constructor<E> constructor = E.class.getDeclaredConstructor(Stage.class);

    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(E.class).toConstructor(constructor);
              }
            });

    E e = injector.getInstance(E.class);
    assertEquals(Stage.DEVELOPMENT, e.stage);
  }

  public void testToConstructorAndScopes() throws NoSuchMethodException {
    final Constructor<F> constructor = F.class.getConstructor(Stage.class);

    final Key<Object> d = Key.get(Object.class, named("D")); // default scoping
    final Key<Object> s = Key.get(Object.class, named("S")); // singleton
    final Key<Object> n = Key.get(Object.class, named("N")); // "N" instances
    final Key<Object> r = Key.get(Object.class, named("R")); // a regular binding

    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(d).toConstructor(constructor);
                bind(s).toConstructor(constructor).in(Singleton.class);
                bind(n).toConstructor(constructor).in(Scopes.NO_SCOPE);
                bind(r).to(F.class);
              }
            });

    assertDistinct(injector, 1, d, d, d, d);
    assertDistinct(injector, 1, s, s, s, s);
    assertDistinct(injector, 4, n, n, n, n);
    assertDistinct(injector, 1, r, r, r, r);
    assertDistinct(injector, 4, d, d, r, r, s, s, n);
  }

  public void assertDistinct(Injector injector, int expectedCount, Key<?>... keys) {
    ImmutableSet.Builder<Object> builder = ImmutableSet.builder();
    for (Key<?> k : keys) {
      builder.add(injector.getInstance(k));
    }
    assertEquals(expectedCount, builder.build().size());
  }

  public void testToConstructorSpiData() throws NoSuchMethodException {
    final Set<TypeLiteral<?>> heardTypes = Sets.newHashSet();

    final Constructor<D> constructor = D.class.getConstructor(Stage.class);
    final TypeListener listener =
        new TypeListener() {
          @Override
          public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
            if (!heardTypes.add(type)) {
              fail("Heard " + type + " multiple times!");
            }
          }
        };

    Guice.createInjector(
        new AbstractModule() {
          @Override
          protected void configure() {
            bind(Object.class).toConstructor(constructor);
            bind(D.class).toConstructor(constructor);
            bindListener(Matchers.any(), listener);
          }
        });

    assertEquals(ImmutableSet.of(TypeLiteral.get(D.class)), heardTypes);
  }

  public void testInterfaceToImplementationConstructor() throws NoSuchMethodException {
    final Constructor<CFoo> constructor = CFoo.class.getDeclaredConstructor();

    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(IFoo.class).toConstructor(constructor);
              }
            });

    injector.getInstance(IFoo.class);
  }

  public static interface IFoo {}
  public static class CFoo implements IFoo {}

  public void testGetAllBindings() {
    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(D.class).toInstance(new D(Stage.PRODUCTION));
                bind(Object.class).to(D.class);
                getProvider(new Key<C<Stage>>() {});
              }
            });

    Map<Key<?>,Binding<?>> bindings = injector.getAllBindings();
    assertEquals(ImmutableSet.of(Key.get(Injector.class), Key.get(Stage.class), Key.get(D.class),
        Key.get(Logger.class), Key.get(Object.class), new Key<C<Stage>>() {}),
        bindings.keySet());

    // add a JIT binding
    injector.getInstance(F.class);

    Map<Key<?>,Binding<?>> bindings2 = injector.getAllBindings();
    assertEquals(ImmutableSet.of(Key.get(Injector.class), Key.get(Stage.class), Key.get(D.class),
        Key.get(Logger.class), Key.get(Object.class), new Key<C<Stage>>() {}, Key.get(F.class)),
        bindings2.keySet());

    // the original map shouldn't have changed
    assertEquals(ImmutableSet.of(Key.get(Injector.class), Key.get(Stage.class), Key.get(D.class),
        Key.get(Logger.class), Key.get(Object.class), new Key<C<Stage>>() {}),
        bindings.keySet());

    // check the bindings' values
    assertEquals(injector, bindings.get(Key.get(Injector.class)).getProvider().get());
  }

  public void testGetAllServletBindings() throws Exception {
    Injector injector =
        Guice.createInjector(
            new AbstractModule() {
              @Override
              protected void configure() {
                bind(F.class); // an explicit binding that uses a JIT binding for a constructor
              }
            });
    injector.getAllBindings();
  }

  public static class C<T> {
    private Stage stage;
    private T t;
    @Inject T anotherT;

    public C(Stage stage, T t) {
      this.stage = stage;
      this.t = t;
    }

    @Inject C() {}
  }

  public static class D {
    Stage stage;
    public D(Stage stage) {
      this.stage = stage;
    }
  }

  private static class E {
    Stage stage;
    private E(Stage stage) {
      this.stage = stage;
    }
  }

  @Singleton
  public static class F {
    Stage stage;
    @Inject public F(Stage stage) {
      this.stage = stage;
    }
  }

  public void testTurkeyBaconProblemUsingToConstuctor() {
    Injector injector = Guice.createInjector(new AbstractModule() {
      @SuppressWarnings("unchecked")
      @Override
      public void configure() {
        bind(Bacon.class).to(UncookedBacon.class);
        bind(Bacon.class).annotatedWith(named("Turkey")).to(TurkeyBacon.class);
        bind(Bacon.class).annotatedWith(named("Tofu")).to(TofuBacon.class);
        bind(Bacon.class).annotatedWith(named("Cooked")).toConstructor(
            (Constructor)InjectionPoint.forConstructorOf(Bacon.class).getMember());
      }
    });
    Bacon bacon = injector.getInstance(Bacon.class);
    assertEquals(Food.PORK, bacon.getMaterial());
    assertFalse(bacon.isCooked());

    Bacon turkeyBacon = injector.getInstance(Key.get(Bacon.class, named("Turkey")));
    assertEquals(Food.TURKEY, turkeyBacon.getMaterial());
    assertTrue(turkeyBacon.isCooked());

    Bacon cookedBacon = injector.getInstance(Key.get(Bacon.class, named("Cooked")));
    assertEquals(Food.PORK, cookedBacon.getMaterial());
    assertTrue(cookedBacon.isCooked());

    try {
      // Turkey typo, missing a letter...
      injector.getInstance(Key.get(Bacon.class, named("Turky")));
      fail();
    } catch (ConfigurationException e) {
      String msg = e.getMessage();
      assertContains(
          msg,
          "Guice configuration errors:",
          "1) No implementation for"
              + " com.google.inject.BindingTest$Bacon annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("Turky")
              + ") was bound.",
          "Did you mean?",
          "* com.google.inject.BindingTest$Bacon annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("Turkey")
              + ")",
          "* com.google.inject.BindingTest$Bacon annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("Tofu")
              + ")",
          "1 more binding with other annotations.",
          "while locating com.google.inject.BindingTest$Bacon annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("Turky")
              + ")");
    }
  }

  public void testMissingAnnotationOneChoice() {
    Injector injector = Guice.createInjector(new AbstractModule() {
      @SuppressWarnings("unchecked")
      @Override
      public void configure() {
        bind(Bacon.class).annotatedWith(named("Turkey")).to(TurkeyBacon.class);
      }
    });

    try {
      // turkey typo (should be Upper case)...
      injector.getInstance(Key.get(Bacon.class, named("turkey")));
      fail();
    } catch (ConfigurationException e) {
      String msg = e.getMessage();
      assertContains(msg, "Guice configuration errors:");
      assertContains(
          msg,
          "1) No implementation for com.google.inject.BindingTest$Bacon"
              + " annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("turkey")
              + ") was bound.",
          "Did you mean?",
          "* com.google.inject.BindingTest$Bacon annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("Turkey")
              + ")",
          "while locating com.google.inject.BindingTest$Bacon annotated with"
              + " @com.google.inject.name.Named(value="
              + Annotations.memberValueString("turkey")
              + ")");
    }
  }

  enum Food { TURKEY, PORK, TOFU }

  private static class Bacon {
    public Food getMaterial() { return Food.PORK; }
    public boolean isCooked() { return true; }
  }

  private static class TurkeyBacon extends Bacon {
    @Override
    public Food getMaterial() { return Food.TURKEY; }
  }

  private static class TofuBacon extends Bacon {
    @Override
    public Food getMaterial() { return Food.TOFU; }
  }

  private static class UncookedBacon extends Bacon {
    @Override
    public boolean isCooked() { return false; }
  }

  public void testMissingAnnotationRelated() {
    try {
      final TypeLiteral<List<Butter>> list = new TypeLiteral<List<Butter>>() {};

      Guice.createInjector(new AbstractModule() {
        @SuppressWarnings("unchecked")
        @Override
        public void configure() {
          bind(list).toInstance(butters);
          bind(Sandwitch.class).to(ButterSandwitch.class);
        }
      });

      fail();
    } catch (CreationException e) {
      final String msg = e.getMessage();
      assertContains(msg, "Unable to create injector, see the following errors:",
          "Did you mean?",
          "java.util.List<com.google.inject.BindingTest$Butter> bound"
          + "  at com.google.inject.BindingTest$24.configure");
    }
  }

  private static List<Butter> butters = new ArrayList<>();

  private static interface Sandwitch {};

  private static interface Butter {};

  private static class ButterSandwitch implements Sandwitch {
    private ButterSandwitch() {};

    @Inject
    ButterSandwitch(@Named("unsalted") Butter butter) {};
  }
}

redpajama_set_name: RedPajamaGithub


text:
using Xamarin.Forms;

namespace ArcTouchApp.Views
{
    public partial class MoviePage : ContentPage
    {
        public MoviePage()
        {
            InitializeComponent();
        }
    }
}


text:
//-----------------------------------------------------------------------
// <copyright file="DirectoryManager.cs" company="Google">
//
// Copyright 2019 Google Inc. All Rights Reserved.
//
// 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.
//
// </copyright>
//-----------------------------------------------------------------------
using UnityEngine;
using System.IO;

namespace SIS {

    public class DirectoryManager {

        public static string layoutSaveDirectory { get { return Path.Combine(Application.persistentDataPath, "layouts"); } }
        public static string soundSaveDirectory { get { return Path.Combine(Application.persistentDataPath, "sounds"); } }

        static DirectoryManager() {
            CreatePaths();
            Debug.Log("DataPath: " + Application.persistentDataPath);
        }

        // Creates the path to a layout and sound file on local storage.
        static void CreatePaths() {
            foreach (string dir in new string[] { layoutSaveDirectory, soundSaveDirectory }) {
                if (!Directory.Exists(dir)) {
                    Directory.CreateDirectory(dir);
                }
            }
        }

    }
}


text:
//go:build example
// +build example

package main

import (
	"context"
	"log"

	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
	"github.com/minio/minio-go/v7/pkg/lifecycle"
)

func main() {
	// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
	// dummy values, please replace them with original values.

	// Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
	// This boolean value is the last argument for New().

	// New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
	// determined based on the Endpoint value.
	s3Client, err := minio.New("s3.amazonaws.com", &minio.Options{
		Creds:  credentials.NewStaticV4("YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", ""),
		Secure: true,
	})
	if err != nil {
		log.Fatalln(err)
	}

	// s3Client.TraceOn(os.Stderr)

	// Set lifecycle on a bucket
	config := lifecycle.NewConfiguration()
	config.Rules = []lifecycle.Rule{
		{
			ID:     "expire-bucket",
			Status: "Enabled",
			Expiration: lifecycle.Expiration{
				Days: 365,
			},
		},
	}
	err = s3Client.SetBucketLifecycle(context.Background(), "my-bucketname", config)
	if err != nil {
		log.Fatalln(err)
	}
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Observ. bot. 4:15. 1786-1787 ("1786")

#### Original name
null

### Remarks
null


text:
//
//  RgLinkLabel.m
//  KILabelDemo
//
//  Created by rogue on 16/10/19.
//  Copyright © 2016年 Matthew Styles. All rights reserved.
//

#import "RgLinkLabel.h"

NSString * const RgLabelLinkTypeKey = @"rg_linkType";
NSString * const RgLabelRangeKey = @"rg_range";
NSString * const RgLabelLinkKey = @"rg_link";

// 记录  标签
NSString * const RgDeleteBeginKey = @"";
NSString * const RgDeleteEndKey = @"";

#pragma mark - Private Interface

@interface RgLinkLabel()

// Used to control layout of glyphs and rendering
@property (nonatomic, strong) NSLayoutManager *layoutManager;

// Specifies the space in which to render text
@property (nonatomic, strong) NSTextContainer *textContainer;

// Backing storage for text that is rendered by the layout manager
@property (nonatomic, strong) NSTextStorage *textStorage;

// Dictionary of detected links and their ranges in the text
@property (nonatomic, copy) NSArray *linkRanges;

// State used to trag if the user has dragged during a touch
@property (nonatomic, assign) BOOL isTouchMoved;

// During a touch, range of text that is displayed as selected
@property (nonatomic, assign) NSRange selectedRange;

// 标签的属性

@property (nonatomic, strong) NSMutableArray *rg_linkAttributes;

@end

#pragma mark - Implementation

@implementation RgLinkLabel
{
    NSMutableDictionary *_linkTypeAttributes;
}

#pragma mark - Construction

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setupTextSystem];
    }

    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self)
    {
        [self setupTextSystem];
    }

    return self;
}

- (void)setupTextSystem
{

    _textContainer = [[NSTextContainer alloc] init];
    _textContainer.lineFragmentPadding = 0;
    _textContainer.maximumNumberOfLines = self.numberOfLines;
    _textContainer.lineBreakMode = self.lineBreakMode;
    _textContainer.size = self.frame.size;

    // Create a layout manager for rendering
    _layoutManager = [[NSLayoutManager alloc] init];
    _layoutManager.delegate = self;
    [_layoutManager addTextContainer:_textContainer];

    // Attach the layou manager to the container and storage
    [_textContainer setLayoutManager:_layoutManager];

    // Make sure user interaction is enabled so we can accept touches
    self.userInteractionEnabled = YES;

    // Don't go via public setter as this will have undesired side effect
    _automaticLinkDetectionEnabled = YES;

    // All links are detectable by default
    _linkDetectionTypes = RgLinkTypeOptionAll;

    // Link Type Attributes. Default is empty (no attributes).
    _linkTypeAttributes = [NSMutableDictionary dictionary];

    // Don't underline URL links by default.
    _systemURLStyle = NO;

    // By default we hilight the selected link during a touch to give feedback that we are
    // responding to touch.
    _selectedLinkBackgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];

    // Establish the text store with our current text
    [self updateTextStoreWithText];
}

#pragma mark - Text and Style management

- (void)setAutomaticLinkDetectionEnabled:(BOOL)decorating
{
    _automaticLinkDetectionEnabled = decorating;

    // Make sure the text is updated properly
    [self updateTextStoreWithText];
}

- (void)setLinkDetectionTypes:(RgLinkTypeOption)linkDetectionTypes
{
    _linkDetectionTypes = linkDetectionTypes;

    // Make sure the text is updated properly
    [self updateTextStoreWithText];
}

- (NSDictionary *)linkAtPoint:(CGPoint)location
{
    // Do nothing if we have no text
    if (_textStorage.string.length == 0)
    {
        return nil;
    }

    // Work out the offset of the text in the view
    CGPoint textOffset = [self calcGlyphsPositionInView];

    // Get the touch location and use text offset to convert to text cotainer coords
    location.x -= textOffset.x;
    location.y -= textOffset.y;

    NSUInteger touchedChar = [_layoutManager glyphIndexForPoint:location inTextContainer:_textContainer];

    // If the touch is in white space after the last glyph on the line we don't
    // count it as a hit on the text
    NSRange lineRange;
    CGRect lineRect = [_layoutManager lineFragmentUsedRectForGlyphAtIndex:touchedChar effectiveRange:&lineRange];
    if (CGRectContainsPoint(lineRect, location) == NO)
        return nil;

    // Find the word that was touched and call the detection block
    for (NSDictionary *dictionary in self.linkRanges)
    {
        NSRange range = [[dictionary objectForKey:RgLabelRangeKey] rangeValue];

        if ((touchedChar >= range.location) && touchedChar < (range.location + range.length))
        {
            return dictionary;
        }
    }

    return nil;
}

// Applies background color to selected range. Used to hilight touched links
- (void)setSelectedRange:(NSRange)range
{
    // Remove the current selection if the selection is changing
    if (self.selectedRange.length && !NSEqualRanges(self.selectedRange, range))
    {
        [_textStorage removeAttribute:NSBackgroundColorAttributeName range:self.selectedRange];
    }

    // Apply the new selection to the text
    if (range.length && _selectedLinkBackgroundColor != nil)
    {
        [_textStorage addAttribute:NSBackgroundColorAttributeName value:_selectedLinkBackgroundColor range:range];
    }

    // Save the new range
    _selectedRange = range;

    [self setNeedsDisplay];
}

- (void)setNumberOfLines:(NSInteger)numberOfLines
{
    [super setNumberOfLines:numberOfLines];

    _textContainer.maximumNumberOfLines = numberOfLines;
}

- (void)setText:(NSString *)text
{
    // Pass the text to the super class first
    [super setText:text];

    // Update our text store with an attributed string based on the original
    // label text properties.
    if (!text)
    {
        text = @"";
    }

    NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:@{NSForegroundColorAttributeName: [UIColor orangeColor]}];//[self attributesFromProperties]
    [self updateTextStoreWithAttributedString:attributedText];
}

- (void)setAttributedText:(NSAttributedString *)attributedText
{
    // Pass the text to the super class first
    [super setAttributedText:attributedText];

    [self updateTextStoreWithAttributedString:attributedText];
}

- (void)setSystemURLStyle:(BOOL)systemURLStyle
{
    _systemURLStyle = systemURLStyle;

    // Force refresh
    self.text = self.text;
}

- (NSDictionary*)attributesForLinkType:(RgLinkType)linkType
{
    NSDictionary *attributes = _linkTypeAttributes[@(linkType)];

    if (!attributes)
    {
        attributes = @{NSForegroundColorAttributeName : self.tintColor};
    }

    return attributes;
}

- (void)setAttributes:(NSDictionary*)attributes forLinkType:(RgLinkType)linkType
{
    if (attributes)
    {
        _linkTypeAttributes[@(linkType)] = attributes;
    }
    else
    {
        [_linkTypeAttributes removeObjectForKey:@(linkType)];
    }

    // Force refresh text
    self.text = self.text;
}

#pragma mark - Text Storage Management

- (void)updateTextStoreWithText
{
    // Now update our storage from either the attributedString or the plain text
    if (self.attributedText)
    {
        [self updateTextStoreWithAttributedString:self.attributedText];
    }
    else if (self.text)
    {
        [self updateTextStoreWithAttributedString:[[NSAttributedString alloc] initWithString:self.text attributes:[self attributesFromProperties]]];
    }
    else
    {
        [self updateTextStoreWithAttributedString:[[NSAttributedString alloc] initWithString:@"" attributes:[self attributesFromProperties]]];
    }

    [self setNeedsDisplay];
}

- (void)updateTextStoreWithAttributedString:(NSAttributedString *)attributedString
{
    NSString *current = [attributedString.string stringByReplacingOccurrencesOfString:RgDeleteBeginKey withString:@""];
    current = [current stringByReplacingOccurrencesOfString:RgDeleteEndKey withString:@""];
    NSMutableAttributedString *currentAtt = [[NSMutableAttributedString alloc] initWithString:current];
    [currentAtt addAttribute:NSForegroundColorAttributeName value:self.textColor range:NSMakeRange(0, currentAtt.length)];
    [currentAtt addAttribute:NSFontAttributeName value:self.font range:NSMakeRange(0, currentAtt.length)];

    if (attributedString.length != 0)
    {
        attributedString = [RgLinkLabel sanitizeAttributedString:attributedString];
    }

    if (self.isAutomaticLinkDetectionEnabled && (attributedString.length != 0))
    {
        self.linkRanges = [self getRangesForLinks:attributedString];
        attributedString = [self addLinkAttributesToAttributedString:currentAtt linkRanges:self.linkRanges];
    }
    else
    {
        self.linkRanges = nil;
    }

    if (_textStorage)
    {
        // Set the string on the storage
        [_textStorage setAttributedString:attributedString];
    }
    else
    {
        // Create a new text storage and attach it correctly to the layout manager
        _textStorage = [[NSTextStorage alloc] initWithAttributedString:attributedString];
        [_textStorage addLayoutManager:_layoutManager];
        [_layoutManager setTextStorage:_textStorage];
    }
}

// Returns attributed string attributes based on the text properties set on the label.
// These are styles that are only applied when NOT using the attributedText directly.
- (NSDictionary *)attributesFromProperties
{
    // Setup shadow attributes
    NSShadow *shadow = shadow = [[NSShadow alloc] init];
    if (self.shadowColor)
    {
        shadow.shadowColor = self.shadowColor;
        shadow.shadowOffset = self.shadowOffset;
    }
    else
    {
        shadow.shadowOffset = CGSizeMake(0, -1);
        shadow.shadowColor = nil;
    }

    UIFont *currentFont = self.font;
    UIColor *currentColor = self.textColor;

    // Setup paragraph attributes
    NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
    paragraph.alignment = self.textAlignment;

    // Create the dictionary
    NSDictionary *attributes = @{NSFontAttributeName : currentFont,
                                 NSForegroundColorAttributeName : currentColor,
                                 NSShadowAttributeName : shadow,
                                 NSParagraphStyleAttributeName : paragraph,
                                 };
    return attributes;
}

/**
 *  Returns array of ranges for all special words, user handles, hashtags and urls in the specfied
 *  text.
 *
 *  @param text Text to parse for links
 *
 *  @return Array of dictionaries describing the links.
 */
- (NSArray *)getRangesForLinks:(NSAttributedString *)text
{
    NSMutableArray *rangesForLinks = [[NSMutableArray alloc] init];

    if (self.linkDetectionTypes & RgLinkTypeOptionUserHandle)
    {
        [rangesForLinks addObjectsFromArray:[self getRangesForUserHandles:text.string]];
    }

    return rangesForLinks;
}

- (NSArray *)getRangesForUserHandles:(NSString *)text
{
    NSMutableArray *rangesForUserHandles = [[NSMutableArray alloc] init];

    // Setup a regular expression for user handles and hashtags
    static NSRegularExpression *regex = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSError *error = nil;
        regex = [[NSRegularExpression alloc] initWithPattern:@"([\\w\\_><]+)?" options:0 error:&error];
    });

    // Run the expression and get matches
    NSArray *matches = [regex matchesInString:text options:0 range:NSMakeRange(0, text.length)];

    // Add all our ranges to the result
    NSInteger i = 0;
    NSInteger beginLen = 3;
    NSInteger endLen = 4;
    for (NSTextCheckingResult *match in matches)
    {
        NSRange matchRange = [match range];
        NSString *matchString = [text substringWithRange:matchRange];

        if (![self ignoreMatch:matchString])
        {
            [rangesForUserHandles addObject:@{RgLabelLinkTypeKey : @(RgLinkTypeUserHandle),
                                              RgLabelRangeKey : [NSValue valueWithRange:NSMakeRange(matchRange.location - i * (beginLen + endLen), matchRange.length - (beginLen + endLen))],
                                              RgLabelLinkKey : [matchString substringWithRange:NSMakeRange(3, matchString.length - (beginLen + endLen))]
                                              }];
        }

        i++;
    }

    return rangesForUserHandles;
}

- (BOOL)ignoreMatch:(NSString*)string
{
    return [_ignoredKeywords containsObject:[string lowercaseString]];
}

- (NSAttributedString *)addLinkAttributesToAttributedString:(NSAttributedString *)string linkRanges:(NSArray *)linkRanges
{
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:string];
    NSInteger i = 0;
    for (NSDictionary *dictionary in linkRanges)
    {
        NSRange range = [[dictionary objectForKey:RgLabelRangeKey] rangeValue];

        [attributedString addAttributes:self.rg_linkAttributes[i] range:range];

        // Add an URL attribute if this is a URL
        if (_systemURLStyle)
        {
            // Add a link attribute using the stored link
            [attributedString addAttribute:NSLinkAttributeName value:dictionary[RgLabelLinkKey] range:range];
        }

        i++;
    }

    return attributedString;
}

#pragma mark - Layout and Rendering

- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines
{
    // Use our text container to calculate the bounds required. First save our
    // current text container setup
    CGSize savedTextContainerSize = _textContainer.size;
    NSInteger savedTextContainerNumberOfLines = _textContainer.maximumNumberOfLines;

    // Apply the new potential bounds and number of lines
    _textContainer.size = bounds.size;
    _textContainer.maximumNumberOfLines = numberOfLines;

    // Measure the text with the new state
    CGRect textBounds = [_layoutManager usedRectForTextContainer:_textContainer];

    // Position the bounds and round up the size for good measure
    textBounds.origin = bounds.origin;
    textBounds.size.width = ceil(textBounds.size.width);
    textBounds.size.height = ceil(textBounds.size.height);

    if (textBounds.size.height < bounds.size.height)
    {
        // Take verical alignment into account
        CGFloat offsetY = (bounds.size.height - textBounds.size.height) / 2.0;
        textBounds.origin.y += offsetY;
    }

    // Restore the old container state before we exit under any circumstances
    _textContainer.size = savedTextContainerSize;
    _textContainer.maximumNumberOfLines = savedTextContainerNumberOfLines;

    return textBounds;
}

- (void)drawTextInRect:(CGRect)rect
{
    // Don't call super implementation. Might want to uncomment this out when
    // debugging layout and rendering problems.
    // [super drawTextInRect:rect];

    // Calculate the offset of the text in the view
    NSRange glyphRange = [_layoutManager glyphRangeForTextContainer:_textContainer];
    CGPoint glyphsPosition = [self calcGlyphsPositionInView];

    // Drawing code
    [_layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:glyphsPosition];
    [_layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:glyphsPosition];
}

// Returns the XY offset of the range of glyphs from the view's origin
- (CGPoint)calcGlyphsPositionInView
{
    CGPoint textOffset = CGPointZero;

    CGRect textBounds = [_layoutManager usedRectForTextContainer:_textContainer];
    textBounds.size.width = ceil(textBounds.size.width);
    textBounds.size.height = ceil(textBounds.size.height);

    if (textBounds.size.height < self.bounds.size.height)
    {
        CGFloat paddingHeight = (self.bounds.size.height - textBounds.size.height) / 2.0;
        textOffset.y = paddingHeight;
    }

    return textOffset;
}

- (void)setFrame:(CGRect)frame
{
    [super setFrame:frame];

    _textContainer.size = self.bounds.size;
}

- (void)setBounds:(CGRect)bounds
{
    [super setBounds:bounds];

    _textContainer.size = self.bounds.size;
}

- (void)layoutSubviews
{
    [super layoutSubviews];

    // Update our container size when the view frame changes
    _textContainer.size = self.bounds.size;
}

- (void)setIgnoredKeywords:(NSSet *)ignoredKeywords
{
    NSMutableSet *set = [NSMutableSet setWithCapacity:ignoredKeywords.count];

    [ignoredKeywords enumerateObjectsUsingBlock:^(id obj, BOOL *stop) {
        [set addObject:[obj lowercaseString]];
    }];

    _ignoredKeywords = [set copy];
}

#pragma mark - Interactions

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    _isTouchMoved = NO;

    // Get the info for the touched link if there is one
    NSDictionary *touchedLink;
    CGPoint touchLocation = [[touches anyObject] locationInView:self];
    touchedLink = [self linkAtPoint:touchLocation];

    if (touchedLink)
    {
        self.selectedRange = [[touchedLink objectForKey:RgLabelRangeKey] rangeValue];
    }
    else
    {
        [super touchesBegan:touches withEvent:event];
    }
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesMoved:touches withEvent:event];

    _isTouchMoved = YES;
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesEnded:touches withEvent:event];

    // If the user dragged their finger we ignore the touch
    if (_isTouchMoved)
    {
        self.selectedRange = NSMakeRange(0, 0);

        return;
    }

    // Get the info for the touched link if there is one
    NSDictionary *touchedLink;
    CGPoint touchLocation = [[touches anyObject] locationInView:self];
    touchedLink = [self linkAtPoint:touchLocation];

    if (touchedLink)
    {
        NSRange range = [[touchedLink objectForKey:RgLabelRangeKey] rangeValue];
        NSString *touchedSubstring = [touchedLink objectForKey:RgLabelLinkKey];
        RgLinkType linkType = (RgLinkType)[[touchedLink objectForKey:RgLabelLinkTypeKey] intValue];

        [self receivedActionForLinkType:linkType string:touchedSubstring range:range];
    }
    else
    {
        [super touchesBegan:touches withEvent:event];
    }

    self.selectedRange = NSMakeRange(0, 0);
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesCancelled:touches withEvent:event];

    // Make sure we don't leave a selection when the touch is cancelled
    self.selectedRange = NSMakeRange(0, 0);
}

- (void)receivedActionForLinkType:(RgLinkType)linkType string:(NSString*)string range:(NSRange)range
{
    switch (linkType)
    {
        case RgLinkTypeUserHandle:
            if (_userHandleLinkTapHandler)
            {
                _userHandleLinkTapHandler(self, string, range);
            }
            break;
    }
}

#pragma mark - Layout manager delegate

-(BOOL)layoutManager:(NSLayoutManager *)layoutManager shouldBreakLineByWordBeforeCharacterAtIndex:(NSUInteger)charIndex
{
    // Don't allow line breaks inside URLs
    NSRange range;
    NSURL *linkURL = [layoutManager.textStorage attribute:NSLinkAttributeName atIndex:charIndex effectiveRange:&range];

    return !(linkURL && (charIndex > range.location) && (charIndex <= NSMaxRange(range)));
}

+ (NSAttributedString *)sanitizeAttributedString:(NSAttributedString *)attributedString
{
    // Setup paragraph alignement properly. IB applies the line break style
    // to the attributed string. The problem is that the text container then
    // breaks at the first line of text. If we set the line break to wrapping
    // then the text container defines the break mode and it works.
    // NOTE: This is either an Apple bug or something I've misunderstood.

    // Get the current paragraph style. IB only allows a single paragraph so
    // getting the style of the first char is fine.
    NSRange range;
    NSParagraphStyle *paragraphStyle = [attributedString attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:&range];

    if (paragraphStyle == nil)
    {
        return attributedString;
    }

    // Remove the line breaks
    NSMutableParagraphStyle *mutableParagraphStyle = [paragraphStyle mutableCopy];
    mutableParagraphStyle.lineBreakMode = NSLineBreakByWordWrapping;

    // Apply new style
    NSMutableAttributedString *restyled = [[NSMutableAttributedString alloc] initWithAttributedString:attributedString];
    [restyled addAttribute:NSParagraphStyleAttributeName value:mutableParagraphStyle range:NSMakeRange(0, restyled.length)];

    return restyled;
}

#pragma mark - 给每个标签设置对应的字体属性

- (void)setLinkAttributes:(NSArray *)attributes {

    if(!self.rg_linkAttributes) {

        self.rg_linkAttributes = [[NSMutableArray alloc] init];

    }

    [self.rg_linkAttributes removeAllObjects];
    [self.rg_linkAttributes addObjectsFromArray:attributes];

}

@end


text:
<?php

use yii\helpers\Html;
use app\models\ProfileNotification;

/** @var $this yii\web\View */
/** @var $model app\models\Profiles */

$icons = [
    ProfileNotification::TYPE_REQUEST_NEW => 'fa fa-ticket bg-green',
    ProfileNotification::TYPE_REQUEST_DELAYED_START => 'fa fa-ticket bg-red',
    ProfileNotification::TYPE_REQUEST_DELAYED_END => 'fa fa-ticket bg-red',
    ProfileNotification::TYPE_COMMENT_NEW => 'fa fa-commenting bg-green',
    ProfileNotification::TYPE_REQUEST_MATCHING => 'fa fa-ticket bg-aqua',
];
?>

            <?php
            if (!empty($model->profileNotifications)) {
                echo Html::a(Yii::t('app', 'Очистить все уведомления'), ['notifications/clear'],
                    ['class' => 'btn btn-flat btn-primary']);
            }
            ?>

        <?php foreach ($model->profileNotifications as $notification): ?>

                <i class="<?= $icons[$notification->type] ?>">

                        <time> <?= Yii::$app->formatter->asDatetime($notification->created_at) ?></time>

                        <a href="<?= \yii\helpers\Url::to($notification->urlArray) ?>">
                            <?= $notification->notification ?>

        <?php endforeach; ?>


text:
using Microsoft.DotNet.Cli.Utils;
using NuGet.Frameworks;
using System.Collections.Generic;
namespace FluentMigrator.Runner.Cli
{
    public class BuildCommandFactory
    {
        public static ICommand Create(string project, string configuration,
               NuGetFramework framework, string buildBasePath, string output)
        {
            // TODO: Specify --runtime?
            var args = new List<string>
            {
                project,
                "--configuration", configuration,
                "--framework", framework.GetShortFolderName()
            };
            if (buildBasePath != null)
            {
                args.Add("--build-base-path");
                args.Add(buildBasePath);
            }
            if (output != null)
            {
                args.Add("--output");
                args.Add(output);
            }
            return Command.CreateDotNet("build", args, framework, configuration);
        }
    }
}


text:
<?php

namespace Appsco\Market\ApiBundle\Service\Notification\Validator\Certificate;

use Appsco\Dashboard\ApiBundle\Client\AppscoClient;
use Appsco\Market\ApiBundle\Error\InvalidNotificationException;
use Appsco\Market\ApiBundle\Model\Notification;
use Appsco\Market\ApiBundle\Service\Notification\Validator\NotificationValidatorInterface;
use BWC\Component\Jwe\Encoder;

class AppscoCertificateValidator implements NotificationValidatorInterface
{
    /** @var  AppscoClient */
    protected $client;

    /** @var  Encoder */
    protected $jwtEncoder;

    /**
     * @param AppscoClient $appscoClient
     * @param \BWC\Component\Jwe\Encoder $jwtEncoder
     */
    public function __construct(AppscoClient $appscoClient, Encoder $jwtEncoder)
    {
        $this->client = $appscoClient;
        $this->jwtEncoder = $jwtEncoder;
    }

    /**
     * @param Notification $notification
     * @throws InvalidNotificationException
     * @return void
     */
    public function validate(Notification $notification)
    {
        $certificateList = $this->client->certificateGet($notification->getIssuer());

        if (0 == count($certificateList->getCertificates())) {
            throw new InvalidNotificationException(sprintf(
                "Issuer '%s' has no Appsco certificates",
                $notification->getIssuer()
            ));
        }

        $error = null;
        foreach ($certificateList->getCertificates() as $certificate) {
            try {
                $this->jwtEncoder->verify($notification, $certificate->getCertificate());
                $error = null;
                break;
            } catch (\Exception $ex) {
                $error = $ex;
            }
        }

        if ($error) {
            throw new InvalidNotificationException(
                sprintf("Unable to verify certificate of issuer '%s'", $notification->getIssuer()),
                0,
                $error
            );
        }
    }

}


text:
define([
    'underscore',
    'backbone',
    'utils',
    'APP',
    'viewCommons',
    'app/models/credentials',
    'app/views/header/chunk/header',
    'app/collections/user-collection',
    'app/collections/user-sm-collection',
    'checkSHA'

], function(_,
            Backbone,
            utils,
            APP,
            viewCommons,
            Credentials,
            Header,
            UserCollection,
            UserSMCollection,
            checkSHA){

var LoginPage = Backbone.View.extend({

    model: new Credentials(),

    bindings: {
        '[name=usuario]': {
            observe: 'usuario',
            setOptions: {
                validate: true
            }
        },
        '[name=contrasena]': {
            observe: 'contrasena',
            setOptions: {
                validate: true
            }
        },
    },

    initialize: function () {
        this.template = _.template(utils.tpl.get('login/page/login-page'));
        this.title = "Autenticación";
    },

    events: {
        "click #login-button": "login"
    },

    render: function (eventName) {
        this.model.set("usuario", "");
        this.model.set("contrasena", "");

        this.$el.html(this.template(this.model.toJSON()));
        this.stickit();

        var self = this;
        new Header({
            el: this.$el.find('#header'),
            titulo: this.title,
            botonMenu: false,
            usuario: null
        }).render();

        return this;
    },

    login: function (event) {
        event.preventDefault(); // Don't let this button submit the form

        var self = this;
        var usuario = this.model.get('usuario');
        var contrasena = this.model.get('contrasena');

        APP.notifier.notify({
            message: "Iniciando sesión...",
            position: 'center',
            fadeInMs: 0,
            fadeOutMs: 0,
            ms: null,
            modal: true,
            loader: true,
            destroy: false,
            width: APP.config.POPUP_WIDTH
        });

        APP.usuarioSM = new UserSMCollection();
        APP.usuarioSM.username = usuario;
        APP.usuarioSM.password = contrasena;
        APP.usuarioSM.fetch({
            success: function (model, response, options) {
                console.log('Success usuarios hash: ', APP.usuarioSM);
                    if (!_.find(APP.usuarioSM.models, function(model){
                            return model.get('username') == usuario;
                        })) {

                        utils.notifyError('Credenciales inválidas o debe ' +
                        'iniciar sesión al menos una vez con acceso a la red con este usuario!');
                    } else {
                        self.onUserHashFound(usuario, contrasena);
                    }
                },
            error: function(model, response, options) {
                console.error('Error fetch usuarios hash: ', response);
                utils.notifyError('Credenciales inválidas o debe ' +
                'iniciar sesión al menos una vez con acceso a la red con este usuario!');
            }
        });
    },

    onUserHashFound: function (usuario, contrasena) {

        APP.currentUser = null;
        var hash = "";
        var usuarioHash = APP.usuarioSM.models[0]; //Its only one.

        if (usuarioHash) {
            hash = usuarioHash.get('password');
        }

        if (checkSHA.check(hash, contrasena)) {
            APP.usuarios = new UserCollection(null, {contrasena: contrasena, usuario: usuario});

            APP.usuarios.fetch({
                success: function () {
                    console.log("Success fetch usuarios");

                    var busquedaUsuario = APP.usuarios.findWhere({'usuario': usuario});

                    if (busquedaUsuario) {
                        APP.usuarioActual = busquedaUsuario;
                        APP.notifier.destroyAll();
                        APP.logeadoRecien = 1;
                        APP.usuarioActual.ultimaActividad = new Date();
                        viewCommons.cargarEntregas(function () {
                            APP.router.navigate("home", {
                                trigger: true
                            });
                        });

                    } else {
                        utils.notifyError("Credenciales inválidas!");
                    }
                },
                error: function (model, response, options) {
                    APP.notifier.destroyAll();
                    console.error("usuarios fetch: " + JSON.stringify(response));
                    utils.notifyError('Credenciales inválidas o debe ' +
                        'iniciar sesión al menos una vez con acceso a la red con este usuario!');
                },
            });

        } else {
            utils.notifyError("Credenciales inválidas!");
        }
    },

    buscarUsuario: function (usuario, contrasena) {
        return APP.usuarios.findWhere({'usuario': usuario});
    },

    remove: function () {
        // Remove the validation binding
        Backbone.Validation.unbind(this);
        return Backbone.View.prototype.remove.apply(this, arguments);
    }

});

return LoginPage;

});


text:
module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        conventionalChangelog: {
          options: {
            changelogOpts: {
              // conventional-changelog options go here
              preset: "angular"
           },
           context: {
              // context goes here
           },
           gitRawCommitsOpts: {
              // git-raw-commits options go here
           },
           parserOpts: {
              // conventional-commits-parser options go here
           },
           writerOpts: {
              // conventional-changelog-writer options go here
           }
          },
          release: {
            src: "CHANGELOG.md"
          }
        }
    });

    require('load-grunt-tasks')(grunt);
};


text:
/**
 * Prepros interface for Node
 * @author Carl-Erik Kopseng <carlerik@gmail.com>
 *
 * Built using `prepros/build_prepros.sh`
 */

var prepros = require('./angular-to-requirejs-adapter')
    , _ = require('lodash')
    , dummy = function() {}
    , Backbone = { Notifier : function() {
        this.info = dummy;
        this.notify = dummy;
        this.destroyAll = dummy;
    }}
    , angular = {
        fromJson : function() {
            return {
                version : -99,
                dependencies : {},
                ruby : {
                    gems : {},
                    bourbon : '',
                    neat : '',
                    bitters : ''
                }
            }
        }        ,
        toJson : JSON.stringify
    }
    , $ = { parseJSON : JSON.parse }
    , localStorage = {};


text:
published: true
date: '2017-04-14 10:05 -0700'
title: What is Evolved Programmable Network EPN?
permalink: /getting-started/whatis-@epndocs
author: Ahmed Abeer
tags:
  - epn
  - cisco
---
A Programmable, Physical, and Virtual Infrastructure

The Evolved Programmable Network (EPN) is designed for web-speed agility with an open, elastic, and application centric network infrastructure. It could help you transform and expand your business, and accelerate time to revenue while reducing costs and complexities of deploying new services. The Cisco Evolved Programmable Network (EPN) works together via open APIs with the complementary Cisco Evolved Services Platform to help you realize these goals.


text:
package io.redbarn;

import jdk.nashorn.api.scripting.ScriptObjectMirror;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import javax.script.ScriptEngine;
import javax.script.ScriptException;
import java.io.IOException;

/**
 * Tests methods in the RedbarnScriptEngineManager class.
 *
 * @author Mike Atkisson
 * @since 0.1.0
 */
public class RedbarnScriptEngineManagerTest extends AbstractScriptEngineTest {

    @DataProvider
    public static Object[][] vars() {
        return new Object[][] {
                {"console", true},
        };
    }

    @Test(groups = "Slow")
    public void getScriptEngine_WithNoArguments_ReturnsNonNull()
            throws IOException, ScriptException {
        Assert.assertNotNull(scriptEngine);
    }

    @Test(groups = "Slow", dataProvider = "vars")
    public void getScriptEngine_WithNoArguments_ObjectIsAvailableInScript(String name, boolean notNull)
            throws IOException, ScriptException {
        Object variable = scriptEngine.get(name);
        Assert.assertNotNull(variable);
    }

}


text:
id: 5a24c314108439a4d4036182
title: Add Inline Styles in React
challengeType: 6
forumTopicId: 301378
dashedName: add-inline-styles-in-react
---

# --description--

You may have noticed in the last challenge that there were several other syntax differences from HTML inline styles in addition to the `style` attribute set to a JavaScript object. First, the names of certain CSS style properties use camel case. For example, the last challenge set the size of the font with `fontSize` instead of `font-size`. Hyphenated words like `font-size` are invalid syntax for JavaScript object properties, so React uses camel case. As a rule, any hyphenated style properties are written using camel case in JSX.

All property value length units (like `height`, `width`, and `fontSize`) are assumed to be in `px` unless otherwise specified. If you want to use `em`, for example, you wrap the value and the units in quotes, like `{fontSize: "4em"}`. Other than the length values that default to `px`, all other property values should be wrapped in quotes.

# --instructions--

If you have a large set of styles, you can assign a style `object` to a constant to keep your code organized. Declare your styles constant as a global variable at the top of the file. Initialize `styles` constant and assign an `object` with three style properties and their values to it. Give the `div` a color of `purple`, a font-size of `40`, and a border of `2px solid purple`. Then set the `style` attribute equal to the `styles` constant.

# --hints--

The `styles` variable should be an `object` with three properties.

```js
assert(Object.keys(styles).length === 3);
```

The `styles` variable should have a `color` property set to a value of `purple`.

```js
assert(styles.color === 'purple');
```

The `styles` variable should have a `fontSize` property set to a value of `40`.

```js
assert(styles.fontSize === 40);
```

The `styles` variable should have a `border` property set to a value of `2px solid purple`.

```js
assert(styles.border === '2px solid purple');
```

The component should render a `div` element.

```js
assert(
  (function () {
    const mockedComponent = Enzyme.shallow(React.createElement(Colorful));
    return mockedComponent.type() === 'div';
  })()
);
```

The `div` element should have its styles defined by the `styles` object.

```js
assert(
  (function () {
    const mockedComponent = Enzyme.shallow(React.createElement(Colorful));
    return (
      mockedComponent.props().style.color === 'purple' &&
      mockedComponent.props().style.fontSize === 40 &&
      mockedComponent.props().style.border === '2px solid purple'
    );
  })()
);
```

# --seed--

## --after-user-code--

```jsx
ReactDOM.render(<Colorful />, document.getElementById('root'))
```

## --seed-contents--

```jsx
// Change code above this line
class Colorful extends React.Component {
  render() {
    // Change code below this line
    return (
      <div style={{color: "yellow", fontSize: 24}}>Style Me!</div>
    );
    // Change code above this line
  }
};
```

# --solutions--

```jsx
const styles = {
  color: "purple",
  fontSize: 40,
  border: "2px solid purple"
};
// Change code above this line
class Colorful extends React.Component {
  render() {
    // Change code below this line
    return (
      <div style={styles}>Style Me!</div>
    );
    // Change code above this line
  }
};
```


text: Simple Akka Chat created with remote actors.


text:
<!DOCTYPE html>

    <link href="css/awsdocs.css" rel="stylesheet" type="text/css">

    <meta charset="utf-8">

Amazon Simple Email Service ReceiptRule AddHeaderAction

The
                        AddHeaderAction property type add a header to email it recieves on behalf of one or more email addresses
                        or domains that you own.

                        AddHeaderAction is a property of the Amazon Simple Email Service ReceiptRule Action property type.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "HeaderValue" : String,
  "HeaderName" : String
}

YAML

HeaderValue: String
HeaderName: String

Properties

HeaderName

The name of the header to add. Must be between 1 and 50 characters, inclusive, and
                                 consist of alphanumeric (a-z, A-Z, 0-9) characters and dashes only.

                                 Required: Yes

                                 Type: String

                                 Update requires:
                                 No interruption

HeaderValue

Must be less than 2048 characters, and must not contain newline characters ("\r" or
                                 "\n").

                                 Required: Yes

                                 Type: String

                                 Update requires:
                                 No interruption

See Also

Creating Receipt Rules for Amazon SES Email Receiving in the Amazon Simple Email Service Developer Guide

CreateReceiptRule in the Amazon Simple Email Service API Reference

AddHeaderAction in the Amazon Simple Email Service API Reference


text:
<?xml version="1.0" encoding="UTF-8"?>

<ConceptMap xmlns="http://hl7.org/fhir">
  <identifier value="http://hl7.org/fhir/cm/v3/address-use"/>
  <name value="v3 map for AddressUse"/>
  <publisher value="HL7 (FHIR Project)"/>
  <telecom>
    <system value="url"/>
    <value value="http://hl7.org/fhir"/>
  </telecom>
  <telecom>
    <system value="email"/>
    <value value="fhir@lists.hl7.org"/>
  </telecom>
  <description value="v3 Map (AddressUse)"/>
  <status value="draft"/>
  <date value="2013-12-18T09:56:09.981+11:00"/>
  <source>
    <reference value="http://hl7.org/fhir/vs/address-use"/>
  </source>
  <target>
    <reference value="http://hl7.org/fhir/v3/vs/AddressUse"/>
  </target>
  <concept>
    <system value="http://hl7.org/fhir/address-use"/>

    <map>
      <system value="http://hl7.org/fhir/v3/AddressUse"/>

      <equivalence value="equal"/>
    </map>
  </concept>
  <concept>
    <system value="http://hl7.org/fhir/address-use"/>

    <map>
      <system value="http://hl7.org/fhir/v3/AddressUse"/>

      <equivalence value="equal"/>
    </map>
  </concept>
  <concept>
    <system value="http://hl7.org/fhir/address-use"/>

    <map>
      <system value="http://hl7.org/fhir/v3/AddressUse"/>

      <equivalence value="equal"/>
    </map>
  </concept>
  <concept>
    <system value="http://hl7.org/fhir/address-use"/>

    <map>
      <system value="http://hl7.org/fhir/v3/AddressUse"/>

      <equivalence value="narrower"/>
    </map>
  </concept>
  <concept>
    <system value="http://hl7.org/fhir/address-use"/>

    <map>
      <system value="http://hl7.org/fhir/v3/AddressUse"/>

      <equivalence value="narrower"/>
    </map>
  </concept>
</ConceptMap>


text:
Ext.define('MVC.controller.Login', {
    extend: 'Ext.app.Controller',
    config: {
        routes: {
            'login': 'loginView'
        },
        refs: {
            loginPanel: 'loginpanel',
            forgotButton: {
                selector: '[itemId="forgotbtn"]'
            },
            loginButton: {
                selector: '[itemId="loginbtn"]'
            }
        },
        control: {
            forgotButton: {
                tap: "forgotNav"
            },
            loginButton: {
                tap: "loginNav"
            }
        }

    },
    getNewView: function () {
        var me = this;
        me.loginview = Ext.create('MVC.view.Login');
        return me.loginview;
    },
    loginView: function (anim) {
        console.log("werwe");
        var controller = this.getApplication().getController('Login'),
        newview = controller.getNewView(), viewportcontroller = this.getApplication().getController('Main');
        viewportcontroller.doNavigation(newview, anim || global_anim);
    },
    forgotNav: function () {
        var viewportcontroller = this.getApplication().getController('Main');
        global_anim = backward_dir;
        viewportcontroller.appRedirect('forgot');
    },
    loginNav: function () {
        var me = this;
        console.log(me.getLoginPanel().getValues());

        me.getLoginPanel().submit({
            url: requestMethod.login,
            standardSubmit: false,
            params: me.getLoginPanel().getValues(),
            waitMsg: { message: 'Submitting', cls: 'form-loading' },
            success: function (form, responseObj, c) {
                var viewportcontroller = me.getApplication().getController('Main');
                global_anim = forward_dir;
                viewportcontroller.appRedirect('usersettings');

            },
            failure: function (from, responseObj) {
                console.log(responseObj.statusText)
                var errortext = (Ext.isObject(responseObj)) ? (responseObj.text || responseObj.statusText) : Ext.decode(responseObj).error;
                Ext.Msg.alert('Error', errortext, Ext.emptyFn);
            }
        });

    }
});