text:
package jetbrains.buildServer.nuget.tests.integration.feed.server;

import jetbrains.buildServer.nuget.tests.integration.Paths;
import jetbrains.buildServer.nuget.tests.server.entity.FeedParseResult;
import jetbrains.buildServer.nuget.tests.server.entity.MetadataBeanProperty;
import jetbrains.buildServer.nuget.tests.server.entity.MetadataParseResult;
import jetbrains.buildServer.nuget.tests.server.entity.XmlFeedParsers;
import jetbrains.buildServer.util.FileUtil;
import jetbrains.buildServer.util.TestFor;
import jetbrains.buildServer.util.XmlUtil;
import org.jdom.*;
import org.jdom.xpath.XPath;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;
import java.util.*;

/**
 * Created by Eugene Petrenko (eugene.petrenko@gmail.com)
 * Date: 06.01.12 22:23
 */
public class NuGetJavaFeedContentTest extends NuGetJavaFeedIntegrationTestBase {
  private static final boolean LOCAL_DIFF_GOLD_AND_GENERATED = false;

  @BeforeMethod
  protected void setUp() throws Exception {
    super.setUp();
  }

  @Test
  public void testMetadata_v1() throws JDOMException, IOException {
    final String s = openRequest("$metadata");
    compareStringAsXml(s, "/feed/odata/metadata.v1.xml");
  }

  @Test
  public void testMetadata_v2() throws JDOMException, IOException {
    final String s = openRequest("$metadata");
    checkMetadata(s, "/feed/odata/metadata.v2.xml");
  }

  private void checkMetadata(@NotNull final String metadataXml, @NotNull final String gold) throws JDOMException, IOException {
    MetadataParseResult actual = XmlFeedParsers.loadMetadataBeans(parseXml(metadataXml));
    MetadataParseResult expected = XmlFeedParsers.loadMetadataBeans(parseGoldXml(gold));

    Assert.assertEquals(listProps(actual.getKey()), listProps(expected.getKey()));
    Assert.assertTrue(listProps(actual.getData()).containsAll(listProps(expected.getData())));

    compareStringAsXml(metadataXml, gold);
  }

  private void checkFeed(@NotNull final String feedXml, @NotNull final String gold) throws JDOMException, IOException {
    final Element root = parseXml(feedXml);

    final String base = root.getAttributeValue("base", Namespace.XML_NAMESPACE);
    Assert.assertTrue(base.startsWith(getNuGetServerUrl()), base);

    XPath xp = XPath.newInstance("//a:content/@src");
    xp.addNamespace("a", "http://www.w3.org/2005/Atom");
    for (Object o : xp.selectNodes(root)) {
      Attribute att = (Attribute) o;
      final String value = att.getValue();
      Assert.assertTrue(value.startsWith(getServerBase() + "/"), value);
    }

    FeedParseResult actual = XmlFeedParsers.loadFeedBeans(root);
    FeedParseResult expected = XmlFeedParsers.loadFeedBeans(parseGoldXml(gold));

    Assert.assertFalse(actual.getPropertyNames().isEmpty());
    Assert.assertFalse(expected.getPropertyNames().isEmpty());
    Assert.assertFalse(actual.getAtomProperties().isEmpty());
    Assert.assertFalse(expected.getAtomProperties().isEmpty());

    Assert.assertTrue(actual.getPropertyNames().containsAll(expected.getPropertyNames()));
    Assert.assertEquals(actual.getAtomProperties().toString(), expected.getAtomProperties().toString());

    compareStringAsXml(feedXml, gold);
  }

  private Set<String> listProps(Collection<MetadataBeanProperty> result) {
    Set<String> set = new HashSet<String>();
    for (MetadataBeanProperty property : result) {
      set.add(property.getName());
    }
    return set;
  }

  @Test
  public void testRoot() throws JDOMException, IOException {
    final String s = openRequest("");
    compareStringAsXml(s, "/feed/odata/root.v2.xml", true);
  }

  @Test
  public void testPackages_v1() throws JDOMException, IOException {
    addPackage(Paths.getTestDataPath("/packages/CommonServiceLocator.1.0.nupkg"), false);
    final String s = openRequest("Packages()");

    checkFeed(s, "/feed/odata/packages.v1.CommonServiceLocator.xml");
  }

  @Test
  public void testPackages_v2() throws JDOMException, IOException {
    addPackage(Paths.getTestDataPath("/packages/CommonServiceLocator.1.0.nupkg"), false);
    final String s = openRequest("Packages()");

    checkFeed(s, "/feed/odata/packages.v2.CommonServiceLocator.xml");
  }

  @Test
  @TestFor(issues = "TW-26658")
  public void testPackages_title() throws JDOMException, IOException {
    addPackage(Paths.getTestDataPath("/packages/YCM.Web.UI.1.0.20.7275.nupkg"), false);
    final String s = openRequest("Packages()");
    System.out.println(XmlUtil.to_s(XmlUtil.from_s(s)));

    Assert.assertTrue(s.contains("<d:Title>YorkNet UI Components</d:Title>"));
  }

  @Test
  public void testPackages_count() throws JDOMException, IOException {
    addPackage(Paths.getTestDataPath("/packages/CommonServiceLocator.1.0.nupkg"), false);
    final String s = openRequest("Packages()/$count");
    Assert.assertEquals(s, "1");
  }

  @Test
  public void testVSRequests() {
    String[] reqs = {
            "Packages()",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeee',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeee',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeee%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeeeff',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeeeff',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeeeff%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeeeffdfg',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeeeffdfg',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeeeffdfg%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeeeffdfgdfg',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeeeffdfgdfg',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeeeffdfgdfg%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeeeffdfgdfgdfg',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeeeffdfgdfgdfg',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeeeffdfgdfgdfg%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeeeffdfgdfgdfgdf',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeeeffdfgdfgdfgdf',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeeeffdfgdfgdfgdf%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=((((Id%20ne%20null)%20and%20substringof('freerereeeeffdfgdfgdfgdfgdfg',tolower(Id)))%20or%20((Description%20ne%20null)%20and%20substringof('freerereeeeffdfgdfgdfgdfgdfg',tolower(Description))))%20or%20((Tags%20ne%20null)%20and%20substringof('%20freerereeeeffdfgdfgdfgdfgdfg%20',tolower(Tags))))%20and%20IsLatestVersion",
            "Packages()/$count?$filter=IsLatestVersion",
            "Packages()?$filter=(tolower(Id)%20eq%20'castle.core')%20or%20(tolower(Id)%20eq%20'castle.windsor')&$orderby=Id&$skip=0&$top=30",
    };

    for (String req : reqs) {
      assert200(req).run();
    }
  }

  @Test(enabled = false) @TestFor(issues = "TW-36083")
  public void testSemanticVersioning() throws Exception {
    addMockPackage("foo", "1.0.0-Beta6");
    addMockPackage("foo", "1.0.0-Beta7");
    addMockPackage("foo", "1.0.0");

    final String response = openRequest("Packages()?$filter=(Version%20gt%20%271.0.0-Beta1%27)");
    assertContainsPackageVersion(response, "1.0.0-Beta6");
    assertContainsPackageVersion(response, "1.0.0-Beta7");
    assertContainsPackageVersion(response, "1.0.0");

    assert400("Packages()?$filter=(Version gt '1.0.0')").run();
  }

  private String replaceXml(@NotNull final String text) {
    return text
            .replace("http://nuget.org/api/v2/", "BASE_URI/")
            .replace(getNuGetServerUrl(), "BASE_URI/")
            .replaceAll("\\d+-\\d+-\\d+T\\d+:\\d+:\\d+(\\.\\d+)?Z?", "TIME")
            ;
  }

  private void compareStringAsXml(String actualXml, String goldPath) throws JDOMException, IOException {
    compareStringAsXml(actualXml, goldPath, false);
  }

  private void compareStringAsXml(String actualXml, String goldPath, boolean checkUnderTeamCity) throws JDOMException, IOException {
    //disable comparison check for TeamCity
    if (!checkUnderTeamCity && System.getenv("TEAMCITY_VERSION") != null) return;
    //noinspection PointlessBooleanExpression
    if (!checkUnderTeamCity && !LOCAL_DIFF_GOLD_AND_GENERATED) return;
    System.out.println("actualXml = " + actualXml);
    compareXmlWithGold(parseXml(actualXml), goldPath);
  }

  private Element parseXml(String text) {
    return XmlUtil.from_s(text);
  }

  private void compareXmlWithGold(Element actual, String goldPath) throws JDOMException, IOException {
    System.out.println("actual: \r\n" + XmlUtil.to_s(actual) + "\r\n\r\n");
    Element gold = parseGoldXml(goldPath);
    compareXml(actual, gold);
  }

  private Element parseGoldXml(String goldPath) throws IOException {
    final File file = Paths.getTestDataPath(goldPath);
    final String text = new String(FileUtil.loadFileText(file, "utf-8"));
    return parseXml(text);
  }

  private void compareXml(Element actual, Element gold) throws JDOMException {
    String actualText = XmlUtil.to_s(sortProperties(sortEntityTypeProperties(actual)));
    String goldText = XmlUtil.to_s(sortProperties(sortEntityTypeProperties(gold)));

    Assert.assertEquals(replaceXml(actualText), replaceXml(goldText));
  }

  private Element sortEntityTypeProperties(Element el) throws JDOMException {
    XPath xp = XPath.newInstance("//x:EntityType");
    xp.addNamespace("x", "http://schemas.microsoft.com/ado/2006/04/edm");

    for (Object pNode : xp.selectNodes(el)) {
      Element node = (Element) pNode;
      final List<Element> props = new ArrayList<Element>();
      for (Object pChild : new ArrayList<Object>(node.getChildren())) {
        Element child = (Element) pChild;
        if (child.getName().equals("Property")) {
          props.add((Element) child.clone());
          child.detach();
        }
      }

      Collections.sort(props, new Comparator<Element>() {
        public int compare(Element o1, Element o2) {
          return o1.getAttributeValue("Name").compareTo(o2.getAttributeValue("Name"));
        }
      });

      for (Element prop : props) {
        node.addContent((Content)prop);
      }
    }
    return el;
  }

  private Element sortProperties(Element el) throws JDOMException {
    XPath xp = XPath.newInstance("//m:properties");
    xp.addNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");

    for (Object pNode : xp.selectNodes(el)) {
      Element node = (Element) pNode;
      final List<Element> props = new ArrayList<Element>();
      for (Object pChild : new ArrayList<Object>(node.getChildren())) {
        Element child = (Element) pChild;
        props.add((Element) child.clone());
        child.detach();
      }

      Collections.sort(props, new Comparator<Element>() {
        public int compare(Element o1, Element o2) {
          return o1.getName().compareTo(o2.getName());
        }
      });

      for (Element prop : props) {
        node.addContent((Content)prop);
      }
    }
    return el;
  }

}


