text:
    [[nValidTabs_]] valid metadatas

  <cr-button on-click="setFakeBrowserTabModel_" class="internals-button">
    Change Browser Tabs Status
  </cr-button>

    Note: Click the button above to propagate
    VALID (green) browser tab status values on
    the right hand side to the fake phonehub manager. Note that if a field is
    empty or favicon is set to NONE, then that corresponding tab will not be
    sent, and the background will be grey.

    Toggle Tab Sync enabled

  <cr-toggle checked="{{isTabSyncEnabled_}}">
  </cr-toggle>
  <template is="dom-if" if="[[isTabSyncEnabled_]]" restamp>

1:

      <browser-tabs-metadata-form
          browser-tab-metadata="{{browserTabOneMetadata_}}">
      </browser-tabs-metadata-form>

2:

      <browser-tabs-metadata-form
          browser-tab-metadata="{{browserTabTwoMetadata_}}">
      </browser-tabs-metadata-form>

  </template>


text:
package websocket_handler

import (
	"io"
	"log"
	"net/http"
	"time"

	"github.com/gorilla/websocket"
)

type connection struct {
	ws   *websocket.Conn // The websocket connection.
	send chan []byte     // Buffered channel of outbound messages.
}

// WebSocketHandler represents a websocket
type WebSocketHandler interface {
	io.Writer
	Handler(w http.ResponseWriter, r *http.Request)
}

// webSocketHandler main structure
type webSocketHandler struct {
	connections      map[*connection]bool // Registered connections.
	broadcast        chan []byte          // Inbound messages from the connections.
	register         chan *connection     // Register requests from the connections.
	unregister       chan *connection     // Unregister requests from connections.
	connectionNumber chan int
}

var upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
	CheckOrigin:     func(r *http.Request) bool { return true },
}

// handles messages coming from websocket
func (c *connection) reader(errCh chan bool) {
	for {
		messageType, message, err := c.ws.ReadMessage()
		if err != nil {
			log.Println("[Reader] Error", err)
			defer func() { errCh <- true }()
			return
		}

		log.Println("Received message ", messageType, message, err)
		log.Println("Received message " + string(message))

		//parseMessageSent(string(message))
	}
}

// handles messages to a connected client
func (c *connection) writer(errCh chan bool) {
	for msg := range c.send {
		err := c.ws.WriteMessage(websocket.BinaryMessage, msg)
		if err != nil {
			log.Println("[Writer] Error", err)
			defer func() { errCh <- true }()
			break
		}
	}
}

// Echo the data received on the WebSocket.
// WebSocket handler. It perform user authentication, upgrades connection
// to websocket and spawns goroutines to handle data transfers.
func (wsh *webSocketHandler) Handler(w http.ResponseWriter, r *http.Request) {

	ws, err := upgrader.Upgrade(w, r, nil)
	if err != nil {
		log.Println("Got error while upgrading connection", err)
		return
	}
	defer ws.Close()

	// we have a initialized websocket connection.
	c := &connection{ws, make(chan []byte, 10)}

	log.Println("Got connection")
	// put it in the registration channel for the hub to take it.
	wsh.register <- c
	// create error channel. It will be used in case of errors to
	// end the connection
	errorCh := make(chan bool)
	defer func() {
		wsh.unregister <- c
	}()
	// spawn go routing to send/receive data
	go c.reader(errorCh)
	go c.writer(errorCh)
	// wait for errors or connection end
	<-errorCh
}

// Main worker loop. Three things can happen: (i) we got a new
// connection from a client. Handler created connection object and
// sent it in the connections channel. Connection is stored in
// connections map in order to know to who send data. (ii) Connection
// is closed, we remove the object from connections map. (iii) We got
// a message from rabbitmq: we iterate over connections map and send
// the message in each connection channel for the writer goroutine to
// pick it up.
func (wsh *webSocketHandler) run() {
	for {
		select {
		case c := <-wsh.register:
			log.Println("[hub] register")
			wsh.connections[c] = true
			log.Println("Register call end -> Number of current connections: ", len(wsh.connections))
			if wsh.connectionNumber != nil {
				wsh.connectionNumber <- len(wsh.connections)
			}
			break

		case c := <-wsh.unregister:
			log.Println("[hub] unregister")
			if _, ok := wsh.connections[c]; ok {
				delete(wsh.connections, c)
				close(c.send)
			}
			log.Println("Unregister call end -> Number of current connections: ", len(wsh.connections))
			if wsh.connectionNumber != nil {
				wsh.connectionNumber <- len(wsh.connections)
			}
			break

		case msg := <-wsh.broadcast:
			for c := range wsh.connections {
				select {
				case c.send <- msg:
					continue
				case <-time.After(100 * time.Millisecond):
					log.Println("[WSHandler] Skipping message to connection")
					// skip message if timeout
				}
			}
			break
		}
	}
}

