text:
import Device from 'ismobilejs';

export default function maxRecommendedTextures(max)
{
    if (Device.tablet || Device.phone)
    {
        // check if the res is iphone 6 or higher..
        return 2;
    }

    // desktop should be ok
    return max;
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef AVOGADRO_QUANTUMIO_MOLDEN_H
#define AVOGADRO_QUANTUMIO_MOLDEN_H

#include "avogadroquantumioexport.h"
#include <avogadro/core/gaussianset.h>
#include <avogadro/io/fileformat.h>

#include <vector>

namespace Avogadro {
namespace QuantumIO {

class AVOGADROQUANTUMIO_EXPORT MoldenFile : public Io::FileFormat
{
public:
  MoldenFile();
  ~MoldenFile() AVO_OVERRIDE;

  Operations supportedOperations() const AVO_OVERRIDE
  {
    return Read | File | Stream | String;
  }

  FileFormat * newInstance() const AVO_OVERRIDE { return new MoldenFile; }
  std::string identifier() const AVO_OVERRIDE { return "Avogadro: Molden"; }
  std::string name() const AVO_OVERRIDE { return "Molden"; }
  std::string description() const AVO_OVERRIDE
  {
    return "Molden file format.";
  }

  std::string specificationUrl() const AVO_OVERRIDE
  {
    return "http://www.cmbi.ru.nl/molden/molden_format.html";
  }

  std::vector<std::string> fileExtensions() const AVO_OVERRIDE;
  std::vector<std::string> mimeTypes() const AVO_OVERRIDE;

  bool read(std::istream &in, Core::Molecule &molecule) AVO_OVERRIDE;
  bool write(std::ostream &, const Core::Molecule &) AVO_OVERRIDE
  {
    // Empty, as we do not write out Molden files.
    return false;
  }

private:
  void outputAll();

  void processLine(std::istream &in);
  void readAtom(const std::vector<std::string> &list);
  void load(Core::GaussianSet* basis);

  double m_coordFactor;
  int m_electrons;
  unsigned int m_numBasisFunctions;
  std::vector<int> m_aNums;
  std::vector<double> m_aPos;
  std::vector<Core::GaussianSet::orbital> m_shellTypes;
  std::vector<int> m_shellNums;
  std::vector<int> m_shelltoAtom;
  std::vector<double> m_a;
  std::vector<double> m_c;
  std::vector<double> m_csp;
  std::vector<double> m_orbitalEnergy;
  std::vector<double> m_MOcoeffs;

  enum Mode { Atoms, GTO, MO, Unrecognized };
  Mode m_mode;
};

} // End namespace
}

#endif


text:
describe('lib/rules/validate-jsdoc/leading-underscore-access', function () {
    var checker = global.checker({
        plugins: ['./lib/index']
    });

    describe('not configured', function() {

        it('should report with undefined', function() {
            global.expect(function() {
                checker.configure({leadingUnderscoreAccess: undefined});
            }).to.throws(/accepted value/i);
        });

        it('should report with an object', function() {
            global.expect(function() {
                checker.configure({leadingUnderscoreAccess: {}});
            }).to.throws(/accepted value/i);
        });

    });

    describe('common', function() {

        checker.cases([
            /* jshint ignore:start */
            {
                it: 'should not report',
                rules: {leadingUnderscoreAccess: true},
                code: function() {
                    function yay(yey) {
                    }
                }
            }, {
                it: 'should report enforcing @private on leading underscores',
                rules: {leadingUnderscoreAccess: 'private'},
                errors: 1,
                code: function () {
                    /**
                     * @protected
                     */
                    function _funcName(p) {
                    }
                }
            }, {
                it: 'should report @private/@protected absent',
                rules: {leadingUnderscoreAccess: true},
                errors: 1,
                code: function () {
                    /**
                     * yolo
                     */
                    function _funcName(p) {

                    }
                }
            }, {
                it: 'should not report @private/@protected absent',
                rules: {leadingUnderscoreAccess: true},
                code: function () {
                    /**
                     * @private
                     */
                    function _funcName(p) {
                    }

                    /**
                     * @protected
                     */
                    function _funcName(p) {
                    }
                }
            }, {
                it: 'should not report @protected on trailing underscores',
                rules: {leadingUnderscoreAccess: 'protected'},
                code: function () {
                    /**
                     * @protected
                     */
                    function _funcName(p) {
                    }
                }
            }, {
                it: 'should report correct line for @private/@protected absent',
                rules: {leadingUnderscoreAccess: true},
                code: function () {
                    /**
                     * @protected
                     */
                    function _funcName(p) {}

                    /**
                     * yolo
                     */
                    function _funcName(p) {}
                },
                errors: [{
                    line: 9,
                    column: 9,
                    message: 'Missing access tag for _funcName',
                    rule: 'jsDoc',
                    filename: 'input',
                    fixed: undefined
                }]
            }, {
                it: 'should skip anonymous',
                rules: {leadingUnderscoreAccess: true},
                code: function () {
                    /**
                     * @access private
                     */
                    (function (p) { return p; })
                }
            }, {
                it: 'should not report @private for object prop',
                rules: {leadingUnderscoreAccess: true},
                code: function () {
                    Cls = {
                        /**
                         * @access private
                         */
                        _privFunc: function (p) {
                        },

                        /**
                         * @access protected
                         */
                        _protFunc: function (p) {
                        },

                        /**
                         * @access public
                         */
                        func: function (p) {
                        }
                    };
                }
            }, {
                it: 'should report non-@protected for object prop',
                rules: {leadingUnderscoreAccess: 'protected'},
                code: function () {
                    Cls = {
                        /**
                         * @access private
                         */
                        _privFunc: function (p) {
                        },

                        /**
                         * @access public
                         */
                        _pubFunc: function (p) {
                        }
                    };
                },
                errors: 2
            }, {
                it: 'should not report in variables',
                rules: {leadingUnderscoreAccess: true},
                code: function () {
                    /**
                     * @access private
                     */
                    var _privFunc = function (p) {};

                    /**
                     * @access protected
                     */
                    var _protFunc = function (p) {};
                }
            }, {
                it: 'should report invalid access in variables',
                rules: {leadingUnderscoreAccess: 'protected'},
                code: function () {
                    /**
                     * @access private
                     */
                    var _privFunc = function (p) {};

                    /**
                     * @access public
                     */
                    var _pubFuncWithUnderscore = function (p) {};
                },
                errors: [{
                    column: 3, line: 2, filename: 'input', rule: 'jsDoc', fixed: undefined,
                    message: 'Method access doesn\'t match'
                }, {
                    column: 3, line: 7, filename: 'input', rule: 'jsDoc', fixed: undefined,
                    message: 'Method access doesn\'t match'
                }]
            }, {
                it: 'should not report standard idendifiers',
                rules: {leadingUnderscoreAccess: 'protected'},
                code: function () {
                    /**
                     * @access private
                     */
                    var super_ = function (p) {};

                    /**
                     * @access public
                     */
                    var __proto__ = function (p) {};
                }
            }, {
                it: 'should not report private functions. jscs-dev/node-jscs#1588',
                rules: {leadingUnderscoreAccess: 'private'},
                code: function () {
                    /**
                     * @access private
                     */
                    function _super(p) {};

                    /**
                     * @private
                     */
                    function _proto(p) {};
                }
            }, {
                it: 'should not report incorrect jsdoc with right tag. jscs-dev/node-jscs#1588',
                rules: {leadingUnderscoreAccess: 'private'},
                code: function() {
                    /**
                    * @private
                    **/
                    function _yay(yey) {
                    }
                }
            }, {
                it: 'should not report overriden methods. #114',
                rules: {leadingUnderscoreAccess: 'private'},
                code: function () {
                    /**
                     * @override
                     */
                    function _funcName(p) {
                    }
                }
            }, {
                it: 'should report overriden with wrong @access value. #114',
                rules: {leadingUnderscoreAccess: 'private'},
                code: function () {
                    /**
                     * @override
                     * @protected
                     */
                    function _funcName(p) {
                    }
                },
                errors: 1
            }
            /* jshint ignore:end */
        ]);

    });

});


text:
package com.sishuok.es.common.entity.search.exception;

/**
 *
User: Zhang Kaitao
 *
Date: 13-1-17 上午11:44
 *
Version: 1.0
 */
public final class InvalidSearchValueException extends SearchException {

    public InvalidSearchValueException(String searchProperty, String entityProperty, Object value) {
        this(searchProperty, entityProperty, value, null);
    }

    public InvalidSearchValueException(String searchProperty, String entityProperty, Object value, Throwable cause) {
        super("Invalid Search Value, searchProperty [" + searchProperty + "], " +
                "entityProperty [" + entityProperty + "], value [" + value + "]", cause);
    }

}


text:
from django.conf import settings
from django.db import migrations, models

import openslides.utils.models

class Migration(migrations.Migration):

    dependencies = [("users", "0009_auto_20190119_0941")]

    operations = [
        migrations.AlterField(
            model_name="personalnote",
            name="user",
            field=models.OneToOneField(
                on_delete=openslides.utils.models.CASCADE_AND_AUTOUODATE,
                to=settings.AUTH_USER_MODEL,
            ),
        )
    ]


text:
package org.joda.beans;

import static org.assertj.core.api.Assertions.assertThat;

import org.joda.beans.sample.MutableListFinalBean;
import org.joda.beans.sample.MutableListNonFinalBean;
import org.junit.jupiter.api.Test;

/**
 * Test list with builder.
 */
public class TestMutableListBeans {

    @Test
    public void test_finalBean_noList() {
        MutableListFinalBean test = MutableListFinalBean.builder().build();
        assertThat(test.getStrings()).isNull();
    }

    @Test
    public void test_finalBean_list() {
        MutableListFinalBean test = MutableListFinalBean.builder().strings("A", "B").build();
        assertThat(test.getStrings()).containsExactly("A", "B");
    }

    @Test
    public void test_nonFinalBean_noList() {
        MutableListNonFinalBean test = MutableListNonFinalBean.builder().build();
        assertThat(test.getStrings()).isNull();
    }

    @Test
    public void test_nonFinalBean_list() {
        MutableListNonFinalBean test = MutableListNonFinalBean.builder().strings("A", "B").build();
        assertThat(test.getStrings()).containsExactly("A", "B");
    }

}


text:
using System;
using System.Threading.Tasks;
using Nethereum.Besu.RPC.Debug;
using Nethereum.JsonRpc.Client;
using Nethereum.Besu.IntegrationTests;
using Nethereum.RPC.Tests.Testers;
using Newtonsoft.Json.Linq;
using Xunit;

namespace Nethereum.Besu.Tests.Testers
{

    public class DebugMetricsTester : RPCRequestTester<JObject>, IRPCRequestTester
    {
        public override Task<JObject> ExecuteAsync(IClient client)
        {
            var debugMetrics = new DebugMetrics(client);
            return debugMetrics.SendRequestAsync();
        }

        public override Type GetRequestType()
        {
            return typeof(DebugMetrics);
        }

        [Fact]
        public async void ShouldReturnNotNull()
        {
            var result = await ExecuteAsync().ConfigureAwait(false);
            Assert.NotNull(result);
        }
    }

}


text:
package org.summer.dp.cms.helper.language;

import java.util.Random;

import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;

/**
 * 暂时为员工管理激活帐号服务
 * 如需要新的功能自行进行添加
 * @author dong
 *
 */
public class Pinyin4jUtil {
	private static HanyuPinyinOutputFormat hanyuPinyinOutputFormat = new HanyuPinyinOutputFormat();
	private final static String abc[]={"A","B","C","D","E","F","G","H","I",
		"J","K","L","M","N","O","P","Q","R",
		"S","T","U","V","W","X","Y","Z",
		"a","b","c","d","e","f","g","h","i",
		"j","k","l","m","n","o","p","q","r",
		"s","t","u","v","w","x","y","z",
		"1","2","3","4","5","6","7","8","9","0"};

	static{
		hanyuPinyinOutputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
	}

	/**
	 *
	 * @param inputString 赵宝东
	 * @return zhaobd
	 */
	public static String toHanyuPinyin(String inputString){
		StringBuffer outputString = new StringBuffer();
		try {
			char[] cs = inputString.toCharArray();
			for(byte i=0;i<cs.length;i++){

				String[] hanyuPinyin = PinyinHelper.toHanyuPinyinStringArray(cs[i], hanyuPinyinOutputFormat);
				String s = hanyuPinyin[0];

				if(i==0){
					outputString.append(s);
				}else if(i>0){
					outputString.append(s.substring(0, 1));
				}

			}
		}
		catch (BadHanyuPinyinOutputFormatCombination e) {
			e.printStackTrace();
		}

		return outputString.toString();
	}

	public static String genRandomPassword(){
		int length = 6;

		Random rand = new Random();
		StringBuffer password = new StringBuffer();
		for (int i = 0; i < length; i++)
		{
			password.append(abc[rand.nextInt(abc.length)]);
		}
		return password.toString();
	}

}


text:
package com.google.cloud.tools.gradle.endpoints.framework.client.task;

import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;

/**
 * Task to extract all discovery docs from zips generated by other modules in the same gradle
 * project.
 */
public class ExtractDiscoveryDocZipsTask extends DefaultTask {

  private Collection<File> discoveryDocZips;
  private File discoveryDocsDir;

  @InputFiles
  public Collection<File> getDiscoveryDocZips() {
    return discoveryDocZips;
  }

  public void setDiscoveryDocZips(Collection<File> discoveryDocZips) {
    this.discoveryDocZips = discoveryDocZips;
  }

  @OutputDirectory
  public File getDiscoveryDocsDir() {
    return discoveryDocsDir;
  }

  public void setDiscoveryDocsDir(File discoveryDocsDir) {
    this.discoveryDocsDir = discoveryDocsDir;
  }

  /** Task entry point. */
  @TaskAction
  public void extractDiscoveryDocs() {
    getProject().delete(discoveryDocsDir);
    getProject().mkdir(discoveryDocsDir);

    for (final File discoveryDocZip : discoveryDocZips) {
      getAnt()
          .invokeMethod(
              "unzip",
              new HashMap<String, String>() {
                {
                  put("src", discoveryDocZip.getPath());
                  put("dest", discoveryDocsDir.getPath());
                }
              });
    }
  }
}


text:
require File.expand_path('../../spec_helper', __FILE__)

describe "String" do
  it "should know if it's blank" do
    ''.should.be.blank
    ' '.should.not.be.blank
    'Not'.should.not.be.blank
  end
end


text:
package pio.refactor

import org.apache.predictionio.controller.IEngineFactory
import org.apache.predictionio.controller.Engine
import org.apache.predictionio.controller._

class VanillaEvaluator
  extends Evaluator[EmptyEvaluationInfo, Query, PredictedResult,
  ActualResult, Int, Int, String] {

  def evaluateUnit(q: Query, p: PredictedResult, a: ActualResult): Int = {
    q.q - p.p
  }

  def evaluateSet(evalInfo: EmptyEvaluationInfo, eus: Seq[Int]): Int = eus.sum

  def evaluateAll(input: Seq[(EmptyEvaluationInfo, Int)]): String = {
    val sum = input.map(_._2).sum
    s"VanillaEvaluator(${input.size}, $sum)"
  }
}


text: module.exports = require('./lib/optimist-config-file');


text:
    include "_header_page.html"

Vision der GWÖ

            Gemeinwohl-Ökonomie bezeichnet ein alternatives Wirtschaftssystem, das auf Gemeinwohl-fördernden Werten
            aufgebaut ist. Gemeinwohl-Ökonomie ist ein Veränderungshebel auf wirtschaftlicher, politischer und
            gesellschaftlicher Ebene – eine Brücke von Altem zu Neuem.

Auf wirtschaftlicher Ebene ist sie eine lebbare, konkret umsetzbare Alternative für
            Unternehmen verschiedener Größen und Rechtsformen. Der Zweck des Wirtschaftens und die Bewertung von
            Unternehmenserfolg werden anhand Gemeinwohl-orientierter Werte definiert.

Auf politischer Ebene will die Bewegung für eine Gemeinwohl-Ökonomie rechtliche Veränderung
            bewirken. Ziel des Engagements ist ein gutes Leben für alle Lebewesen und den Planeten, unterstützt durch
            ein Gemeinwohl-orientiertes Wirtschaftssystem. Menschenwürde, globale Fairness und Solidarität, ökologische
            Nachhaltigkeit, soziale Gerechtigkeit und demokratische Mitbestimmung sind dabei wesentliche Elemente.

Auf gesellschaftlicher Ebene ist die Bewegung für eine Gemeinwohl-Ökonomie eine Initiative
            der Bewusstseinsbildung für Systemwandel, die auf dem gemeinsamen, wertschätzenden Tun möglichst vieler
            Menschen beruht. Die Bewegung gibt Hoffnung und Mut und sucht die Vernetzung und Befruchtung mit anderen
            alternativen Initiativen.

            Sie versteht sich als ergebnisoffener, partizipativer, lokal wachsender Prozess
            mit globaler Ausstrahlung.

    include "_footer_page.html"


text:
package cceventmgmt

import (
	"fmt"

	"github.com/hyperledger/fabric/core/ledger"
	"github.com/hyperledger/fabric/protos/common"
)

// ChaincodeDefinition captures the info about chaincode
type ChaincodeDefinition struct {
	Name              string
	Hash              []byte
	Version           string
	CollectionConfigs *common.CollectionConfigPackage
}

func (cdef *ChaincodeDefinition) String() string {
	return fmt.Sprintf("Name=%s, Version=%s, Hash=%#v", cdef.Name, cdef.Version, cdef.Hash)
}

// ChaincodeLifecycleEventListener interface enables ledger components (mainly, intended for statedb)
// to be able to listen to chaincode lifecycle events. 'dbArtifactsTar' represents db specific artifacts
// (such as index specs) packaged in a tar
type ChaincodeLifecycleEventListener interface {
	// HandleChaincodeDeploy is invoked when chaincode installed + defined becomes true.
	// The expected usage are to creates all the necessary statedb structures (such as indexes) and update
	// service discovery info. This function is invoked immediately before the committing the state changes
	// that contain chaincode definition or when a chaincode install happens
	HandleChaincodeDeploy(chaincodeDefinition *ChaincodeDefinition, dbArtifactsTar []byte) error
	// ChaincodeDeployDone is invoked after the chaincode deployment is finished - `succeeded` indicates
	// whether the deploy finished successfully
	ChaincodeDeployDone(succeeded bool)
}

// ChaincodeInfoProvider interface enables event mgr to retrieve chaincode info for a given chaincode
type ChaincodeInfoProvider interface {
	// GetDeployedChaincodeInfo retrieves the details about the deployed chaincode.
	// This function is expected to return nil, if the chaincode with the given name is not deployed
	// or the version or hash of the deployed chaincode does not match with the given version and hash
	GetDeployedChaincodeInfo(chainid string, chaincodeDefinition *ChaincodeDefinition) (*ledger.DeployedChaincodeInfo, error)
	// RetrieveChaincodeArtifacts checks if the given chaincode is installed on the peer and if yes,
	// it extracts the state db specific artifacts from the chaincode package tarball
	RetrieveChaincodeArtifacts(chaincodeDefinition *ChaincodeDefinition) (installed bool, dbArtifactsTar []byte, err error)
}


text:
var popup = new mapboxgl.Popup({
    closeButton: false,
    closeOnClick: true
});
var map;

var app = new Vue({
    el: '#events',
    data: {
        events: [],
        mapLoaded: false
    },
    methods: {
        init() {
            app.events = events;
            app.initMap(function () {
                app.updateMap(app.events);
            });
        },
        initMap(onMapLoaded) {
            if (app.mapLoaded) {
                if (onMapLoaded) {
                    return onMapLoaded();
                }
                else {
                    return;
                }
            }
            else {
                app.mapLoaded = true;
                mapboxgl.accessToken = mapboxAccessToken;
                var bounds = [
                    [-98, 29],
                    [-97, 31]
                ]; // Austin city bounds
                map = new mapboxgl.Map({
                    container: "map",
                    style: mapboxStyle,
                    center: [-97.74306, 30.26715],
                    zoom: 14,
                    pitch: 30
                });

                // device geolocation
                var geoloptions = {
                    enableHighAccuracy: true,
                    timeout: 5000,
                    maximumAge: 0
                };
                navigator.geolocation.getCurrentPosition(locateSuccess, locateError, geoloptions);

                map.addControl(new mapboxgl.NavigationControl(), 'top-left');

                map.on('load', function() {
                    if (onMapLoaded) {
                        onMapLoaded();
                    }
                });
            }
        },
        updateMap(points) {
            if (popup.isOpen()) popup.remove();
            var geoj = {
                type: "FeatureCollection"
            };
            var features = [];
            var point;
            var feature;
            var min = [];
            var max = [];
            for (var i = 0; i < points.length; i++) {
                point = points[i];
                feature = {
                    type: "Feature"
                };
                feature.properties = {};
                for (var prop in point) {
                    if (point.hasOwnProperty(prop)) {
                        if (prop == "geometry") {
                            feature.geometry = {};
                            if (!point[prop].type) {
                                feature.geometry.type = "Point";
                            } else {
                                feature.geometry.type = point[prop].type;
                            }
                            // something is screwy with data so do this weird hack
                            if (point.geometry.coordinates[0] < 0) // 0 is x
                                feature.geometry.coordinates = point.geometry.coordinates;
                            else
                                feature.geometry.coordinates = [point.geometry.coordinates[1], point.geometry.coordinates[0]];
                        } else { // end geometry
                            feature.properties[prop] = point[prop];
                        }
                    }
                }

                if (feature.geometry && feature.geometry.coordinates && feature.geometry.coordinates.length == 2 && feature.geometry.coordinates[0] && feature.geometry.coordinates[1]) {
                    features.push(feature);
                }
            }
            geoj.features = features;
            if (!geoj.features.length) {
                console.log('no results!')
                return
            }

            var bbox = turf.bbox(geoj);
            // console.log("geoj bbox: " + bbox);

            if (!map.getSource('locations')) {
                map.addSource('locations', {
                    "type": "geojson",
                    "data": geoj,
                    "cluster": false,
                    "clusterMaxZoom": 20,
                    "clusterRadius": 5
                });
            } else {
                map.getSource('locations').setData(geoj)
            }

            if (!map.getLayer('eventsLayer')) {
                map.addLayer({
                    "id": "eventsLayer",
                    "type": "symbol",
                    "source": 'locations',
                    "layout": {
                        "icon-image": mapboxIcon,
                        "icon-size": {
                            "stops": [[7, 0.4], [15, 0.6]]
                        },
                        "icon-allow-overlap": true
                    }
                }, 'events-label');
            }

            if (geoj.features.length > 0) { //If no results are returned, don't fail on fitBounds()
                try {
                    let buffer = 0.003
                    map.fitBounds([
                        [bbox[0] - buffer, bbox[1] - buffer],
                        [bbox[2] + buffer, bbox[3] + buffer]
                    ]);
                } catch (e) {
                    console.log(e)
                }
            }

            map.on('click', function(e) {
                let buffer = 3;
                minpoint = new Array(e.point['x'] - buffer, e.point['y'] - buffer);
                maxpoint = new Array(e.point['x'] + buffer, e.point['y'] + buffer);
                var fs = map.queryRenderedFeatures([minpoint, maxpoint], {
                    layers: ["eventsLayer"]
                });
                app.displayPopup(fs);
            });
        },
        displayPopup(fs) {
            map.getCanvas().style.cursor = (fs.length) ? "pointer" : "";
            if (!fs.length) {
                popup.remove();
                return;
            }
            ;
            if (fs.length > 1) {
                popuphtml = "";
                fs.forEach(function (f) {
                    titl = "" + f.properties.name + ""
                    popuphtml += "
" + titl + "
";
                    if (f.properties.description) {
                        var desc = f.properties.description;
                        if (desc.length > 50) desc = f.properties.description.substring(0, 50) + "...";
                        popuphtml += "
" + desc + "
";
                    }

                }, this);
                popup.setLngLat(fs[0].geometry.coordinates).setHTML(popuphtml).addTo(map);
            } else {
                var f = fs[0];
                if (!f.properties.cluster) {
                    titl = "" + f.properties.name + "";
                    popuphtml = "
" + titl + "

";
                    var desc = f.properties.description;
                    if (desc.length > 370) desc = f.properties.description.substring(0, 370) + "...";
                    if (f.properties.img_url && f.properties.img_url != 'undefined')
                        popuphtml += "";
                    popuphtml += desc + "
";
                    popup.setLngLat(f.geometry.coordinates).setHTML(popuphtml).addTo(map);
                }
            }
        }
    }
});

(function() {
    // Initialize vue app
    app.init();
})();

function mapToggle() {
    window.location = "/?token=" + token;
}

function locateSuccess(pos) {
    var crd = pos.coords;
    locationPt = {
        'type': 'Feature',
        'geometry': {
            'type': 'Point',
            'coordinates': [ crd.longitude, crd.latitude]
        }
    };

    if (!map.getLayer('locationlayer')) {
        map.addLayer({
            "id": "locationlayer",
            "type": "circle",
            "source": {
                "type": "geojson",
                "data": locationPt,
            },
            "paint": {
                "circle-color": "#FF6600",
                "circle-radius": 12
            }
        }, 'location-label');
    } else {
        map.getLayer('locationlayer').setData(locationPt);
    }

};

function locateError() {}


text:
'use strict';
var express = require('express');
var AV = require('leanengine');
var router = express.Router();
var util = require('./util');
var https = require('https');
//验证码
var Geetest = require('../gt-sdk');

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

var User = AV.Object.extend('_User');
var messageObject = AV.Object.extend('messageObject');

var releaseTaskObject = AV.Object.extend('releaseTaskObject'); // 发布的库
var receiveTaskObject = AV.Object.extend('receiveTaskObject'); // 领取任务的库
var cashRecordObjectSql = AV.Object.extend('cashRecordObject');
var ASOPlanObjectSql = AV.Object.extend('ASOPlanObject');

var Base64 = require('../public/javascripts/vendor/base64').Base64;

var cookieTimeout = 1000*60*60*24*30;
// var cookieTimeout = 1000*60;

// 验证码
var pcGeetest = new Geetest({
    privateKey: '9889d9c10b5bcc33c12e3bcba6ac8d83',
    publicKey: 'c508c87580bd11dbaab2a40a02430af2'
});

router.get("/pc-geetest/register", function (req, res) {
    // 向极验申请一次验证所需的challenge
    pcGeetest.register(function (data) {
        res.send(JSON.stringify({
            gt: pcGeetest.publicKey,
            challenge: data.challenge,
            success: data.success
        }));
    });
});

// 用户注册
router.post('/getSmsCode', function(req, res) {
    var userphone = req.body.mobile;
    // 对form表单的结果进行验证
    pcGeetest.validate({

        challenge: req.body.geetest_challenge,
        validate: req.body.geetest_validate,
        seccode: req.body.geetest_seccode

    }, function (err, result) {
        if (err || !result) {
            console.error('------ 验证码服务error', err.message);
            res.json({'errorId':-100, 'errorMsg':'验证码服务出现问题'});
        } else {
            var query = new AV.Query(User);
            query.equalTo('username', userphone);
            query.first().then(function(userObject){
                if (userObject == undefined || userObject.length == 0){
                    //验证码正确才会发送短信,防止被攻击
                    AV.Cloud.requestSmsCode(userphone).then(function() {
                        //发送成功
                        res.json({'errorId':0, 'errorMsg':''});
                    }, function(error) {
                        //发送失败
                        res.json({'errorId':error.code, 'errorMsg':error.message});
                    });
                }else {
                    res.json({'errorId':1, 'errorMsg':'手机号码已存在'})
                }
            },function(error){
                res.json({'errorId':error.code, 'errorMsg':error.message});
            })

        }
    });

});

function userRegister(req, res, next){
    var userphone = req.body.mobile;
    var password = req.body.password;
    var smsCode = req.body.smsCode;
    var inviteUserId = util.decodeUserId(req.body.inviteCode);

    var user = new AV.User();
    user.signUpOrlogInWithMobilePhone({
        mobilePhoneNumber: userphone,
        smsCode: smsCode,
        password:password,
        username:userphone,
        feedingMoney:0,
        totalMoney:0,
        freezingMoney:0,
        registerBonus:'register_new',
        passwordEx:password,
        inviteUserId:inviteUserId
    }).then(function(user) {
        var user_id = user.id;
        //注册或者登录成功
        if(inviteUserId != undefined && inviteUserId.length > 0){
            var inviteUserObject = new AV.User();
            inviteUserObject.id = inviteUserId;
            inviteUserObject.increment('inviteCount', 1);
            inviteUserObject.save();
        }

        //encode userid
        var encodeUserId = Base64.encode(user_id);
        res.cookie('username', user.get('username'), { maxAge: cookieTimeout, path:'/'});
        res.cookie('userIdCookie', encodeUserId, { maxAge: cookieTimeout, path:'/'});
        res.json({'errorId':0, 'errorMsg':''});

    }, function(error) {
        // 失败
        res.json({'errorId':error.code, 'errorMsg':error.message});
    });
}

router.post('/register', function(req, res, next) {
    userRegister(req, res, next);
});

router.get('/', function(req, res, next) {
    res.render('userCenter');
});

//个人中心
router.get('/userCenter',function(req, res){
    var userId = util.useridInReq(req);
    var userNickname = req.body.userNickname;
    var userQQ = req.body.userQQ;

    var query = new AV.Query(User);
    query.get(userId).then(function(results){
        var PhoneNumber = results.get('mobilePhoneNumber');
        var userNickname = results.get('userNickname');
        var userQQ = results.get('userQQ');
        var balance = results.get('totalMoney');
        var freezingMoney = results.get('freezingMoney');
        var registerBonus = results.get('registerBonus');
        var inviteCount = results.get('inviteCount');
        var invitesucceedCount = results.get('inviteSucceedCount');
        var inviteSucceedCount = '';
        if (invitesucceedCount == undefined || invitesucceedCount == 0){
            inviteSucceedCount = 0;
        }else {
            inviteSucceedCount = invitesucceedCount
        }
        var freezingYB = '';
        if (freezingMoney == undefined || freezingMoney <= 0){
            freezingYB = 0;
        }else {
            freezingYB = freezingMoney;
        }

        //信誉系统
        var userReputation = results.get('reputation');
        if(userReputation == undefined){
            userReputation = 100;
        }

        var Administrator = results.get('isSellerChannel');

        res.json({'personAPP':PhoneNumber, 'userNickname':userNickname, 'userReputation': userReputation,'Administrator':Administrator,
            'userQQ':userQQ, 'balance': balance, 'userFreezingYB':freezingYB,
            'registerBonus':registerBonus, 'inviteCount':inviteCount, 'inviteSucceedCount':inviteSucceedCount
        });
    }, function(error){
        //失败
        res.json({'errorId':error.code, 'errorMsg':error.message});
    });
});

//个人中心用户保存信息
router.post('/userSaveInfo',function(req, res){
    var userId = util.useridInReq(req);
    var userNickname = req.body.userNickname;
    var userQQ = req.body.userQQ;

    var user = AV.Object.createWithoutData('User', userId);
    user.set('userNickname', userNickname);
    user.set('userQQ',userQQ);
    user.save().then(function(){
        //保存成功

        //cookie 30天有效期
        res.cookie('username', user.get('username'), { maxAge: cookieTimeout, path:'/'});
        if (userNickname != undefined && userNickname != ''){
            res.cookie('username', userNickname, { maxAge: cookieTimeout, path:'/'});
            res.cookie('uploadName', userNickname, { maxAge: cookieTimeout, path:'/'});
            //console.log('service ----- save do task nickname succeed', userNickname);
        }

        res.json({'errorId':0, 'errorMsg':''});
    },function(error){
        res.json({'errorId':-1, 'errorMsg':error.message});
    })

});

function dateCompare(DateA, DateB) {
    var a = new Date(DateA);
    var b = new Date(DateB);
    var msDateA = Date.UTC(a.getFullYear(), a.getMonth()+1, a.getDate());
    var msDateB = Date.UTC(b.getFullYear(), b.getMonth()+1, b.getDate());
    if (parseFloat(msDateA) < parseFloat(msDateB)) {
        if ((a.getDate() - b.getDate()) == -1) {
            return '昨天';
        }
        else {
            return a.getFullYear() + (a.getMonth() + 1) +  a.getDate() + '';
        }
    }// lt
    else if (parseFloat(msDateA) == parseFloat(msDateB)){
        return '今天';}  // eq
    else if (parseFloat(msDateA) > parseFloat(msDateB)){
        return '未来';} // gt
    else{
        return a.getFullYear() + (a.getMonth() + 1) +  a.getDate() + '';
    }
}

//个人中心获取信息
router.post('/userCenter/YCoinFlow/:page', function(req, res){
    var userId = util.useridInReq(req);
    var page = req.params.page;
    var checkType = req.body.checkType;

    var userObject = new AV.User();
    userObject.id = userId;

    var query_user = new AV.Query(messageObject);
    query_user.equalTo('receiverObject', userObject);

    var query_new = new AV.Query(messageObject);
    query_new.equalTo('receiverObjectId', userId);

    var query_message = AV.Query.or(query_user, query_new);
    query_message.descending('createdAt');
    query_message.include('receiverObject');
    query_message.skip(page * 50);
    query_message.limit(50);

    var queryCash = new AV.Query(cashRecordObjectSql);
    queryCash.equalTo('userId', userId);
    queryCash.descending('createdAt');
    queryCash.skip(page * 50);
    queryCash.limit(50);

    var query = new AV.Query(User);
    query.get(userId).then(function(userObject){
        if (checkType == 'Y币流水'){
            query_message.find().then(function(results){
                var YCoinMessages = Array();
                for (var i = 0; i < results.length; i++){
                    var messageObject = results[i];
                    var messageDicObject = Object();

                    messageDicObject.messageText = messageObject.get('messageText');
                    messageDicObject.type = messageObject.get('type');
                    //messageDicObject. = messageObject.get('');

                    messageDicObject.totalMoney = messageObject.get('totalMoney');
                    messageDicObject.freezingMoney = messageObject.get('freezingMoney');
                    messageDicObject.feedingMoney = messageObject.get('feedingMoney');

                    var messageDate = messageObject.createdAt;
                    messageDicObject.messageDateStr =
                        (messageDate.getMonth() + 1) + '-' + messageDate.getDate() + ' ' + messageDate.getHours() + ':' + messageDate.getMinutes();

                    //css
                    if(messageDicObject.type == '赚取'){
                        messageDicObject.rowClass = 'success';
                    }else if(messageDicObject.type == '解冻'){
                        messageDicObject.rowClass = 'info';
                    }else if(messageDicObject.type == '奖励'){
                        messageDicObject.rowClass = '';
                    }else if(messageDicObject.type == '扣罚'){
                        messageDicObject.rowClass = 'danger';
                    }else if(messageDicObject.type == '支付'){
                        messageDicObject.rowClass = 'danger';
                    }else if(messageDicObject.type == '冻结'){
                        messageDicObject.rowClass = 'warning';
                    }else if(messageDicObject.type == '充值'){
                        messageDicObject.rowClass = 'active';
                    }

                    YCoinMessages.push(messageDicObject);
                }

                if(userObject != undefined){
                    res.json({'YCoinMessages': YCoinMessages, 'totalMoney':userObject.get('totalMoney'),
                        'freezingMoney':userObject.get('freezingMoney'), 'feedingMoney':userObject.get('feedingMoney')});
                }else {
                    res.json({'YCoinMessages': YCoinMessages, 'totalMoney':0,
                        'freezingMoney':0, 'feedingMoney':0});
                }

            },function(error){
                res.json({'errorId': error.code, 'errorMsg': error.message});
            })
        }
        else if (checkType == '现金流水'){
            var lock = 0;
            queryCash.find().then(function(cashObject){
                var cashMessages = Array();
                if (cashObject == undefined || cashObject.length == 0){
                    res.json({'cashMessagesArray':cashMessages});
                    return;
                }
                for (var e = 0; e < cashObject.length; e++){
                    var cashMessageDicObject = Object();
                    cashMessageDicObject.type = cashObject[e].get('type');

                    var cashMessageTime = cashObject[e].createdAt;

                    if (cashMessageDicObject.type == '付费'){
                        cashMessageDicObject.planId = cashObject[e].get('planId');
                        cashMessageDicObject.costMoney = cashObject[e].get('costMoney');
                    }
                    else if (cashMessageDicObject.type == '充值'){
                        cashMessageDicObject.costMoney = cashObject[e].get('rechargeMoney');
                        cashMessageDicObject.messageText = '您充值了' + cashMessageDicObject.costMoney + '元';
                        cashMessageDicObject.cashMessageDate =
                            (cashMessageTime.getMonth() + 1) + '-' + cashMessageTime.getDate() + ' ' +
                            cashMessageTime.getHours() + ':' + cashMessageTime.getMinutes();
                    }
                    else if (cashMessageDicObject.type == '退款'){
                        cashMessageDicObject.costMoney = cashObject[e].get('refundMoney');
                        cashMessageDicObject.messageText = cashObject[e].get('refundMessage');
                        cashMessageDicObject.planId = cashObject[e].get('planId')
                    }
                    else if (cashMessageDicObject.type == '积分兑换'){
                        cashMessageDicObject.costMoney = cashObject[e].get('rechargeMoney');
                        cashMessageDicObject.costPointer = cashObject[e].get('costPointer');
                        cashMessageDicObject.messageText = '您花费' + cashMessageDicObject.costPointer + '积分兑换' +
                            cashMessageDicObject.costMoney + '现金券';
                        cashMessageDicObject.cashMessageDate =
                            (cashMessageTime.getMonth() + 1) + '-' + cashMessageTime.getDate() + ' ' +
                            cashMessageTime.getHours() + ':' + cashMessageTime.getMinutes();
                    }

                    (function messageDicObject(tempMessageDicObject){
                        var projectSwingNow = 0;
                        if (tempMessageDicObject.planId == undefined){
                            lock++;
                            cashMessages.push(tempMessageDicObject)
                        }else {
                            var queryASOPlan = new AV.Query(ASOPlanObjectSql);
                            queryASOPlan.include('appObject');
                            queryASOPlan.get(tempMessageDicObject.planId).then(function(ASOPlanInfo){

                                var planName = ASOPlanInfo.get('appObject').get('trackName');
                                var taskCountPerDay = ASOPlanInfo.get('taskCountPerDay');
                                if (tempMessageDicObject.type != '退款')
                                    tempMessageDicObject.messageText = '您投放了计划:' + planName + ',共' + taskCountPerDay + '条';

                                var planStatus = ASOPlanInfo.get('planDeliverStatus');
                                if (planStatus != 'planEnd'){
                                    projectSwingNow ++
                                }

                                var time = ASOPlanInfo.createdAt;
                                tempMessageDicObject.cashMessageDate =
                                    (time.getMonth() + 1) + '-' + time.getDate() + ' ' + time.getHours() + ':' + time.getMinutes();

                                cashMessages.push(tempMessageDicObject);

                                lock++;
                                if (lock == cashObject.length){
                                    res.json({'cashMessagesArray':cashMessages, 'projectSwingNow':projectSwingNow})
                                }

                            },function(error){
                                lock++;
                                if (lock == cashObject.length) {
                                    console.error('cash logger error ', error.message);
                                    res.json({'cashMessagesArray':cashMessages, 'projectSwingNow':projectSwingNow})
                                }
                            })
                        }

                    })(cashMessageDicObject);
                }
            },function(error){
                res.json({'errorId': error.code, 'errorMsg': error.message});
            })
        }
    },function(error){
        res.json({'errorId': error.code, 'errorMsg': error.message});
    });
});

//// 任务历史
//router.get('/taskhistory', function(req, res){
//  var userId = util.useridInReq(req);
//
//  var user = new AV.User();
//  user.id = userId;
//
//  var query = new AV.Query(releaseTaskObject);
//  query.equalTo('userObject', user);
//  query.include('appObject');
//  query.equalTo('completed', 1);
//  query.descending('createdAt');
//  query.find().then(function(results){
//    var promise = results.length;
//    var counter = 0;
//    var retApps = new Array();
//    for (var i = 0; i < results.length; i++){
//      var historyObject = new Object();
//      var appInfo = results[i].get('appObject');
//      historyObject.trackName = appInfo.get('trackName').substr(0,8);
//      historyObject.artworkUrl100 = appInfo.get('artworkUrl100');
//
//      historyObject.totalCount = results[i].get('excCount');
//      historyObject.taskType = results[i].get('taskType');
//      historyObject.date = results[i].get('releaseDate');
//      historyObject.taskid = results[i].id;
//
//      // 谁领取了我的任务
//      (function(whoReceive){
//        whoReceive.receiveTasks = new Array();
//        var todo = AV.Object.createWithoutData('releaseTaskObject', whoReceive.taskid);
//        var query_receive = new AV.Query(receiveTaskObject);
//        query_receive.equalTo('taskObject', todo);
//        query_receive.include('userObject');
//        query_receive.find().then(function(receiveInfo){
//          for (var e = 0; e < receiveInfo.length; e++){
//            var receiveObject = new Object();
//            var userInfo = receiveInfo[e].get('userObject');
//            var user_name = userInfo.get('userNickname');
//            if (user_name == undefined || user_name == ''){
//              receiveObject.userName = userInfo.get('username').substring(0, 7) + '****';
//            }else {
//              receiveObject.userName = user_name;
//            }
//            receiveObject.receiveCount = receiveInfo[e].get('receiveCount');
//            var status = receiveInfo[e].get('completed');
//            if (status == 1){
//              receiveObject.status = '完成'
//            }else {
//              receiveObject.status = '未完成'
//            }
//            whoReceive.receiveTasks.push(receiveObject);
//          }
//          retApps.push(whoReceive);
//          counter++;
//          if (counter == promise){
//            res.json({'errorMsg':'', 'errorId': 0, 'ReleaseTaskHistory':retApps})
//          }
//        }, function(error){
//          counter++;
//          res.json({'errorMsg':error.message, 'errorId': error.code});
//        })
//      })(historyObject)
//    }
//
//      res.json({'errorMsg':'', 'errorId': 0, 'ReleaseTaskHistory':[]})
//  }, function(error){
//    res.json({'errorMsg':error.message, 'errorId': error.code});
//  })
//});

router.get('/register', function(req, res, next) {
    //res.send('user register :' + encodeUserId);
    res.render('register');
});

router.get('/register/:inviteUserId', function(req, res, next) {
    res.render('register');
});

router.get('/login', function(req, res, next) {
    res.render('login');
});

router.post('/login', function(req, res) {
    var userPhone = req.body.mobile;
    var password = req.body.password;

    if (userPhone == undefined || userPhone == '' || password == undefined || password == ''){
        res.json({'errorId':-1, 'errorMsg':'请输入帐号和密码'});
    }else {
        AV.User.logIn(userPhone, password).then(function(user) {
            // 成功了,现在可以做其他事情了
            var user_id = user.id;
            //encode userid
            var encodeUserId = Base64.encode(user_id);
            var userNickname = user.get('userNickname');
            //login succeed,response cookie to browser
            //cookie 30天有效期
            res.cookie('username', user.get('username'), { maxAge: cookieTimeout, path:'/'});
            res.cookie('userIdCookie', encodeUserId, { maxAge: cookieTimeout, path:'/'});
            if (userNickname != undefined && userNickname != ''){
                res.cookie('username', userNickname, { maxAge: cookieTimeout, path:'/'});
            }

            res.json({'errorId':0, 'errorMsg':''});
        }, function(error) {
            // 失败了
            res.json({'errorId':error.code, 'errorMsg':error.message});
        });
    }
});

router.get('/forget', function(req, res, next) {

    //获取cookie的值
    var encodeUserId = req.cookies.userIdCookie;

    //鉴别cookie是否存在
    if ('undefined' == (typeof req.cookies.userIdCookie)){
        res.send('cookie not exist,need relogin');
    }

    var user_id = Base64.decode(encodeUserId);

    //do the case

    res.send('user id =' + user_id);
});

router.get('/forgetSecret', function(req, res, next) {
    res.render('forgetSecret');
});

router.post('/getNewSmsCode', function(req, res, next) {
    var userphone = req.body.mobile;
    AV.User.requestPasswordResetBySmsCode(userphone).then(function() {
        // 密码重置请求已成功发送
        res.json({'errorId':0, 'errorMsg':''});
    }, function(error) {
        // 记录失败信息
        console.error('send new sms error: ' + error.code + ' ' + error.message);
        res.json({'errorId':error.code, 'errorMsg':error.message});
    });

});

// 重置密码
router.post('/forgetSecret', function(req, res, next) {
    var smsCode = req.body.smsCode;
    var newSecret = req.body.newPassword;
    AV.User.resetPasswordBySmsCode(smsCode, newSecret, {
        success: function(success) {
            // 密码被成功更新,debug sucess 返回的是不是用户
            //TODO: passwordEx:password 新密码记录到passwordEx中
            var userObject = new User();
            userObject.id = success.objectId;
            userObject.set('passwordEx', newSecret);
            userObject.save().then(function () {
                res.json({'errorId':0, 'errorMsg':''});
            }, function (error) {
                res.json({'errorId':0, 'errorMsg':''});
            });

        },
        error: function(error) {
            // 记录失败信息
            console.error('Error: ' + error.code + ' ' + error.message);
            res.json({'errorId':error.code, 'errorMsg':error.message});
        }
    });
});

module.exports = router;


text:
#include "third_party/blink/renderer/core/editing/commands/replace_node_with_span_command.h"

#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/html/html_span_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"

namespace blink {

ReplaceNodeWithSpanCommand::ReplaceNodeWithSpanCommand(HTMLElement* element)
    : SimpleEditCommand(element->GetDocument()), element_to_replace_(element) {
  DCHECK(element_to_replace_);
}

static void SwapInNodePreservingAttributesAndChildren(
    HTMLElement* new_element,
    HTMLElement& element_to_replace) {
  DCHECK(element_to_replace.isConnected()) << element_to_replace;
  ContainerNode* parent_node = element_to_replace.parentNode();
  parent_node->InsertBefore(new_element, &element_to_replace);

  NodeVector children;
  GetChildNodes(element_to_replace, children);
  for (const auto& child : children)
    new_element->AppendChild(child);

  // FIXME: Fix this to send the proper MutationRecords when MutationObservers
  // are present.
  new_element->CloneAttributesFrom(element_to_replace);

  parent_node->RemoveChild(&element_to_replace, ASSERT_NO_EXCEPTION);
}

void ReplaceNodeWithSpanCommand::DoApply(EditingState*) {
  if (!element_to_replace_->isConnected())
    return;
  if (!span_element_) {
    span_element_ = MakeGarbageCollected<HTMLSpanElement>(
        element_to_replace_->GetDocument());
  }
  SwapInNodePreservingAttributesAndChildren(span_element_.Get(),
                                            *element_to_replace_);
}

void ReplaceNodeWithSpanCommand::DoUnapply() {
  if (!span_element_->isConnected())
    return;
  SwapInNodePreservingAttributesAndChildren(element_to_replace_.Get(),
                                            *span_element_);
}

void ReplaceNodeWithSpanCommand::Trace(Visitor* visitor) {
  visitor->Trace(element_to_replace_);
  visitor->Trace(span_element_);
  SimpleEditCommand::Trace(visitor);
}

}  // namespace blink


text:
'use strict';
module.exports = function(sequelize, DataTypes) {
     const crypto = require('crypto');

  var User = sequelize.define('User', {
    firstname:{
      type: DataTypes.STRING,
      validate: {isAlphanumeric: true}
    },
    lastname: {
      type: DataTypes.STRING,
      validate: {isAlphanumeric: true}
    },
    salt: {
      type: DataTypes.BIGINT,
    },
     password: {
      type: DataTypes.STRING,
    },
    email:{
      type: DataTypes.STRING,
      validate: {isEmail:true}
    },
    phonenumber: DataTypes.STRING
  }, {
    classMethods: {
      associate: function(models) {
        // associations can be defined here
      User.belongsTo(models.Store)
      User.hasMany(models.Challenge, {foreignKey:'challengerId'});
      User.hasMany(models.Challenge, {foreignKey:'challengedId'});

      User.belongsToMany(models.Game, {through: 'UserGame'})
      },
      fullname(){
        return `${this.firstname} ${this.lastname}`;
      },
      createPasswordSalt: ()=>{
         let randomValueHex  = (len)=> {
           return crypto.randomBytes(Math.ceil(len/2))
           .toString('hex') // convert to hexadecimal format
            .slice(0,len);   // return required number of characters
        }
        return randomValueHex(34);
        },
      encryptPassword: function(password, salt){
          return crypto.pbkdf2Sync(password, salt, 100000, 512, 'sha512');
      }
    }
  });
  return User;
};


text:
package org.canova.hadoop.records.reader;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.StringTokenizer;

import org.canova.api.conf.Configuration;
import org.canova.api.io.data.DoubleWritable;
import org.canova.api.io.data.Text;
import org.canova.api.records.reader.impl.LineRecordReader;
import org.canova.api.split.InputSplit;
//import org.canova.api.records.reader.impl.SVMLightRecordReader;
import org.canova.api.writable.Writable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SVMLightRecordReader extends LineRecordReader {

    private static Logger log = LoggerFactory.getLogger(SVMLightRecordReader.class);

    public SVMLightRecordReader() {
    }

    @Override
    public void initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException {
        initialize(split);
    }

    @Override
    public boolean hasNext() {
    //    return iter != null && iter.hasNext();
    	return false;
    }

    /**
     * next() method for getting another K/V pair off disk from the SVMLight text file
     *
     */
    @Override
    public Collection<Writable> next() {

        Text t =  (Text) super.next().iterator().next();

        String val = new String(t.getBytes());
        Collection<Writable> ret = new ArrayList<>();
        StringTokenizer tok;
        int	index,max;
        String	col;
        double	value;

        // actual data
        try {
            // determine max index
            max = 0;
            tok = new StringTokenizer(val, " \t");
            tok.nextToken();  // skip class
            while (tok.hasMoreTokens()) {
                col = tok.nextToken();
                // finished?
                if (col.startsWith("#"))
                    break;
                // qid is not supported
                if (col.startsWith("qid:"))
                    continue;
                // actual value
                index = Integer.parseInt(col.substring(0, col.indexOf(":")));
                if (index > max)
                    max = index;
            }

            // read values into array
            tok    = new StringTokenizer(val, " \t");

            // 1. class
            double classVal = Double.parseDouble(tok.nextToken());

            // 2. attributes
            while (tok.hasMoreTokens()) {
                col  = tok.nextToken();
                // finished?
                if (col.startsWith("#"))
                    break;
                // qid is not supported
                if (col.startsWith("qid:"))
                    continue;
                // actual value
                index = Integer.parseInt(col.substring(0, col.indexOf(":")));
                value = Double.parseDouble(col.substring(col.indexOf(":") + 1));
                ret.add(new DoubleWritable(value));
            }

            ret.add(new DoubleWritable(classVal));
        }
        catch (Exception e) {
            log.error("Error parsing line '" + val + "': ",e);
        }

        return ret;
    }

}


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

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle" >
            <solid android:color="@android:color/transparent" />
        </shape>
    </item>

    <item android:top="-2dp" android:right="-2dp" android:left="-2dp">
        <shape>
            <solid android:color="@android:color/transparent" />
            <stroke
                android:width="1dp"
                android:color="#90ffffff" />
        </shape>
    </item>
</layer-list>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.analytics.synapse.artifacts.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Expression type. */
public final class ExpressionType extends ExpandableStringEnum<ExpressionType> {
    /** Static value Expression for ExpressionType. */
    public static final ExpressionType EXPRESSION = fromString("Expression");

    /**
     * Creates or finds a ExpressionType from its string representation.
     *
     * @param name a name to look for.
     * @return the corresponding ExpressionType.
     */
    @JsonCreator
    public static ExpressionType fromString(String name) {
        return fromString(name, ExpressionType.class);
    }

    /**
     * Gets known ExpressionType values.
     *
     * @return known ExpressionType values.
     */
    public static Collection<ExpressionType> values() {
        return values(ExpressionType.class);
    }
}


text:
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("CacheCow.Server.EntityTagStore.Memcached12")]
[assembly: AssemblyDescription("Memcached persistence for server-side CacheCow [For version 1.2 of Memcached server]")]