text:
require 'rails_helper'

feature "Pagination of photos", type: :feature do

  let(:user) { create :user }

  background do
    @event = create :event, users: [user]
    @photo1, @photo2, @photo3 = create_list :photo, 3, event: @event

    login_as user
  end

  describe 'Pagination' do
    before do
      allow(Photo).to receive(:default_per_page) { 1 }
    end

    it 'appends the next page', js: true do
      visit event_path @event
      expect(page).to have_css "##{dom_id @photo1}"

      click_link 'Next page'
      expect(page).to have_css "##{dom_id @photo1}"
      expect(page).to have_css "##{dom_id @photo2}"

      click_link 'Next page'
      expect(page).to have_css "##{dom_id @photo1}"
      expect(page).to have_css "##{dom_id @photo2}"
      expect(page).to have_css "##{dom_id @photo3}"
    end

    it 'hides next-link on last page' do
      visit event_path @event, page: 3

      expect(page).to have_css "##{dom_id @photo3}"
      expect(page).not_to have_link 'Next page'
    end

    it 'prepends the previous page', js: true do
      visit event_path @event, page: 3
      expect(page).to have_css "##{dom_id @photo3}"

      click_link 'Previous page'
      expect(page).to have_css "##{dom_id @photo3}"
      expect(page).to have_css "##{dom_id @photo2}"

      click_link 'Previous page'
      expect(page).to have_css "##{dom_id @photo3}"
      expect(page).to have_css "##{dom_id @photo2}"
      expect(page).to have_css "##{dom_id @photo1}"
    end

    it 'hides previous-link on first page' do
      visit event_path @event

      expect(page).to have_css "##{dom_id @photo1}"
      expect(page).not_to have_link 'Previous page'
    end

    it 'links directly to the first page', js: true do
      visit event_path @event, page: 3

      click_link 'First page'
      expect(page).to have_css "##{dom_id @photo1}"

      visit event_path @event, page: 2
      expect(page).not_to have_link 'First page'
    end

    it 'shows link to first page not on the first and second page' do
      visit event_path @event
      expect(page).not_to have_link 'First page'

      click_link 'Next page'
      expect(page).not_to have_link 'First page'

      click_link 'Next page'
      expect(page).to have_link 'First page'
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
layout: post
author: erholmes
categories: post
title: I Came, I Saw, I Used a Flask
published: true
---

Must be something in the water because I didn't have any major issues installing and getting Flask up and running. I installed and cloned Flask with no issues at all. I got the site up and running on my local host and was able to login easily. <br \> I created my about.html page and added the route in flaskr.py. I ended up getting the same template error that Kyle mentioned in the Google Plus community. Shout out to Grant for providing a quick fix! Turns out I was missing a {! Silly typos! But once that was fixed, I was able to get a site up and working. Admittedly, it's not pretty, but it's functional!