// Send puts message body into the queue of messages that have to be
// broadcasted to clients.
func (wsh *webSocketHandler) Write(data []byte) (n int, err error) {
	// Optimization: don't send if there is no connection
	if len(wsh.connections) <= 0 {
		return
	}

	wsh.broadcast <- data
	n = len(data)
	return
}

// NewWebSocketHandler builds new websocket handler to communicate upstream
func NewWebSocketHandler(connectionNumber chan int) WebSocketHandler {
	wsh := webSocketHandler{
		broadcast:        make(chan []byte),
		register:         make(chan *connection),
		unregister:       make(chan *connection),
		connections:      make(map[*connection]bool),
		connectionNumber: connectionNumber,
	}

	go wsh.run()
	return &wsh
}

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Kew Bull. , Addit. Ser. 3: 31 (1970)

#### Original name
Marasmiellus stenophylloides f. stenophylloides

### Remarks
null


text:
class Article < ActiveRecord::Base
  include ActiveModel::Validations

  validates_presence_of :content
  validates_presence_of :title

  has_many :comments
  belongs_to :user

  def self.previous_article(type, current_id)
    if type == "blog_post"
      type = {blog_post: true}
    elsif type == "project"
      type = {project: true}
    else
      type = {blog_post: true}
    end

    pluck_index = Article.where(type).pluck(:id).sort.index(current_id.to_i)-1
    prev_id = Article.where(type).pluck(:id)[pluck_index]
    return Article.find(prev_id)

  end

  def self.next_article(type, current_id)
    if type == "blog_post"
      type = {blog_post: true}
    elsif type == "project"
      type = {project: true}
    else
      type = {blog_post: true}
    end

    pluck_index = Article.where(type).pluck(:id).sort.index(current_id.to_i)+1
    next_id = Article.where(type).pluck(:id)[pluck_index]
    if next_id.nil?
      return Article.last
    else
      return Article.find(next_id)
    end
  end

end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

		<title>Practice Help</title>
		<link rel="stylesheet" type="text/css" href="style.css" />

Practice Help

Find the Check-Mate (can be more than one move).

Your time and average time per position is shown next to the board.

Press the 'Show' button for the solution.

Press the 'Next' button to go to the next position.

Sometimes multiple solutions can be found, but the application only accepts one.

This application contains 2000 forced mate sequences taken from grand master games.


text:
using Microsoft.WindowsAzure.Storage.Table;
using System;

namespace GS.Explore.AzTableStorageApp
{
    public class OrderEntity : TableEntity
    {
        public OrderEntity(string customerName, string orderDate)
        {
            PartitionKey = customerName;
            RowKey = orderDate;
        }

        public OrderEntity()
        {}
        public string OrderNumber { get; set; }
        public DateTime RequiredDate { get; set; }
        public DateTime ShippedDate { get; set; }
        public string Status { get; set; }
    }
}


text:
module ApplicationHelper

  include LandParcelViewHelper

  def render_flash(flash)
    # Maps each flash message type to the corresponding foundation alert
    # CSS classes
    flash_types = {
      :alert  => 'alert-box alert',
      :notice => 'alert-box success'
    }

    output = ''.html_safe

    flash_types.each do |type, classes|
      if flash[type]
        output.concat(content_tag(:div, flash[type], :class => classes))
      end
    end

    return output
  end
end


text:
import { Grid } from "@material-ui/core";
import React from "react";
import { StatusChip } from "./StatusChip";

const StateCounter = ({
  type,
  list,
}: {
  type: string;
  list: { state: string }[];
}) => {
  const stateMap = {} as { [state: string]: number };
  list.forEach(({ state }) => {
    stateMap[state] = stateMap[state] + 1 || 1;
  });

  return (
    <Grid container spacing={2} alignItems="center">
      <Grid item>
        <StatusChip status="TOTAL" type={type} suffix={`x ${list.length}`} />
      </Grid>
      {Object.entries(stateMap).map(([s, num]) => (
        <Grid key={s} item>
          <StatusChip status={s} type={type} suffix={` x ${num}`} />
        </Grid>
      ))}
    </Grid>
  );
};

export default StateCounter;