#if BUILDTESTS
[assembly: InternalsVisibleTo("CacheCow.Server.EntityTagStore.Memcached.Tests")]
#endif


text:
BEGIN;
CREATE TABLE `advisory` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `message_id` integer NOT NULL,
    `app_id` integer NOT NULL,
    `version` varchar(25) NOT NULL,
    `text` longtext NOT NULL
);
CREATE TABLE `app` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(150) NOT NULL UNIQUE
);
ALTER TABLE `advisory` ADD CONSTRAINT app_id_refs_id_63421648 FOREIGN KEY (`app_id`) REFERENCES `app` (`id`);
CREATE TABLE `app_version` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `app_id` integer NOT NULL REFERENCES `app` (`id`),
    `version` varchar(50) NOT NULL
);
CREATE TABLE `message_type` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(25) NOT NULL UNIQUE,
    `description` longtext NOT NULL
);
CREATE TABLE `user_criteria` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `criteria_id` integer NOT NULL,
    `criteria_value_id` integer NOT NULL
);
CREATE TABLE `source` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(50) NOT NULL,
    `url` varchar(100) NOT NULL,
    `desc` varchar(150) NOT NULL,
    `type_id` integer NOT NULL REFERENCES `message_type` (`id`)
);
CREATE TABLE `user` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `email` varchar(75) NOT NULL UNIQUE
);
ALTER TABLE `user_criteria` ADD CONSTRAINT user_id_refs_id_4baa58fe FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
CREATE TABLE `criteria` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(50) NOT NULL UNIQUE,
    `desc` longtext NOT NULL,
    `type` varchar(50) NOT NULL
);
ALTER TABLE `user_criteria` ADD CONSTRAINT criteria_id_refs_id_3413a524 FOREIGN KEY (`criteria_id`) REFERENCES `criteria` (`id`);
CREATE TABLE `message` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `text` longtext NOT NULL,
    `subject` varchar(250) NOT NULL UNIQUE,
    `body` longtext NOT NULL,
    `type_id` integer NOT NULL REFERENCES `message_type` (`id`),
    `source_id` integer NOT NULL REFERENCES `source` (`id`),
    `processed` bool NOT NULL
);
ALTER TABLE `advisory` ADD CONSTRAINT message_id_refs_id_2a949678 FOREIGN KEY (`message_id`) REFERENCES `message` (`id`);
CREATE TABLE `criteria_value` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `criteria_id` integer NOT NULL REFERENCES `criteria` (`id`),
    `value` varchar(50) NOT NULL,
    `user_id` integer NOT NULL REFERENCES `user` (`id`)
);
ALTER TABLE `user_criteria` ADD CONSTRAINT criteria_value_id_refs_id_6742b210 FOREIGN KEY (`criteria_value_id`) REFERENCES `criteria_value` (`id`);
COMMIT;