![Flask](http://www.unc.edu/~erholmes/flaskr.png)


text:
package bartender

import (
	"errors"
	"fmt"
	"reflect"

	"github.com/go-kit/kit/endpoint"
)

var errNumArgMismatch = errors.New("number of arguement(s) mismatch")

// validAssign check if type *from can be assigned to *to
// and detect possible error
func validAssign(from, to *reflect.Type, pos int) (err error) {
	if (*to).Kind() == reflect.Interface {
		// if to is an interface, check if from implements to
		if !(*from).Implements(*to) {
			err = fmt.Errorf("cannot use type %s as type %s "+
				"in argument %d:\n%s does not implement %s",
				*from, *to, pos,
				*from, *to)
		}
		return
	} else if *from != *to {
		// simply check if the types are the same
		err = fmt.Errorf("cannot use type %s as type %s "+
			"in argument %d", *from, *to, pos)
		return
	}
	return
}

// validConnect check if output of function from
// could be connected to the function to.
// reports error involved
func validConnect(from, to interface{}) (err error) {

	// assumes from and to are function
	// and will not check
	fn1 := reflect.TypeOf(from)
	fn2 := reflect.TypeOf(to)

	// check number of arguments
	if fn1.NumOut() != fn2.NumIn() {
		err = errNumArgMismatch
		return
	}

	// check each arguments type
	for i := 0; i < fn1.NumOut(); i++ {
		vt1 := fn1.Out(i)
		vt2 := fn2.In(i)
		if err = validAssign(&vt1, &vt2, i+1); err != nil {
			return
		}
	}

	return
}

// canConnect check if output of function from
// could be connected to the function to
func canConnect(from, to interface{}) bool {
	if err := validConnect(from, to); err != nil {
		return false
	}
	return true
}

// Compose takes multiple functions and compose them into a single
// endpoint. The functions will be called in the order of input.
// The rule to valid compose:
//
// 1. The output variables of any functions should match the
//    types and position of arguments of the next function.
//
// 2. The first function should take a context.Context and
//    1 other argument.
//
// 3. The last function should output 1 variable with 1 error
//
func Compose(fns ...interface{}) (e endpoint.Endpoint, err error) {

	// examine all functions and see if they can be composed
	l := len(fns)
	var last interface{}
	for i, fn := range fns {

		if !isFunc(fn) {
			err = fmt.Errorf("arugment %d is not a function", i+1)
			return
		}

		// test the first and the last one
		fnt := reflect.TypeOf(fn)
		if i == 0 {
			if errInner := validEndpointIn(&fnt); errInner != nil {
				err = fmt.Errorf(
					"begining function is not valid:\n%s",
					errInner.Error())
				return
			}
		} else {

			// test the connection
			if errInner := validConnect(last, fn); errInner != nil {
				err = fmt.Errorf(
					"failed to connect function %d and %d:\n%s",
					i, i+1, errInner.Error())
				return
			}

			if i == l-1 {
				if errInner := validEndpointOut(&fnt); errInner != nil {
					err = fmt.Errorf(
						"ending function is not valid:\n%s",
						errInner.Error())
					return
				}
			}

		}

		last = fn
	}

	// reflect all function values
	fnvs := make([]reflect.Value, len(fns))
	for i, fn := range fns {
		fnvs[i] = reflect.ValueOf(fn)
	}

	// handle first fn request
	fn1t := reflect.TypeOf(fns[0])
	numIn := fn1t.NumIn()
	reqt := fn1t.In(numIn - 1)

	// handle last fn response
	et := reflect.TypeOf(e)
	respt := et.Out(0)

	// use MakeFunc to compose an endpoint.Endpoint
	endpointFn := func(in []reflect.Value) []reflect.Value {

		var work []reflect.Value

		// recast request as type of first function request
		reqv := reflect.New(reqt)
		reqv.Elem().Set(in[1].Elem())

		work = []reflect.Value{in[0], reqv.Elem()}
		for i := range fnvs {
			work = fnvs[i].Call(work)
		}

		// recast last response as interface{}
		respv := reflect.New(respt)
		respv.Elem().Set(work[0])
		work[0] = respv.Elem()

		return work
	}

	// generate the endpoint.Endpoint it
	fout := reflect.ValueOf(&e).Elem()
	v := reflect.MakeFunc(fout.Type(), endpointFn)
	fout.Set(v)

	return
}


text:
package loon.media;

import java.util.HashMap;

import loon.core.Assets;
import loon.utils.CollectionUtils;

public abstract class SoundBox {

	private HashMap<String, Sound> sounds = new HashMap<String, Sound>(
			CollectionUtils.INITIAL_CAPACITY);

	public void playSound(String path) {
		playSound(path, false);
	}

	public void playSound(String path, boolean loop) {
		Sound sound = sounds.get(path);
		if (sound == null) {
			sound = Assets.getSound(path);
			sounds.put(path, sound);
		} else {
			sound.stop();
		}
		sound.setLooping(loop);
		sound.play();
	}

	public void volume(String path, float volume) {
		Sound sound = sounds.get(path);
		if (sound != null) {
			sound.setVolume(volume);
		}
	}

	public void stopSound(String path) {
		Sound sound = sounds.get(path);
		if (sound != null) {
			sound.stop();
		}
	}

	public void stopSound() {
		for (Sound s : sounds.values()) {
			if (s != null) {
				s.stop();
			}
		}
	}

	public void release() {
		for (Sound s : sounds.values()) {
			if (s != null) {
				s.release();
			}
		}
		sounds.clear();
	}
}


text:
namespace __tsan {

using namespace __sanitizer;  // NOLINT

static ReportStack *SymbolizeStack(StackTrace trace);

void TsanCheckFailed(const char *file, int line, const char *cond,
                     u64 v1, u64 v2) {
  // There is high probability that interceptors will check-fail as well,
  // on the other hand there is no sense in processing interceptors
  // since we are going to die soon.
  ScopedIgnoreInterceptors ignore;
  Printf("FATAL: ThreadSanitizer CHECK failed: "
         "%s:%d \"%s\" (0x%zx, 0x%zx)\n",
         file, line, cond, (uptr)v1, (uptr)v2);
  PrintCurrentStackSlow(StackTrace::GetCurrentPc());
  Die();
}

// Can be overriden by an application/test to intercept reports.
#ifdef TSAN_EXTERNAL_HOOKS
bool OnReport(const ReportDesc *rep, bool suppressed);
#else
SANITIZER_WEAK_CXX_DEFAULT_IMPL
bool OnReport(const ReportDesc *rep, bool suppressed) {
  (void)rep;
  return suppressed;
}
#endif

static void StackStripMain(SymbolizedStack *frames) {
  SymbolizedStack *last_frame = nullptr;
  SymbolizedStack *last_frame2 = nullptr;
  for (SymbolizedStack *cur = frames; cur; cur = cur->next) {
    last_frame2 = last_frame;
    last_frame = cur;
  }

  if (last_frame2 == 0)
    return;
#ifndef SANITIZER_GO
  const char *last = last_frame->info.function;
  const char *last2 = last_frame2->info.function;
  // Strip frame above 'main'
  if (last2 && 0 == internal_strcmp(last2, "main")) {
    last_frame->ClearAll();
    last_frame2->next = nullptr;
  // Strip our internal thread start routine.
  } else if (last && 0 == internal_strcmp(last, "__tsan_thread_start_func")) {
    last_frame->ClearAll();
    last_frame2->next = nullptr;
  // Strip global ctors init.
  } else if (last && 0 == internal_strcmp(last, "__do_global_ctors_aux")) {
    last_frame->ClearAll();
    last_frame2->next = nullptr;
  // If both are 0, then we probably just failed to symbolize.
  } else if (last || last2) {
    // Ensure that we recovered stack completely. Trimmed stack
    // can actually happen if we do not instrument some code,
    // so it's only a debug print. However we must try hard to not miss it
    // due to our fault.
    DPrintf("Bottom stack frame is missed\n");
  }
#else
  // The last frame always point into runtime (gosched0, goexit0, runtime.main).
  last_frame->ClearAll();
  last_frame2->next = nullptr;
#endif
}

ReportStack *SymbolizeStackId(u32 stack_id) {
  if (stack_id == 0)
    return 0;
  StackTrace stack = StackDepotGet(stack_id);
  if (stack.trace == nullptr)
    return nullptr;
  return SymbolizeStack(stack);
}

static ReportStack *SymbolizeStack(StackTrace trace) {
  if (trace.size == 0)
    return 0;
  SymbolizedStack *top = nullptr;
  for (uptr si = 0; si < trace.size; si++) {
    const uptr pc = trace.trace[si];
    uptr pc1 = pc;
    // We obtain the return address, but we're interested in the previous
    // instruction.
    if ((pc & kExternalPCBit) == 0)
      pc1 = StackTrace::GetPreviousInstructionPc(pc);
    SymbolizedStack *ent = SymbolizeCode(pc1);
    CHECK_NE(ent, 0);
    SymbolizedStack *last = ent;
    while (last->next) {
      last->info.address = pc;  // restore original pc for report
      last = last->next;
    }
    last->info.address = pc;  // restore original pc for report
    last->next = top;
    top = ent;
  }
  StackStripMain(top);

  ReportStack *stack = ReportStack::New();
  stack->frames = top;
  return stack;
}

ScopedReport::ScopedReport(ReportType typ) {
  ctx->thread_registry->CheckLocked();
  void *mem = internal_alloc(MBlockReport, sizeof(ReportDesc));
  rep_ = new(mem) ReportDesc;
  rep_->typ = typ;
  ctx->report_mtx.Lock();
  CommonSanitizerReportMutex.Lock();
}

ScopedReport::~ScopedReport() {
  CommonSanitizerReportMutex.Unlock();
  ctx->report_mtx.Unlock();
  DestroyAndFree(rep_);
}

void ScopedReport::AddStack(StackTrace stack, bool suppressable) {
  ReportStack **rs = rep_->stacks.PushBack();
  *rs = SymbolizeStack(stack);
  (*rs)->suppressable = suppressable;
}

void ScopedReport::AddMemoryAccess(uptr addr, Shadow s, StackTrace stack,
                                   const MutexSet *mset) {
  void *mem = internal_alloc(MBlockReportMop, sizeof(ReportMop));
  ReportMop *mop = new(mem) ReportMop;
  rep_->mops.PushBack(mop);
  mop->tid = s.tid();
  mop->addr = addr + s.addr0();
  mop->size = s.size();
  mop->write = s.IsWrite();
  mop->atomic = s.IsAtomic();
  mop->stack = SymbolizeStack(stack);
  if (mop->stack)
    mop->stack->suppressable = true;
  for (uptr i = 0; i < mset->Size(); i++) {
    MutexSet::Desc d = mset->Get(i);
    u64 mid = this->AddMutex(d.id);
    ReportMopMutex mtx = {mid, d.write};
    mop->mset.PushBack(mtx);
  }
}

void ScopedReport::AddUniqueTid(int unique_tid) {
  rep_->unique_tids.PushBack(unique_tid);
}

void ScopedReport::AddThread(const ThreadContext *tctx, bool suppressable) {
  for (uptr i = 0; i < rep_->threads.Size(); i++) {
    if ((u32)rep_->threads[i]->id == tctx->tid)
      return;
  }
  void *mem = internal_alloc(MBlockReportThread, sizeof(ReportThread));
  ReportThread *rt = new(mem) ReportThread;
  rep_->threads.PushBack(rt);
  rt->id = tctx->tid;
  rt->pid = tctx->os_id;
  rt->running = (tctx->status == ThreadStatusRunning);
  rt->name = internal_strdup(tctx->name);
  rt->parent_tid = tctx->parent_tid;
  rt->stack = 0;
  rt->stack = SymbolizeStackId(tctx->creation_stack_id);
  if (rt->stack)
    rt->stack->suppressable = suppressable;
}

#ifndef SANITIZER_GO
static bool FindThreadByUidLockedCallback(ThreadContextBase *tctx, void *arg) {
  int unique_id = *(int *)arg;
  return tctx->unique_id == (u32)unique_id;
}

static ThreadContext *FindThreadByUidLocked(int unique_id) {
  ctx->thread_registry->CheckLocked();
  return static_cast<ThreadContext *>(
      ctx->thread_registry->FindThreadContextLocked(
          FindThreadByUidLockedCallback, &unique_id));
}

static ThreadContext *FindThreadByTidLocked(int tid) {
  ctx->thread_registry->CheckLocked();
  return static_cast<ThreadContext*>(
      ctx->thread_registry->GetThreadLocked(tid));
}

static bool IsInStackOrTls(ThreadContextBase *tctx_base, void *arg) {
  uptr addr = (uptr)arg;
  ThreadContext *tctx = static_cast<ThreadContext*>(tctx_base);
  if (tctx->status != ThreadStatusRunning)
    return false;
  ThreadState *thr = tctx->thr;
  CHECK(thr);
  return ((addr >= thr->stk_addr && addr < thr->stk_addr + thr->stk_size) ||
          (addr >= thr->tls_addr && addr < thr->tls_addr + thr->tls_size));
}

ThreadContext *IsThreadStackOrTls(uptr addr, bool *is_stack) {
  ctx->thread_registry->CheckLocked();
  ThreadContext *tctx = static_cast<ThreadContext*>(
      ctx->thread_registry->FindThreadContextLocked(IsInStackOrTls,
                                                    (void*)addr));
  if (!tctx)
    return 0;
  ThreadState *thr = tctx->thr;
  CHECK(thr);
  *is_stack = (addr >= thr->stk_addr && addr < thr->stk_addr + thr->stk_size);
  return tctx;
}
#endif

void ScopedReport::AddThread(int unique_tid, bool suppressable) {
#ifndef SANITIZER_GO
  if (const ThreadContext *tctx = FindThreadByUidLocked(unique_tid))
    AddThread(tctx, suppressable);
#endif
}

void ScopedReport::AddMutex(const SyncVar *s) {
  for (uptr i = 0; i < rep_->mutexes.Size(); i++) {
    if (rep_->mutexes[i]->id == s->uid)
      return;
  }
  void *mem = internal_alloc(MBlockReportMutex, sizeof(ReportMutex));
  ReportMutex *rm = new(mem) ReportMutex;
  rep_->mutexes.PushBack(rm);
  rm->id = s->uid;
  rm->addr = s->addr;
  rm->destroyed = false;
  rm->stack = SymbolizeStackId(s->creation_stack_id);
}

u64 ScopedReport::AddMutex(u64 id) {
  u64 uid = 0;
  u64 mid = id;
  uptr addr = SyncVar::SplitId(id, &uid);
  SyncVar *s = ctx->metamap.GetIfExistsAndLock(addr);
  // Check that the mutex is still alive.
  // Another mutex can be created at the same address,
  // so check uid as well.
  if (s && s->CheckId(uid)) {
    mid = s->uid;
    AddMutex(s);
  } else {
    AddDeadMutex(id);
  }
  if (s)
    s->mtx.Unlock();
  return mid;
}

void ScopedReport::AddDeadMutex(u64 id) {
  for (uptr i = 0; i < rep_->mutexes.Size(); i++) {
    if (rep_->mutexes[i]->id == id)
      return;
  }
  void *mem = internal_alloc(MBlockReportMutex, sizeof(ReportMutex));
  ReportMutex *rm = new(mem) ReportMutex;
  rep_->mutexes.PushBack(rm);
  rm->id = id;
  rm->addr = 0;
  rm->destroyed = true;
  rm->stack = 0;
}

void ScopedReport::AddLocation(uptr addr, uptr size) {
  if (addr == 0)
    return;
#ifndef SANITIZER_GO
  int fd = -1;
  int creat_tid = -1;
  u32 creat_stack = 0;
  if (FdLocation(addr, &fd, &creat_tid, &creat_stack)) {
    ReportLocation *loc = ReportLocation::New(ReportLocationFD);
    loc->fd = fd;
    loc->tid = creat_tid;
    loc->stack = SymbolizeStackId(creat_stack);
    rep_->locs.PushBack(loc);
    ThreadContext *tctx = FindThreadByUidLocked(creat_tid);
    if (tctx)
      AddThread(tctx);
    return;
  }
  MBlock *b = 0;
  Allocator *a = allocator();
  if (a->PointerIsMine((void*)addr)) {
    void *block_begin = a->GetBlockBegin((void*)addr);
    if (block_begin)
      b = ctx->metamap.GetBlock((uptr)block_begin);
  }
  if (b != 0) {
    ThreadContext *tctx = FindThreadByTidLocked(b->tid);
    ReportLocation *loc = ReportLocation::New(ReportLocationHeap);
    loc->heap_chunk_start = (uptr)allocator()->GetBlockBegin((void *)addr);
    loc->heap_chunk_size = b->siz;
    loc->tid = tctx ? tctx->tid : b->tid;
    loc->stack = SymbolizeStackId(b->stk);
    rep_->locs.PushBack(loc);
    if (tctx)
      AddThread(tctx);
    return;
  }
  bool is_stack = false;
  if (ThreadContext *tctx = IsThreadStackOrTls(addr, &is_stack)) {
    ReportLocation *loc =
        ReportLocation::New(is_stack ? ReportLocationStack : ReportLocationTLS);
    loc->tid = tctx->tid;
    rep_->locs.PushBack(loc);
    AddThread(tctx);
  }
  if (ReportLocation *loc = SymbolizeData(addr)) {
    loc->suppressable = true;
    rep_->locs.PushBack(loc);
    return;
  }
#endif
}

#ifndef SANITIZER_GO
void ScopedReport::AddSleep(u32 stack_id) {
  rep_->sleep = SymbolizeStackId(stack_id);
}
#endif

void ScopedReport::SetCount(int count) {
  rep_->count = count;
}

const ReportDesc *ScopedReport::GetReport() const {
  return rep_;
}

void RestoreStack(int tid, const u64 epoch, VarSizeStackTrace *stk,
                  MutexSet *mset) {
  // This function restores stack trace and mutex set for the thread/epoch.
  // It does so by getting stack trace and mutex set at the beginning of
  // trace part, and then replaying the trace till the given epoch.
  Trace* trace = ThreadTrace(tid);
  ReadLock l(&trace->mtx);
  const int partidx = (epoch / kTracePartSize) % TraceParts();
  TraceHeader* hdr = &trace->headers[partidx];
  if (epoch < hdr->epoch0 || epoch >= hdr->epoch0 + kTracePartSize)
    return;
  CHECK_EQ(RoundDown(epoch, kTracePartSize), hdr->epoch0);
  const u64 epoch0 = RoundDown(epoch, TraceSize());
  const u64 eend = epoch % TraceSize();
  const u64 ebegin = RoundDown(eend, kTracePartSize);
  DPrintf("#%d: RestoreStack epoch=%zu ebegin=%zu eend=%zu partidx=%d\n",
          tid, (uptr)epoch, (uptr)ebegin, (uptr)eend, partidx);
  Vector<uptr> stack(MBlockReportStack);
  stack.Resize(hdr->stack0.size + 64);
  for (uptr i = 0; i < hdr->stack0.size; i++) {
    stack[i] = hdr->stack0.trace[i];
    DPrintf2("  #%02zu: pc=%zx\n", i, stack[i]);
  }
  if (mset)
    *mset = hdr->mset0;
  uptr pos = hdr->stack0.size;
  Event *events = (Event*)GetThreadTrace(tid);
  for (uptr i = ebegin; i <= eend; i++) {
    Event ev = events[i];
    EventType typ = (EventType)(ev >> 61);
    uptr pc = (uptr)(ev & ((1ull << 61) - 1));
    DPrintf2("  %zu typ=%d pc=%zx\n", i, typ, pc);
    if (typ == EventTypeMop) {
      stack[pos] = pc;
    } else if (typ == EventTypeFuncEnter) {
      if (stack.Size() < pos + 2)
        stack.Resize(pos + 2);
      stack[pos++] = pc;
    } else if (typ == EventTypeFuncExit) {
      if (pos > 0)
        pos--;
    }
    if (mset) {
      if (typ == EventTypeLock) {
        mset->Add(pc, true, epoch0 + i);
      } else if (typ == EventTypeUnlock) {
        mset->Del(pc, true);
      } else if (typ == EventTypeRLock) {
        mset->Add(pc, false, epoch0 + i);
      } else if (typ == EventTypeRUnlock) {
        mset->Del(pc, false);
      }
    }
    for (uptr j = 0; j <= pos; j++)
      DPrintf2("      #%zu: %zx\n", j, stack[j]);
  }
  if (pos == 0 && stack[0] == 0)
    return;
  pos++;
  stk->Init(&stack[0], pos);
}

static bool HandleRacyStacks(ThreadState *thr, VarSizeStackTrace traces[2],
                             uptr addr_min, uptr addr_max) {
  bool equal_stack = false;
  RacyStacks hash;
  bool equal_address = false;
  RacyAddress ra0 = {addr_min, addr_max};
  {
    ReadLock lock(&ctx->racy_mtx);
    if (flags()->suppress_equal_stacks) {
      hash.hash[0] = md5_hash(traces[0].trace, traces[0].size * sizeof(uptr));
      hash.hash[1] = md5_hash(traces[1].trace, traces[1].size * sizeof(uptr));
      for (uptr i = 0; i < ctx->racy_stacks.Size(); i++) {
        if (hash == ctx->racy_stacks[i]) {
          VPrintf(2,
              "ThreadSanitizer: suppressing report as doubled (stack)\n");
          equal_stack = true;
          break;
        }
      }
    }
    if (flags()->suppress_equal_addresses) {
      for (uptr i = 0; i < ctx->racy_addresses.Size(); i++) {
        RacyAddress ra2 = ctx->racy_addresses[i];
        uptr maxbeg = max(ra0.addr_min, ra2.addr_min);
        uptr minend = min(ra0.addr_max, ra2.addr_max);
        if (maxbeg < minend) {
          VPrintf(2, "ThreadSanitizer: suppressing report as doubled (addr)\n");
          equal_address = true;
          break;
        }
      }
    }
  }
  if (!equal_stack && !equal_address)
    return false;
  if (!equal_stack) {
    Lock lock(&ctx->racy_mtx);
    ctx->racy_stacks.PushBack(hash);
  }
  if (!equal_address) {
    Lock lock(&ctx->racy_mtx);
    ctx->racy_addresses.PushBack(ra0);
  }
  return true;
}

static void AddRacyStacks(ThreadState *thr, VarSizeStackTrace traces[2],
                          uptr addr_min, uptr addr_max) {
  Lock lock(&ctx->racy_mtx);
  if (flags()->suppress_equal_stacks) {
    RacyStacks hash;
    hash.hash[0] = md5_hash(traces[0].trace, traces[0].size * sizeof(uptr));
    hash.hash[1] = md5_hash(traces[1].trace, traces[1].size * sizeof(uptr));
    ctx->racy_stacks.PushBack(hash);
  }
  if (flags()->suppress_equal_addresses) {
    RacyAddress ra0 = {addr_min, addr_max};
    ctx->racy_addresses.PushBack(ra0);
  }
}

bool OutputReport(ThreadState *thr, const ScopedReport &srep) {
  if (!flags()->report_bugs)
    return false;
  atomic_store_relaxed(&ctx->last_symbolize_time_ns, NanoTime());
  const ReportDesc *rep = srep.GetReport();
  Suppression *supp = 0;
  uptr pc_or_addr = 0;
  for (uptr i = 0; pc_or_addr == 0 && i < rep->mops.Size(); i++)
    pc_or_addr = IsSuppressed(rep->typ, rep->mops[i]->stack, &supp);
  for (uptr i = 0; pc_or_addr == 0 && i < rep->stacks.Size(); i++)
    pc_or_addr = IsSuppressed(rep->typ, rep->stacks[i], &supp);
  for (uptr i = 0; pc_or_addr == 0 && i < rep->threads.Size(); i++)
    pc_or_addr = IsSuppressed(rep->typ, rep->threads[i]->stack, &supp);
  for (uptr i = 0; pc_or_addr == 0 && i < rep->locs.Size(); i++)
    pc_or_addr = IsSuppressed(rep->typ, rep->locs[i], &supp);
  if (pc_or_addr != 0) {
    Lock lock(&ctx->fired_suppressions_mtx);
    FiredSuppression s = {srep.GetReport()->typ, pc_or_addr, supp};
    ctx->fired_suppressions.push_back(s);
  }
  {
    bool old_is_freeing = thr->is_freeing;
    thr->is_freeing = false;
    bool suppressed = OnReport(rep, pc_or_addr != 0);
    thr->is_freeing = old_is_freeing;
    if (suppressed)
      return false;
  }
  PrintReport(rep);
  ctx->nreported++;
  if (flags()->halt_on_error)
    Die();
  return true;
}

bool IsFiredSuppression(Context *ctx, ReportType type, StackTrace trace) {
  ReadLock lock(&ctx->fired_suppressions_mtx);
  for (uptr k = 0; k < ctx->fired_suppressions.size(); k++) {
    if (ctx->fired_suppressions[k].type != type)
      continue;
    for (uptr j = 0; j < trace.size; j++) {
      FiredSuppression *s = &ctx->fired_suppressions[k];
      if (trace.trace[j] == s->pc_or_addr) {
        if (s->supp)
          atomic_fetch_add(&s->supp->hit_count, 1, memory_order_relaxed);
        return true;
      }
    }
  }
  return false;
}

static bool IsFiredSuppression(Context *ctx, ReportType type, uptr addr) {
  ReadLock lock(&ctx->fired_suppressions_mtx);
  for (uptr k = 0; k < ctx->fired_suppressions.size(); k++) {
    if (ctx->fired_suppressions[k].type != type)
      continue;
    FiredSuppression *s = &ctx->fired_suppressions[k];
    if (addr == s->pc_or_addr) {
      if (s->supp)
        atomic_fetch_add(&s->supp->hit_count, 1, memory_order_relaxed);
      return true;
    }
  }
  return false;
}

static bool RaceBetweenAtomicAndFree(ThreadState *thr) {
  Shadow s0(thr->racy_state[0]);
  Shadow s1(thr->racy_state[1]);
  CHECK(!(s0.IsAtomic() && s1.IsAtomic()));
  if (!s0.IsAtomic() && !s1.IsAtomic())
    return true;
  if (s0.IsAtomic() && s1.IsFreed())
    return true;
  if (s1.IsAtomic() && thr->is_freeing)
    return true;
  return false;
}

void ReportRace(ThreadState *thr) {
  CheckNoLocks(thr);

  // Symbolizer makes lots of intercepted calls. If we try to process them,
  // at best it will cause deadlocks on internal mutexes.
  ScopedIgnoreInterceptors ignore;

  if (!flags()->report_bugs)
    return;
  if (!flags()->report_atomic_races && !RaceBetweenAtomicAndFree(thr))
    return;

  bool freed = false;
  {
    Shadow s(thr->racy_state[1]);
    freed = s.GetFreedAndReset();
    thr->racy_state[1] = s.raw();
  }

  uptr addr = ShadowToMem((uptr)thr->racy_shadow_addr);
  uptr addr_min = 0;
  uptr addr_max = 0;
  {
    uptr a0 = addr + Shadow(thr->racy_state[0]).addr0();
    uptr a1 = addr + Shadow(thr->racy_state[1]).addr0();
    uptr e0 = a0 + Shadow(thr->racy_state[0]).size();
    uptr e1 = a1 + Shadow(thr->racy_state[1]).size();
    addr_min = min(a0, a1);
    addr_max = max(e0, e1);
    if (IsExpectedReport(addr_min, addr_max - addr_min))
      return;
  }

  ReportType typ = ReportTypeRace;
  if (thr->is_vptr_access && freed)
    typ = ReportTypeVptrUseAfterFree;
  else if (thr->is_vptr_access)
    typ = ReportTypeVptrRace;
  else if (freed)
    typ = ReportTypeUseAfterFree;

  if (IsFiredSuppression(ctx, typ, addr))
    return;

  const uptr kMop = 2;
  VarSizeStackTrace traces[kMop];
  const uptr toppc = TraceTopPC(thr);
  ObtainCurrentStack(thr, toppc, &traces[0]);
  if (IsFiredSuppression(ctx, typ, traces[0]))
    return;

  // MutexSet is too large to live on stack.
  Vector<u64> mset_buffer(MBlockScopedBuf);
  mset_buffer.Resize(sizeof(MutexSet) / sizeof(u64) + 1);
  MutexSet *mset2 = new(&mset_buffer[0]) MutexSet();

  Shadow s2(thr->racy_state[1]);
  RestoreStack(s2.tid(), s2.epoch(), &traces[1], mset2);
  if (IsFiredSuppression(ctx, typ, traces[1]))
    return;

  if (HandleRacyStacks(thr, traces, addr_min, addr_max))
    return;

  ThreadRegistryLock l0(ctx->thread_registry);
  ScopedReport rep(typ);
  for (uptr i = 0; i < kMop; i++) {
    Shadow s(thr->racy_state[i]);
    rep.AddMemoryAccess(addr, s, traces[i], i == 0 ? &thr->mset : mset2);
  }

  for (uptr i = 0; i < kMop; i++) {
    FastState s(thr->racy_state[i]);
    ThreadContext *tctx = static_cast<ThreadContext*>(
        ctx->thread_registry->GetThreadLocked(s.tid()));
    if (s.epoch() < tctx->epoch0 || s.epoch() > tctx->epoch1)
      continue;
    rep.AddThread(tctx);
  }

  rep.AddLocation(addr_min, addr_max - addr_min);

#ifndef SANITIZER_GO
  {  // NOLINT
    Shadow s(thr->racy_state[1]);
    if (s.epoch() <= thr->last_sleep_clock.get(s.tid()))
      rep.AddSleep(thr->last_sleep_stack_id);
  }
#endif

  if (!OutputReport(thr, rep))
    return;

  AddRacyStacks(thr, traces, addr_min, addr_max);
}

void PrintCurrentStack(ThreadState *thr, uptr pc) {
  VarSizeStackTrace trace;
  ObtainCurrentStack(thr, pc, &trace);
  PrintStack(SymbolizeStack(trace));
}

void PrintCurrentStackSlow(uptr pc) {
#ifndef SANITIZER_GO
  BufferedStackTrace *ptrace =
      new(internal_alloc(MBlockStackTrace, sizeof(BufferedStackTrace)))
          BufferedStackTrace();
  ptrace->Unwind(kStackTraceMax, pc, 0, 0, 0, 0, false);
  for (uptr i = 0; i < ptrace->size / 2; i++) {
    uptr tmp = ptrace->trace_buffer[i];
    ptrace->trace_buffer[i] = ptrace->trace_buffer[ptrace->size - i - 1];
    ptrace->trace_buffer[ptrace->size - i - 1] = tmp;
  }
  PrintStack(SymbolizeStack(*ptrace));
#endif
}

}  // namespace __tsan

using namespace __tsan;

extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_print_stack_trace() {
  PrintCurrentStackSlow(StackTrace::GetCurrentPc());
}
}  // extern "C"


