text:
var fs         = require("fs");
var path       = require("path");

var pluginTmpl = templateFile("/plugin.tmpl");
var configTmpl = templateFile("/config.tmpl");
var configItem = templateFile("/config.item.tmpl");
var inlineTemp = templateFile("/inline.template.tmpl");
var pluginItemTmpl  = fs.readFileSync(path.resolve(__dirname, "../", "templates/plugin.item.tmpl"), "utf-8");

function templateFile (filepath) {
    return fs.readFileSync(path.join(__dirname, "/../templates", filepath || ""), "utf-8");
}

/**
 * @type {{page: Function, markup: Function, client:js: Function, templates: Function}}
 */
module.exports = {
    /**
     * Create the url config for each section of the ui
     * @param hooks
     * @param ui
     */
    "page": function (hooks, ui) {

        var config = hooks
            .map(transformConfig)
            .reduce(createConfigItem, {});

        return {
            /**
             * pagesConfig - This is the angular configuration such as routes
             */
            pagesConfig: configTmpl
                .replace("%when%", hooks.reduce(
                    createAngularRoutes,
                    ""
                ))
                .replace("%pages%", JSON.stringify(
                    config,
                    null,
                    4
                )),
            /**
             * pagesConfig in object form
             */
            pagesObj: config,
            pageMarkup: function () {
                return preAngular(ui.pluginManager.plugins, config, ui);
            }
        };
    },
    /**
     * Controller markup for each plugin
     * @param hooks
     * @returns {*}
     */
    "markup": function (hooks) {
        return hooks.reduce(pluginTemplate, "");
    },
    /**
     * @param hooks
     * @param {UI} ui
     * @returns {*|string}
     */
    "client:js": function (hooks, ui) {

        /**
         * Add client JS from BrowserSync Plugins
         */
        ui.bsPlugins.forEach(function (plugin) {
            if (plugin.has("client:js")) {
                hooks.push(plugin.get("client:js"));
            }
        });

        var out = hooks.reduce(function (all, item) {
            if (typeof item === "string") {
                all += ";" + item;
            } else if (Array.isArray(item)) {
                item.forEach(function (item) {
                    all += ";" + item;
                });
            }
            return all;
        }, "");
        return out;
    },
    /**
     * @param hooks
     * @param initial
     * @param {UI} ui
     * @returns {String}
     */
    "templates": function (hooks, initial, ui) {

        /**
         * Add templates from BrowserSync Plugins
         * @type {string}
         */
        var pluginDirectives = ui.bsPlugins.reduce(function (all, plugin) {

            var optPath = ["pkg", "browser-sync:ui", "hooks", "templates"];

            if (plugin.hasIn(optPath)) {

                var templatename = path.basename(plugin.getIn(optPath).get(0));

                if (templatename) {
                    all +=  angularWrap(templatename, plugin.get("templates"));
                }
            }
            return all;
        }, "");

        return [pluginDirectives, createInlineTemplates(hooks.concat([initial]))].join("");
    },
    /**
     * Allow plugins to register toggle-able elements
     * @param hooks
     * @returns {{}}
     */
    "elements": function (hooks) {
        var obj = {};
        hooks.forEach(function (elements) {
            elements.forEach(function (item) {
                if (!obj[item.name]) {
                    obj[item.name] = item;
                }
            });
        });
        return obj;
    }
};

/**
 * @param hooks
 * @returns {String}
 */
function createInlineTemplates (hooks) {
    return hooks.reduce(function (combined, item) {
        return combined + item.reduce(function (all, filepath) {
            return all + angularWrap(
                path.basename(filepath),
                fs.readFileSync(filepath));
        }, "");
    }, "");
}

/**
 * @param item
 * @returns {*}
 */
function transformConfig (item) {
    return item;
}

/**
 * @param {String} all
 * @param {Object} item
 * @returns {*}
 */
function createAngularRoutes(all, item) {
    return all + configItem.replace(/%(.+)%/g, function () {
        var key = arguments[1];
        if (item[key]) {
            return item[key];
        }
    });
}

/**
 * @param joined
 * @param item
 * @returns {*}
 */
function createConfigItem (joined, item) {
    if (item.path === "/") {
        joined["overview"] = item;
    } else {
        joined[item.path.slice(1)] = item;
    }
    return joined;
}

/**
 * @returns {*}
 */
function pluginTemplate (combined, item) {
    return [combined, pluginTmpl.replace("%markup%", item)].join("\n");
}

/**
 * @param plugins
 * @param config
 * @returns {*}
 */
function preAngular (plugins, config, ui) {

    return Object.keys(plugins)
        .filter(function (key) {
            return config[key]; // only work on plugins that have pages
        })
        .map(function (key) {
            if (key === "plugins") {
                var pluginMarkup = ui.bsPlugins.reduce(function (all, item, i) {
                    all += pluginItemTmpl
                        .replace("%content%", item.get("markup") || "")
                        .replace(/%index%/g, i)
                        .replace(/%name%/g, item.get("name"));

                    return all;
                }, "");
                plugins[key].hooks.markup = plugins[key].hooks.markup.replace("%pluginlist%", pluginMarkup);
            }
            return angularWrap(config[key].template, bindOnce(plugins[key].hooks.markup, config[key]));
        })
        .reduce(function (combined, item) {
            return combined + item;
        }, "");
}

/**
 * @param templateName
 * @param markup
 * @returns {*}
 */
function angularWrap (templateName, markup) {
    return inlineTemp
        .replace("%content%", markup)
        .replace("%id%", templateName);
}

/**
 * @param markup
 * @param config
 * @returns {*|string}
 */
function bindOnce (markup, config) {
    return markup.toString().replace(/\{\{ctrl.section\.(.+?)\}\}/g, function ($1, $2) {
        return config[$2] || "";
    });
}

module.exports.bindOnce = bindOnce;


text:
// Generated by CoffeeScript 1.12.6

/*
 * Instance code module initial data parsing
 */

(function() {
  'use strict';
  var object;

  object = require('../../common/object');

  module.exports = {
    mount: function(dd, instances) {
      var i, key, len, ref;
      ref = ['modules', 'instanceNames', 'instancesList'];
      for (i = 0, len = ref.length; i < len; i++) {
        key = ref[i];
        if (instances[key] != null) {
          dd[key][dd.path] = instances[key];
        }
      }
      return dd;
    },
    parse: function(code, initials) {
      var _, initial, instanceName, instances;
      if (Array.isArray(initials)) {
        instances = {
          modules: object.construct(code, initials),
          instanceNames: {}
        };
        return instances;
      }
      instances = {};
      initials = object.report(initials, true);
      for (instanceName in initials) {
        initial = initials[instanceName];
        object.insertKey(instances, instanceName, object.construct(code, initial));
      }
      return _ = {
        modules: instances,
        instanceNames: Object.keys(initials),
        instancesList: instances
      };
    }
  };

}).call(this);

redpajama_set_name: RedPajamaGithub


text:
<md-dialog aria-label="dialog-colaborador">
    <md-toolbar class="md-primary md-hue-2">

Asignación

        <md-button class="md-icon-button" ng-click="formCtrl.cerrar()">
          <md-icon style="color: white" aria-label="Cerrar diálogo">close</md-icon>
        </md-button>

    </md-toolbar>
      <md-dialog-content style="min-width:450px;" flex layout-padding>

            <form name="expediente-form" ng-submit="$event.preventDefault()">
                <md-subheader>Expediente No: {{formCtrl.number}}</md-subheader>
                <md-autocomplete
                    md-selected-item="formCtrl.formData.practicante"
                    md-search-text="formCtrl.searchTextPracticante"
                    md-items="practicante in formCtrl.practicantes | filter:formCtrl.searchTextPracticante",
                    md-item-text="practicante.carnet + ' - ' + practicante.nombres + ' ' + practicante.apellidos"
                    md-min-length="3"
                    placeholder="Seleccione practicante"
                    md-floating-label="Practicante">
                    <md-item-template>
                      <md-icon>face</md-icon>
                      {{practicante.carnet +' - '+practicante.nombres + ' ' + practicante.apellidos}}
                    </md-item-template>
                    <md-not-found>
                      No se encontraron resultados: "{{formCtrl.searchTextPracticante}}".
                    </md-not-found>
                </md-autocomplete>
                <md-autocomplete
                    md-selected-item="formCtrl.formData.asesor"
                    md-search-text="formCtrl.searchTextAsesor"
                    md-items="asesor in formCtrl.asesores | filter:formCtrl.searchTextAsesor",
                    md-item-text="asesor.username + ' - ' +asesor.colaborador.nombres + ' ' + asesor.colaborador.apellidos"
                    md-min-length="3"
                    placeholder="Seleccione asesor"
                    md-floating-label="Asesor">
                    <md-item-template>
                      <md-icon>face</md-icon>
                      {{asesor.username + ' - ' + asesor.colaborador.nombres + ' ' + asesor.colaborador.apellidos}}
                    </md-item-template>
                    <md-not-found>
                      No se encontraron resultados: "{{formCtrl.searchTextAsesor}}".
                    </md-not-found>
                </md-autocomplete>
                <md-input-container class="md-block">
                  Área
                  <md-select name="area" ng-model="formCtrl.formData.area" required>
                    <md-option ng-repeat="area in formCtrl.areas" value="{{ area.id }}">{{area.nombre}}</md-option>
                  </md-select>

Requerido

                </md-input-container>
            </form>

              <md-button ng-click="formCtrl.cancelar()">
                Cancelar
              </md-button>
              <md-button ng-click="formCtrl.procesar($event)" style="margin-right:20px;">
                Guardar
              </md-button>

      </md-dialog-content>
</md-dialog>


text:
/**
 * @typedef {import('mdast').LinkReference} LinkReference
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('../index.js').Handler} Handler
 */

import normalize from 'mdurl/encode.js'
import {revert} from '../revert.js'
import {all} from '../traverse.js'

/**
 * @type {Handler}
 * @param {LinkReference} node
 */
export function linkReference(h, node) {
  const def = h.definition(node.identifier)

  if (!def) {
    return revert(h, node)
  }

  /** @type {Properties} */
  const props = {href: normalize(def.url || '')}

  if (def.title !== null && def.title !== undefined) {
    props.title = def.title
  }

  return h(node, 'a', props, all(h, node))
}


text:
def types():
  return ['cropland', 'pasture', 'primary', 'secondary', 'urban']