text:
from rdfalchemy import (
    Namespace,
    rdfSingle,
    rdfMultiple
)
from rdfalchemy.rdfsSubject import rdfsSubject

DC = Namespace('http://purl.org/dc/terms/')
BIBO = Namespace('http://purl.org/ontology/bibo/')
FOAF = Namespace('http://xmlns.com/foaf/0.1/')
SKOS = Namespace('http://www.w3.org/2004/02/skos/core#')

class Document(rdfsSubject):
    rdf_type = BIBO.Document
    title = rdfSingle(DC['title'])
    alt_titles = rdfMultiple(DC.alt)
    date = rdfSingle(DC.date)
    issued = rdfSingle(DC.issued)
    modified = rdfSingle(DC.modified)
    creators = rdfMultiple(DC.creator)
    authorList = rdfMultiple(BIBO.authorList)
    subjects = rdfMultiple(DC.subject, range_type=SKOS.Concept)

class Book(Document):
    rdf_type = BIBO.Book
    publisher = rdfSingle(DC.publisher, range_type=FOAF.Organization)
    series = rdfSingle(DC.isPartOf, range_type=BIBO.Series)

x = Book(title="Some Title")
y = Document(title="Another Title")

def len_test():
    assert len(list(Document.ClassInstances())) == 2,\
        "wanted 2 ... one book and one document"