text:
<?php

namespace RoyallTheFourth\HtmlDocument\Element;

use RoyallTheFourth\HtmlDocument\Attribute\BooleanAttribute;
use RoyallTheFourth\HtmlDocument\Attribute\StandardAttribute;
use RoyallTheFourth\HtmlDocument\Set\AttributeSet;
use RoyallTheFourth\HtmlDocument\Tag\EmptyTag;

/**
 * Class Link
 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
 */
final class Link extends AbstractElement
{
    public function __construct(AttributeSet $attributes = null)
    {
        $this->attributes = $attributes ?? new AttributeSet();
        $this->tag = new EmptyTag('link', $attributes);
    }

    public function withAttribute(string $name, string $value = null): Link
    {
        if ($value) {
            $attribute = new StandardAttribute($name, $value);
        } else {
            $attribute = new BooleanAttribute($name);
        }

        return new Link($this->attributes->add($attribute));
    }

    public function withCrossOrigin(string $policy): Link
    {
        return $this->withAttribute('crossorigin', $policy);
    }

    public function withHref(string $url): Link
    {
        return $this->withAttribute('href', $url);
    }

    public function withHrefLang(string $language): Link
    {
        return $this->withAttribute('hreflang', $language);
    }

    /**
     * @param string $mediaQuery
     * @return Link
     * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries
     */
    public function withMedia(string $mediaQuery): Link
    {
        return $this->withAttribute('media', $mediaQuery);
    }