text:
program file_handler
   INTEGER :: u, Reason, a, total, count, i, n, iostat
   LOGICAL :: file_exist, verbose, param_found
   REAL*8 :: average
   CHARACTER(len=255) :: arg
   CHARACTER(len=255) :: file_name
   n = IARGC ( )
   param_found = .FALSE.
   verbose = .FALSE.
   do i=1,n
      call GETARG(i,arg)
      if ( arg .eq. "-v" ) then
         write(*,*) 'Verbose mode'
         verbose = .TRUE.
      end if
      if ( i < n ) then
         if ( arg .eq. "-f" ) then
            call GETARG(i + 1,file_name)
            param_found = .TRUE.
         end if
      end if
   end do
   if ( .NOT. param_found ) then
      write (*,*) 'please specify file name'
      call exit(-1)
   end if
   inquire(file=file_name, exist=file_exist)
   if (file_exist) then
      if (verbose) then
         write (*,*) 'File found'
      end if
   else
      write (*,*) 'File not found'
      call exit(-1)
   end if
   open (newunit = u, file = file_name, iostat=iostat)
   if (iostat /= 0) then
      write (*,*) 'Unable to open file ', file_name
      call exit(-1)
   end if
   total = 0
   count = 0
   file_loop: do
     read (u,*,iostat=Reason) a
     if (Reason < 0 ) then
        exit file_loop
     end if
     if (verbose) then
        write(*,*) a
     end if
     total = total + a
     count = count + 1
   end do file_loop
   close (u)
   average = real(total) / count
   write (*,*) 'The total is ', total
   write (*,*) 'The average is ', average
end program file_handler


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace SqlSugar
{
    public partial class SqlServerExpressionContext : ExpressionContext, ILambdaExpressions
    {
        public SqlSugarProvider Context { get; set; }
        public SqlServerExpressionContext()
        {
            base.DbMehtods = new SqlServerMethod();
        }

    }
    public partial class SqlServerMethod : DefaultDbMethod, IDbMethods
    {
        public override string HasValue(MethodCallExpressionModel model)
        {
            if (model.Args[0].Type == UtilConstants.GuidType)
            {
                var parameter = model.Args[0];
                return string.Format("( {0} IS NOT NULL )", parameter.MemberName);
            }
            else
            {
                var parameter = model.Args[0];
                return string.Format("( {0}<>'' AND {0} IS NOT NULL )", parameter.MemberName);
            }
        }
    }
}


text:
title: "The Best Motherboards for The GTX 1080 Ti"
permalink: "/graphics-cards/gtx-1080-ti/motherboard/"
layout: page
seotitle: "3 Best Motherboards for GTX 1080 Ti (2020)"
meta: "Make sure you buy the best monitor for your GTX 1080 Ti, otherwise you're wasting your money!"
redirect_to: /motherboard/gtx-1080-ti/
---

	Jacob Tuwiner

![best motherboard for 1080 ti header graphic](/img/header/1080ti-motherboards.png){: .page-header}

* TOC
{: toc}

The motherboard can seem like an all-important piece of machinery that will make or break the system to some, while others view it as another chance to save a couple of bucks.

The reality is, like most components, it's on a case by case basis.

Do you really need that $300 motherboard for your [GTX 1080 Ti](/graphics-cards/gtx-1080-ti/), or can you settle down and sit pretty with a cheap $60 motherboard?

Your motherboard really can make or break your system in some cases, so it's definitely important that you make sure you choose what's best for you based on the system you've got planned.

And since you're investing in such a beefy [GPU](/graphics-cards/) like the 1080 Ti, you need the right motherboard for the job.

If you want the best motherboard for the GTX 1080 Ti, we recommend the [Asus Prime Z370-P II](https://amzn.to/2KvHHRh){: target="_blank"}.

It's by far the all-around best choice for the 1080 Ti.

Our Pick

Asus Prime Z370-P II

Best Motherboard for GTX 1080 Ti

If you're rocking a 1080 Ti and you want the best motherboard to go with it, you can't go wrong with the Prime Z370-P II from ASUS.

Check Price on Amazon

Pros

Future-proof

Upgradeability

2 M.2 slots

Cons

No onboard WiFi

          Form

          ATX

          Chipset

          Z370

          Slots

          4

          SATA

          4

          M.2

          2

          Overclock

          Yes

As usual, the war between Team Red and Team Blue rages on.

AMD has been manipulating the market since its release of Ryzen, but for once it seems like Intel's partners are pulling through, trying to get Intel to the undisputed top, and this motherboard definitely shows it.

The Asus Prime Z370-P may not sport the integrated Wi-Fi or improved power delivery of the Z390, but it sure as hell proves itself as a worthy opponent.

While it does lack in the IO department for a $100USD motherboard, only running 4 USB ports (all at USB 3.1, however), it makes up for it with its PCIE lanes. This motherboard will have no problem supporting [our pick for the best CPU for the 1080 Ti](/graphics-cards/gtx-1080-ti/cpu/) either.

The Z370-P II manages to fit in 2 PCIE x16 Gen 3 lanes and 4 PCIE x1 lanes, so you'll have all the expansion slots you'd ever need. And its 4 SATA III connectors ensure you'll have enough space for your storage as well.

Oh, and did I mention its 2 M.2 slots?

  Read Reviews on Amazon

Runner Up

Gigabyte X570 Gaming X

Best AMD Motherboard for the 1080 Ti

Switching gears now to AMD, we have one of the best, if not the best, X570 motherboard you can buy right now. The Gigabyte X570 Gaming X.

Check Price on Amazon

Pros

Future-proof

Upgradeability

2 M.2 slots

Cons

No onboard WiFi

          Form

          ATX

          Chipset

          X570

          Slots

          4

          SATA

          6

          M.2

          2

          Overclock

          Yes

One of the X570's biggest flaws so far is its price tag. Across the board, X570 boards will cost you a pretty penny – we tried to get the best of both worlds in this pick, but we ain't perfect.

Moving down the board to the PCIE lanes, we can find a not-too-shabby two PCIE x16 Gen 4 lanes and 3 PCIE x1 lanes in tow. Above and below the PCIE lanes you can also find 2 whole M.2 slots.

Moving over by the SATA slots we can find 6 SATA III ports and a very interesting cooling solution beside them. Due to the improvements made on the X570 chipset, its massive heat output requires a little fan to keep it cool. Ain't that neat.

You'll need to make sure you're using a good power supply with this motherboard. We recommend checking out our guide on the [best power supplies for the 1080 Ti](/graphics-cards/gtx-1080-ti/power-supply/) while you're here.

Interestingly, those chipset improvements have allowed for much faster RAM than ever before and the Gaming X can support upwards of 4000MHz RAM, which is just absolutely insane to me.

This board's also got RGB Fusion addressable RGB lighting, so go ham with all that RGB goodness.

  Read Reviews on Amazon

Also Awesome

MSI Z390-A Pro

Best Intel Motherboard for the 1080 Ti

Finally, we'll be wrapping up our picks with a trip back down Intel lane, showing off the MSI Z390-A Pro.

Check Price on Amazon

Pros

Awesome IO

Supports Intel Optane

Native support for 8th & 9th gen Intel CPUs

Cons

No flashy features

          Form

          ATX

          Chipset

          Z390

          Slots

          4

          SATA

          6

          M.2

          2

          Overclock

          Yes

Similarly to our All-around choice, this motherboard supports LGA1151 CPUs, including native support for Intel's newer 8th and 9th Generation processors.

This board's got its ups and downs but it's a solid overclocker and doesn't have any problems in the heat department.

The IO sports an impressive 1 USB 3.1 Gen 2, 2 USB 3.1 Gen 1, and 2 USB 2.0 ports. Alongside these lines the ever desirable USB 3.1 Gen 2 Type C port. Sexy.

Just like our other picks, the Z390-A Pro doesn't lack in the PCIE department with its 2 PCIE x16 Gen 3 and 4 PCIE x1 slots. Just as with AMD's board, above and below the PCIE slots you'll find two M.2 slots.

Heading over to the SATA ports, you'll be getting your money's worth with 6 SATA III ports. Though, we should note that the motherboard's description says that Sata 2 will be disabled when M.2 is in use. And, the board supports [Intel Optane](https://www.laptopmag.com/articles/intel-optane-memory-faq){: target="_blank"}. Badass!

In terms of other features, the Z390-A Pro supports RGB, but doesn't entirely stand out with any other flashy features due to its relatively low price. Though, you can sleep sound knowing that your new board can support 4000MHz RAM and above.

  Read Reviews on Amazon

## 3 Best Motherboards for 1080 Ti Graphics Card

		Motherboard
		Image
		See Price

		Asus Prime Z370-P II

		Check

		Gigabyte X570 Gaming X

		Check

		MSI Z390-A Pro

		Check

## Finding a Motherboard for Your GPU

One simple thing you might not pay much attention to when buying a motherboard is the [PCIE](https://www.tomshardware.com/reviews/pcie-definition,5754.html){: target="_blank"} slots.

Believe it or not, PCIE slots have different generations that operate at different speeds, and we're currently in the middle of a generational shift.

Though you may not have much problem with it when going for a brand new modern board, some older boards might have lower speed lanes that could hinder your performance.

Gen 1 PCIE lanes are so rare that your probability of encountering them is astronomically low, so all you really need to know is that they're slooow.

As for Gen 2, they can be fairly common if you're opting for last-gen hardware that utilizes DDR3 memory. Gen 2 is an okay speed for gaming, but your performance could be impacted when using higher-end cards or running non-gaming workloads.

Gen 3 is what most motherboards use right now, and it's fast enough to handle any modern graphics card to the best of its potential. The large majority of modern motherboards you find will be running Gen 3 (with the exception of AMD's X570s) and you won't run into any problems there.

Gen 4 isn't exactly all that impactful for gaming performance. Not to say it doesn't improve performance, but if you're choosing X570 just for PCIE 4.0's gaming yields, you're not in the right place. Rendering and video editing workloads, however, will benefit marginally more.

## Chipsets

When you're browsing online looking for a motherboard you should keep an eye out for chipsets for sure.

In simple terms, you can think of chipsets like a hub for communication within the motherboard.

The chipset of your motherboard controls all inbound and outbound communication between the motherboard and its components, thus the importance of your chipset to component compatibility can be detrimental.

For example, Intel CPUs with the K or KF designation are Unlocked, or overclock enabled, processors. But there's a bit of a catch.

Say you go ahead and choose one of Intel's H310, B360, or Q370 chipsets, you will not have access to overclocking even with a K series CPU.

Again, on Intel's side, chipsets can get a little confusing because of their first line of LGA1151 processors.

The first couple of chipsets (H110, B150, Q150, H170, Q170, Z170) only support DDR3L memory which can be a bit difficult to find and has its own separate implications that we'd rather not get into.

Point is, it can get a little confusing.

AMD's side is a little bit easier to understand, but still has it's fair share of quirks that should be made known to anyone planning on going that route.

Basically, there's Ryzen 1000, Ryzen 2000, and Ryzen 3000. The newest chipset is X570, which can support all three generations up to 3000 (not counting for Threadripper since that's its own socket). Next down from there is the X470 and B450s which support up to Ryzen 2000 natively, but can also support Ryzen 3000 with a BIOS update. The same rule applies to the X370 and B350 boards.