for document in Document.ClassInstances():
    print(document.title)


text:
var request = require('request');
var url = 'http://ipinfo.io';

module.exports = function (callback) {
  return new Promise(function (resolve, reject) {
    request({
      url: url,
      json: true
    }, function (error, response, body) {
      if (error) {
        reject('Unable to guess location');
      } else {
        resolve(body);
      }
    });
  });
}


text:
package org.redisson.api;

/**
 *
 * @author Nikita Koksharov
 *
 */
public class RateLimiterConfig {

    private RateType rateType;
    private Long rateInterval;
    private Long rate;

    public RateLimiterConfig(RateType rateType, Long rateInterval, Long rate) {
        super();
        this.rateType = rateType;
        this.rateInterval = rateInterval;
        this.rate = rate;
    }

    /**
     * Returns current rate type set through {@link RRateLimiter#trySetRate(RateType, long, long, RateIntervalUnit)}
     * or {@link RRateLimiter#trySetRateAsync(RateType, long, long, RateIntervalUnit)} method.
     *
     * @return rate type
     */
    public RateType getRateType() {
        return rateType;
    }

    /**
     * Returns current rate time interval value set through {@link RRateLimiter#trySetRate(RateType, long, long, RateIntervalUnit)}
     * or {@link RRateLimiter#trySetRateAsync(RateType, long, long, RateIntervalUnit)} method.
     *
     * @return rate time interval in milliseconds
     */
    public Long getRateInterval() {
        return rateInterval;
    }