    /**
     * @param string $linkType
     * @return Link
     * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
     */
    public function withRel(string $linkType): Link
    {
        return $this->withAttribute('rel', $linkType);
    }

    public function withSizes(string $sizes = 'any'): Link
    {
        return $this->withAttribute('sizes', $sizes);
    }

    public function withType(string $mime): Link
    {
        return $this->withAttribute('type', $mime);
    }
}


text:
package org.ayo.notify.nifty;

import android.view.View;

import com.nineoldandroids.animation.ObjectAnimator;

/**
 * Created by lee on 2014/7/30.
 */
public class FadeIn extends BaseEffects {

    @Override
    protected void setupAnimation(View view) {
        getAnimatorSet().playTogether(
                ObjectAnimator.ofFloat(view,"alpha",0,1).setDuration(mDuration)

        );
    }
}


text:
.panel-heading #alerts-accordion-toggle::after {
  /* symbol for "opening" panels */
  font-family: FontAwesome;/* stylelint-disable-line font-family-no-missing-generic-family-keyword */
  content: "\f078";
  float: right;
  color: grey;
}

.panel-heading #alerts-accordion-toggle.collapsed::after {
  /* symbol for "closing" panels */
  font-family: FontAwesome;/* stylelint-disable-line font-family-no-missing-generic-family-keyword */
  content: "\f054";
  float: right;
  color: grey;
}

#errorHeading {
  background-color: #d6d8d9; /* same color as Bootstrap's Dark Alert */
}

.dag-import-error {
  position: relative;
  white-space: pre;
  height: 14px;
  line-height: 14px; /* show only one line of 14px text */
  overflow: hidden;
  cursor: pointer;
}

.expanded-error {
  height: 100%;
}

.dag-import-error::after {
  /* symbol for "opening" panels */
  font-family: FontAwesome;/* stylelint-disable-line font-family-no-missing-generic-family-keyword */
  content: "\f054";
  float: right;
  color: #e43921;
  position: absolute;
  top: 0;
  right: 0;
}

.dag-import-error.expanded-error::after {
  /* symbol for "closing" panels */
  content: "\f078";
}


text:
An etcd cluster needs periodic maintenance to remain reliable. Depending on an etcd application's needs, this maintenance can usually be automated and performed without downtime or significantly degraded performance.

All etcd maintenance manages storage resources consumed by the etcd keyspace. Failure to adequately control the keyspace size is guarded by storage space quotas; if an etcd member runs low on space, a quota will trigger cluster-wide alarms which will put the system into a limited-operation maintenance mode. To avoid running out of space for writes to the keyspace, the etcd keyspace history must be compacted. Storage space itself may be reclaimed by defragmenting etcd members. Finally, periodic snapshot backups of etcd member state makes it possible to recover any unintended logical data loss or corruption caused by operational error.

## History compaction

Since etcd keeps an exact history of its keyspace, this history should be periodically compacted to avoid performance degradation and eventual storage space exhaustion. Compacting the keyspace history drops all information about keys superseded prior to a given keyspace revision. The space used by these keys then becomes available for additional writes to the keyspace.

The keyspace can be compacted automatically with `etcd`'s time windowed history retention policy, or manually with `etcdctl`. The `etcdctl` method provides fine-grained control over the compacting process whereas automatic compacting fits applications that only need key history for some length of time.

`etcd` can be set to automatically compact the keyspace with the `--experimental-auto-compaction` option with a period of hours:

```sh
# keep one hour of history
$ etcd --experimental-auto-compaction-retention=1
```

An `etcdctl` initiated compaction works as follows:

```sh
# compact up to revision 3
$ etcdctl compact 3

```

Revisions prior to the compaction revision become inaccessible:

```sh
$ etcdctl get --rev=2 somekey
Error:  rpc error: code = 11 desc = etcdserver: storage: required revision has been compacted
```

## Defragmentation

After compacting the keyspace, the backend database may exhibit internal fragmentation. Any internal fragmentation is space that is free to use by the backend but still consumes storage space. The process of defragmentation releases this storage space back to the file system. Defragmentation is issued on a per-member so that cluster-wide latency spikes may be avoided.

Compacting old revisions internally fragments `etcd` by leaving gaps in backend database. Fragmented space is available for use by `etcd` but unavailable to the host filesystem.

To defragment an etcd member, use the `etcdctl defrag` command:

```sh
$ etcdctl defrag
Finished defragmenting etcd member[127.0.0.1:2379]
```

## Space quota

The space quota in `etcd` ensures the cluster operates in a reliable fashion. Without a space quota, `etcd` may suffer from poor performance if the keyspace grows excessively large, or it may simply run out of storage space, leading to unpredictable cluster behavior. If the keyspace's backend database for any member exceeds the space quota, `etcd` raises a cluster-wide alarm that puts the cluster into a maintenance mode which only accepts key reads and deletes. After freeing enough space in the keyspace, the alarm can be disarmed and the cluster will resume normal operation.

By default, `etcd` sets a conservative space quota suitable for most applications, but it may be configured on the command line, in bytes:

```sh
# set a very small 16MB quota
$ etcd --quota-backend-bytes=16777216
```

The space quota can be triggered with a loop:

```sh
# fill keyspace
$ while [ 1 ]; do dd if=/dev/urandom bs=1024 count=1024  | etcdctl put key  || break; done
...
Error:  rpc error: code = 8 desc = etcdserver: storage: database space exceeded
# confirm quota space is exceeded
$ etcdctl endpoint status
+----------------+------------------+-----------+---------+-----------+-----------+------------+
|    ENDPOINT    |        ID        |  VERSION  | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
+----------------+------------------+-----------+---------+-----------+-----------+------------+
| 127.0.0.1:2379 | bf9071f4639c75cc | 2.3.0+git | 18 MB   | true      |         2 |       3332 |
+----------------+------------------+-----------+---------+-----------+-----------+------------+
# confirm alarm is raised
$ etcdctl alarm list
memberID:13803658152347727308 alarm:NOSPACE
```

Removing excessive keyspace data will put the cluster back within the quota limits so the alarm can be disarmed:

```sh
# get current revision
$ etcdctl --endpoints=:2379 endpoint status
[{"Endpoint":"127.0.0.1:2379","Status":{"header":{"cluster_id":8925027824743593106,"member_id":13803658152347727308,"revision":1516,"raft_term":2},"version":"2.3.0+git","dbSize":17973248,"leader":13803658152347727308,"raftIndex":6359,"raftTerm":2}}]
# compact away all old revisions
$ etdctl compact 1516
compacted revision 1516
# defragment away excessive space
$ etcdctl defrag
Finished defragmenting etcd member[127.0.0.1:2379]
# disarm alarm
$ etcdctl alarm disarm
memberID:13803658152347727308 alarm:NOSPACE
# test puts are allowed again
$ etdctl put newkey 123
OK
```