Similarly, some older Intel chips may need a BIOS update to utilize 8th or 9th Gen Intel processors.

AMD also has their not-so-popular A320 chipset, which tends to be much, much cheaper than the other chipsets with the downside of being unable to support overclocking for any AMD processors.

There's a lot more to delve into with CPUs and motherboard support, but we suggest you just check your motherboard's CPU support before purchasing.


text:
<!DOCTYPE html>

<meta charset="UTF-8" />
<title>用户登录</title>

<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/css/login.css" />

后台登录

		<form action="/login" class="layui-form" method="post">

				
				<input type="text" name="userName" required="" lay-verify="userName" autocomplete="off" placeholder="用户名" class="layui-input" />

				 
				<input type="password" name="password" required="" lay-verify="password" autocomplete="off" placeholder="密码" class="layui-input" />

					记住帐号? <input type="checkbox" name="rememberMe" value="true" lay-submit="" lay-skin="switch" checked="checked" title="记住帐号" />

					<button class="layui-btn layui-btn-primary" lay-submit="" lay-filter="login">
						 登录
					</button>

		</form>

huqi © www.biaocheclub.cn


text:
struct ScientistComparisonAlpha
{
    bool operator() (Scientist i, Scientist j)
    {
        string iName = i.getName();
        string jName = j.getName();
        transform(iName.begin(), iName.end(), iName.begin(), ::tolower);
        transform(jName.begin(), jName.end(), jName.begin(), ::tolower);

        return (iName<jName);
    }
};

struct ScientistComparisonYoung
{
    bool operator() (Scientist i, Scientist j)
    {
        int iAge = i.getDateOfDeath()-i.getDateOfBirth();
        int jAge = j.getDateOfDeath()-j.getDateOfBirth();
        return (iAge<jAge);
    }
};

struct ScientistComparisonOld
{
    bool operator() (Scientist i, Scientist j)
    {
        int iAge = i.getDateOfDeath()-i.getDateOfBirth();
        int jAge = j.getDateOfDeath()-j.getDateOfBirth();
        return (jAge<iAge);
    }
};

ScientistService::ScientistService()
{
    DataBase db;
    db.initTxtFile();
    scientists = data.readingTxt();
}

vector<Scientist> ScientistService::getScientistsAlpha()
{
    ScientistComparisonAlpha cmp;

    sort(scientists.begin(), scientists.end(), cmp);

    return scientists;
}

vector<Scientist> ScientistService::getScientistsYoung()
{
    ScientistComparisonYoung cmpYoung;

    std::sort(scientists.begin(), scientists.end(), cmpYoung);

    return scientists;
}

vector<Scientist> ScientistService::getScientists()
{
    return scientists;
}

vector<Scientist> ScientistService::getScientistsOld()
{
    ScientistComparisonOld cmpOld;

    std::sort(scientists.begin(), scientists.end(), cmpOld);

    return scientists;
}

//Skilar einum scientist inn í vectorinn.
//Skilar einum scientist í database, þar sem hann verður sendur inn í textaskrá.
void ScientistService::create(Scientist scientist)
{
    data.returnInfo(scientist);
    scientists.push_back(scientist);
}

vector<Scientist> ScientistService::searchName(string name)
{
    vector<Scientist> temp;
    string scientist;

    for(size_t i = 0; i < scientists.size(); i++)
    {
        scientist = scientists[i].getName();
        transform(scientist.begin(), scientist.end(), scientist.begin(), ::tolower);
        transform(name.begin(), name.end(), name.begin(), ::tolower);
        if(scientist.find(name) !=string::npos)
        {
            temp.push_back(scientists[i]);
        }
    }
    return temp;
}

vector<Scientist> ScientistService::searchGender(char gender)
{
    vector<Scientist> temp2;

    if(gender == 'F'||gender == 'f')
    {
        for(size_t i = 0; i < scientists.size();i++)
        {
            if(scientists[i].getGender()== "Female")
            {
                temp2.push_back(scientists[i]);
            }
        }
    }
    else if(gender == 'M'||gender == 'm')
    {
        for(size_t i = 0; i < scientists.size();i++)
        {
            if(scientists[i].getGender()=="Male")
            {
                temp2.push_back(scientists[i]);
            }
        }
    }
    return temp2;
}

vector<Scientist> ScientistService::searchDateOfBirth(int birthYear)
{
    vector<Scientist> temp1;

    for(size_t i = 0; i < scientists.size(); i++)
    {
        if(scientists[i].getDateOfBirth() == birthYear)
        {
            temp1.push_back(scientists[i]);
        }
    }
    return temp1;
}

vector<Scientist> ScientistService::searchRandom()
{
    vector<Scientist> temp3;
    srand(time(0));
                   // Virkni sem býr til slembitölur með hjálp time.
                   // Ástæðan fyrir að nota %(scientist.size() - 1) er til að ná í allt "range-ið" úr vektornum.
    temp3.push_back(scientists[1+(rand()%(scientists.size() - 1))]);

    return temp3;
}