    /**
     * Returns current rate value set through {@link RRateLimiter#trySetRate(RateType, long, long, RateIntervalUnit)}
     * or {@link RRateLimiter#trySetRateAsync(RateType, long, long, RateIntervalUnit)} method.
     *
     * @return rate
     */
    public Long getRate() {
        return rate;
    }

}


text:
@interface __MediaView : UIView

@end

@implementation __MediaView

+ (Class)layerClass
{
    return [AVPlayerLayer class];
}

@end

#pragma mark - HHPlayerView

@implementation HHPlayerView
{
    BOOL _isInitalized;
    CGRect _preFrame;
    UIView *_statusBarView;
}

- (void)__destroyProperty
{
    self.backgroundView = nil;
    self.controlView = nil;
    self.navigationView = nil;
}

- (void)__destroyVariable
{
    [_mediaView release], _mediaView = nil;
    [_statusBarView release], _statusBarView = nil;
}

- (void)dealloc
{
    [self __destroyVariable];
    [self __destroyProperty];
    [super dealloc];
}

#pragma mark - Private Methods

- (void)__setPlayer:(AVPlayer *)player
{
    [(AVPlayerLayer *)_mediaView.layer setPlayer:player];
    [(AVPlayerLayer *)_mediaView.layer setVideoGravity:AVLayerVideoGravityResizeAspect];
}