## Snapshot backup

Snapshotting the `etcd` cluster on a regular basis serves as a durable backup for an etcd keyspace. By taking periodic snapshots of an etcd member's backend database, an `etcd` cluster can be recovered to a point in time with a known good state.

A snapshot is taken with `etcdctl`:

```sh
$ etcdctl snapshot save backup.db
$ etcdctl snapshot status backup.db
+----------+----------+------------+------------+
|   HASH   | REVISION | TOTAL KEYS | TOTAL SIZE |
+----------+----------+------------+------------+
| fe01cf57 |       10 |          7 | 2.1 MB     |
+----------+----------+------------+------------+

```


text:
<Type Name="HistogramTargetExt" FullName="MonoMac.OpenGL.HistogramTargetExt">
  <TypeSignature Language="C#" Value="public enum HistogramTargetExt" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed HistogramTargetExt extends System.Enum" />
  <AssemblyInfo>
    <AssemblyName>MonoMac</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Enum</BaseTypeName>
  </Base>
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName="HistogramExt">
      <MemberSignature Language="C#" Value="HistogramExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.HistogramTargetExt HistogramExt = int32(32804)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.HistogramTargetExt</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="ProxyHistogramExt">
      <MemberSignature Language="C#" Value="ProxyHistogramExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.HistogramTargetExt ProxyHistogramExt = int32(32805)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.HistogramTargetExt</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
  </Members>
</Type>


text:
// Generated by CoffeeScript 1.10.0
var Bus, METHODS, RELATIONS, actions, debug, errorHandler, interceptRelations, ref1, thinky, utils;

thinky = require("thinky");

debug = require('debug')("mithink:bus");

actions = require('./actions');

utils = require('../utils');

errorHandler = require('./error-handler');

interceptRelations = require('./relational-interceptor');

ref1 = require('../utils/relations'), METHODS = ref1.METHODS, RELATIONS = ref1.RELATIONS;

Bus = function(io) {
  Bus.io = io;
  Bus.io.on('connection', function(socket) {
    debug("META: " + (JSON.stringify(Bus.meta())));
    return Bus.io.emit('meta', Bus.meta());
  });
  return Bus;
};

Bus.__actions__ = {};

Bus.__tables__ = [];

Bus.__refs__ = [];

Bus.NAMESPACE = "mithink";

require('./access-control')(Bus);

Bus.tables = function() {
  return Bus.__refs__.map(function(ref) {
    return ref();
  });
};

Bus.tablesByName = function() {
  return Bus.__refs__.reduce(function(acc, ref) {
    var table;
    table = ref();
    acc[table.getTableName()] = table;
    return acc;
  }, {});
};

Bus.meta = function() {
  return Bus.__refs__.map(function(ref) {
    var joins, meta, table;
    table = ref();
    joins = table[RELATIONS];
    return meta = {
      table: table.getTableName(),
      relations: Object.keys(joins).map(function(relation) {
        meta = joins[relation];
        return Object.keys(meta).reduce(function(acc, key) {
          var data;
          data = meta[key];
          acc[key] = data.getTableName ? data.getTableName() : data;
          return acc;
        }, {
          attribute: relation
        });
      })
    };
  });
};

Bus.extend = function(model, isRelation) {
  if (isRelation == null) {
    isRelation = false;
  }
  if (~Bus.__tables__.indexOf(model.getTableName())) {
    return Bus;
  }
  debug("Bus.extend(" + (model.getTableName()) + ")");
  model.__mithink__ = {
    actions: {}
  };
  model.guard = Bus.guard.bind({
    model: model
  });
  Bus.__refs__.push(function() {
    return model;
  });
  if (!isRelation) {
    interceptRelations(model, Bus);
  }

  /**
   * @class Server.Model
   * @description The Server-side Model object
   * @property channel { Socket.IO.Channel } The socket.io channel for a given model
   * @example
   *   Thing = mithink.createModel 'Thing', schema, options
   */
  model.channel = Bus.io.of(utils.channelName(model.getTableName()));

  /**
   * add custom events to a channel so that they can have access control handlers
   * @class Server.Model
   * @function Server.Model#registerActions
   * @param {Object} actions - set of actions and handlers to register, will over-write preexisting handlers
   * @example
   * Thing.registerActions {
   *   mapreduce: (data)->
   *     return false unless socket.authenticated
   *     Thing.map(m).reduce(r).exec().then (data)=>
   *       # send data back to client that asked for it on the channel the event was received on
   *       this.socket.emit "mapreduce", data
   * }
   */
  model.registerActions = Bus._actionable.bind(model.__mithink__);
  model.registerActions(actions);
  model.channel.on("connection", Bus.wrap.bind({
    model: model
  }));
  Bus._wireUp(model);
  return Bus;
};

Bus._wireUp = function(model) {
  if (~Bus.__tables__.indexOf(model.getTableName())) {
    return Bus;
  }
  debug("Bus.wireUp(" + (model.getTableName()) + ")");
  Bus.__tables__.push(model.getTableName());
  model.changes().then(function(feed) {
    return feed.each(function(err, doc) {
      if (err) {
        debug(err);
        throw err;
      }
      if (!doc.isSaved()) {
        debug("emitting destroy... " + (JSON.stringify(doc)));
        return model.channel.emit('destroy', doc);
      }
      debug("emitting upsert... " + (JSON.stringify(doc)));
      return model.channel.emit('upsert', doc);
    });
  });
  return Bus;
};

Bus.wrap = function(socket) {
  var ctx;
  ctx = {
    socket: socket,
    model: this.model,
    Bus: Bus
  };
  return Bus.__protect__.call(utils.merge(ctx, {
    action: 'connection'
  }), function() {
    var action, handler, ref2, results;
    Bus.__protect__.call(utils.merge(ctx, {
      action: 'load'
    }), this.model.__mithink__.actions.load)();
    ref2 = this.model.__mithink__.actions;
    results = [];
    for (action in ref2) {
      handler = ref2[action];
      results.push((function(action, handler) {
        return socket.on(action, Bus.__protect__.call(utils.merge(ctx, {
          action: action
        }), handler));
      })(action, handler));
    }
    return results;
  })();
};

Bus._actionable = function(opts) {
  var action, handler, results;
  if (opts == null) {
    opts = {};
  }
  results = [];
  for (action in opts) {
    handler = opts[action];
    results.push(this.actions[action] = handler);
  }
  return results;
};

module.exports = Bus;


text:
"""
abuse.ch Zeus C&C RSS feed bot.

Maintainer: Lari Huttunen <mit-code@huttu.net>
"""

import re
from abusehelper.core import bot

from . import host_or_ip, resolve_level, split_description, AbuseCHFeedBot

class ZeusCcBot(AbuseCHFeedBot):
    feed_malware = "zeus"
    feed_type = "c&c"
    feed_name = "zeus c&c"

    feeds = bot.ListParam(default=["https://zeustracker.abuse.ch/rss.php"])

    def parse_title(self, title):
        pieces = title.split(None, 1)

        yield host_or_ip(pieces[0])

        if len(pieces) > 1:
            date = pieces[1]
            date = re.sub("[()]", "", date)
            yield "source time", date + "Z"

    def parse_description(self, description):
        for key, value in split_description(description):
            if key == "status":
                yield key, value
            elif key == "level":
                yield "description", resolve_level(value)
            elif key == "sbl" and value.lower() != "not listed":
                yield key + " id", value
            elif key == "ip address":
                yield "ip", value

if __name__ == "__main__":
    ZeusCcBot.from_command_line().execute()


text:
/* eslint-disable */
/////////////////////////////////////////////////////////////////////////////////////////
//                                                                                //
// !!! DO NOT EDIT THIS FILE !!!                                                       //
//                                                                                //
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
// Please refer to the script code to learn how to update the source data.             //
//                                                                                //
/////////////////////////////////////////////////////////////////////////////////////////

import { WebAPICallResult } from '../WebClient';
export type ConversationsRepliesResponse = WebAPICallResult & {
  error?:             string;
  has_more?:          boolean;
  messages?:          Message[];
  needed?:            string;
  ok?:                boolean;
  provided?:          string;
  response_metadata?: ResponseMetadata;
};

export interface Message {
  app_id?:            string;
  attachments?:       Attachment[];
  blocks?:            Block[];
  bot_id?:            string;
  bot_profile?:       BotProfile;
  display_as_bot?:    boolean;
  edited?:            Edited;
  files?:             FileElement[];
  is_locked?:         boolean;
  last_read?:         string;
  latest_reply?:      string;
  metadata?:          MessageMetadata;
  parent_user_id?:    string;
  reactions?:         Reaction[];
  reply_count?:       number;
  reply_users?:       string[];
  reply_users_count?: number;
  subscribed?:        boolean;
  team?:              string;
  text?:              string;
  thread_ts?:         string;
  ts?:                string;
  type?:              string;
  upload?:            boolean;
  user?:              string;
  x_files?:           string[];
}

export interface Attachment {
  actions?:               Action[];
  app_id?:                string;
  app_unfurl_url?:        string;
  author_icon?:           string;
  author_id?:             string;
  author_link?:           string;
  author_name?:           string;
  author_subname?:        string;
  blocks?:                Block[];
  bot_id?:                string;
  callback_id?:           string;
  channel_id?:            string;
  channel_name?:          string;
  color?:                 string;
  fallback?:              string;
  fields?:                Field[];
  filename?:              string;
  files?:                 FileElement[];
  footer?:                string;
  footer_icon?:           string;
  from_url?:              string;
  id?:                    number;
  image_bytes?:           number;
  image_height?:          number;
  image_url?:             string;
  image_width?:           number;
  indent?:                boolean;
  is_app_unfurl?:         boolean;
  is_msg_unfurl?:         boolean;
  is_reply_unfurl?:       boolean;
  is_thread_root_unfurl?: boolean;
  metadata?:              AttachmentMetadata;
  mimetype?:              string;
  mrkdwn_in?:             string[];
  msg_subtype?:           string;
  original_url?:          string;
  pretext?:               string;
  preview?:               Preview;
  service_icon?:          string;
  service_name?:          string;
  service_url?:           string;
  size?:                  number;
  text?:                  string;
  thumb_height?:          number;
  thumb_url?:             string;
  thumb_width?:           number;
  title?:                 string;
  title_link?:            string;
  ts?:                    string;
  url?:                   string;
  video_html?:            string;
  video_html_height?:     number;
  video_html_width?:      number;
  video_url?:             string;
}