vector<Scientist> ScientistService::searchDateOfDeath(int deathYear)
{
    vector<Scientist> temp4;

    for(size_t i = 0; i < scientists.size(); i++)
    {
        if(scientists[i].getDateOfDeath() == deathYear)
        {
            temp4.push_back(scientists[i]);
        }
    }
    return temp4;
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Drawing.Internal
{
    using System.Diagnostics;
    using System.Runtime.InteropServices;

    internal partial class IntNativeMethods
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
        public const int MaxTextLengthInWin9x = 8192;

        public const int
        DT_TOP = 0x00000000,
        DT_LEFT = 0x00000000,
        DT_CENTER = 0x00000001,
        DT_RIGHT = 0x00000002,
        DT_VCENTER = 0x00000004,
        DT_BOTTOM = 0x00000008,
        DT_WORDBREAK = 0x00000010,
        DT_SINGLELINE = 0x00000020,
        DT_EXPANDTABS = 0x00000040,
        DT_TABSTOP = 0x00000080,
        DT_NOCLIP = 0x00000100,
        DT_EXTERNALLEADING = 0x00000200,
        DT_CALCRECT = 0x00000400,
        DT_NOPREFIX = 0x00000800,
        DT_INTERNAL = 0x00001000,
        DT_EDITCONTROL = 0x00002000,
        DT_PATH_ELLIPSIS = 0x00004000,
        DT_END_ELLIPSIS = 0x00008000,
        DT_MODIFYSTRING = 0x00010000,
        DT_RTLREADING = 0x00020000,
        DT_WORD_ELLIPSIS = 0x00040000,
        DT_NOFULLWIDTHCHARBREAK = 0x00080000,
        DT_HIDEPREFIX = 0x00100000,
        DT_PREFIXONLY = 0x00200000,

        DIB_RGB_COLORS = 0,
        BI_BITFIELDS = 3,
        BI_RGB = 0,
        BITMAPINFO_MAX_COLORSIZE = 256,
        SPI_GETICONTITLELOGFONT = 0x001F,
        SPI_GETNONCLIENTMETRICS = 41,
        DEFAULT_GUI_FONT = 17,
        HOLLOW_BRUSH = 5,

        BITSPIXEL = 12,
        ALTERNATE = 1,
        WINDING = 2,

        SRCCOPY = 0x00CC0020,
        SRCPAINT = 0x00EE0086, /* dest = source OR dest           */
        SRCAND = 0x008800C6, /* dest = source AND dest          */
        SRCINVERT = 0x00660046, /* dest = source XOR dest          */
        SRCERASE = 0x00440328, /* dest = source AND (NOT dest )   */
        NOTSRCCOPY = 0x00330008, /* dest = (NOT source)             */
        NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
        MERGECOPY = 0x00C000CA, /* dest = (source AND pattern)     */
        MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest     */
        PATCOPY = 0x00F00021, /* dest = pattern                  */
        PATPAINT = 0x00FB0A09, /* dest = DPSnoo                   */
        PATINVERT = 0x005A0049, /* dest = pattern XOR dest         */
        DSTINVERT = 0x00550009, /* dest = (NOT dest)               */
        BLACKNESS = 0x00000042, /* dest = BLACK                    */
        WHITENESS = 0x00FF0062, /* dest = WHITE                    */
        CAPTUREBLT = 0x40000000, /* Include layered windows */

        /* FONT WEIGHT (BOLD) VALUES */
        FW_DONTCARE = 0,
        FW_NORMAL = 400,
        FW_BOLD = 700,
        // some others...

        /* FONT CHARACTER SET */
        ANSI_CHARSET = 0,
        DEFAULT_CHARSET = 1,
        // plus others ....

        /* Font OutPrecision */
        OUT_DEFAULT_PRECIS = 0,
        OUT_TT_PRECIS = 4,
        OUT_TT_ONLY_PRECIS = 7,
        // some others...

        /* Font clip precision */
        CLIP_DEFAULT_PRECIS = 0,
        // some others...

        /* Font Quality */
        DEFAULT_QUALITY = 0,
        DRAFT_QUALITY = 1,
        PROOF_QUALITY = 2,
        NONANTIALIASED_QUALITY = 3,
        ANTIALIASED_QUALITY = 4,
        CLEARTYPE_QUALITY = 5,
        CLEARTYPE_NATURAL_QUALITY = 6,

        /* Object Definitions for GetCurrentObject() and others. */
        OBJ_PEN = 1,
        OBJ_BRUSH = 2,
        OBJ_DC = 3,
        OBJ_METADC = 4,
        //      OBJ_PAL       = 5,
        OBJ_FONT = 6,
        OBJ_BITMAP = 7,
        //      OBJ_REGION    = 8,
        //      OBJ_METAFILE  = 9,
        OBJ_MEMDC = 10,
        OBJ_EXTPEN = 11,
        OBJ_ENHMETADC = 12,
        //      OBJ_ENHMETAFILE = 13,
        //      OBJ_COLORSPACE = 14

        // Brush styles
        BS_SOLID = 0,
        BS_HATCHED = 2,
        // BS_PATTERN = 3,
        // some others...

        // Code page
        CP_ACP = 0, // ANSI

        FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
        FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
        FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
        FORMAT_MESSAGE_DEFAULT = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM;
        // some others...

        public enum RegionFlags
        {
            ERROR = 0,
            NULLREGION = 1,
            SIMPLEREGION = 2,
            COMPLEXREGION = 3,
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct RECT
        {
            public int left;
            public int top;
            public int right;
            public int bottom;

            public RECT(int left, int top, int right, int bottom)
            {
                this.left = left;
                this.top = top;
                this.right = right;
                this.bottom = bottom;
            }

            public RECT(System.Drawing.Rectangle r)
            {
                left = r.Left;
                top = r.Top;
                right = r.Right;
                bottom = r.Bottom;
            }

            public static RECT FromXYWH(int x, int y, int width, int height)
            {
                return new RECT(
                    x,
                    y,
                    x + width,
                    y + height);
            }

            public Size Size
            {
                get
                {
                    return new Size(right - left, bottom - top);
                }
            }

            public System.Drawing.Rectangle ToRectangle()
            {
                return new Rectangle(
                    left,
                    top,
                    right - left,
                    bottom - top);
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        public class POINT
        {
            public int x;
            public int y;

            public POINT()
            {
            }

            public POINT(int x, int y)
            {
                this.x = x;
                this.y = y;
            }

            public System.Drawing.Point ToPoint()
            {
                return new System.Drawing.Point(x, y);
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        public class DRAWTEXTPARAMS
        {
            private int _cbSize = Marshal.SizeOf(typeof(DRAWTEXTPARAMS));
            public int iTabLength;
            public int iLeftMargin;
            public int iRightMargin;

            /// <devdoc>
            ///     Receives the number of characters processed by DrawTextEx, including white-space characters.
            ///     The number can be the length of the string or the index of the first line that falls below the drawing area.
            ///     Note that DrawTextEx always processes the entire string if the DT_NOCLIP formatting flag is specified.
            /// </devdoc>
            public int uiLengthDrawn;

            public DRAWTEXTPARAMS()
            {
            }
            public DRAWTEXTPARAMS(DRAWTEXTPARAMS original)
            {
                iLeftMargin = original.iLeftMargin;
                iRightMargin = original.iRightMargin;
                iTabLength = original.iTabLength;
            }

            public DRAWTEXTPARAMS(int leftMargin, int rightMargin)
            {
                iLeftMargin = leftMargin;
                iRightMargin = rightMargin;
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        public class LOGBRUSH
        {
            public int lbStyle;
            public int lbColor;
            public int lbHatch;
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        public class LOGFONT
        {
            public int lfHeight;
            public int lfWidth;
            public int lfEscapement;
            public int lfOrientation;
            public int lfWeight;
            public byte lfItalic;
            public byte lfUnderline;
            public byte lfStrikeOut;
            public byte lfCharSet;
            public byte lfOutPrecision;
            public byte lfClipPrecision;
            public byte lfQuality;
            public byte lfPitchAndFamily;
            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
            public string lfFaceName;

            public LOGFONT()
            {
            }

            public LOGFONT(LOGFONT lf)
            {
                Debug.Assert(lf != null, "lf is null");

                lfHeight = lf.lfHeight;
                lfWidth = lf.lfWidth;
                lfEscapement = lf.lfEscapement;
                lfOrientation = lf.lfOrientation;
                lfWeight = lf.lfWeight;
                lfItalic = lf.lfItalic;
                lfUnderline = lf.lfUnderline;
                lfStrikeOut = lf.lfStrikeOut;
                lfCharSet = lf.lfCharSet;
                lfOutPrecision = lf.lfOutPrecision;
                lfClipPrecision = lf.lfClipPrecision;
                lfQuality = lf.lfQuality;
                lfPitchAndFamily = lf.lfPitchAndFamily;
                lfFaceName = lf.lfFaceName;
            }
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct TEXTMETRIC
        {
            public int tmHeight;
            public int tmAscent;
            public int tmDescent;
            public int tmInternalLeading;
            public int tmExternalLeading;
            public int tmAveCharWidth;
            public int tmMaxCharWidth;
            public int tmWeight;
            public int tmOverhang;
            public int tmDigitizedAspectX;
            public int tmDigitizedAspectY;
            public char tmFirstChar;
            public char tmLastChar;
            public char tmDefaultChar;
            public char tmBreakChar;
            public byte tmItalic;
            public byte tmUnderlined;
            public byte tmStruckOut;
            public byte tmPitchAndFamily;
            public byte tmCharSet;
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
        public struct TEXTMETRICA
        {
            public int tmHeight;
            public int tmAscent;
            public int tmDescent;
            public int tmInternalLeading;
            public int tmExternalLeading;
            public int tmAveCharWidth;
            public int tmMaxCharWidth;
            public int tmWeight;
            public int tmOverhang;
            public int tmDigitizedAspectX;
            public int tmDigitizedAspectY;
            public byte tmFirstChar;
            public byte tmLastChar;
            public byte tmDefaultChar;
            public byte tmBreakChar;
            public byte tmItalic;
            public byte tmUnderlined;
            public byte tmStruckOut;
            public byte tmPitchAndFamily;
            public byte tmCharSet;
        }

        [StructLayout(LayoutKind.Sequential)]
        public class SIZE
        {
            public int cx;
            public int cy;

            public SIZE()
            {
            }

            public SIZE(int cx, int cy)
            {
                this.cx = cx;
                this.cy = cy;
            }

            public System.Drawing.Size ToSize()
            {
                return new System.Drawing.Size(cx, cy);
            }
        }
    }
}


text:
package org.jetbrains.plugins.scala.actions

//import java.{util => ju}
//import com.intellij.codeInsight.documentation.DocumentationComponent
//import com.intellij.lang.ExpressionTypeProvider
//import com.intellij.openapi.util.text.StringUtil
//import com.intellij.ui.ColorUtil
//import org.jetbrains.plugins.scala.ScalaBundle
//import org.jetbrains.plugins.scala.lang.psi.api.base.patterns.{ScBindingPattern, ScCaseClause}
//import org.jetbrains.plugins.scala.lang.psi.api.expr.{ScArgumentExprList, ScBlock, ScExpression}
//import org.jetbrains.plugins.scala.lang.psi.api.statements.{ScFunctionDefinition, ScMacroDefinition, ScValueOrVariable}
//import org.jetbrains.plugins.scala.lang.psi.api.toplevel.templates.ScTemplateBody
//import scala.jdk.CollectionConverters._

//NOTE: ScalaExpressionTypeProvider is commented in scala-plugin-common.xml so not effectively used
// do not remove it for some time beaing
//class ScalaExpressionTypeProvider extends ExpressionTypeProvider[PsiElement] {
//
//  import ScalaExpressionTypeProvider._
//
//  override def getErrorHint: String = ScalaBundle.message("no.expression.found")
//
//  override def getExpressionsAt(elementAt: PsiElement): ju.List[PsiElement] = {
//    @scala.annotation.tailrec
//    def collectCandidates(parents: Iterator[PsiElement], acc: List[PsiElement] = Nil): List[PsiElement] = {
//      if (parents.hasNext) {
//        val current = parents.next()
//        current match {
//          case (block: ScBlock) childOf (_: ScArgumentExprList | _: ScCaseClause) =>
//            if (block.statements.size == 1) collectCandidates(parents, acc)
//            else                            collectCandidates(parents, current :: acc)
//          case _: ScFunctionDefinition | _: ScMacroDefinition                        => current :: acc
//          case _: ScTemplateBody | _: ScBlock | _: ScValueOrVariable                 => acc
//          case _: ScExpression | _: ScBindingPattern                                 => collectCandidates(parents,  current :: acc)
//          case _                                                                     => collectCandidates(parents, acc)
//        }
//      } else acc
//    }
//
//    collectCandidates(elementAt.withParentsInFile).reverse.asJava
//  }
//
//  override def getInformationHint(element: PsiElement): String =
//    extractType(element).fold(unknownType) { (t: ScType) =>
//      val original  = ScalaBundle.message("type.hint.table.title.type")      -> t
//      val dealiased = ScalaBundle.message("type.hint.table.title.dealiased") -> t.removeAliasDefinitions()
//      val widened   = ScalaBundle.message("type.hint.table.title.widened")   -> t.tryExtractDesignatorSingleton
//
//      val (expected, withoutImplicits) = element match {
//        case expr: ScExpression =>
//          val expected         = expr.expectedType().map(ScalaBundle.message("type.hint.table.title.expected") -> _)
//          val withoutImplicits = expr.getTypeWithoutImplicits().toOption.map(ScalaBundle.message("type.hint.table.title.without.implicits") -> _)
//          (expected, withoutImplicits)
//        case _                  => (None, None)
//      }
//
//      val infos = (Seq(original, dealiased, widened) ++ expected ++ withoutImplicits)
//        .map { case (title, tpe) => title -> tpe.presentableText(element) }
//        .distinctBy(_._2)
//
//      infos
//        .map { case (title, tpeText) => makeAdvancedInformationTableRow(title, tpeText) }
//        .mkString("
", "\n", "
")
//    }
//}

object ScalaExpressionTypeProvider {
//  private def unknownType = ScalaBundle.message("unknown.type")
  import com.intellij.psi.PsiElement
  import org.jetbrains.plugins.scala.extensions._
  import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
  import org.jetbrains.plugins.scala.lang.psi.types.ScType
  import org.jetbrains.plugins.scala.lang.psi.types.result.Typeable

  private def extractType: PsiElement => Option[ScType] = {
    case element @ ResolvedWithSubst(target, subst) =>
      target.ofNamedElement(subst, scalaScope = Some(element.elementScope))
    case Typeable(tpe)              => Option(tpe)
    case _                          => None
  }

//  private def makeAdvancedInformationTableRow(
//    title:   String,
//    tpeText: String
//  ): String = {
//    @nowarn("cat=deprecation")
//    val colorFinal = ColorUtil.toHtmlColor(DocumentationComponent.SECTION_COLOR)
//    val titleFinal = StringUtil.escapeXmlEntities(title)
//    val titleCell = s"$titleFinal:	"
//    val contentCell = s"${StringUtil.escapeXmlEntities(tpeText)}	"
//    s"
$titleCell$contentCell
"
//  }

  def getTypeInfoHint(e: PsiElement): Option[String] =
    if (e.getNode.getElementType == ScalaTokenTypes.tIDENTIFIER)
      e.parent.flatMap(extractType).map(_.presentableText(e))
    else None
}


text:
package com.the151suggestions.part3.s39;

import java.util.ArrayList;
import java.util.List;

/**
 * 建议39:使用匿名类的构造函数
 *  匿名类虽然没有名字,但也有构造方法(构造代码块).
 * Created by ankang on 2017-08-04.
 */
public class S39 {
    /**
     * List<Integer> list2 = new ArrayList<Integer>(){}; 等价于
     *  class Sub extends ArrayList<Integer>{}
     *  List list2 = new Sub();
     * List<Integer> list3 = new ArrayList<Integer>(){{}};  等价于
     *  class Sub extends ArrayList<Integer>{
     *      {}
     *  }
     *  List list3 = new Sub();
     * List<Integer> list4 = new ArrayList<Integer>(){{}{}{}{}}; 等价于
     *  class Sub extends ArrayList<Integer>{
     *      {}
     *      {}
     *      {}
     *      {}
     *  }
     *  List list4 = new Sub();
     * @param args
     */
    public static void main(String[] args) {
        List<Integer> list1 = new ArrayList<Integer>();
        List<Integer> list2 = new ArrayList<Integer>(){};
        List<Integer> list3 = new ArrayList<Integer>(){{}};
        List<Integer> list4 = new ArrayList<Integer>(){{}{}{}{}};
        System.out.println(list1.getClass());   //class java.util.ArrayList
        System.out.println(list2.getClass());   //class com.the151suggestions.part3.s39.S39$1
        System.out.println(list3.getClass());   //class com.the151suggestions.part3.s39.S39$2
        System.out.println(list4.getClass());   //class com.the151suggestions.part3.s39.S39$3
    }
}


text:
Write-Host "Stopping Docker"
Stop-Service docker

Write-Host "Removing key.json to recreate key.json on first vagrant up"
rm C:\ProgramData\docker\config\key.json


text:
'use strict';
module.exports = (function () {
	if (process.argv.indexOf('--no-color') !== -1) {
		return false;
	}

	if (process.argv.indexOf('--color') !== -1) {
		return true;
	}

	if (!process.stdout.isTTY) {
		return false;
	}

	if (process.platform === 'win32') {
		return true;
	}

	if ('COLORTERM' in process.env) {
		return true;
	}

	return /^screen|^xterm|color|ansi|cygwin|linux/i.test(process.env.TERM);
})();


text:
@class EKAdjustTableViewCell;
@interface EKAdjustCellElement : EKCellElement
{
    double _cellHeight;
}
@property (nonatomic, assign) double cellHeight;
@property  (nonatomic, strong, readonly, getter=uiEventPool) EKAdjustTableViewCell * activeCell;
- (void) layoutCell:(EKAdjustTableViewCell*)cell;
@end


text:
using System;
using System.Data;

using SSW.DataOnion.Interfaces;

namespace SSW.DataOnion.Core
{
    public class DbContextScopeFactory : IDbContextScopeFactory
    {
        private readonly IDbContextFactory _dbContextFactory;

        public DbContextScopeFactory(IDbContextFactory dbContextFactory = null)
        {
            this._dbContextFactory = dbContextFactory;
        }

        public IDbContextScope Create(DbContextScopeOption joiningOption = DbContextScopeOption.JoinExisting)
        {
            return new DbContextScope(
                joiningOption: joiningOption,
                readOnly: false,
                isolationLevel: null,
                dbContextFactory: this._dbContextFactory);
        }

        public IDbContextReadOnlyScope CreateReadOnly(DbContextScopeOption joiningOption = DbContextScopeOption.JoinExisting)
        {
            return new DbContextReadOnlyScope(
                joiningOption: joiningOption,
                isolationLevel: null,
                dbContextFactory: this._dbContextFactory);
        }

        public IDbContextScope CreateWithTransaction(IsolationLevel isolationLevel)
        {
            return new DbContextScope(
                joiningOption: DbContextScopeOption.ForceCreateNew,
                readOnly: false,
                isolationLevel: isolationLevel,
                dbContextFactory: this._dbContextFactory);
        }

        public IDbContextReadOnlyScope CreateReadOnlyWithTransaction(IsolationLevel isolationLevel)
        {
            return new DbContextReadOnlyScope(
                joiningOption: DbContextScopeOption.ForceCreateNew,
                isolationLevel: isolationLevel,
                dbContextFactory: this._dbContextFactory);
        }

        public IDisposable SuppressAmbientContext()
        {
            return new AmbientContextSuppressor();
        }
    }
}


text:
#ifndef ANDROID_SF_FRAMEBUFFER_SURFACE_H
#define ANDROID_SF_FRAMEBUFFER_SURFACE_H

#include <stdint.h>
#include <sys/types.h>

#include <gui/ConsumerBase.h>

#include "DisplaySurface.h"

// ---------------------------------------------------------------------------
namespace android {
// ---------------------------------------------------------------------------

class Rect;
class String8;
class HWComposer;

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

class FramebufferSurface : public ConsumerBase,
                           public DisplaySurface {
public:
    FramebufferSurface(HWComposer& hwc, int disp, const sp<IGraphicBufferConsumer>& consumer);

    virtual status_t beginFrame();
    virtual status_t prepareFrame(CompositionType compositionType);
    virtual status_t compositionComplete();
    virtual status_t advanceFrame();
    virtual void onFrameCommitted();

    // Implementation of DisplaySurface::dump(). Note that ConsumerBase also
    // has a non-virtual dump() with the same signature.
    virtual void dump(String8& result) const;

private:
    virtual ~FramebufferSurface() { }; // this class cannot be overloaded

    virtual void onFrameAvailable();
    virtual void freeBufferLocked(int slotIndex);

    virtual void dumpLocked(String8& result, const char* prefix) const;

    // nextBuffer waits for and then latches the next buffer from the
    // BufferQueue and releases the previously latched buffer to the
    // BufferQueue.  The new buffer is returned in the 'buffer' argument.
    status_t nextBuffer(sp<GraphicBuffer>& outBuffer, sp<Fence>& outFence);

    // mDisplayType must match one of the HWC display types
    int mDisplayType;

    // mCurrentBufferIndex is the slot index of the current buffer or
    // INVALID_BUFFER_SLOT to indicate that either there is no current buffer
    // or the buffer is not associated with a slot.
    int mCurrentBufferSlot;

    // mCurrentBuffer is the current buffer or NULL to indicate that there is
    // no current buffer.
    sp<GraphicBuffer> mCurrentBuffer;

    // Hardware composer, owned by SurfaceFlinger.
    HWComposer& mHwc;
};

// ---------------------------------------------------------------------------
}; // namespace android
// ---------------------------------------------------------------------------

#endif // ANDROID_SF_FRAMEBUFFER_SURFACE_H


text:
/**
 * @file Holds all RoboPaint template mode code.
 *   @see the mode readme for all the goodies that modes come with. Also,
 *      any robopaint dependencies you add to the package JSON will be available
 *      as well, like jQuery $ and underscore _.
 */
"use strict";

var actualPen = {}; // Hold onto the latest actualPen object from updates.
var buffer = {};
var canvas = rpRequire('canvas');
var t = i18n.t; // The mother of all shortcuts

mode.pageInitReady = function () {
  // Initialize the paper.js canvas with wrapper margin and other settings.
  canvas.domInit({
    replace: '#paper-placeholder', // jQuery selecter of element to replace
    paperScriptFile: 'template.ps.js', // The main PaperScript file to load
    wrapperMargin: {
      top: 30,
      left: 30,
      right: 265,
      bottom: 40
    },

    // Called when PaperScript init is complete, requires
    // canvas.paperInit(paper) to be called in this modes paperscript file.
    // Don't forget that!
    loadedCallback: paperLoadedInit
  });
}

// Callback that tells us that our Paper.js canvas is ready!
function paperLoadedInit() {
  console.log('Paper ready!');

  $(window).resize();

  // Uncomment to use mode settings management on all "managed" class items.
  // This saves/loads settings from/into the elements on change/init.
  // mode.settings.$manage('.managed');

  // With Paper ready, send a single up to fill values for buffer & pen.
  mode.run('up');
}

// Catch CNCServer buffered callbacks
mode.onCallbackEvent = function(name) {
  switch (name) {
    case 'autoPaintBegin': // Should happen when we've just started
      $('#pause').prop('disabled', false); // Enable pause button
      break;
    case 'autoPaintComplete': // Should happen when we're completely done
      $('#pause').attr('class', 'ready')
        .text(robopaint.t('common.action.start'))
        .prop('disabled', false);
      $('#buttons button.normal').prop('disabled', false); // Enable options
      $('#cancel').prop('disabled', true); // Disable the cancel print button
      break;
  }
};

// Bind all controls (happens before pageInitReady, @see mode.preload.js)
mode.bindControls = function() {
  // Cancel Print
  $('#cancel').click(function() {
    var cancelPrint = confirm(t("common.action.cancelconfirm"));
    if (cancelPrint) {
      mode.onCallbackEvent('autoPaintComplete');
      mode.fullCancel(mode.t('status.cancelled'));
    }
  });

  // Bind pause click and functionality
  $('#pause').click(function() {
    // With nothing in the queue, start autopaint!
    if (buffer.length === 0) {
      $('#pause')
        .removeClass('ready')
        .attr('title', t("modes.print.status.pause"))
        .text(t('common.action.pause'))
        .prop('disabled', true);
      $('#buttons button.normal').prop('disabled', true); // Disable options
      $('#cancel').prop('disabled', false); // Enable the cancel print button

      // TODO: Send commands to Print
      // This is done with mode.run()

    } else {
      // With something in the queue... we're either pausing, or resuming
      if (!buffer.paused) {
        // Starting Pause =========
        $('#pause').prop('disabled', true).attr('title', t("status.wait"));
        mode.run([
          ['status', t("status.pausing")],
          ['pause']
        ], true); // Insert at the start of the buffer so it happens immediately

        mode.onFullyPaused = function(){
          mode.run('status', t("status.paused"));
          $('#buttons button.normal').prop('disabled', false); // Enable options
          $('#pause')
            .addClass('active')
            .attr('title', t("status.resume"))
            .prop('disabled', false)
            .text(t("common.action.resume"));
        };
      } else {
        // Resuming ===============
        $('#buttons button.normal').prop('disabled', true); // Disable options
        mode.run([
          ['status', t("status.resuming")],
          ['resume']
        ], true); // Insert at the start of the buffer so it happens immediately

        mode.onFullyResumed = function(){
          $('#pause')
            .removeClass('active')
            .attr('title', t("mode.print.status.pause"))
            .text(t('common.action.pause'));
          mode.run('status', t("status.resumed"));
        };
      }
    }
  });

  // Bind to control buttons
  $('#park').click(function(){
    // If we're paused, skip the buffer
    mode.run([
      ['status', t("status.parking"), buffer.paused],
      ['park', buffer.paused], // TODO: If paused, only one message will show :/
      ['status', t("status.parked"), buffer.paused]
    ]);
  });

  $('#pen').click(function(){
    // Run height pos into the buffer, or skip buffer if paused
    var newState = 'up';
    if (actualPen.state === "up" || actualPen.state === 0) {
      newState = 'down';
    }

    mode.run(newState, buffer.paused);
  });

  // Motor unlock: Also lifts pen and zeros out.
  $('#disable').click(function(){
    mode.run([
      ['status', t("status.unlocking")],
      ['up'],
      ['zero'],
      ['unlock'],
      ['status', t("status.unlocked")]
    ]);
  });
}

// Warn the user on close about cancelling jobs.
mode.onClose = function(callback) {
  if (buffer.length) {
    var r = confirm(i18n.t('common.dialog.confirmexit'));
    if (r == true) {
      // As this is a forceful cancel, shove to the front of the queue
      mode.run(['clear', 'park', 'clearlocal'], true);
      callback(); // The user chose to close.
    }
  } else {
    callback(); // Close, as we have nothing the user is waiting on.
  }
}

// Actual pen update event
mode.onPenUpdate = function(botPen){
  // Update the pen position on the paper.js canvas
  paper.canvas.drawPoint.move(botPen.absCoord, botPen.lastDuration);
  actualPen = $.extend({}, botPen);

  // Update button text/state
  // TODO: change implement type <brush> based on actual implement selected!
  var key = 'common.action.brush.raise';
  if (actualPen.state === "up" || actualPen.state === 0){
    key = 'common.action.brush.lower';
  }
  $('#pen').text(t(key));
}

// An abbreviated buffer update event, contains paused/not paused & length.
mode.onBufferUpdate = function(b) {
  buffer = b;
}


text:
<?php

namespace MemCachier;

/**
 * Pure PHP Memcached client. We aim to be largely compatible with the PHP
 * memcached class, so that dictates the interface we provide.
 */
class MemcacheSASL
{
    protected $_request_format = 'CCnCCnNNNN';
    protected $_response_format = 'Cmagic/Copcode/nkeylength/Cextralength/Cdatatype/nstatus/Nbodylength/NOpaque/NCAS1/NCAS2';

    /* Enalbe or disable compression of values */
    const OPT_COMPRESSION = -1001;

    /**
     * Timeout units are a odd mixture, but we keep them this way for
     * php-memcached comptability.
     */

    /* Timeout for establishing connection (seconds) */
    const OPT_CONNECT_TIMEOUT = -1002;

    /* Timeout for sending side (microseconds) */
    const OPT_SEND_TIMEOUT = -1003;

    /* Timeout for receiving side (microseconds) */
    const OPT_RECV_TIMEOUT = -1004;

    const RES_TIMEOUT = 31;

    const MEMC_VAL_TYPE_MASK = 0xf;
    const MEMC_VAL_IS_STRING = 0;
    const MEMC_VAL_IS_LONG = 1;
    const MEMC_VAL_IS_DOUBLE = 2;
    const MEMC_VAL_IS_BOOL = 3;
    const MEMC_VAL_IS_SERIALIZED = 4;

    const MEMC_VAL_COMPRESSED = 16; // 2^4

    protected $_timeout_connect = 3;
    protected $_timeout_send = 2000000;
    protected $_timeout_recv = 2000000;

    protected function _build_request($data)
    {
        $valuelength = $extralength = $keylength = 0;
        if (array_key_exists('extra', $data)) {
            $extralength = strlen($data['extra']);
        }
        if (array_key_exists('key', $data)) {
            $keylength = strlen($data['key']);
        }
        if (array_key_exists('value', $data)) {
            $valuelength = strlen($data['value']);
        }
        $bodylength = $extralength + $keylength + $valuelength;
        $ret = pack($this->_request_format,
                0x80,
                $data['opcode'],
                $keylength,
                $extralength,
                array_key_exists('datatype', $data) ? $data['datatype'] : null,
                array_key_exists('status', $data) ? $data['status'] : null,
                $bodylength,
                array_key_exists('Opaque', $data) ? $data['Opaque'] : null,
                array_key_exists('CAS1', $data) ? $data['CAS1'] : null,
                array_key_exists('CAS2', $data) ? $data['CAS2'] : null
            );

        if (array_key_exists('extra', $data)) {
            $ret .= $data['extra'];
        }

        if (array_key_exists('key', $data)) {
            $ret .= $data['key'];
        }

        if (array_key_exists('value', $data)) {
            $ret .= $data['value'];
        }
        return $ret;
    }

    protected function _show_request($data)
    {
        $array = unpack($this->_response_format, $data);
        return $array;
    }

    protected function _send($data)
    {
        $send_data = $this->_build_request($data);
        stream_set_timeout($this->_fp, 0, $this->_timeout_send);
        fwrite($this->_fp, $send_data);
        $info = stream_get_meta_data($this->_fp);
        if ($info['timed_out']) {
          return FALSE;
        }
        return $info;
    }

    protected function _recv()
    {
        stream_set_timeout($this->_fp, 0, $this->_timeout_recv);
        $data = fread($this->_fp, 24);
        $info = stream_get_meta_data($this->_fp);
        if ($info['timed_out']) {
          return FALSE;
        }

        $array = $this->_show_request($data);
        if ($array['bodylength']) {
            $bodylength = $array['bodylength'];
            $data = '';
            while ($bodylength > 0) {
                $recv_data = fread($this->_fp, $bodylength);
                $bodylength -= strlen($recv_data);
                $data .= $recv_data;
            }

            if ($array['extralength']) {
                $extra_unpacked = unpack('Nint', substr($data, 0, $array['extralength']));
                $array['extra'] = $extra_unpacked['int'];
            }
            $array['key'] = substr($data, $array['extralength'], $array['keylength']);
            $array['body'] = substr($data, $array['extralength'] + $array['keylength']);
        }
        return $array;
    }

    public function __construct()
    {
    }

    public function listMechanisms()
    {
        $ok = $this->_send(array('opcode' => 0x20));
        if (!$ok) {
          throw new \Exception('Connection timed out (write)');
        }

        $data = $this->_recv();
        if (!$data) {
          throw new \Exception('Connection timed out (read)');
        }
        return explode(" ", $data['body']);
    }

    public function setSaslAuthData($user, $password)
    {
        $ok = $this->_send(array(
                    'opcode' => 0x21,
                    'key' => 'PLAIN',
                    'value' => '' . chr(0) . $user . chr(0) . $password
                    ));
        if (!$ok) {
          throw new \Exception('Connection timed out (write)');
        }

        $data = $this->_recv();
        if (!$data) {
          throw new \Exception('Connection timed out (read)');
        }

        if ($data['status']) {
            throw new \Exception($data['body'], $data['status']);
        }
    }

    public function addServer($host, $port, $weight = 0)
    {
      $server = stream_socket_client($host . ':' . $port, $this->_timeout_connect);
      if ($server) {
        $this->_fp = $server;
        return TRUE;
      } else {
        return FALSE;
      }
    }

    public function addServers($servers)
    {
      for ($i = 0; $i < count($servers); $i++) {
        $s = $servers[$i];
        if (count($s) >= 2) {
          $this->addServer($s[0], $s[1]);
        } else {
          trigger_error("could not add entry #"
            .($i+1)." to the server list", E_USER_WARNING);
        }
      }
    }

    public function addServersByString($servers)
    {
        $servers = explode(",", $servers);
        for ($i = 0; $i < count($servers); $i++) {
            $servers[$i] = explode(":", $servers[$i]);
        }
        $this->addServers($servers);
    }

    public function get($key)
    {
        $ok = $this->_send(array(
                    'opcode' => 0x00,
                    'key' => $key,
                    ));
        if (!$ok) {
          return FALSE;
        }

        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }

        if (0 == $data['status']) {
            if ($data['extra'] & self::MEMC_VAL_COMPRESSED) {
                $body = gzuncompress($data['body']);
            } else {
                $body = $data['body'];
            }

            $type = $data['extra'] & self::MEMC_VAL_TYPE_MASK;

            switch ($type) {
            case self::MEMC_VAL_IS_STRING:
                $body = strval($body);
                break;

            case self::MEMC_VAL_IS_LONG:
                $body = intval($body);
                break;

            case self::MEMC_VAL_IS_DOUBLE:
                $body = doubleval($body);
                break;

            case self::MEMC_VAL_IS_BOOL:
                $body = $body ? TRUE : FALSE;
                break;

            case self::MEMC_VAL_IS_SERIALIZED:
                $body = unserialize($body);
                break;
            }

            return $body;
        }
        return FALSE;
    }

    /**
     * process value and get flag
     *
     * @param int $flag
     * @param mixed $value
     * @access protected
     * @return array($flag, $processed_value)
     */
    protected function _processValue($flag, $value)
    {
        if (is_string($value)) {
            $flag |= self::MEMC_VAL_IS_STRING;
        } elseif (is_long($value)) {
            $flag |= self::MEMC_VAL_IS_LONG;
        } elseif (is_double($value)) {
            $flag |= self::MEMC_VAL_IS_DOUBLE;
        } elseif (is_bool($value)) {
            $flag |= self::MEMC_VAL_IS_BOOL;
        } else {
            $value = serialize($value);
            $flag |= self::MEMC_VAL_IS_SERIALIZED;
        }

        if (array_key_exists(self::OPT_COMPRESSION, $this->_options) and $this->_options[self::OPT_COMPRESSION]) {
            $flag |= self::MEMC_VAL_COMPRESSED;
            $value = gzcompress($value);
        }
        return array($flag, $value);
    }

    public function add($key, $value, $expiration = 0)
    {
        list($flag, $value) = $this->_processValue(0, $value);

        $extra = pack('NN', $flag, $expiration);
        $ok = $this->_send(array(
                    'opcode' => 0x02,
                    'key' => $key,
                    'value' => $value,
                    'extra' => $extra,
                    ));
        if (!$ok) {
          return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }
        if ($data['status'] == 0) {
            return TRUE;
        }

        return FALSE;
    }

    public function set($key, $value, $expiration = 0)
    {
        list($flag, $value) = $this->_processValue(0, $value);

        $extra = pack('NN', $flag, $expiration);
        $ok = $this->_send(array(
                    'opcode' => 0x01,
                    'key' => $key,
                    'value' => $value,
                    'extra' => $extra,
                    ));
        if (!$ok) {
          return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }
        if ($data['status'] == 0) {
            return TRUE;
        }

        return FALSE;
    }

    public function delete($key)
    {
        $ok = $this->_send(array(
                    'opcode' => 0x04,
                    'key' => $key,
                    ));
        if (!$ok) {
          return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }
        if ($data['status'] == 0) {
            return TRUE;
        }

        return FALSE;
    }

    public function flush()
    {
        $ok = $sent = $this->_send(array(
            'opcode' => 0x08
        ));
        if (!$ok) {
            return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
            return FALSE;
        }
        if($data['status'] == 0){
            return TRUE;
        }

        return FALSE;
    }

    public function replace($key, $value, $expiration = 0)
    {
        list($flag, $value) = $this->_processValue(0, $value);

        $extra = pack('NN', $flag, $expiration);
        $ok = $this->_send(array(
                    'opcode' => 0x03,
                    'key' => $key,
                    'value' => $value,
                    'extra' => $extra,
                    ));
        if (!$ok) {
          return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }
        if ($data['status'] == 0) {
            return TRUE;
        }

        return FALSE;
    }

    protected function _upper($num)
    {
        return $num << 32;
    }

    protected function _lower($num)
    {
        return $num % (2 << 32);
    }

    public function increment($key, $offset = 1, $initial_value = 0, $expiry = 0)
    {
        $extra = pack('N2N2N',
            $this->_upper($offset),
            $this->_lower($offset),
            $this->_upper($initial_value),
            $this->_lower($initial_value),
            $expiry);
        $ok = $this->_send(array(
                    'opcode' => 0x05,
                    'key' => $key,
                    'extra' => $extra,
                    ));
        if (!$ok) {
            return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
            return FALSE;
        }
        if ($data['status'] == 0) {
            $n = unpack('N2', $data['body']);
            $n = $n[1] << 32 | $n[2];
            return $n;
        }

        return FALSE;
    }

    public function decrement($key, $offset = 1, $initial_value = 0, $expiry = 0)
    {
        $extra = pack('N2N2N',
            $this->_upper($offset),
            $this->_lower($offset),
            $this->_upper($initial_value),
            $this->_lower($initial_value),
            $expiry);
        $ok = $this->_send(array(
                    'opcode' => 0x06,
                    'key' => $key,
                    'extra' => $extra,
                    ));
        if (!$ok) {
            return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
            return FALSE;
        }
        if ($data['status'] == 0) {
            $n = unpack('N2', $data['body']);
            $n = $n[1] << 32 | $n[2];
            return $n;
        }

        return FALSE;
    }

    /**
     * Get statistics of the server
     *
     * @param string $type The type of statistics to fetch. Valid values are
     *                     {reset, malloc, maps, cachedump, slabs, items,
     *                     sizes}. According to the memcached protocol spec
     *                     these additional arguments "are subject to change
     *                     for the convenience of memcache developers".
     *
     * @link http://code.google.com/p/memcached/wiki/BinaryProtocolRevamped#Stat
     * @access public
     * @return array  Returns an associative array of server statistics or
     *                FALSE on failure.
     */
    public function getStats($type = null)
    {
        $ok = $this->_send(
            array(
                'opcode' => 0x10,
                'key' => $type,
            )
        );
        if (!$ok) {
          return FALSE;
        }

        $ret = array();
        while (TRUE) {
            $item = $this->_recv();
            if (!$item) {
              return FALSE;
            }
            if (empty($item['key'])) {
                break;
            }
            $ret[$item['key']] = $item['body'];
        }
        return $ret;
    }

    public function append($key, $value)
    {
        // TODO: If the Memcached::OPT_COMPRESSION is enabled, the operation
        // should failed.
        $ok = $this->_send(array(
                    'opcode' => 0x0e,
                    'key' => $key,
                    'value' => $value,
                    ));
        if (!$ok) {
          return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }
        if ($data['status'] == 0) {
            return TRUE;
        }

        return FALSE;
    }

    public function prepend($key, $value)
    {
        // TODO: If the Memcached::OPT_COMPRESSION is enabled, the operation
        // should failed.
        $ok = $this->_send(array(
                    'opcode' => 0x0f,
                    'key' => $key,
                    'value' => $value,
                    ));
        if (!$ok) {
          return FALSE;
        }
        $data = $this->_recv();
        if (!$data) {
          return FALSE;
        }
        if ($data['status'] == 0) {
            return TRUE;
        }

        return FALSE;
    }

    public function getMulti(array $keys)
    {
        // TODO: from http://code.google.com/p/memcached/wiki/BinaryProtocolRevamped#Get,_Get_Quietly,_Get_Key,_Get_Key_Quietly
        //       Clients should implement multi-get (still important for reducing network roundtrips!) as n pipelined requests ...
        $list = array();

        foreach ($keys as $key) {
            $value = $this->get($key);
            if (false !== $value) {
                $list[$key] = $value;
            }
        }

        return $list;
    }

    protected $_options = array();

    /**
     * This method sets the value of a memcache option. Currently supported
     * options are:
     * - OPT_CONNECT_TIMEOUT: connection timeout in ms (rounded up to second
     * granularity).
     * - OPT_SEND_TIMEOUT: timeout for sending data to memcache (ms).
     * - OPT_RECV_TIMEOUT: timeout for receiving data from memcache (ms).
     *
     * @param int $key      One of 'OPT_CONNECT_TIMEOUT', 'OPT_SEND_TIMEOUT',
     *                      or 'OPT_RECV_TIMEOUT'.
     * @param mixed $value  Value to set for the option.
     * @access public
     * @return bool         Returns TRUE on success or FALSE on failure.
     */
    public function setOption($key, $value)
    {
        $this->_options[$key] = $value;

        if ($key === self::OPT_CONNECT_TIMEOUT) {
            // option is in ms, but we only support second granularity.
            $this->_timeout_connect = intval(ceil($value / 1000));
        } else if ($key === self::OPT_SEND_TIMEOUT) {
            $this->_timeout_send = $value;
        } else if ($key === self::OPT_RECV_TIMEOUT) {
            $this->_timeout_recv = $value;
        } else {
          // unsupported option
          return FALSE;
        }

        return TRUE;
    }

    /**
     * MemcacheSASL::setOptions() is a variation of the
     * MemcacheSASL::setOption() that takes an array of options to be set.
     *
     * @param array An associative array of options where the key is the option
     *              to set and the value is the new value for the option.
     * @access public
     * @return bool Returns TRUE on success or FALSE on failure.
     */
    public function setOptions(array $opts)
    {
      foreach($opts as $k => $v) {
        if (!setOption($k, $v)) {
          return FALSE;
        }
      }
    }

    /**
     * Set the memcache object to be a session handler
     *
     * Ex:
     * $m = new MemcacheSASL;
     * $m->addServer('xxx', 11211);
     * $m->setSaslAuthData('user', 'password');
     * $m->setSaveHandler();
     * session_start();
     * $_SESSION['hello'] = 'world';
     *
     * @param int $expiration the time in seconds when the session should expire (0 for never).
     * @access public
     * @return void
     */
    public function setSaveHandler($expiration = 0)
    {
        session_set_save_handler(
            function($savePath, $sessionName){ // open
            },
            function(){ // close
            },
            function($sessionId){ // read
                return $this->get($sessionId);
            },
            function($sessionId, $data) use($expiration) { // write
                return $this->set($sessionId, $data, $expiration);
            },
            function($sessionId){ // destroy
                $this->delete($sessionId);
            },
            function($lifetime) { // gc
            }
        );
    }
}


text:
package cn.limw.summer.datasource.combo;

import java.sql.Connection;
import java.util.HashSet;
import java.util.Set;

import cn.limw.summer.java.sql.wrapper.ConnectionWrapper;

/**
 * ComboConnection
 *
 * @author li (limingwei@mail.com)
 * @version 1 (2014年3月4日 下午5:13:56)
 */
public class ComboConnection extends ConnectionWrapper {
    private Set<Connection> connections = new HashSet<Connection>();

    public void add(Connection connection) {
        this.connections.add(connection);
    }

    public Connection getConnection() {
        return connections.iterator().next();
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <title>Literate sample
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="FAKE - F# Make">
    <meta name="author" content="Steffen Forkmann, Mauricio Scheffer, Colin Bull">

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
    <link type="text/css" rel="stylesheet" href="content/style.css" />

fsharp.org

github page

FAKE - F# Make

Literate sample

This file demonstrates how to write literate F# script
files (*.fsx) that can be transformed into nice HTML
using the literate.fsx script from the F# Formatting
package.

As you can see, a comment starting with double asterisk
is treated as part of the document and is transformed
using Markdown, which means that you can use:

Unordered or ordered lists

Text formatting including bold and emphasis

And numerous other Markdown features.

Writing F# code

Code that is not inside comment will be formatted as
a sample snippet (which also means that you can
run it in Visual Studio or MonoDevelop).

1:
2:
3:
4:
5:
6:

/// The Hello World of functional languages!
let rec factorial x =
  if x = 0 then 1
  else x * (factorial (x - 1))

let f10 = factorial 10

Hiding code

If you want to include some code in the source code,
but omit it from the output, you can use the hide
command.

The value will be deffined in the F# code and so you
can use it from other (visible) code and get correct
tool tips:

1:

let answer = hidden

Moving code around

Sometimes, it is useful to first explain some code that
has to be located at the end of the snippet (perhaps
because it uses some definitions discussed in the middle).
This can be done using include and define commands.

The following snippet gets correct tool tips, even though
it uses laterFunction:

1:
2:
3:

let sample =
  laterFunction()
  |> printfn "Got: %s"

Then we can explain how laterFunction is defined:

1:
2:

let laterFunction() =
  "Not very difficult, is it?"

This example covers pretty much all features that are
currently implemented in literate.fsx, but feel free
to fork the project on GitHub and add more
features or report bugs!

Other features

The tool-tips also work for double-backtick identifiers.
This might be useful to generate nice documents from tests:

1:
2:

let ``1 + 1 should be equal to 2``() =
  1 + 1 = 2

Others examples follow here.

val factorial : x:int -> int

Full name: Demo.factorial

 The Hello World of functional languages!

val x : int

val f10 : int

Full name: Demo.f10

val hidden : int

Full name: Demo.hidden

 This is a hidden answer

val answer : int

Full name: Demo.answer

val laterFunction : unit -> string

Full name: Demo.laterFunction

val sample : unit

Full name: Demo.sample

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn

val ( 1 + 1 should be equal to 2 ) : unit -> bool

Full name: Demo.( 1 + 1 should be equal to 2 )

FAKE - F# Make

Home page

Get FAKE via NuGet

Source Code on GitHub

License (Apache 2)

Release Notes

Contributing to FAKE

Who is using FAKE?

Ask a question

Tutorials

Getting started

Build script caching

NuGet package restore

Using FxCop in a build

Generating AssemblyInfo

Create NuGet packages

Running specific targets

Running FAKE from command line

Running targets in parallel

Using the F# compiler from FAKE

Creating custom tasks

Soft dependencies

TeamCity integration

Running canopy tests

Octopus Deploy

TypeScript support

Azure WebJobs support

Azure Cloud Services support

SQL DACPAC support

FluentMigrator support

Android publisher

File Watcher

WiX Setup Generation

Using Chocolatey

Using Slack

Using SonarQube

Fake.Deploy

Fake.IIS

Reference

API Reference


text:
<!DOCTYPE html>

    <title>CSS3 UserInterface Test: CSS3UI_box-sizing_border-box</title>
    <link rel="author" title="Intel" href="http://www.intel.com/" />
    <link rel="help" href="http://www.w3.org/TR/2012/WD-css3-ui-20120117/#box-sizing" />
    <meta name="assert" content="Check if 'box-sizing:border-box' on test div" />
    <meta name="flags" content="" />


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CodeStyle
{
    internal static class CodeStyleHelpers
    {
        public static bool TryParseStringEditorConfigCodeStyleOption(string arg, CodeStyleOption2<string> defaultValue, [NotNullWhen(true)] out CodeStyleOption2<string>? option)
        {
            if (TryGetCodeStyleValueAndOptionalNotification(
                    arg, defaultValue.Notification, out var value, out var notification))
            {
                option = new CodeStyleOption2<string>(value, notification);
                return true;
            }

            option = null;
            return false;
        }

        public static bool TryParseBoolEditorConfigCodeStyleOption(string arg, CodeStyleOption2<bool> defaultValue, out CodeStyleOption2<bool> option)
        {
            if (TryGetCodeStyleValueAndOptionalNotification(
                    arg, defaultValue.Notification, out var value, out var notification))
            {
                // First value has to be true or false.  Anything else is unsupported.
                if (bool.TryParse(value, out var isEnabled))
                {
                    option = new CodeStyleOption2<bool>(isEnabled, notification);
                    return true;
                }
            }

            option = defaultValue;
            return false;
        }

        /// <summary>
        /// Given an editor-config code-style-option, gives back the core value part of the
        /// option.  For example, if the option is "true:error" or "true" then "true" will be returned
        /// in <paramref name="value"/>.
        /// </summary>
        public static bool TryGetCodeStyleValue(
            string arg, [NotNullWhen(true)] out string? value)
            => TryGetCodeStyleValueAndOptionalNotification(arg, defaultNotification: NotificationOption2.None, out value, out _);

        /// <summary>
        /// Given an editor-config code-style-option, gives back the constituent parts of the
        /// option.  For example, if the option is "true:error" then "true" will be returned
        /// in <paramref name="value"/> and <see cref="NotificationOption2.Error"/> will be returned
        /// in <paramref name="notification"/>.  Note that users are allowed to not provide
        /// a NotificationOption, so <paramref name="notification"/> will default to <paramref name="defaultNotification"/>.
        /// </summary>
        public static bool TryGetCodeStyleValueAndOptionalNotification(
            string arg, NotificationOption2 defaultNotification, [NotNullWhen(true)] out string? value, [NotNullWhen(true)] out NotificationOption2? notification)
        {
            var args = arg.Split(':');
            Debug.Assert(args.Length > 0);

            // We allow a single value to be provided without an explicit notification.
            if (args.Length == 1)
            {
                value = args[0].Trim();
                notification = defaultNotification;
                return true;
            }

            if (args.Length == 2)
            {
                // If we have two args, then the second must be a notification option.  If
                // it isn't, then this isn't a valid code style option at all.
                if (TryParseNotification(args[1], out var localNotification))
                {
                    value = args[0].Trim();
                    notification = localNotification;
                    return true;
                }
            }

            // We only support 0 or 1 args.  Anything else can't be parsed properly.
            value = null;
            notification = null;
            return false;
        }

        private static bool TryParseNotification(string value, out NotificationOption2 notification)
        {
            switch (value.Trim())
            {
                case EditorConfigSeverityStrings.None:
                    notification = NotificationOption2.None;
                    return true;

                case EditorConfigSeverityStrings.Refactoring:
                case EditorConfigSeverityStrings.Silent:
                    notification = NotificationOption2.Silent;
                    return true;

                case EditorConfigSeverityStrings.Suggestion: notification = NotificationOption2.Suggestion; return true;
                case EditorConfigSeverityStrings.Warning: notification = NotificationOption2.Warning; return true;
                case EditorConfigSeverityStrings.Error: notification = NotificationOption2.Error; return true;
            }

            notification = NotificationOption2.Silent;
            return false;
        }

        public static Option2<T> CreateOption<T>(
            OptionGroup group,
            string feature,
            string name,
            T defaultValue,
            ImmutableArray<IOption2>.Builder optionsBuilder,
            OptionStorageLocation2 storageLocation)
        {
            var option = new Option2<T>(feature, group, name, defaultValue, ImmutableArray.Create(storageLocation));
            optionsBuilder.Add(option);
            return option;
        }

        public static Option2<T> CreateOption<T>(
            OptionGroup group,
            string feature,
            string name,
            T defaultValue,
            ImmutableArray<IOption2>.Builder optionsBuilder,
            OptionStorageLocation2 storageLocation1,
            OptionStorageLocation2 storageLocation2)
        {
            var option = new Option2<T>(feature, group, name, defaultValue, ImmutableArray.Create(storageLocation1, storageLocation2));
            optionsBuilder.Add(option);
            return option;
        }

        public static Option2<T> CreateOption<T>(
            OptionGroup group,
            string feature,
            string name,
            T defaultValue,
            ImmutableArray<IOption2>.Builder optionsBuilder,
            ImmutableArray<OptionStorageLocation2> storageLocations)
        {
            var option = new Option2<T>(feature, group, name, defaultValue, storageLocations);
            optionsBuilder.Add(option);
            return option;
        }

        private static readonly CodeStyleOption2<UnusedValuePreference> s_preferNoneUnusedValuePreference =
            new(default, NotificationOption2.None);

        private static readonly BidirectionalMap<string, UnusedValuePreference> s_unusedExpressionAssignmentPreferenceMap =
            new(new[]
            {
                KeyValuePairUtil.Create("discard_variable", UnusedValuePreference.DiscardVariable),
                KeyValuePairUtil.Create("unused_local_variable", UnusedValuePreference.UnusedLocalVariable),
            });

        public static Option2<CodeStyleOption2<UnusedValuePreference>> CreateUnusedExpressionAssignmentOption(
            OptionGroup group,
            string feature,
            string name,
            string editorConfigName,
            CodeStyleOption2<UnusedValuePreference> defaultValue,
            ImmutableArray<IOption2>.Builder optionsBuilder)
            => CreateOption(
                group,
                feature,
                name,
                defaultValue,
                optionsBuilder,
                new EditorConfigStorageLocation<CodeStyleOption2<UnusedValuePreference>>(
                    editorConfigName,
                    s => ParseUnusedExpressionAssignmentPreference(s, defaultValue),
                    o => GetUnusedExpressionAssignmentPreferenceEditorConfigString(o, defaultValue)),
                new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{name}Preference"));

        private static Optional<CodeStyleOption2<UnusedValuePreference>> ParseUnusedExpressionAssignmentPreference(
            string optionString,
            CodeStyleOption2<UnusedValuePreference> defaultCodeStyleOption)
        {
            if (TryGetCodeStyleValueAndOptionalNotification(optionString,
                    defaultCodeStyleOption.Notification, out var value, out var notification))
            {
                return new CodeStyleOption2<UnusedValuePreference>(
                    s_unusedExpressionAssignmentPreferenceMap.GetValueOrDefault(value), notification);
            }

            return s_preferNoneUnusedValuePreference;
        }

        private static string GetUnusedExpressionAssignmentPreferenceEditorConfigString(CodeStyleOption2<UnusedValuePreference> option, CodeStyleOption2<UnusedValuePreference> defaultValue)
        {
            Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
            var value = s_unusedExpressionAssignmentPreferenceMap.GetKeyOrDefault(option.Value) ?? s_unusedExpressionAssignmentPreferenceMap.GetKeyOrDefault(defaultValue.Value);
            return $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}";
        }

        internal static string GetEditorConfigStringNotificationPart<T>(CodeStyleOption2<T> option, CodeStyleOption2<T> defaultValue)
            => option.Notification != defaultValue.Notification
                ? $":{option.Notification.ToEditorConfigString()}"
                : string.Empty;
    }
}


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

namespace BACnet.SchemaParser
{
    public class EnumerationOptionDefinition
    {
        /// <summary>
        /// The name of the option
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// The value of the option
        /// </summary>
        public int Value { get; private set; }

        /// <summary>
        /// Constructs a new enumeration option definition
        /// </summary>
        /// <param name="name">The name of the option</param>
        /// <param name="value">The value of the option</param>
        public EnumerationOptionDefinition(string name, int value)
        {
            this.Name = name;
            this.Value = value;
        }
    }
}


text: SELECT c FROM t6 WHERE a<'abc';


text:
<!DOCTYPE html>

 <meta charset="UTF-8">

<title>RowSize—Wolfram Language Documentation</title>
<meta name="buildnumber" content="0000000" />
<meta name="historydata" content="{XX, , , }" />
<meta name="keywords" content="RowSize" />

<meta name="description" content="RowSize is an option for CentralAxes. defines the number or images per showing the segmentation. Can be &quot;Automatic&quot; of an integer." />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link rel="stylesheet" href="../css/reference.css" />

            <link rel="stylesheet" href="../css/clipboard.css" />

   Q M R I TOOLS PACKAGE SYMBOL

RowSize

RowSize
is an option for CentralAxes. defines the number or images per showing the segmentation. Can be "Automatic" of an integer.


text:
$LOAD_PATH << Dir.pwd
# Add the gem root dir so that sample_bots can be loaded
$LOAD_PATH << File.expand_path('../../../', __FILE__)

module RTanque
  # Runner manages running an {RTanque::Match}
  class Runner
    LoadError = Class.new(::LoadError)
    attr_reader :match

    # @param [Integer] width
    # @param [Integer] height
    # @param [*match_args] args provided to {RTanque::Match#initialize}
    def initialize(width, height, *match_args)
      @match = RTanque::Match.new(RTanque::Arena.new(width, height), *match_args)
    end

    # Attempts to load given {RTanque::Bot::Brain} given its path
    # @param [String] brain_path
    # @raise [RTanque::Runner::LoadError] if brain could not be loaded
    def add_brain_path(brain_path)
      parsed_path = self.parse_brain_path(brain_path)
      bots = parsed_path.multiplier.times.map { self.new_bots_from_brain_path(parsed_path.path) }.flatten
      self.match.add_bots(bots)
    end

    # Starts the match
    # @param [Boolean] gui if false, runs headless match
    def start(gui = true)
      if gui
        require 'rtanque/gui'
        window = RTanque::Gui::Window.new(self.match)
        trap(:INT) { window.close }
        window.show
      else
        trap(:INT) { self.match.stop }
        self.match.start
      end
    end

    protected

    def new_bots_from_brain_path(brain_path)
      self.fetch_brain_klasses(brain_path).map do |brain_klass|
        RTanque::Bot.new_random_location(self.match.arena, brain_klass)
      end
    end

    def fetch_brain_klasses(brain_path)
      @load_brain_klass_cache ||= Hash.new do |cache, path|
        cache[path] = self.get_diff_in_object_space(RTanque::Bot::Brain) {
          begin
            require(path)
          rescue ::LoadError => e
            raise LoadError, e.message
          end
        }
        raise LoadError, "No class of type #{RTanque::Bot::Brain} found in #{path}" if cache[path].empty?
        cache[path]
      end
      @load_brain_klass_cache[brain_path]
    end

    def get_diff_in_object_space(klass)
      current_object_space = self.get_descendants_of_class(klass)
      yield
      self.get_descendants_of_class(klass) - current_object_space
    end

    def get_descendants_of_class(klass)
      ::ObjectSpace.each_object(::Class).select {|k| k < klass }
    end

    BRAIN_PATH_PARSER = /\A(.+?)\:[x|X](\d+)\z/
    # @!visibility private
    ParsedBrainPath = Struct.new(:path, :multiplier)
    def parse_brain_path(brain_path)
      path = brain_path.gsub('\.rb$', '')
      multiplier = 1
      brain_path.match(BRAIN_PATH_PARSER) { |m|
        path = m[1]
        multiplier = m[2].to_i
      }
      ParsedBrainPath.new(path, multiplier)
    end
  end
end