- (void)__initBackgroundView
{
    _backgroundView = [[HHPlayerBGView alloc] initWithFrame:CGRectMake(0, 0, _width, _height)];
    [self addSubview:_backgroundView];
    _airplayActiveView = [[HHAirplayActiveView alloc] initWithFrame:CGRectMake(0.f, 0.f, _width, _height) indicatorTitle:INDICATOR_TITLE];
    [_airplayActiveView setHidden:YES];
    [self addSubview:_airplayActiveView];
}

- (void)__initMediaView
{
    _mediaView.frame = CGRectMake(0, 0, _width, _height);
    [self addSubview:_mediaView];
}

- (void)__initNavigationView
{
    _statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, _width, 44.f)];
    [_statusBarView setBackgroundColor:[UIColor blackColor]];
    _statusBarView.hidden = YES;
    [self addSubview:_statusBarView];

    _navigationView = [[HHPlayerNavView alloc] initWithFrame:CGRectMake(0.f, 20.f, _width, 44.f)];
    [_navigationView setHidden:YES];
    [self addSubview:_navigationView];
}

- (void)__initControlView
{
    _controlView = [[HHPlayerControlView alloc] initWithFrame:CGRectMake(0.f, _height - 78.f, _width, 78.f)];
    [self addSubview:_controlView];
}

- (void)__initalize
{
    _isInitalized = YES;
    [self __initBackgroundView];
    [self __initMediaView];
    [self __initControlView];
    [self __initNavigationView];
}

- (void)__layoutSubViews
{
    _statusBarView.frame = CGRectMake(0.f, 0.f, _width, 20.f);

    _backgroundView.frame = CGRectMake(0, 0, _width, _height);
    _airplayActiveView.frame = CGRectMake(0, 0, _width, _height);
    _mediaView.frame = CGRectMake(0, 0, _width, _height);
    _navigationView.frame = CGRectMake(0.f, 20.f, _width, NAV_VIEW_H);
    _controlView.frame = CGRectMake(0.f, _height - CONTROL_VIEW_H, _width, CONTROL_VIEW_H);
}

#pragma mark - Super Methods

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

        _width = CGRectGetWidth(frame);
        _height = CGRectGetHeight(frame);

        [self setBackgroundColor:[UIColor clearColor]];
        _mediaView = [__MediaView new];
    }
    return self;
}

#pragma mark - Setter and Getter

- (void)setFrame:(CGRect)frame
{
    if (CGRectIsEmpty(frame)) return;

    [super setFrame:frame];
    _width = CGRectGetWidth(frame);
    _height = CGRectGetHeight(frame);

    if (_isInitalized) {
        [self __layoutSubViews];
    } else {
        [self __initalize];
    }
}

- (void)setScalingMode:(HHMovieScalingMode)scalingMode
{
    _scalingMode = scalingMode;

    NSString *videoGravity = nil;
    switch (scalingMode) {
        case HHMovieScalingModeNone:
            videoGravity = nil;
            break;
        case HHMovieScalingModeAspectFit:
            videoGravity = AVLayerVideoGravityResizeAspect;
            break;
        case HHMovieScalingModeAspectFill:
            videoGravity = AVLayerVideoGravityResizeAspectFill;
            break;
        case HHMovieScalingModeFill:
            videoGravity = AVLayerVideoGravityResize;
            break;
    }

    [(AVPlayerLayer *)_mediaView.layer setVideoGravity:videoGravity];
}

- (void)setBackgroundView:(HHPlayerBGView *)backgroundView
{
    if (_backgroundView != backgroundView) {
        [_backgroundView removeFromSuperview];
        [_backgroundView release], _backgroundView = nil;
    }
}

- (void)setNavigationView:(HHPlayerNavView *)navigationView
{
    if (_navigationView) {
        [_navigationView release], _navigationView = nil;
    }
    _navigationView = [navigationView retain];

    [self setNeedsLayout];
}

- (void)setControlView:(HHPlayerControlView *)controlView
{
    if (_controlView) {
        [_controlView release], _controlView = nil;
    }
    _controlView = [controlView retain];

    [self setNeedsLayout];
}

- (BOOL)isFullScreen
{
    CGFloat h = CGRectGetHeight([[UIScreen mainScreen] applicationFrame]);
    return (_width == h);
}

- (NSTimeInterval)controlViewHideAnimationDuration
{
    return ANIMATION_TIME_INTERVAL;
}

#pragma mark - Public Methods

- (void)becomeFullScreenWithAnimation:(BOOL)animation
{
    if (animation) {
        self.userInteractionEnabled = NO;
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:ANIMATION_TIME_INTERVAL];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(showControlView)];
        [self hideControlView];
    }

    _preFrame = self.frame;
    CGFloat w = CGRectGetHeight([UIScreen mainScreen].applicationFrame);
    CGFloat h = CGRectGetWidth([UIScreen mainScreen].applicationFrame);
    [self setFrame:CGRectMake(0.f, 0.f, w, h + 20.f)];

    if (animation) {
        [UIView commitAnimations];
    } else {
        self.navigationView.hidden = NO;
    }
}

- (void)resignFullScreenWithAnimation:(BOOL)animation
{
    if (animation) {
        self.userInteractionEnabled = NO;
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:ANIMATION_TIME_INTERVAL];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(showControlView)];
        [self setFrame:_preFrame];
        [self hideControlView];
        [UIView commitAnimations];
    } else {
        self.frame = _preFrame;
    }
}

- (void)hideControlView
{
    _isHideControl = YES;

    self.controlView.hidden = YES;
    self.navigationView.hidden = YES;

    _statusBarView.hidden = YES;
    [[UIApplication sharedApplication] setStatusBarHidden:[self isFullScreen]];
}