export interface Action {
  confirm?:          ActionConfirm;
  data_source?:      string;
  id?:               string;
  min_query_length?: number;
  name?:             string;
  option_groups?:    ActionOptionGroup[];
  options?:          SelectedOptionElement[];
  selected_options?: SelectedOptionElement[];
  style?:            string;
  text?:             string;
  type?:             string;
  url?:              string;
  value?:            string;
}

export interface ActionConfirm {
  dismiss_text?: string;
  ok_text?:      string;
  text?:         string;
  title?:        string;
}

export interface ActionOptionGroup {
  options?: SelectedOptionElement[];
  text?:    string;
}

export interface SelectedOptionElement {
  text?:  string;
  value?: string;
}

export interface Block {
  accessory?:                Accessory;
  alt_text?:                 string;
  api_decoration_available?: boolean;
  app_collaborators?:        string[];
  app_id?:                   string;
  author_name?:              string;
  block_id?:                 string;
  bot_user_id?:              string;
  button_label?:             string;
  call?:                     Call;
  call_id?:                  string;
  description?:              Description;
  dispatch_action?:          boolean;
  element?:                  Accessory;
  elements?:                 Accessory[];
  external_id?:              string;
  fallback?:                 string;
  fields?:                   Description[];
  file?:                     BlockFile;
  file_id?:                  string;
  function_trigger_id?:      string;
  hint?:                     Description;
  image_bytes?:              number;
  image_height?:             number;
  image_url?:                string;
  image_width?:              number;
  is_workflow_app?:          boolean;
  label?:                    Description;
  optional?:                 boolean;
  provider_icon_url?:        string;
  provider_name?:            string;
  source?:                   string;
  text?:                     Description;
  thumbnail_url?:            string;
  title?:                    Description;
  title_url?:                string;
  type?:                     string;
  url?:                      string;
  video_url?:                string;
}

export interface Accessory {
  accessibility_label?:             string;
  action_id?:                       string;
  alt_text?:                        string;
  border?:                          number;
  confirm?:                         AccessoryConfirm;
  default_to_current_conversation?: boolean;
  elements?:                        AccessoryElement[];
  fallback?:                        string;
  filter?:                          Filter;
  focus_on_load?:                   boolean;
  image_bytes?:                     number;
  image_height?:                    number;
  image_url?:                       string;
  image_width?:                     number;
  indent?:                          number;
  initial_channel?:                 string;
  initial_channels?:                string[];
  initial_conversation?:            string;
  initial_conversations?:           string[];
  initial_date?:                    string;
  initial_option?:                  InitialOptionElement;
  initial_options?:                 InitialOptionElement[];
  initial_time?:                    string;
  initial_user?:                    string;
  initial_users?:                   string[];
  max_selected_items?:              number;
  min_query_length?:                number;
  offset?:                          number;
  option_groups?:                   AccessoryOptionGroup[];
  options?:                         InitialOptionElement[];
  placeholder?:                     Description;
  response_url_enabled?:            boolean;
  style?:                           string;
  text?:                            Description;
  timezone?:                        string;
  type?:                            string;
  url?:                             string;
  value?:                           string;
}

export interface AccessoryConfirm {
  confirm?: Description;
  deny?:    Description;
  style?:   string;
  text?:    Description;
  title?:   Description;
}

export interface Description {
  emoji?:    boolean;
  text?:     string;
  type?:     string;
  verbatim?: boolean;
}

export interface AccessoryElement {
  border?:   number;
  elements?: PurpleElement[];
  indent?:   number;
  offset?:   number;
  style?:    string;
  type?:     string;
}

export interface PurpleElement {
  channel_id?:   string;
  name?:         string;
  range?:        string;
  skin_tone?:    number;
  style?:        Style;
  team_id?:      string;
  text?:         string;
  timestamp?:    string;
  type?:         string;
  unicode?:      string;
  url?:          string;
  user_id?:      string;
  usergroup_id?: string;
  value?:        string;
}

export interface Style {
  bold?:   boolean;
  code?:   boolean;
  italic?: boolean;
  strike?: boolean;
}

export interface Filter {
  exclude_bot_users?:                boolean;
  exclude_external_shared_channels?: boolean;
  include?:                          string[];
}

export interface InitialOptionElement {
  description?: Description;
  text?:        Description;
  url?:         string;
  value?:       string;
}

export interface AccessoryOptionGroup {
  label?:   Description;
  options?: InitialOptionElement[];
}

export interface Call {
  media_backend_type?: string;
  v1?:                 V1;
}

export interface V1 {
  active_participants?:  Participant[];
  all_participants?:     Participant[];
  app_icon_urls?:        AppIconUrls;
  app_id?:               string;
  channels?:             string[];
  created_by?:           string;
  date_end?:             number;
  date_start?:           number;
  desktop_app_join_url?: string;
  display_id?:           string;
  has_ended?:            boolean;
  id?:                   string;
  is_dm_call?:           boolean;
  join_url?:             string;
  name?:                 string;
  was_accepted?:         boolean;
  was_missed?:           boolean;
  was_rejected?:         boolean;
}

export interface Participant {
  avatar_url?:   string;
  display_name?: string;
  external_id?:  string;
  slack_id?:     string;
}

export interface AppIconUrls {
  image_1024?:     string;
  image_128?:      string;
  image_192?:      string;
  image_32?:       string;
  image_36?:       string;
  image_48?:       string;
  image_512?:      string;
  image_64?:       string;
  image_72?:       string;
  image_96?:       string;
  image_original?: string;
}

export interface BlockFile {
  alt_txt?:                   string;
  app_id?:                    string;
  app_name?:                  string;
  bot_id?:                    string;
  cc?:                        Cc[];
  channel_actions_count?:     number;
  channel_actions_ts?:        string;
  channels?:                  string[];
  comments_count?:            number;
  converted_pdf?:             string;
  created?:                   number;
  deanimate?:                 string;
  deanimate_gif?:             string;
  display_as_bot?:            boolean;
  duration_ms?:               number;
  edit_link?:                 string;
  editable?:                  boolean;
  editor?:                    string;
  external_id?:               string;
  external_type?:             string;
  external_url?:              string;
  file_access?:               string;
  filetype?:                  string;
  from?:                      Cc[];
  groups?:                    string[];
  has_more?:                  boolean;
  has_rich_preview?:          boolean;
  headers?:                   Headers;
  hls?:                       string;
  hls_embed?:                 string;
  id?:                        string;
  image_exif_rotation?:       number;
  ims?:                       string[];
  initial_comment?:           InitialComment;
  is_external?:               boolean;
  is_public?:                 boolean;
  is_starred?:                boolean;
  last_editor?:               string;
  lines?:                     number;
  lines_more?:                number;
  media_display_type?:        string;
  mimetype?:                  string;
  mode?:                      string;
  mp4?:                       string;
  name?:                      string;
  non_owner_editable?:        boolean;
  num_stars?:                 number;
  original_attachment_count?: number;
  original_h?:                string;
  original_w?:                string;
  permalink?:                 string;
  permalink_public?:          string;
  pinned_to?:                 string[];
  pjpeg?:                     string;
  plain_text?:                string;
  pretty_type?:               string;
  preview?:                   string;
  preview_highlight?:         string;
  preview_is_truncated?:      boolean;
  preview_plain_text?:        string;
  public_url_shared?:         boolean;
  reactions?:                 Reaction[];
  sent_to_self?:              boolean;
  shares?:                    Shares;
  simplified_html?:           string;
  size?:                      number;
  subject?:                   string;
  subtype?:                   string;
  thumb_1024?:                string;
  thumb_1024_gif?:            string;
  thumb_1024_h?:              string;
  thumb_1024_w?:              string;
  thumb_160?:                 string;
  thumb_160_gif?:             string;
  thumb_160_h?:               string;
  thumb_160_w?:               string;
  thumb_360?:                 string;
  thumb_360_gif?:             string;
  thumb_360_h?:               string;
  thumb_360_w?:               string;
  thumb_480?:                 string;
  thumb_480_gif?:             string;
  thumb_480_h?:               string;
  thumb_480_w?:               string;
  thumb_64?:                  string;
  thumb_64_gif?:              string;
  thumb_64_h?:                string;
  thumb_64_w?:                string;
  thumb_720?:                 string;
  thumb_720_gif?:             string;
  thumb_720_h?:               string;
  thumb_720_w?:               string;
  thumb_80?:                  string;
  thumb_800?:                 string;
  thumb_800_gif?:             string;
  thumb_800_h?:               string;
  thumb_800_w?:               string;
  thumb_80_gif?:              string;
  thumb_80_h?:                string;
  thumb_80_w?:                string;
  thumb_960?:                 string;
  thumb_960_gif?:             string;
  thumb_960_h?:               string;
  thumb_960_w?:               string;
  thumb_gif?:                 string;
  thumb_pdf?:                 string;
  thumb_pdf_h?:               string;
  thumb_pdf_w?:               string;
  thumb_tiny?:                string;
  thumb_video?:               string;
  thumb_video_h?:             number;
  thumb_video_w?:             number;
  timestamp?:                 number;
  title?:                     string;
  to?:                        Cc[];
  transcription?:             Transcription;
  updated?:                   number;
  url_private?:               string;
  url_private_download?:      string;
  user?:                      string;
  user_team?:                 string;
  username?:                  string;
  vtt?:                       string;
}

export interface Cc {
  address?:  string;
  name?:     string;
  original?: string;
}

export interface Headers {
  date?:        string;
  in_reply_to?: string;
  message_id?:  string;
  reply_to?:    string;
}

export interface InitialComment {
  channel?:   string;
  comment?:   string;
  created?:   number;
  id?:        string;
  is_intro?:  boolean;
  timestamp?: number;
  user?:      string;
}

export interface Reaction {
  count?: number;
  name?:  string;
  url?:   string;
  users?: string[];
}

export interface Shares {
  private?: { [key: string]: Private[] };
  public?:  { [key: string]: Private[] };
}

export interface Private {
  channel_name?:      string;
  latest_reply?:      string;
  reply_count?:       number;
  reply_users?:       string[];
  reply_users_count?: number;
  share_user_id?:     string;
  team_id?:           string;
  thread_ts?:         string;
  ts?:                string;
}

export interface Transcription {
  locale?: string;
  status?: string;
}

export interface Field {
  short?: boolean;
  title?: string;
  value?: string;
}