- (void)showControlView
{
    self.userInteractionEnabled = YES;
    _isHideControl = NO;

    self.controlView.hidden = NO;
    self.navigationView.hidden = ![self isFullScreen];
    _statusBarView.hidden = ![self isFullScreen];
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}

#pragma mark -

@end


text:
import {FootControlDevice} from './foot_control_device';
import {PowerMic3Device} from './powermic_3_device';
import {SpeechMikeGamepadDevice} from './speechmike_gamepad_device';
import {SpeechMikeHidDevice} from './speechmike_hid_device';

export type DictationDevice =|SpeechMikeHidDevice|SpeechMikeGamepadDevice|
    PowerMic3Device|FootControlDevice;


text:
BOOL GCGuild::Read( SocketInputStream& iStream )
{
__ENTER_FUNCTION

    m_GuildPacket.Read( iStream );
    return TRUE;

__LEAVE_FUNCTION

    return FALSE;
}

BOOL GCGuild::Write( SocketOutputStream& oStream ) const
{
__ENTER_FUNCTION

    m_GuildPacket.Write( oStream );
    return TRUE;

__LEAVE_FUNCTION

    return FALSE;
}

UINT GCGuild::Execute( Player* pPlayer )
{
__ENTER_FUNCTION

    return GCGuildHandler::Execute( this, pPlayer );

__LEAVE_FUNCTION

    return FALSE;
}


text:
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
    var c = arguments.length,
        r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
        d;
    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
        if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    }return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = this && this.__metadata || function (k, v) {
    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, ElementRef, Renderer } from '@angular/core';
import { Animation } from '../../animations/animation';
import { Transition } from '../../transitions/transition';
import { Config } from '../../config/config';
import { isPresent } from '../../util/util';
import { NavParams } from '../nav/nav-params';
import { NavController } from '../nav/nav-controller';
import { ViewController } from '../nav/view-controller';
/**
 * @name Toast
 * @description
 * A Toast is a subtle notification commonly used in modern applications.
 * It can be used to provide feedback about an operation or to
 * display a system message. The toast appears on top of the app's content,
 * and can be dismissed by the app to resume user interaction with
 * the app.
 *
 * ### Creating
 * All of the toast options should be passed in the first argument of
 * the create method: `Toast.create(opts)`. The message to display should be
 * passed in the `message` property. The `showCloseButton` option can be set to
 * true in order to display a close button on the toast. See the [create](#create)
 * method below for all available options.
 *
 * ### Positioning
 * Toasts can be positioned at the top, bottom or middle of the
 * view port. The position can be passed to the `Toast.create(opts)` method.
 * The position option is a string, and the values accepted are `top`, `bottom` and `middle`.
 * If the position is not specified, the toast will be displayed at the bottom of the view port.
 *
 * ### Dismissing
 * The toast can be dismissed automatically after a specific amount of time
 * by passing the number of milliseconds to display it in the `duration` of
 * the toast options. If `showCloseButton` is set to true, then the close button
 * will dismiss the toast. To dismiss the toast after creation, call the `dismiss()`
 * method on the Toast instance. The `onDismiss` function can be called to perform an action after the toast
 * is dismissed.
 *
 * @usage
 * ```ts
 * constructor(nav: NavController) {
 *   this.nav = nav;
 * }
 *
 * presentToast() {
 *   let toast = Toast.create({
 *     message: 'User was added successfully',
 *     duration: 3000,
 *     position: 'top'
 *   });
 *
 *   toast.onDismiss(() => {
 *     console.log('Dismissed toast');
 *   });
 *
 *   this.nav.present(toast);
 * }
 * ```
 *
 * @demo /docs/v2/demos/toast/
 */