export interface FileElement {
  alt_txt?:                   string;
  app_id?:                    string;
  app_name?:                  string;
  bot_id?:                    string;
  cc?:                        Cc[];
  channel_actions_count?:     number;
  channel_actions_ts?:        string;
  channels?:                  string[];
  comments_count?:            number;
  converted_pdf?:             string;
  created?:                   number;
  deanimate?:                 string;
  deanimate_gif?:             string;
  display_as_bot?:            boolean;
  duration_ms?:               number;
  edit_link?:                 string;
  editable?:                  boolean;
  editor?:                    string;
  external_id?:               string;
  external_type?:             string;
  external_url?:              string;
  file_access?:               string;
  filetype?:                  string;
  from?:                      Cc[];
  groups?:                    string[];
  has_more?:                  boolean;
  has_rich_preview?:          boolean;
  headers?:                   Headers;
  hls?:                       string;
  hls_embed?:                 string;
  id?:                        string;
  image_exif_rotation?:       number;
  ims?:                       string[];
  initial_comment?:           InitialComment;
  is_external?:               boolean;
  is_public?:                 boolean;
  is_starred?:                boolean;
  last_editor?:               string;
  lines?:                     number;
  lines_more?:                number;
  media_display_type?:        string;
  mimetype?:                  string;
  mode?:                      string;
  mp4?:                       string;
  name?:                      string;
  non_owner_editable?:        boolean;
  num_stars?:                 number;
  original_attachment_count?: number;
  original_h?:                string;
  original_w?:                string;
  permalink?:                 string;
  permalink_public?:          string;
  pinned_to?:                 string[];
  pjpeg?:                     string;
  plain_text?:                string;
  pretty_type?:               string;
  preview?:                   string;
  preview_highlight?:         string;
  preview_is_truncated?:      boolean;
  preview_plain_text?:        string;
  public_url_shared?:         boolean;
  reactions?:                 Reaction[];
  sent_to_self?:              boolean;
  shares?:                    Shares;
  simplified_html?:           string;
  size?:                      number;
  subject?:                   string;
  subtype?:                   string;
  thumb_1024?:                string;
  thumb_1024_gif?:            string;
  thumb_1024_h?:              string;
  thumb_1024_w?:              string;
  thumb_160?:                 string;
  thumb_160_gif?:             string;
  thumb_160_h?:               string;
  thumb_160_w?:               string;
  thumb_360?:                 string;
  thumb_360_gif?:             string;
  thumb_360_h?:               string;
  thumb_360_w?:               string;
  thumb_480?:                 string;
  thumb_480_gif?:             string;
  thumb_480_h?:               string;
  thumb_480_w?:               string;
  thumb_64?:                  string;
  thumb_64_gif?:              string;
  thumb_64_h?:                string;
  thumb_64_w?:                string;
  thumb_720?:                 string;
  thumb_720_gif?:             string;
  thumb_720_h?:               string;
  thumb_720_w?:               string;
  thumb_80?:                  string;
  thumb_800?:                 string;
  thumb_800_gif?:             string;
  thumb_800_h?:               string;
  thumb_800_w?:               string;
  thumb_80_gif?:              string;
  thumb_80_h?:                string;
  thumb_80_w?:                string;
  thumb_960?:                 string;
  thumb_960_gif?:             string;
  thumb_960_h?:               string;
  thumb_960_w?:               string;
  thumb_gif?:                 string;
  thumb_pdf?:                 string;
  thumb_pdf_h?:               string;
  thumb_pdf_w?:               string;
  thumb_tiny?:                string;
  thumb_video?:               string;
  thumb_video_h?:             number;
  thumb_video_w?:             number;
  timestamp?:                 number;
  title?:                     string;
  to?:                        Cc[];
  transcription?:             Transcription;
  updated?:                   number;
  url_private?:               string;
  url_private_download?:      string;
  user?:                      string;
  user_team?:                 string;
  username?:                  string;
  vtt?:                       string;
}

export interface AttachmentMetadata {
  extension?:   string;
  format?:      string;
  original_h?:  number;
  original_w?:  number;
  rotation?:    number;
  thumb_160?:   boolean;
  thumb_360_h?: number;
  thumb_360_w?: number;
  thumb_64?:    boolean;
  thumb_80?:    boolean;
  thumb_tiny?:  string;
}

export interface Preview {
  can_remove?: boolean;
  icon_url?:   string;
  subtitle?:   Description;
  title?:      Description;
  type?:       string;
}

export interface BotProfile {
  app_id?:  string;
  deleted?: boolean;
  icons?:   Icons;
  id?:      string;
  name?:    string;
  team_id?: string;
  updated?: number;
}

export interface Icons {
  image_36?: string;
  image_48?: string;
  image_72?: string;
}

export interface Edited {
  ts?:   string;
  user?: string;
}

export interface MessageMetadata {
  event_payload?: EventPayload;
  event_type?:    string;
}

export interface EventPayload {
}

export interface ResponseMetadata {
  next_cursor?: string;
}


text:
require_relative 'makeme_readme/version'

class MakemeReadme

  def rename_current
    if File.exist?('readme.md')
      system "mv readme.md README_old.md"
    end
  end

  def create_new
    system "touch README.md"
  end

  def add_contents
    system "curl 'https://raw.githubusercontent.com/HatStephens/makeme_readme/master/template.txt' > README.md"
  end

end


text:
import React from 'react'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'

const SearchVariationsExamples = () => (
  <ExampleSection title='Variations'>
    <ComponentExample
      title='Fluid'
      description='A search can have its results take up the width of its container.'
      examplePath='modules/Search/Variations/SearchExampleFluid'
    />
    <ComponentExample
      title='Aligned'
      description='A search can have its results aligned to its left or right container edge.'
      examplePath='modules/Search/Variations/SearchExampleAligned'
    />
  </ExampleSection>
)

export default SearchVariationsExamples


text:
@implementation NSEntityDescription (CDEAdditions)

#pragma mark - Convenience
- (NSArray *)supportedAttributes_cde {
    NSMutableArray *result = [NSMutableArray new];
    for(NSAttributeDescription *attribute in [[self attributesByName] allValues]) {
        // Ignore transient properties
        if(attribute.isTransient) {
            continue;
        }
        if(!attribute.isSupportedAttribute_cde) {
            continue;
        }

        [result addObject:attribute];
    }
    return result;
}

- (NSArray *)sortedToOneRelationships_cde {
    NSMutableArray *result = [NSMutableArray new];
    [self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
        if(relation.isToMany) {
            return;
        }
        [result addObject:relation];
    }];
    return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
        return [relationA.name localizedStandardCompare:relationB.name];
    }];
}

- (NSArray *)sortedRelationships_cde {
    return [self.relationshipsByName.allValues sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
        return [relationA.name localizedStandardCompare:relationB.name];
    }];
}

- (NSString *)nameForDisplay_cde {
    return [self.name humanReadableStringAccordingToUserDefaults_cde];
}

#pragma mark - CSV

// This method filters out any non supported property names and also respects the sorting of propertyNames
- (NSArray *)CSVValuesForEachManagedObjectInArray:(NSArray *)objects forPropertyNames:(NSArray *)propertyNames includeHeaderValues_cde:(BOOL)includeHeaderValues {
    NSParameterAssert(objects);
    NSParameterAssert(propertyNames);

    NSMutableArray *supportedAttributeNames = [NSMutableArray new];
    for(NSString *propertyName in propertyNames) {
        if([propertyName isEqualToString:@"objectID"]) {
            [supportedAttributeNames addObject:propertyName];
            continue;
        }
        NSAttributeDescription *attribute = self.attributesByName[propertyName];
        if(attribute == nil) {
            continue;
        }
        if(!attribute.isSupportedAttribute_cde || !attribute.isSupportedCSVAttribute_cde) {
            continue;
        }
        [supportedAttributeNames addObject:attribute.name];
    }

    NSMutableArray *result = [NSMutableArray arrayWithCapacity:objects.count + 1];

    if(includeHeaderValues) {
        [result addObject:supportedAttributeNames];
    }

    for(NSManagedObject *object in objects) {
        NSAssert([object.entity isKindOfEntity:self], @"Entity mismatch");
        NSArray *values = [object CSVValuesForAttributeNames_cde:supportedAttributeNames];
        [result addObject:values];
    }

    return result;
}

- (NSArray *)supportedCSVAttributes_cde {
    NSMutableArray *result = [NSMutableArray new];
    for(NSAttributeDescription *attribute in self.supportedAttributes_cde) {
        if(attribute.isSupportedCSVAttribute_cde) {
            [result addObject:attribute];
        }
    }
    return result;
}

#pragma mark - UI
- (NSImage *)icon_cde {
    return [NSImage imageNamed:@"entity-icon-small"];
}

@end


text:
package com.andretrindade.batatas.helpers;

import android.annotation.SuppressLint;

import com.opencsv.CSVReader;
import com.opencsv.CSVWriter;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

final class Utils {
    @SuppressLint("SdCardPath")
    private static final String CSV_PATH = "/data/data/com.andretrindade.batatas/cache/cache.csv";

    public static HashMap<String, List<String>> addItemToHash(HashMap<String, List<String>> hash, String key, String value) {
        List<String> currentValues = hash.get(key);

        if (currentValues == null || currentValues.size() == 0) {
            hash.put(key, Collections.singletonList(value));
        } else if (!currentValues.contains(value)) {
            currentValues.add(value);
            hash.put(key, currentValues);
        }

        return hash;
    }

    public static void addItemToHash(HashMap<String, List<String>> hash, String key, List<String> values) {
        List<String> currentValues = hash.get(key);

        if (currentValues == null || currentValues.size() == 0) {
            hash.put(key, values);
        } else {
            currentValues.addAll(values);
            hash.put(key, currentValues);
        }
    }

    public static HashMap<String, List<String>> readProductsFromCsv() {
        HashMap<String, List<String>> result = new HashMap<>();

        try {
            CSVReader csvReader = new CSVReader(new FileReader(CSV_PATH));
            String[] line;

            while ((line = csvReader.readNext()) != null) {
                String eanCode = line[0];
                String name = line[1];
                result = addItemToHash(result, eanCode, name);
            }
        } catch (IOException e) {
            saveProductsToCsv(new HashMap<String, List<String>>());
            //e.printStackTrace();
        }
        return result;
    }

    public static void saveProductsToCsv(HashMap<String, List<String>> cache) {
        try {
            File file = new File(CSV_PATH);
            if (!file.exists()) {
                file.getParentFile().mkdirs();
                file.createNewFile();
            }

            CSVWriter csvWriter = new CSVWriter(new FileWriter(CSV_PATH));

            for (Map.Entry<String, List<String>> entry : cache.entrySet()) {
                String key = entry.getKey();
                for (String item : entry.getValue()) {
                    csvWriter.writeNext(new String[]{key, item});
                }
            }

            csvWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}