export var Toast = function (_ViewController) {
    _inherits(Toast, _ViewController);

    function Toast() {
        var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

        _classCallCheck(this, Toast);

        opts.dismissOnPageChange = isPresent(opts.dismissOnPageChange) ? !!opts.dismissOnPageChange : false;

        // set the position to the bottom if not provided

        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Toast).call(this, ToastCmp, opts));

        if (!opts.position || !_this.isValidPosition(opts.position)) {
            opts.position = TOAST_POSITION_BOTTOM;
        }
        _this.viewType = 'toast';
        _this.isOverlay = true;
        _this.usePortal = true;
        // by default, toasts should not fire lifecycle events of other views
        // for example, when an toast enters, the current active view should
        // not fire its lifecycle events because it's not conceptually leaving
        _this.fireOtherLifecycles = false;
        return _this;
    }
    /**
    * @private
    */

    _createClass(Toast, [{
        key: "getTransitionName",
        value: function getTransitionName(direction) {
            var key = 'toast' + (direction === 'back' ? 'Leave' : 'Enter');
            return this._nav && this._nav.config.get(key);
        }
        /**
        * @private
        */

    }, {
        key: "isValidPosition",
        value: function isValidPosition(position) {
            return position === TOAST_POSITION_TOP || position === TOAST_POSITION_MIDDLE || position === TOAST_POSITION_BOTTOM;
        }
        /**
         * @param {string} message  Toast message content
         */

    }, {
        key: "setMessage",
        value: function setMessage(message) {
            this.data.message = message;
        }
        /**
         *
         *  Toast options
         *
         *  | Property              | Type      | Default         | Description                                                                                |
         *  |-----------------------|-----------|-----------------|---------------------------------------------------------------------------------------------------------------|
         *  | message               | `string`  | -               | The message for the toast. Long strings will wrap and the toast container will expand.                        |
         *  | duration              | `number`  | -               | How many milliseconds to wait before hiding the toast. By default, it will show until `dismiss()` is called.  |
         *  | position              | `string`  | "bottom"        | The position of the toast on the screen. Accepted values: "top", "middle", "bottom".                          |
         *  | cssClass              | `string`  | -               | Any additional class for custom styles.                                                                       |
         *  | showCloseButton       | `boolean` | false           | Whether or not to show a button to close the toast.                                                           |
         *  | closeButtonText       | `string`  | "Close"         | Text to display in the close button.                                                                          |
         *  | dismissOnPageChange   | `boolean` | false           | Whether to dismiss the toast when navigating to a new page.                                                   |
         *
         * @param {object} opts Toast options. See the above table for available options.
         */

    }], [{
        key: "create",
        value: function create() {
            var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

            return new Toast(opts);
        }
    }]);

    return Toast;
}(ViewController);
/* Don't expose these for now - let's move to an enum or something long term */
var TOAST_POSITION_TOP = 'top';
var TOAST_POSITION_MIDDLE = 'middle';
var TOAST_POSITION_BOTTOM = 'bottom';
/**
* @private
*/
var ToastCmp = function () {
    function ToastCmp(_nav, _viewCtrl, _config, _elementRef, params, renderer) {
        _classCallCheck(this, ToastCmp);

        this._nav = _nav;
        this._viewCtrl = _viewCtrl;
        this._config = _config;
        this._elementRef = _elementRef;
        this.dismissTimeout = undefined;
        this.d = params.data;
        if (this.d.cssClass) {
            renderer.setElementClass(_elementRef.nativeElement, this.d.cssClass, true);
        }
        this.id = ++toastIds;
        if (this.d.message) {
            this.hdrId = 'toast-hdr-' + this.id;
        }
    }

    _createClass(ToastCmp, [{
        key: "ngAfterViewInit",
        value: function ngAfterViewInit() {
            var _this2 = this;

            // if there's a `duration` set, automatically dismiss.
            if (this.d.duration) {
                this.dismissTimeout = setTimeout(function () {
                    _this2.dismiss('backdrop');
                }, this.d.duration);
            }
            this.enabled = true;
        }
    }, {
        key: "ionViewDidEnter",
        value: function ionViewDidEnter() {
            var _document = document;
            var activeElement = _document.activeElement;

            if (activeElement) {
                activeElement.blur();
            }
            var focusableEle = this._elementRef.nativeElement.querySelector('button');
            if (focusableEle) {
                focusableEle.focus();
            }
        }
    }, {
        key: "cbClick",
        value: function cbClick() {
            if (this.enabled) {
                this.dismiss('close');
            }
        }
    }, {
        key: "dismiss",
        value: function dismiss(role) {
            clearTimeout(this.dismissTimeout);
            this.dismissTimeout = undefined;
            return this._viewCtrl.dismiss(null, role);
        }
    }]);

    return ToastCmp;
}();
ToastCmp = __decorate([Component({
    selector: 'ion-toast',
    template: "\n
\n
\n
{{d.message}}
\n        <button clear class=\"toast-button\" *ngIf=\"d.showCloseButton\" (click)=\"cbClick()\">\n          {{ d.closeButtonText || 'Close' }}\n         </button>\n
\n
\n  ",
    host: {
        'role': 'dialog',
        '[attr.aria-labelledby]': 'hdrId',
        '[attr.aria-describedby]': 'descId'
    }
}), __metadata('design:paramtypes', [typeof (_a = typeof NavController !== 'undefined' && NavController) === 'function' && _a || Object, typeof (_b = typeof ViewController !== 'undefined' && ViewController) === 'function' && _b || Object, typeof (_c = typeof Config !== 'undefined' && Config) === 'function' && _c || Object, typeof (_d = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _d || Object, typeof (_e = typeof NavParams !== 'undefined' && NavParams) === 'function' && _e || Object, typeof (_f = typeof Renderer !== 'undefined' && Renderer) === 'function' && _f || Object])], ToastCmp);

var ToastSlideIn = function (_Transition) {
    _inherits(ToastSlideIn, _Transition);

    function ToastSlideIn(enteringView, leavingView, opts) {
        _classCallCheck(this, ToastSlideIn);

        // DOM READS

        var _this3 = _possibleConstructorReturn(this, Object.getPrototypeOf(ToastSlideIn).call(this, opts));

        var ele = enteringView.pageRef().nativeElement;
        var wrapperEle = ele.querySelector('.toast-wrapper');
        var wrapper = new Animation(wrapperEle);
        if (enteringView.data && enteringView.data.position === TOAST_POSITION_TOP) {
            // top
            // by default, it is -100% hidden (above the screen)
            // so move from that to 10px below top: 0px;
            wrapper.fromTo('translateY', '-100%', 10 + "px");
        } else if (enteringView.data && enteringView.data.position === TOAST_POSITION_MIDDLE) {
            // Middle
            // just center it and fade it in
            var topPosition = Math.floor(ele.clientHeight / 2 - wrapperEle.clientHeight / 2);
            // DOM WRITE
            wrapperEle.style.top = topPosition + "px";
            wrapper.fromTo('opacity', '0.01', '1.0');
        } else {
            // bottom
            // by default, it is 100% hidden (below the screen),
            // so move from that to 10 px above bottom: 0px
            wrapper.fromTo('translateY', '100%', 0 - 10 + "px");
        }
        var EASE = 'cubic-bezier(.36,.66,.04,1)';
        var DURATION = 400;
        // DOM WRITES
        _this3.easing(EASE).duration(DURATION).add(wrapper);
        return _this3;
    }

    return ToastSlideIn;
}(Transition);

var ToastSlideOut = function (_Transition2) {
    _inherits(ToastSlideOut, _Transition2);

    function ToastSlideOut(enteringView, leavingView, opts) {
        _classCallCheck(this, ToastSlideOut);

        // DOM reads

        var _this4 = _possibleConstructorReturn(this, Object.getPrototypeOf(ToastSlideOut).call(this, opts));

        var ele = leavingView.pageRef().nativeElement;
        var wrapperEle = ele.querySelector('.toast-wrapper');
        var wrapper = new Animation(wrapperEle);
        if (leavingView.data && leavingView.data.position === TOAST_POSITION_TOP) {
            // top
            // reverse arguments from enter transition
            wrapper.fromTo('translateY', 10 + "px", '-100%');
        } else if (leavingView.data && leavingView.data.position === TOAST_POSITION_MIDDLE) {
            // Middle
            // just fade it out
            wrapper.fromTo('opacity', '1.0', '0.0');
        } else {
            // bottom
            // reverse arguments from enter transition
            wrapper.fromTo('translateY', 0 - 10 + "px", '100%');
        }
        var EASE = 'cubic-bezier(.36,.66,.04,1)';
        var DURATION = 300;
        // DOM writes
        _this4.easing(EASE).duration(DURATION).add(wrapper);
        return _this4;
    }

    return ToastSlideOut;
}(Transition);

var ToastMdSlideIn = function (_Transition3) {
    _inherits(ToastMdSlideIn, _Transition3);

    function ToastMdSlideIn(enteringView, leavingView, opts) {
        _classCallCheck(this, ToastMdSlideIn);

        // DOM reads

        var _this5 = _possibleConstructorReturn(this, Object.getPrototypeOf(ToastMdSlideIn).call(this, opts));

        var ele = enteringView.pageRef().nativeElement;
        var wrapperEle = ele.querySelector('.toast-wrapper');
        var wrapper = new Animation(wrapperEle);
        if (enteringView.data && enteringView.data.position === TOAST_POSITION_TOP) {
            // top
            // by default, it is -100% hidden (above the screen)
            // so move from that to top: 0px;
            wrapper.fromTo('translateY', '-100%', "0px");
        } else if (enteringView.data && enteringView.data.position === TOAST_POSITION_MIDDLE) {
            // Middle
            // just center it and fade it in
            var topPosition = Math.floor(ele.clientHeight / 2 - wrapperEle.clientHeight / 2);
            // DOM WRITE
            wrapperEle.style.top = topPosition + "px";
            wrapper.fromTo('opacity', '0.01', '1.0');
        } else {
            // bottom
            // by default, it is 100% hidden (below the screen),
            // so move from that to bottom: 0px
            wrapper.fromTo('translateY', '100%', "0px");
        }
        var EASE = 'cubic-bezier(.36,.66,.04,1)';
        var DURATION = 400;
        _this5.easing(EASE).duration(DURATION).add(wrapper);
        return _this5;
    }

    return ToastMdSlideIn;
}(Transition);

var ToastMdSlideOut = function (_Transition4) {
    _inherits(ToastMdSlideOut, _Transition4);

    function ToastMdSlideOut(enteringView, leavingView, opts) {
        _classCallCheck(this, ToastMdSlideOut);

        // DOM reads

        var _this6 = _possibleConstructorReturn(this, Object.getPrototypeOf(ToastMdSlideOut).call(this, opts));

        var ele = leavingView.pageRef().nativeElement;
        var wrapperEle = ele.querySelector('.toast-wrapper');
        var wrapper = new Animation(wrapperEle);
        if (leavingView.data && leavingView.data.position === TOAST_POSITION_TOP) {
            // top
            // reverse arguments from enter transition
            wrapper.fromTo('translateY', 0 + "px", '-100%');
        } else if (leavingView.data && leavingView.data.position === TOAST_POSITION_MIDDLE) {
            // Middle
            // just fade it out
            wrapper.fromTo('opacity', '1.0', '0.0');
        } else {
            // bottom
            // reverse arguments from enter transition
            wrapper.fromTo('translateY', 0 + "px", '100%');
        }
        // DOM writes
        var EASE = 'cubic-bezier(.36,.66,.04,1)';
        var DURATION = 450;
        _this6.easing(EASE).duration(DURATION).add(wrapper);
        return _this6;
    }

    return ToastMdSlideOut;
}(Transition);

var ToastWpPopIn = function (_Transition5) {
    _inherits(ToastWpPopIn, _Transition5);

    function ToastWpPopIn(enteringView, leavingView, opts) {
        _classCallCheck(this, ToastWpPopIn);

        // DOM reads

        var _this7 = _possibleConstructorReturn(this, Object.getPrototypeOf(ToastWpPopIn).call(this, opts));

        var ele = enteringView.pageRef().nativeElement;
        var wrapperEle = ele.querySelector('.toast-wrapper');
        var wrapper = new Animation(wrapperEle);
        if (enteringView.data && enteringView.data.position === TOAST_POSITION_TOP) {
            // top
            wrapper.fromTo('opacity', '0.01', '1');
            wrapper.fromTo('scale', '1.3', '1');
        } else if (enteringView.data && enteringView.data.position === TOAST_POSITION_MIDDLE) {
            // Middle
            // just center it and fade it in
            var topPosition = Math.floor(ele.clientHeight / 2 - wrapperEle.clientHeight / 2);
            // DOM WRITE
            wrapperEle.style.top = topPosition + "px";
            wrapper.fromTo('opacity', '0.01', '1.0');
            wrapper.fromTo('scale', '1.3', '1');
        } else {
            // bottom
            wrapper.fromTo('opacity', '0.01', '1');
            wrapper.fromTo('scale', '1.3', '1');
        }
        // DOM writes
        var EASE = 'cubic-bezier(0,0 0.05,1)';
        var DURATION = 200;
        _this7.easing(EASE).duration(DURATION).add(wrapper);
        return _this7;
    }

    return ToastWpPopIn;
}(Transition);

var ToastWpPopOut = function (_Transition6) {
    _inherits(ToastWpPopOut, _Transition6);

    function ToastWpPopOut(enteringView, leavingView, opts) {
        _classCallCheck(this, ToastWpPopOut);

        // DOM reads

        var _this8 = _possibleConstructorReturn(this, Object.getPrototypeOf(ToastWpPopOut).call(this, opts));

        var ele = leavingView.pageRef().nativeElement;
        var wrapperEle = ele.querySelector('.toast-wrapper');
        var wrapper = new Animation(wrapperEle);
        if (leavingView.data && leavingView.data.position === TOAST_POSITION_TOP) {
            // top
            // reverse arguments from enter transition
            wrapper.fromTo('opacity', '1', '0.00');
            wrapper.fromTo('scale', '1', '1.3');
        } else if (leavingView.data && leavingView.data.position === TOAST_POSITION_MIDDLE) {
            // Middle
            // just fade it out
            wrapper.fromTo('opacity', '1.0', '0.00');
            wrapper.fromTo('scale', '1', '1.3');
        } else {
            // bottom
            // reverse arguments from enter transition
            wrapper.fromTo('opacity', '1', '0.00');
            wrapper.fromTo('scale', '1', '1.3');
        }
        // DOM writes
        var EASE = 'ease-out';
        var DURATION = 150;
        _this8.easing(EASE).duration(DURATION).add(wrapper);
        return _this8;
    }

    return ToastWpPopOut;
}(Transition);

Transition.register('toast-slide-in', ToastSlideIn);
Transition.register('toast-slide-out', ToastSlideOut);
Transition.register('toast-md-slide-in', ToastMdSlideIn);
Transition.register('toast-md-slide-out', ToastMdSlideOut);
Transition.register('toast-wp-slide-out', ToastWpPopOut);
Transition.register('toast-wp-slide-in', ToastWpPopIn);
var toastIds = -1;
var _a, _b, _c, _d, _e, _f;


text:
<?php

namespace Demo;

use Exception;

class ArgumentNumberIncorrectException extends Exception
{
    public $message;

    /**
     * @param string $errorMessage The message from the Exception
     */
    public function __construct($errorMessage)
    {
        $this->message = $errorMessage;
    }
}


text:
using System;
using System.Collections.Generic;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.SqlSyntax;

namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete.Expressions
{
    public class DeleteDataExpression : MigrationExpressionBase
    {
        private readonly List<DeletionDataDefinition> _rows = new List<DeletionDataDefinition>();

        public DeleteDataExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax)
            : base(current, databaseProviders, sqlSyntax)
        {
        }

        public virtual string SchemaName { get; set; }
        public string TableName { get; set; }
        public virtual bool IsAllRows { get; set; }

        public List<DeletionDataDefinition> Rows
        {
            get { return _rows; }
        }

        public override string ToString()
        {
            var deleteItems = new List<string>();

            if (IsAllRows)
            {
                deleteItems.Add(string.Format(SqlSyntax.DeleteData, SqlSyntax.GetQuotedTableName(TableName), "1 = 1"));
            }
            else
            {
                foreach (var row in Rows)
                {
                    var whereClauses = new List<string>();
                    foreach (KeyValuePair<string, object> item in row)
                    {
                        whereClauses.Add(string.Format("{0} {1} {2}",
                                                       SqlSyntax.GetQuotedColumnName(item.Key),
                                                       item.Value == null ? "IS" : "=",
                                                       GetQuotedValue(item.Value)));
                    }

                    deleteItems.Add(string.Format(SqlSyntax.DeleteData,
                                                  SqlSyntax.GetQuotedTableName(TableName),
                                                  String.Join(" AND ", whereClauses.ToArray())));
                }
            }

            return String.Join("; ", deleteItems.ToArray());
        }
    }
}


text:
layout: page
title: Boxing
---

	A complete set of padded cells. Just for you.

Letter Boxes

	Letter boxes provide padding to the top and bottom of a given element.

	Available letter box sizes:

.u-letter-box--super
.u-letter-box--xlarge
.u-letter-box--large
.u-letter-box--medium
.u-letter-box--small
.u-letter-box--xsmall
.u-letter-box--tiny
.u-letter-box--none

Pillar Boxes

	Pillar boxes provide padding to the left and right of a given element.

	Available pillar box sizes:

.u-pillar-box--super
.u-pillar-box--xlarge
.u-pillar-box--large
.u-pillar-box--medium
.u-pillar-box--small
.u-pillar-box--xsmall
.u-pillar-box--tiny
.u-pillar-box--none

Window Boxes

	Window boxes provide padding to the all sides of a given element.

	Available box sizes:

.u-window-box--super
.u-window-box--xlarge
.u-window-box--large
.u-window-box--medium
.u-window-box--small
.u-window-box--xsmall
.u-window-box--tiny
.u-window-box--none