text:
using Rhea.Business;
using Rhea.Business.Apartment;
using Rhea.Common;
using Rhea.Model;
using Rhea.Model.Account;
using Rhea.Model.Apartment;
using Rhea.UI.Filters;
using Rhea.UI.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Rhea.UI.Areas.Admin.Controllers
{
    /// <summary>
    /// 居住记录控制器
    /// </summary>
    [EnhancedAuthorize(Rank = 900)]
    public class ResideRecordController : Controller
    {
        #region Field
        /// <summary>
        /// 居住记录业务
        /// </summary>
        private ResideRecordBusiness recordBusiness;
        #endregion //Field

        #region Function
        protected override void Initialize(RequestContext requestContext)
        {
            if (recordBusiness == null)
            {
                recordBusiness = new ResideRecordBusiness();
            }

            base.Initialize(requestContext);
        }
        #endregion //Function

        #region Action
        /// <summary>
        /// 居住记录列表
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            var data = this.recordBusiness.Get();
            return View(data);
        }

        /// <summary>
        /// 居住记录详细
        /// </summary>
        /// <param name="id">居住记录ID</param>
        /// <returns></returns>
        public ActionResult Details(string id)
        {
            var data = this.recordBusiness.Get(id);
            if (data.Files != null && data.Files.Length != 0)
            {
                for (int i = 0; i < data.Files.Length; i++)
                {
                    data.Files[i] = RheaConstant.ApartmentRecord + data.Files[i];
                }
            }
            return View(data);
        }

        /// <summary>
        /// 居住记录编辑
        /// </summary>
        /// <param name="id">居住记录ID</param>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Edit(string id)
        {
            var data = this.recordBusiness.Get(id);
            return View(data);
        }

        /// <summary>
        /// 居住记录编辑
        /// </summary>
        /// <param name="model">居住记录对象</param>
        /// <returns></returns>
        [ValidateAntiForgeryToken]
        [HttpPost]
        public ActionResult Edit(ResideRecord model)
        {
            if (ModelState.IsValid)
            {
                ResideRecord old = this.recordBusiness.Get(model._id);
                model.Files = old.Files;
                model.RentHistory = old.RentHistory;
                model.InhabitantDepartmentId = Convert.ToInt32(Request.Form["DepartmentId"]);

                ErrorCode result = this.recordBusiness.Update(model);
                if (result != ErrorCode.Success)
                {
                    TempData["Message"] = "编辑居住记录失败";
                    ModelState.AddModelError("", result.DisplayName());
                    return View(model);
                }

                //log
                User user = PageService.GetCurrentUser(User.Identity.Name);
                Log log = new Log
                {
                    Title = "后台编辑居住记录",
                    Time = DateTime.Now,
                    Type = (int)LogType.ResideRecordEdit,
                    Content = string.Format("编辑居住记录, ID:{0}, 住户姓名:{1}, 部门:{2}, 房间ID:{3}, 房间名称:{4}。",
                        model._id, model.InhabitantName, model.InhabitantDepartment, model.RoomId, model.GetApartmentRoom().Name),
                    UserId = user._id,
                    UserName = user.Name
                };

                result = this.recordBusiness.Log(model._id, log);
                if (result != ErrorCode.Success)
                {
                    TempData["Message"] = "记录日志失败";
                    ModelState.AddModelError("", result.DisplayName());
                    return View(model);
                }

                TempData["Message"] = "编辑居住记录成功";
                return RedirectToAction("Details", new { id = model._id });
            }

            return View(model);
        }

        /// <summary>
        /// 删除居住记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Delete(string id)
        {
            var data = this.recordBusiness.Get(id);
            return View(data);
        }

        /// <summary>
        /// 删除居住记录
        /// </summary>
        /// <returns></returns>
        [ValidateAntiForgeryToken]
        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirm()
        {
            var id = Request.Form["_id"];

            ResideRecord record = this.recordBusiness.Get(id);

            ErrorCode result = this.recordBusiness.Delete(id);
            if (result != ErrorCode.Success)
            {
                TempData["Message"] = "删除居住记录失败";
                ModelState.AddModelError("", result.DisplayName());
                return RedirectToAction("Delete", new { id = id });
            }

            //log
            User user = PageService.GetCurrentUser(User.Identity.Name);
            Log log = new Log
            {
                Title = "后台删除居住记录",
                Time = DateTime.Now,
                Type = (int)LogType.ResideRecordDelete,
                Content = string.Format("删除居住记录, ID:{0}, 住户姓名:{1}, 部门:{2}, 房间ID:{3}, 房间名称:{4}。",
                    id, record.InhabitantName, record.InhabitantDepartment, record.RoomId, record.GetApartmentRoom().Name),
                UserId = user._id,
                UserName = user.Name
            };

            result = this.recordBusiness.Log(record._id, log);
            if (result != ErrorCode.Success)
            {
                TempData["Message"] = "记录日志失败";
                ModelState.AddModelError("", result.DisplayName());
                return RedirectToAction("Delete", new { id = id });
            }

            TempData["Message"] = "删除居住记录成功";
            return RedirectToAction("List");

        }
        #endregion //Action
    }
}


text:
#ifndef _DEBUG_GRAPHICS_H
#define _DEBUG_GRAPHICS_H

#define DEBUGGER_TEXT_MODE     0
#define DEBUGGER_GRAPHICS_MODE 1
#define MONO_NORMAL  0x07
#define MONO_INTENSE 0x08
#define MONO_UNDER   0x01
#define MONO_REVERSE 0x70
#define MONO_BLINK   0x80

#ifdef __cplusplus   /* support C++ */
extern "C" {
#endif
extern void InitDebug (int mode);
extern void DisplayDebugCharacter (int num, int x, int y);
extern void DrawDebugString (float x, float y, char * str);
extern void DrawDebugStringLeft (float x, float y, char * str);
extern void DrawDebugStringRight (float x, float y, char * str);
extern void RotateDebug2D(float angle);
extern void ResetRotateDebug2D (void);
extern void TranslateDebug2D(float x, float y);
extern void ResetTranslateDebug2D (void);
extern void SetDebugLineStyle (int style);
extern void DisplayDebugString (int row, int col, char *str);
extern void DrawDebugLine (float x1in, float y1in, float x2in, float y2in);
extern void DrawDebugCircle (float x, float y, float radius);
extern void DisplayDebugLine (int x0, int y0, int x1, int y1);
extern void DisplayDebugCircle (int x0, int y0, int radius);
extern void DebugSwapbuffer(void);
extern void DebugClear (void);
extern void MonoPrint( char *, ...);
extern void MonoLocate( unsigned char x, unsigned char y );
extern void MonoGetLoc (int* x, int* y);
extern void MonoCls( void );
extern void MonoScroll( void );
extern void MonoColor( char attribute );
extern void WriteDebugPixel (int, int);

//MI added for simple output
void WriteToFile (char *);

#ifdef __cplusplus
};
#endif

#endif

redpajama_set_name: RedPajamaGithub


text:
package com.winthier.announcements;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

public class Group extends BukkitRunnable {
    public final AnnouncementsPlugin plugin;
    public final String name;

    // Timings
    private int offset;
    private int interval;

    // Behavior
    private boolean logToConsole;
    private boolean randomize;
    private String permission;

    // Messages
    private final List<Announcement> announcements = new ArrayList<>();
    private List<Integer> randomQueue = null;

    // State
    private final Random random = new Random(System.currentTimeMillis());
    private int index = 0;

    public Group(AnnouncementsPlugin plugin, String name) {
        this.plugin = plugin;
        this.name = name;
    }

    // public void save(ConfigurationSection config) {
    //     config.set("Offset", offset);
    //     config.set("Interval", interval);
    //     config.set("LogToConsole", logToConsole);
    //     config.set("Randomize", randomize);
    //     config.set("Permission", permission);
    //     config.set("Prefix", prefix);
    //     config.set("Announcements", announcements);
    // }

    public void load(ConfigurationSection config) {
        // Set some defaults.
        config.addDefault("Permission", "");
        config.addDefault("Interval", 60);
        config.addDefault("Prefix", "[&eServer&r] ");
        config.addDefault("LogToConsole", true);
        config.addDefault("Randomize", true);
        config.addDefault("Announcements", new ArrayList<String>(0));
        // Load
        permission = config.getString("Permission");
        if (permission.length() == 0) permission = null;
        interval = config.getInt("Interval");
        Object prefix = config.get("Prefix");
        logToConsole = config.getBoolean("LogToConsole");
        randomize = config.getBoolean("Randomize");
        announcements.clear();
        randomQueue = null;
        for (Object entry : config.getList("Announcements")) {
            announcements.add(Announcement.withPrefixAndEntry(prefix, entry));
        }
    }

    public void onEnable() {
        final long period = (long)interval * 20L * 60L;
        final long delay = offset == 0 ? period : (long)offset * 20L * 60L;
        runTaskTimer(plugin, delay, period);
    }

    public void onDisable() {
        try {
            cancel();
        } catch (IllegalStateException e) {
            // ignore
        }
    }

    @Override
    public void run() {
        if (announcements.isEmpty()) return;
        if (index >= announcements.size()) index = 0;
        if (randomize) {
            if (randomQueue == null) {
                randomQueue = new ArrayList<>(announcements.size());
                for (int i = 0; i < announcements.size(); ++i) randomQueue.add(i);
                Collections.shuffle(randomQueue);
            }
            announce(randomQueue.get(index++));
        } else {
            announce(index++);
        }
    }

    public void announce(int index) {
        // This may throw
        Announcement announcement = announcements.get(index);
        if (logToConsole) plugin.getLogger().info("[" + name + "] " + announcement.getDebugString());
        for (Player player : plugin.getServer().getOnlinePlayers()) {
            if (permission != null && !player.hasPermission(permission)) continue;
            announcement.announce(player);
        }
    }

    public String getName() {
        return name;
    }

    public int size() {
        return announcements.size();
    }

    /**
     */
    public Announcement getAnnouncement(int index) {
        return announcements.get(index);
    }
}


text:
  Saint-Martin-de-la-Cluze est
       un village
       géographiquement positionné dans le département de l'Isère en Rhône-Alpes. Elle totalisait 603 habitants en 2008.

À proximité de Saint-Martin-de-la-Cluze sont positionnées géographiquement les villes de
Sinard à 4 km, 633 habitants,
Treffort à 7 km, 208 habitants,
Saint-Guillaume située à 6 km, 252 habitants,
Château-Bernard à 6 km, 265 habitants,
La Motte-Saint-Martin localisée à 4 km, 396 habitants,
La Motte-d'Aveillans à 7 km, 1 752 habitants,
 entre autres. De plus, Saint-Martin-de-la-Cluze est située à seulement 24 km de Grenoble.

Le nombre de logements, à Saint-Martin-de-la-Cluze, se décomposait en 2011 en 23 appartements et 265 maisons soit
 un marché plutôt équilibré.

Si vous pensez venir habiter à Saint-Martin-de-la-Cluze, vous pourrez facilement trouver une maison à acheter.

À Saint-Martin-de-la-Cluze, la valorisation moyenne à la vente d'un appartement s'évalue à 1 927 € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 2 281 € du m². À la location la valorisation moyenne se situe à 0 € du m² par mois.


text:
require 'spec_helper'
require 'whois/record/parser/whois.domainregistry.ie.rb'

describe Whois::Record::Parser::WhoisDomainregistryIe, "status_registered.expected" do

  subject do
    file = fixture("responses", "whois.domainregistry.ie/status_registered.txt")
    part = Whois::Record::Part.new(:body => File.read(file))
    described_class.new(part)
  end

  describe "#disclaimer" do
    it do
      subject.disclaimer.should == "Rights restricted by copyright; http://iedr.ie/index.php/mnudomregs/mnudnssearch/96\nDo not remove this notice"
    end
  end
  describe "#domain" do
    it do
      subject.domain.should == "google.ie"
    end
  end
  describe "#domain_id" do
    it do
      lambda { subject.domain_id }.should raise_error(Whois::AttributeNotSupported)
    end
  end
  describe "#status" do
    it do
      subject.status.should == :registered
    end
  end
  describe "#available?" do
    it do
      subject.available?.should == false
    end
  end
  describe "#registered?" do
    it do
      subject.registered?.should == true
    end
  end
  describe "#created_on" do
    it do
      subject.created_on.should be_a(Time)
      subject.created_on.should == Time.parse("2002-03-21")
    end
  end
  describe "#updated_on" do
    it do
      lambda { subject.updated_on }.should raise_error(Whois::AttributeNotSupported)
    end
  end
  describe "#expires_on" do
    it do
      subject.expires_on.should be_a(Time)
      subject.expires_on.should == Time.parse("2014-03-21")
    end
  end
  describe "#registrar" do
    it do
      lambda { subject.registrar }.should raise_error(Whois::AttributeNotSupported)
    end
  end
  describe "#registrant_contacts" do
    it do
      subject.registrant_contacts.should be_a(Array)
      subject.registrant_contacts.should have(1).items
      subject.registrant_contacts[0].should be_a(Whois::Record::Contact)
      subject.registrant_contacts[0].type.should          == Whois::Record::Contact::TYPE_REGISTRANT
      subject.registrant_contacts[0].id.should            == nil
      subject.registrant_contacts[0].name.should          == "Google, Inc"
    end
  end
  describe "#admin_contacts" do
    it do
      subject.admin_contacts.should be_a(Array)
      subject.admin_contacts.should have(1).items
      subject.admin_contacts[0].should be_a(Whois::Record::Contact)
      subject.admin_contacts[0].type.should          == Whois::Record::Contact::TYPE_ADMIN
      subject.admin_contacts[0].id.should            == "AAV410-IEDR"
      subject.admin_contacts[0].name.should          == "Christina Chiou"
    end
  end
  describe "#technical_contacts" do
    it do
      subject.technical_contacts.should be_a(Array)
      subject.technical_contacts.should have(1).items
      subject.technical_contacts[0].should be_a(Whois::Record::Contact)
      subject.technical_contacts[0].type.should          == Whois::Record::Contact::TYPE_TECHNICAL
      subject.technical_contacts[0].id.should            == "CCA7-IEDR"
      subject.technical_contacts[0].name.should          == "eMarkmonitor Inc"
    end
  end
  describe "#nameservers" do
    it do
      subject.nameservers.should be_a(Array)
      subject.nameservers.should have(3).items
      subject.nameservers[0].should be_a(Whois::Record::Nameserver)
      subject.nameservers[0].name.should == "ns1.google.com"
      subject.nameservers[1].should be_a(Whois::Record::Nameserver)
      subject.nameservers[1].name.should == "ns2.google.com"
      subject.nameservers[2].should be_a(Whois::Record::Nameserver)
      subject.nameservers[2].name.should == "ns3.google.com"
    end
  end
end


text:
#include "sys_sys_types.h"
#include "LOG_bridge.h"
#include "POP_bridge.h"
#include "T_bridge.h"
#include "ooaofooa_classes.h"

/*
 * Instance Loader (from string data).
 */
Escher_iHandle_t
ooaofooa_DOC_DATE_instanceloader( Escher_iHandle_t instance, const c_t * avlstring[] )
{
  Escher_iHandle_t return_identifier = 0;
  ooaofooa_DOC_DATE * self = (ooaofooa_DOC_DATE *) instance;
  /* Initialize application analysis class attributes.  */
  self->year = Escher_atoi( avlstring[ 1 ] );
  Escher_strcpy( self->month, avlstring[ 2 ] );
  self->day = Escher_atoi( avlstring[ 3 ] );
  Escher_strcpy( self->time, avlstring[ 4 ] );
  return return_identifier;
}

/*
 * Select any where using referential/identifying attribute set.
 * If not_empty, relate this instance to the selected instance.
 */
void ooaofooa_DOC_DATE_batch_relate( Escher_iHandle_t instance )
{
  ooaofooa_DOC_DATE * ooaofooa_DOC_DATE_instance = (ooaofooa_DOC_DATE *) instance;
}

/*
 * RELATE DOC_DOC TO DOC_DATE ACROSS R2302
 */
void
ooaofooa_DOC_DATE_R2302_Link( ooaofooa_DOC_DOC * part, ooaofooa_DOC_DATE * form )
{
  /* Use TagEmptyHandleDetectionOn() to detect empty handle references.  */
  form->DOC_DOC_R2302 = part;
  part->DOC_DATE_R2302 = form;
}

/*
 * UNRELATE DOC_DOC FROM DOC_DATE ACROSS R2302
 */
void
ooaofooa_DOC_DATE_R2302_Unlink( ooaofooa_DOC_DOC * part, ooaofooa_DOC_DATE * form )
{
  /* Use TagEmptyHandleDetectionOn() to detect empty handle references.  */
  form->DOC_DOC_R2302 = 0;
  part->DOC_DATE_R2302 = 0;
}

/*
 * Dump instances in SQL format.
 */
void
ooaofooa_DOC_DATE_instancedumper( Escher_iHandle_t instance )
{
  ooaofooa_DOC_DATE * self = (ooaofooa_DOC_DATE *) instance;
  printf( "INSERT INTO DOC_DATE VALUES ( %d,'%s',%d,'%s' );\n",
    self->year,
    self->month,
    self->day,
    self->time );
}
/*
 * Statically allocate space for the instance population for this class.
 * Allocate space for the class instance and its attribute values.
 * Depending upon the collection scheme, allocate containoids (collection
 * nodes) for gathering instances into free and active extents.
 */
static Escher_SetElement_s ooaofooa_DOC_DATE_container[ ooaofooa_DOC_DATE_MAX_EXTENT_SIZE ];
static ooaofooa_DOC_DATE ooaofooa_DOC_DATE_instances[ ooaofooa_DOC_DATE_MAX_EXTENT_SIZE ];
Escher_Extent_t pG_ooaofooa_DOC_DATE_extent = {
  {0,0}, {0,0}, &ooaofooa_DOC_DATE_container[ 0 ],
  (Escher_iHandle_t) &ooaofooa_DOC_DATE_instances,
  sizeof( ooaofooa_DOC_DATE ), 0, ooaofooa_DOC_DATE_MAX_EXTENT_SIZE
  };


text:
@interface DDSearchFieldController : NSObject<NSTableViewDataSource,NSTableViewDelegate>{
    NSMutableArray			*allKeywords;
	NSMutableArray			*builtInKeywords;
    NSMutableDictionary     *userIdByName;

	BOOL					completePosting;
    BOOL					commandHandling;

}
@property (weak) IBOutlet NSSearchField *searchField;
@property (weak) IBOutlet NSSearchFieldCell* searchFieldCell;
@property (weak) IBOutlet NSTableView* tableView;
@property (weak) IBOutlet NSScrollView* scrollView;

//TODO:这里需要重构,把Model分离出来
@property (nonatomic,retain)dispatch_queue_t searchQueue;

@end


text:
module GSGraph
  class AdKeyword < Node
    extend Searchable

    attr_accessor :name, :description

    def initialize(identifier, attributes = {})
      super

      %w(name description).each do |field|
        self.send("#{field}=", attributes[field.to_sym])
      end
    end

    def topic_keyword?
      (name =~ /^#/) == 0
    end
  end
end


text:
package com.qmx.wxmp.common.utils;

import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//import sun.misc.BASE64Encoder;

public class GlobalUtil {
    private static Logger logger = LoggerFactory.getLogger(GlobalUtil.class);

    /**
     * 格式化日期
     *
     * @param date
     * @return
     */
    public static String formatDate(Date date) {
        return new SimpleDateFormat(Constant.FORMAT).format(date);
    }

    /**
     * 字符串日期转毫秒
     * @param str
     * @return
     */
    public static long formatDateStrToLong(String str){
    	long time = 0;
		try {
			time = new SimpleDateFormat(Constant.FORMAT).parse(str).getTime();
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return time;

    }
    /**
     * 毫秒转字符串日期
     * @param arg
     * @return
     */
    public static String formatDateLongToStr(long arg) {
		DateFormat formatter = new SimpleDateFormat(Constant.FORMAT);
		return formatter.format(arg);
    }
    /**
     * 返回用户的IP地址
     *
     * @param request
     * @return
     */
    public static String getIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");

        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }

        return ip;
    }

    /**
     * 返回本地IP地址
     *
     * @return
     */
    public static String getIpAddress() {
        try {
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            logger.error(e.getMessage());
            return "";
        }

    }

    /**
     * 简单的MD5加密,平常使用
     *
     * @param password
     * @return
     */
    public static String getMd5(String password) {
        String str = "";
        if (password != null && !password.equals("")) {
            try {
                MessageDigest md = MessageDigest.getInstance("MD5");
                // BASE64Encoder base = new BASE64Encoder();
                // 加密后的字符串
                // str = base.encode(md.digest(password.getBytes("utf-8")));
                str = Encodes.encodeBase64(md.digest(password.getBytes("utf-8")));
            } catch (Exception e) {
                logger.error(e.getMessage());
                e.printStackTrace();
            }
        }
        return str;
    }

    /**
     * MD5加密(32位)
     *
     * @param instr
     *            要加密的字符串
     * @return 返回加密后的字符串
     */
    public final static String encoderByMd5With32Bit(String instr) {
        char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
        try {
            if (instr != null && !"".equals(instr)) {
                byte[] strTemp = instr.getBytes();
                // MD5计算方法
                MessageDigest mdTemp = MessageDigest.getInstance("MD5");
                mdTemp.update(strTemp);
                byte[] md = mdTemp.digest();
                int j = md.length;
                char str[] = new char[j * 2];
                int k = 0;
                for (int i = 0; i < j; i++) {
                    byte byte0 = md[i];
                    str[k++] = hexDigits[byte0 >>> 4 & 0xf];
                    str[k++] = hexDigits[byte0 & 0xf];
                }
                return new String(str);
            } else {
                return null;
            }
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * 获取随机的UUID字符串
     *
     * @return String
     */
    public static String getUUID() {
        return UUID.randomUUID().toString();
    }

    /**
     * 判断变量是否为空
     *
     * @param s
     * @return
     */
    public static boolean isEmpty(String s) {
        if (null == s || "".equals(s) || "".equals(s.trim()) || "null".equalsIgnoreCase(s)) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 用来去掉List中空值和相同项的。
     *
     * @param list
     * @return
     */
    public static List<String> removeSameItem(List<String> list) {
        List<String> difList = new ArrayList<String>();
        for (String t : list) {
            if (t != null && !difList.contains(t)) {
                difList.add(t);
            }
        }
        return difList;
    }

    /**
     * 字符在字符串中出现的次数
     *
     * @param string
     * @param a
     * @return
     */
    public static int occurTimes(String string, String a) {
        int pos = -2;
        int n = 0;

        while (pos != -1) {
            if (pos == -2) {
                pos = -1;
            }
            pos = string.indexOf(a, pos + 1);
            if (pos != -1) {
                n++;
            }
        }
        return n;
    }

    //读文件,返回字符串
    public static String ReadFile(String path){
        File file = new File(path);
        BufferedReader reader = null;
        StringBuffer sb = new StringBuffer();
        try {
            //System.out.println("以行为单位读取文件内容,一次读一整行:");
            reader = new BufferedReader(new FileReader(file));
            String tempString = null;
            //一次读入一行,直到读入null为文件结束
            while ((tempString = reader.readLine()) != null) {
                sb.append(tempString);
            }
            reader.close();
        } catch (IOException e) {
            logger.error(e.toString());
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                    logger.error(e1.toString());
                }
            }
        }
        return sb.toString();
    }

    //把json格式的字符串写到文件
    public static void writeFile(String filePath, String sets) throws IOException {
        FileWriter fw = new FileWriter(filePath);
        PrintWriter out = new PrintWriter(fw);
        out.write(sets);
        out.println();
        fw.close();
        out.close();
    }

    public static String getCookieValue(Cookie[] cookies, String cookieName, String defaultValue) {
        String result = defaultValue;
        if (cookies != null) {
            for (int i = 0; i < cookies.length; i++) {
                Cookie cookie = cookies[i];
                if (cookieName.equals(cookie.getName())) {
                    return cookie.getValue();
                }
            }
        }
        return result;
    }

}


text:
<?php

namespace Fhaculty\Graph\Set;

/**
 * DualAggregate provides access to both its Vertices and its Edges
 *
 * This is the simple base interface for any Graph-like structure / data type
 * which contains a Set of Edges and a Set of Vertices, such as the Graph class
 * itself and the Walk class.
 */
interface DualAggregate extends VerticesAggregate, EdgesAggregate
{
    /**
     * returns a set of ALL Edges in this graph
     *
     * @return Edges
     */
    // abstract public function getEdges();

    /**
     * returns a set of all Vertices
     *
     * @return Vertices
     */
    // abstract public function getVertices();
}


text:
public struct Rectangle : IShape, IMovable, IResizable
{
    private int x, y, width, height;

    public Rectangle(int x, int y, int width, int height)
    {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }

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

    public double CalculateSurface()
    {
        return width * height;
    }

    public void Move(int deltaX, int deltaY) // From IMovable
    {
        this.x += deltaX;
        this.y += deltaY;
    }

    public void Resize(int weightX, int weightY) // IResizable
    {
        width = width * weightX;
        height = height * weightY;
    }

    public void ResizeByX(int weightX) // From IResizable
    {
        width = width * weightX;
    }

    public void ResizeByY(int weightY) // From IResizable
    {
        height = height * weightY;
    }
}


text:
/*
 * simple-share
 * @yujiangshui
 * https://github.com/yujiangshui/simple-share.js
 *
 * Licensed under the MIT license.
 */

var SimpleShare = function (options) {

	// get share content
	options = options || {};
	var url = options.url || window.location.href;
	var title = options.title || document.title;
	var content = options.content || '';
	var pic = options.pic || '';

	// fix content format
	url = encodeURIComponent(url);
	title = encodeURIComponent(title);
	content = encodeURIComponent(content);
	pic = encodeURIComponent(pic);

	// share target url
	var qzone = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}&title={title}&pics={pic}&summary={content}';
	var weibo = 'http://service.weibo.com/share/share.php?url={url}&title={title}&pic={pic}&searchPic=false';
	var tqq = 'http://share.v.t.qq.com/index.php?c=share&a=index&url={url}&title={title}&appkey=801cf76d3cfc44ada52ec13114e84a96';
	var renren = 'http://widget.renren.com/dialog/share?resourceUrl={url}&srcUrl={url}&title={title}&description={content}';
	var douban = 'http://www.douban.com/share/service?href={url}&name={title}&text={content}&image={pic}';
	var facebook = 'https://www.facebook.com/sharer/sharer.php?u={url}&t={title}&pic={pic}';
	var twitter = 'https://twitter.com/intent/tweet?text={title}&url={url}';
	var linkedin = 'https://www.linkedin.com/shareArticle?title={title}&summary={content}&mini=true&url={url}&ro=true';
	var weixin = 'http://qr.liantu.com/api.php?text={url}';
	var qq = 'http://connect.qq.com/widget/shareqq/index.html?url={url}&desc={title}&pics={pic}';

	// replace content functions
	function replaceAPI (api) {
		api = api.replace('{url}', url);
		api = api.replace('{title}', title);
		api = api.replace('{content}', content);
		api = api.replace('{pic}', pic);

		return api;
	}

	// share target
	this.qzone = function() {
		window.open(replaceAPI(qzone));
	};
	this.weibo = function() {
		window.open(replaceAPI(weibo));
	};
	this.tqq = function() {
		window.open(replaceAPI(tqq));
	};
	this.renren = function() {
		window.open(replaceAPI(renren));
	};
	this.douban = function() {
		window.open(replaceAPI(douban));
	};
	this.facebook = function() {
		window.open(replaceAPI(facebook));
	};
	this.twitter = function() {
		window.open(replaceAPI(twitter));
	};
	this.linkedin = function() {
		window.open(replaceAPI(linkedin));
	};
	this.qq = function() {
		window.open(replaceAPI(qq));
	};
	this.weixin = function(callback) {
		if (!callback) {
			window.open(replaceAPI(weixin));
		}else{
			callback(replaceAPI(weixin));
		}
	};

};


text:
#pragma once

#include "ArrayBufferView.h"
#include "DeferGC.h"
#include "Error.h"
#include "ExceptionHelpers.h"
#include "JSArrayBuffer.h"
#include "JSGenericTypedArrayView.h"
#include "TypeError.h"
#include "TypedArrays.h"

namespace JSC {

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>::JSGenericTypedArrayView(
    VM& vm, ConstructionContext& context)
    : Base(vm, context)
{
}

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>* JSGenericTypedArrayView<Adaptor>::create(
    ExecState* exec, Structure* structure, unsigned length)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    ConstructionContext context(vm, structure, length, sizeof(typename Adaptor::Type));
    if (!context) {
        throwOutOfMemoryError(exec, scope);
        return nullptr;
    }
    JSGenericTypedArrayView* result =
        new (NotNull, allocateCell<JSGenericTypedArrayView>(vm.heap))
        JSGenericTypedArrayView(vm, context);
    result->finishCreation(vm);
    return result;
}

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>* JSGenericTypedArrayView<Adaptor>::createWithFastVector(
    ExecState* exec, Structure* structure, unsigned length, void* vector)
{
    VM& vm = exec->vm();
    ConstructionContext context(structure, length, vector);
    RELEASE_ASSERT(context);
    JSGenericTypedArrayView* result =
        new (NotNull, allocateCell<JSGenericTypedArrayView>(vm.heap))
        JSGenericTypedArrayView(vm, context);
    result->finishCreation(vm);
    return result;
}

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>* JSGenericTypedArrayView<Adaptor>::createUninitialized(
    ExecState* exec, Structure* structure, unsigned length)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    ConstructionContext context(
        vm, structure, length, sizeof(typename Adaptor::Type),
        ConstructionContext::DontInitialize);
    if (!context) {
        throwOutOfMemoryError(exec, scope);
        return nullptr;
    }
    JSGenericTypedArrayView* result =
        new (NotNull, allocateCell<JSGenericTypedArrayView>(vm.heap))
        JSGenericTypedArrayView(vm, context);
    result->finishCreation(vm);
    return result;
}

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>* JSGenericTypedArrayView<Adaptor>::create(
    ExecState* exec, Structure* structure, RefPtr<ArrayBuffer>&& buffer,
    unsigned byteOffset, unsigned length)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    size_t size = sizeof(typename Adaptor::Type);
    ASSERT(buffer);
    if (!ArrayBufferView::verifySubRangeLength(*buffer, byteOffset, length, size)) {
        throwException(exec, scope, createRangeError(exec, "Length out of range of buffer"));
        return nullptr;
    }
    if (!ArrayBufferView::verifyByteOffsetAlignment(byteOffset, size)) {
        throwException(exec, scope, createRangeError(exec, "Byte offset is not aligned"));
        return nullptr;
    }
    ConstructionContext context(vm, structure, WTFMove(buffer), byteOffset, length);
    ASSERT(context);
    JSGenericTypedArrayView* result =
        new (NotNull, allocateCell<JSGenericTypedArrayView>(vm.heap))
        JSGenericTypedArrayView(vm, context);
    result->finishCreation(vm);
    return result;
}

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>* JSGenericTypedArrayView<Adaptor>::create(
    VM& vm, Structure* structure, RefPtr<typename Adaptor::ViewType>&& impl)
{
    ConstructionContext context(vm, structure, impl->possiblySharedBuffer(), impl->byteOffset(), impl->length());
    ASSERT(context);
    JSGenericTypedArrayView* result =
        new (NotNull, allocateCell<JSGenericTypedArrayView>(vm.heap))
        JSGenericTypedArrayView(vm, context);
    result->finishCreation(vm);
    return result;
}

template<typename Adaptor>
JSGenericTypedArrayView<Adaptor>* JSGenericTypedArrayView<Adaptor>::create(
    Structure* structure, JSGlobalObject* globalObject,
    RefPtr<typename Adaptor::ViewType>&& impl)
{
    return create(globalObject->vm(), structure, WTFMove(impl));
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::validateRange(
    ExecState* exec, unsigned offset, unsigned length)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    if (canAccessRangeQuickly(offset, length))
        return true;

    throwException(exec, scope, createRangeError(exec, "Range consisting of offset and length are out of bounds"));
    return false;
}

template<typename Adaptor>
template<typename OtherAdaptor>
bool JSGenericTypedArrayView<Adaptor>::setWithSpecificType(
    ExecState* exec, unsigned offset, JSGenericTypedArrayView<OtherAdaptor>* other,
    unsigned otherOffset, unsigned length, CopyType type)
{
    // Handle the hilarious case: the act of getting the length could have resulted
    // in neutering. Well, no. That'll never happen because there cannot be
    // side-effects on getting the length of a typed array. But predicting where there
    // are, or aren't, side-effects is a fool's game so we resort to this cheap
    // check. Worst case, if we're wrong, people start seeing less things get copied
    // but we won't have a security vulnerability.
    length = std::min(length, other->length());

    RELEASE_ASSERT(other->canAccessRangeQuickly(otherOffset, length));
    if (!validateRange(exec, offset, length))
        return false;

    // This method doesn't support copying between the same array. Note that
    // set() will only call this if the types differ, which implicitly guarantees
    // that we can't be the same array. This is relevant because the way we detect
    // non-overlapping is by checking if either (a) either array doesn't have a
    // backing buffer or (b) the backing buffers are different, but that doesn't
    // catch the case where it's the *same* array - fortunately though, this code
    // path never needs to worry about that case.
    ASSERT(static_cast<JSCell*>(this) != static_cast<JSCell*>(other));

    // 1) If the two arrays are non-overlapping, we can copy in any order we like
    //    and we don't need an intermediate buffer. Arrays are definitely
    //    non-overlapping if either one of them has no backing buffer (that means
    //    that it *owns* its philosophical backing buffer) or if they have
    //    different backing buffers.
    // 2) If the two arrays overlap but have the same element size, we can do a
    //    memmove-like copy where we flip-flop direction based on which vector
    //    starts before the other:
    //    A) If the destination vector is before the source vector, then a forward
    //       copy is in order.
    //    B) If the destination vector is after the source vector, then a backward
    //       copy is in order.
    // 3) If we have different element sizes and there is a chance of overlap then
    //    we need an intermediate vector.

    // NB. Comparisons involving elementSize will be constant-folded by template
    // specialization.

    unsigned otherElementSize = sizeof(typename OtherAdaptor::Type);

    // Handle cases (1) and (2A).
    if (!hasArrayBuffer() || !other->hasArrayBuffer()
        || existingBuffer() != other->existingBuffer()
        || (elementSize == otherElementSize && vector() <= other->vector())
        || type == CopyType::LeftToRight) {
        for (unsigned i = 0; i < length; ++i) {
            setIndexQuicklyToNativeValue(
                offset + i, OtherAdaptor::template convertTo<Adaptor>(
                    other->getIndexQuicklyAsNativeValue(i + otherOffset)));
        }
        return true;
    }

    // Now we either have (2B) or (3) - so first we try to cover (2B).
    if (elementSize == otherElementSize) {
        for (unsigned i = length; i--;) {
            setIndexQuicklyToNativeValue(
                offset + i, OtherAdaptor::template convertTo<Adaptor>(
                    other->getIndexQuicklyAsNativeValue(i + otherOffset)));
        }
        return true;
    }

    // Fail: we need an intermediate transfer buffer (i.e. case (3)).
    Vector<typename Adaptor::Type, 32> transferBuffer(length);
    for (unsigned i = length; i--;) {
        transferBuffer[i] = OtherAdaptor::template convertTo<Adaptor>(
            other->getIndexQuicklyAsNativeValue(i + otherOffset));
    }
    for (unsigned i = length; i--;)
        setIndexQuicklyToNativeValue(offset + i, transferBuffer[i]);

    return true;
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::set(
    ExecState* exec, unsigned offset, JSObject* object, unsigned objectOffset, unsigned length, CopyType type)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);

    const ClassInfo* ci = object->classInfo(vm);
    if (ci->typedArrayStorageType == Adaptor::typeValue) {
        // The super fast case: we can just memcpy since we're the same type.
        JSGenericTypedArrayView* other = jsCast<JSGenericTypedArrayView*>(object);
        length = std::min(length, other->length());

        RELEASE_ASSERT(other->canAccessRangeQuickly(objectOffset, length));
        bool success = validateRange(exec, offset, length);
        ASSERT(!scope.exception() == success);
        if (!success)
            return false;

        memmove(typedVector() + offset, other->typedVector() + objectOffset, length * elementSize);
        return true;
    }

    switch (ci->typedArrayStorageType) {
    case TypeInt8:
        scope.release();
        return setWithSpecificType<Int8Adaptor>(
            exec, offset, jsCast<JSInt8Array*>(object), objectOffset, length, type);
    case TypeInt16:
        scope.release();
        return setWithSpecificType<Int16Adaptor>(
            exec, offset, jsCast<JSInt16Array*>(object), objectOffset, length, type);
    case TypeInt32:
        scope.release();
        return setWithSpecificType<Int32Adaptor>(
            exec, offset, jsCast<JSInt32Array*>(object), objectOffset, length, type);
    case TypeUint8:
        scope.release();
        return setWithSpecificType<Uint8Adaptor>(
            exec, offset, jsCast<JSUint8Array*>(object), objectOffset, length, type);
    case TypeUint8Clamped:
        scope.release();
        return setWithSpecificType<Uint8ClampedAdaptor>(
            exec, offset, jsCast<JSUint8ClampedArray*>(object), objectOffset, length, type);
    case TypeUint16:
        scope.release();
        return setWithSpecificType<Uint16Adaptor>(
            exec, offset, jsCast<JSUint16Array*>(object), objectOffset, length, type);
    case TypeUint32:
        scope.release();
        return setWithSpecificType<Uint32Adaptor>(
            exec, offset, jsCast<JSUint32Array*>(object), objectOffset, length, type);
    case TypeFloat32:
        scope.release();
        return setWithSpecificType<Float32Adaptor>(
            exec, offset, jsCast<JSFloat32Array*>(object), objectOffset, length, type);
    case TypeFloat64:
        scope.release();
        return setWithSpecificType<Float64Adaptor>(
            exec, offset, jsCast<JSFloat64Array*>(object), objectOffset, length, type);
    case NotTypedArray:
    case TypeDataView: {
        bool success = validateRange(exec, offset, length);
        ASSERT(!scope.exception() == success);
        if (!success)
            return false;

        // We could optimize this case. But right now, we don't.
        for (unsigned i = 0; i < length; ++i) {
            JSValue value = object->get(exec, i + objectOffset);
            RETURN_IF_EXCEPTION(scope, false);
            bool success = setIndex(exec, offset + i, value);
            ASSERT(!scope.exception() || !success);
            if (!success)
                return false;
        }
        return true;
    } }

    RELEASE_ASSERT_NOT_REACHED();
    return false;
}

template<typename Adaptor>
RefPtr<typename Adaptor::ViewType> JSGenericTypedArrayView<Adaptor>::possiblySharedTypedImpl()
{
    return Adaptor::ViewType::create(possiblySharedBuffer(), byteOffset(), length());
}

template<typename Adaptor>
RefPtr<typename Adaptor::ViewType> JSGenericTypedArrayView<Adaptor>::unsharedTypedImpl()
{
    return Adaptor::ViewType::create(unsharedBuffer(), byteOffset(), length());
}

template<typename Adaptor>
ArrayBuffer* JSGenericTypedArrayView<Adaptor>::existingBuffer()
{
    return existingBufferInButterfly();
}

template<typename Adaptor>
EncodedJSValue JSGenericTypedArrayView<Adaptor>::throwNeuteredTypedArrayTypeError(ExecState* exec, EncodedJSValue object, PropertyName)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    ASSERT_UNUSED(object, jsCast<JSGenericTypedArrayView*>(JSValue::decode(object))->isNeutered());
    return throwVMTypeError(exec, scope, typedArrayBufferHasBeenDetachedErrorMessage);
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::getOwnPropertySlot(
    JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);

    if (std::optional<uint32_t> index = parseIndex(propertyName)) {
        if (thisObject->isNeutered()) {
            slot.setCustom(thisObject, None, throwNeuteredTypedArrayTypeError);
            return true;
        }

        if (thisObject->canGetIndexQuickly(index.value()))
            slot.setValue(thisObject, DontDelete | ReadOnly, thisObject->getIndexQuickly(index.value()));
        else
            slot.setValue(thisObject, DontDelete | ReadOnly, jsUndefined());
        return true;
    }

    return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::put(
    JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value,
    PutPropertySlot& slot)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);

    // https://tc39.github.io/ecma262/#sec-integer-indexed-exotic-objects-set-p-v-receiver
    // Ignore the receiver even if the receiver is altered to non base value.
    // 9.4.5.5-2-b-i Return ? IntegerIndexedElementSet(O, numericIndex, V).
    if (std::optional<uint32_t> index = parseIndex(propertyName))
        return putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode());

    return Base::put(thisObject, exec, propertyName, value, slot);
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::defineOwnProperty(
    JSObject* object, ExecState* exec, PropertyName propertyName,
    const PropertyDescriptor& descriptor, bool shouldThrow)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);

    if (parseIndex(propertyName)) {
        if (descriptor.isAccessorDescriptor())
            return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to store accessor indexed property on a typed array."));

        if (descriptor.configurable())
            return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to configure non-configurable property."));

        if (!descriptor.enumerable() || !descriptor.writable())
            return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to store non-enumerable or non-writable indexed property on a typed array."));

        if (descriptor.value()) {
            PutPropertySlot unused(JSValue(thisObject), shouldThrow);
            scope.release();
            return thisObject->put(thisObject, exec, propertyName, descriptor.value(), unused);
        }
        return true;
    }

    scope.release();
    return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::deleteProperty(
    JSCell* cell, ExecState* exec, PropertyName propertyName)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);

    if (thisObject->isNeutered())
        return typeError(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage));

    if (parseIndex(propertyName))
        return false;

    return Base::deleteProperty(thisObject, exec, propertyName);
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::getOwnPropertySlotByIndex(
    JSObject* object, ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);

    if (thisObject->isNeutered()) {
        slot.setCustom(thisObject, None, throwNeuteredTypedArrayTypeError);
        return true;
    }

    if (propertyName > MAX_ARRAY_INDEX) {
        return thisObject->methodTable()->getOwnPropertySlot(
            thisObject, exec, Identifier::from(exec, propertyName), slot);
    }

    if (!thisObject->canGetIndexQuickly(propertyName))
        return false;

    slot.setValue(thisObject, None, thisObject->getIndexQuickly(propertyName));
    return true;
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::putByIndex(
    JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);

    if (propertyName > MAX_ARRAY_INDEX) {
        PutPropertySlot slot(JSValue(thisObject), shouldThrow);
        return thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot);
    }

    return thisObject->setIndex(exec, propertyName, value);
}

template<typename Adaptor>
bool JSGenericTypedArrayView<Adaptor>::deletePropertyByIndex(
    JSCell* cell, ExecState* exec, unsigned propertyName)
{
    return cell->methodTable()->deleteProperty(cell, exec, Identifier::from(exec, propertyName));
}

template<typename Adaptor>
void JSGenericTypedArrayView<Adaptor>::getOwnPropertyNames(
    JSObject* object, ExecState* exec, PropertyNameArray& array, EnumerationMode mode)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);

    if (array.includeStringProperties()) {
        for (unsigned i = 0; i < thisObject->m_length; ++i)
            array.add(Identifier::from(exec, i));
    }

    return Base::getOwnPropertyNames(object, exec, array, mode);
}

template<typename Adaptor>
size_t JSGenericTypedArrayView<Adaptor>::estimatedSize(JSCell* cell)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);

    if (thisObject->m_mode == OversizeTypedArray)
        return Base::estimatedSize(thisObject) + thisObject->byteSize();
    if (thisObject->m_mode == FastTypedArray && thisObject->m_vector)
        return Base::estimatedSize(thisObject) + thisObject->byteSize();

    return Base::estimatedSize(thisObject);
}

template<typename Adaptor>
void JSGenericTypedArrayView<Adaptor>::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);

    switch (thisObject->m_mode) {
    case FastTypedArray: {
        if (void* vector = thisObject->m_vector.get())
            visitor.markAuxiliary(vector);
        break;
    }

    case OversizeTypedArray: {
        visitor.reportExtraMemoryVisited(thisObject->byteSize());
        break;
    }

    case WastefulTypedArray:
        break;

    case DataViewMode:
        RELEASE_ASSERT_NOT_REACHED();
        break;
    }

    Base::visitChildren(thisObject, visitor);
}

template<typename Adaptor>
ArrayBuffer* JSGenericTypedArrayView<Adaptor>::slowDownAndWasteMemory(JSArrayBufferView* object)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);

    // We play this game because we want this to be callable even from places that
    // don't have access to ExecState* or the VM, and we only allocate so little
    // memory here that it's not necessary to trigger a GC - just accounting what
    // we have done is good enough. The sort of bizarro exception to the "allocating
    // little memory" is when we transfer a backing buffer into the C heap; this
    // will temporarily get counted towards heap footprint (incorrectly, in the case
    // of adopting an oversize typed array) but we don't GC here anyway. That's
    // almost certainly fine. The worst case is if you created a ton of fast typed
    // arrays, and did nothing but caused all of them to slow down and waste memory.
    // In that case, your memory footprint will double before the GC realizes what's
    // up. But if you do *anything* to trigger a GC watermark check, it will know
    // that you *had* done those allocations and it will GC appropriately.
    Heap* heap = Heap::heap(thisObject);
    VM& vm = *heap->vm();
    DeferGCForAWhile deferGC(*heap);

    ASSERT(!thisObject->hasIndexingHeader());

    RELEASE_ASSERT(!thisObject->hasIndexingHeader());
    thisObject->m_butterfly.set(vm, thisObject, Butterfly::createOrGrowArrayRight(
        thisObject->butterfly(), vm, thisObject, thisObject->structure(),
        thisObject->structure()->outOfLineCapacity(), false, 0, 0));

    RefPtr<ArrayBuffer> buffer;

    switch (thisObject->m_mode) {
    case FastTypedArray:
        buffer = ArrayBuffer::create(thisObject->vector(), thisObject->byteLength());
        break;

    case OversizeTypedArray:
        // FIXME: consider doing something like "subtracting" from extra memory
        // cost, since right now this case will cause the GC to think that we reallocated
        // the whole buffer.
        buffer = ArrayBuffer::createAdopted(thisObject->vector(), thisObject->byteLength());
        break;

    default:
        RELEASE_ASSERT_NOT_REACHED();
        break;
    }

    thisObject->butterfly()->indexingHeader()->setArrayBuffer(buffer.get());
    thisObject->m_vector.setWithoutBarrier(buffer->data());
    WTF::storeStoreFence();
    thisObject->m_mode = WastefulTypedArray;
    heap->addReference(thisObject, buffer.get());

    return buffer.get();
}

template<typename Adaptor>
RefPtr<ArrayBufferView> JSGenericTypedArrayView<Adaptor>::getTypedArrayImpl(JSArrayBufferView* object)
{
    JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);
    return thisObject->possiblySharedTypedImpl();
}

} // namespace JSC


text:
package org.ayo.view;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class AyoViewLib {

	public static Context context;

	public static void init(Context context){
		AyoViewLib.context = context;
		Display.init(context);
	}

	public static void setListViewHeight(ListView listView){
		ListAdapter listAdapter = listView.getAdapter();
		if (listAdapter == null) {
			// pre-condition
			return;
		}

		int totalHeight = 0;
		for (int i = 0; i < listAdapter.getCount(); i++) {
			View listItem = listAdapter.getView(i, null, listView);
			listItem.measure(0, 0);
			totalHeight += listItem.getMeasuredHeight() + 30;
		}

		ViewGroup.LayoutParams params = listView.getLayoutParams();
		params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
		listView.setLayoutParams(params);
	}

	/**
	 *
	 * v
	 *  w  -1 = wrap_content, -2 = match_parent,or px
	 * h  -1 = wrap_content, -2 = match_parent,or px
	 */
	public static void setViewSize(View v, int w, int h){
		if(v == null) return;
		int w2 = w;
		if(w == -1)  w2 = ViewGroup.MarginLayoutParams.WRAP_CONTENT;
		if(w == -2)  w2 = ViewGroup.MarginLayoutParams.MATCH_PARENT;
		int h2 = h;
		if(h == -1)  h2 = ViewGroup.MarginLayoutParams.WRAP_CONTENT;
		if(h == -2)  h2 = ViewGroup.MarginLayoutParams.MATCH_PARENT;
		ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
		if(lp == null){
			lp = new ViewGroup.MarginLayoutParams(w2, h2);
		}else{
			lp.width = w2;
			lp.height = h2;
		}
		v.setLayoutParams(lp);
	}

	public static void showHtml(TextView tv, String html){

	}

	public static void showView(View v, int animId){

	}

	public static void hideView(View v, int animId){

	}

	/**
	 */
	public static void hideInputMethod(Activity activity, View v){
		if(v == null) v = activity.getCurrentFocus();
		InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
	}

	/**
	 */
	public static void showInputMethod(Activity activity, View v){
		if(v == null) v = activity.getCurrentFocus();
		InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(v.getWindowToken(), 0); //强制隐藏键盘
	}

	/**
	 */
	public static void showInputMethod(View v){
		v.performClick();
	}

	/**
	 * @param activity
	 */
	public static void closeInputMethodBoard(Activity activity){
		activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
	}

	/**
	 * @param activity
	 */
	public static void showInputMethodBoard(Activity activity){
		activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
	}

	public static void toggleInputMethod(Activity activity){
		InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);

		if (imm.isActive()) {
		}
	}

	/**
	 * @param v
	 */
	public static void locationTheLast(EditText v){
		v.setSelection(v.getText().length());
	}
}


text: Must update myself re: ES6 / Babel.js


text:
#include "precomp.hpp"

#include "opencv2/photo/cuda.hpp"
#include BLIK_OPENCV_U_opencv2__core__private_D_cuda_hpp //original-code:"opencv2/core/private.cuda.hpp"

#include BLIK_OPENCV_U_opencv2__opencv_modules_hpp //original-code:"opencv2/opencv_modules.hpp"

#ifdef HAVE_OPENCV_CUDAARITHM
#  include "opencv2/cudaarithm.hpp"
#endif

#ifdef HAVE_OPENCV_CUDAIMGPROC
#  include "opencv2/cudaimgproc.hpp"
#endif

using namespace cv;
using namespace cv::cuda;

#if !defined (HAVE_CUDA) || !defined(HAVE_OPENCV_CUDAARITHM) || !defined(HAVE_OPENCV_CUDAIMGPROC)

void cv::cuda::nonLocalMeans(InputArray, OutputArray, float, int, int, int, Stream&) { throw_no_cuda(); }
void cv::cuda::fastNlMeansDenoising(InputArray, OutputArray, float, int, int, Stream&) { throw_no_cuda(); }
void cv::cuda::fastNlMeansDenoisingColored(InputArray, OutputArray, float, float, int, int, Stream&) { throw_no_cuda(); }

#else

//////////////////////////////////////////////////////////////////////////////////
//// Non Local Means Denosing (brute force)

namespace cv { namespace cuda { namespace device
{
    namespace imgproc
    {
        template<typename T>
        void nlm_bruteforce_gpu(const PtrStepSzb& src, PtrStepSzb dst, int search_radius, int block_radius, float h, int borderMode, cudaStream_t stream);
    }
}}}

void cv::cuda::nonLocalMeans(InputArray _src, OutputArray _dst, float h, int search_window, int block_window, int borderMode, Stream& stream)
{
    using cv::cuda::device::imgproc::nlm_bruteforce_gpu;
    typedef void (*func_t)(const PtrStepSzb& src, PtrStepSzb dst, int search_radius, int block_radius, float h, int borderMode, cudaStream_t stream);

    static const func_t funcs[4] = { nlm_bruteforce_gpu<uchar>, nlm_bruteforce_gpu<uchar2>, nlm_bruteforce_gpu<uchar3>, 0/*nlm_bruteforce_gpu<uchar4>,*/ };

    const GpuMat src = _src.getGpuMat();

    CV_Assert(src.type() == CV_8U || src.type() == CV_8UC2 || src.type() == CV_8UC3);

    const func_t func = funcs[src.channels() - 1];
    CV_Assert(func != 0);

    int b = borderMode;
    CV_Assert(b == BORDER_REFLECT101 || b == BORDER_REPLICATE || b == BORDER_CONSTANT || b == BORDER_REFLECT || b == BORDER_WRAP);

    _dst.create(src.size(), src.type());
    GpuMat dst = _dst.getGpuMat();

    func(src, dst, search_window/2, block_window/2, h, borderMode, StreamAccessor::getStream(stream));
}

namespace cv { namespace cuda { namespace device
{
    namespace imgproc
    {
        void nln_fast_get_buffer_size(const PtrStepSzb& src, int search_window, int block_window, int& buffer_cols, int& buffer_rows);

        template<typename T>
        void nlm_fast_gpu(const PtrStepSzb& src, PtrStepSzb dst, PtrStepi buffer,
                          int search_window, int block_window, float h, cudaStream_t stream);

        void fnlm_split_channels(const PtrStepSz<uchar3>& lab, PtrStepb l, PtrStep<uchar2> ab, cudaStream_t stream);
        void fnlm_merge_channels(const PtrStepb& l, const PtrStep<uchar2>& ab, PtrStepSz<uchar3> lab, cudaStream_t stream);
     }
}}}

void cv::cuda::fastNlMeansDenoising(InputArray _src, OutputArray _dst, float h, int search_window, int block_window, Stream& stream)
{
    const GpuMat src = _src.getGpuMat();

    CV_Assert(src.depth() == CV_8U && src.channels() < 4);

    int border_size = search_window/2 + block_window/2;
    Size esize = src.size() + Size(border_size, border_size) * 2;

    BufferPool pool(stream);

    GpuMat extended_src = pool.getBuffer(esize, src.type());
    cv::cuda::copyMakeBorder(src, extended_src, border_size, border_size, border_size, border_size, cv::BORDER_DEFAULT, Scalar(), stream);
    GpuMat src_hdr = extended_src(Rect(Point2i(border_size, border_size), src.size()));

    int bcols, brows;
    device::imgproc::nln_fast_get_buffer_size(src_hdr, search_window, block_window, bcols, brows);
    GpuMat buffer = pool.getBuffer(brows, bcols, CV_32S);

    using namespace cv::cuda::device::imgproc;
    typedef void (*nlm_fast_t)(const PtrStepSzb&, PtrStepSzb, PtrStepi, int, int, float, cudaStream_t);
    static const nlm_fast_t funcs[] = { nlm_fast_gpu<uchar>, nlm_fast_gpu<uchar2>, nlm_fast_gpu<uchar3>, 0};

    _dst.create(src.size(), src.type());
    GpuMat dst = _dst.getGpuMat();

    funcs[src.channels()-1](src_hdr, dst, buffer, search_window, block_window, h, StreamAccessor::getStream(stream));
}

void cv::cuda::fastNlMeansDenoisingColored(InputArray _src, OutputArray _dst, float h_luminance, float h_color, int search_window, int block_window, Stream& stream)
{
    const GpuMat src = _src.getGpuMat();

    CV_Assert(src.type() == CV_8UC3);

    BufferPool pool(stream);

    GpuMat lab = pool.getBuffer(src.size(), src.type());
    cv::cuda::cvtColor(src, lab, cv::COLOR_BGR2Lab, 0, stream);

    GpuMat l = pool.getBuffer(src.size(), CV_8U);
    GpuMat ab = pool.getBuffer(src.size(), CV_8UC2);
    device::imgproc::fnlm_split_channels(lab, l, ab, StreamAccessor::getStream(stream));

    fastNlMeansDenoising(l, l, h_luminance, search_window, block_window, stream);
    fastNlMeansDenoising(ab, ab, h_color, search_window, block_window, stream);

    device::imgproc::fnlm_merge_channels(l, ab, lab, StreamAccessor::getStream(stream));
    cv::cuda::cvtColor(lab, _dst, cv::COLOR_Lab2BGR, 0, stream);
}

#endif


text:
class Object
  def in?(*array)
    array = array.first if array.first.is_a?(Array)
    array.include?(self)
  end
end


text:
package scala
package tools
package nsc

import java.io.{ OutputStream, PrintStream, ByteArrayOutputStream, PrintWriter, StringWriter, Reader }
import scala.collection.immutable.ArraySeq

package object util {
  // forwarder for old code that builds against 2.9 and 2.10
  val Chars = scala.reflect.internal.Chars

  type Set[T <: AnyRef] = scala.reflect.internal.util.Set[T]
  type HashSet[T >: Null <: AnyRef] = scala.reflect.internal.util.HashSet[T]
  val HashSet = scala.reflect.internal.util.HashSet

  /** Execute code and then wait for all non-daemon Threads
   *  created and begun during its execution to complete.
   */
  def waitingForThreads[T](body: => T) = {
    val (result, created) = trackingThreads(body)
    val threads = created filterNot (_.isDaemon)

    // As long as there are non-daemon, live threads (the latter
    // condition should exclude shutdown hooks) we will wait.
    while (threads exists (_.isAlive))
      threads filter (_.isAlive) foreach (_.join())

    result
  }

  /** Executes the code and returns the result and any threads
   *  which were created during its execution.
   */
  def trackingThreads[T](body: => T): (T, Seq[Thread]) = {
    def allThreads(): IndexedSeq[Thread] = {
      val tarray = new Array[Thread](Thread.activeCount())
      val got    = Thread.enumerate(tarray)

      ArraySeq.unsafeWrapArray(tarray.take(got))
    }

    val ts1    = allThreads()
    val result = body
    val ts2    = allThreads()

    (result, ts2 filterNot (ts1 contains _))
  }

  def stringFromReader(reader: Reader) = {
    val writer = new StringWriter()
    var c = reader.read()
    while(c != -1) {
      writer.write(c)
      c = reader.read()
    }
    reader.close()
    writer.toString()
  }

  /** Generate a string using a routine that wants to write on a stream. */
  def stringFromWriter(writer: PrintWriter => Unit): String = {
    val stringWriter = new StringWriter()
    val stream = new NewLinePrintWriter(stringWriter)
    writer(stream)
    stream.close()
    stringWriter.toString
  }
  def stringFromStream(stream: OutputStream => Unit): String = {
    val bs = new ByteArrayOutputStream()
    val ps = new PrintStream(bs)
    stream(ps)
    ps.close()
    bs.toString()
  }
  def stackTraceString(ex: Throwable): String = stringFromWriter(ex.printStackTrace)

  /** A one line string which contains the class of the exception, the
   *  message if any, and the first non-Predef location in the stack trace
   *  (to exclude assert, require, etc.)
   */
  def stackTraceHeadString(ex: Throwable): String = {
    val frame = ex.getStackTrace.dropWhile(_.getClassName contains "Predef") take 1 mkString ""
    val msg   = ex.getMessage match { case null | "" => "" ; case s => s"""("$s")""" }
    val clazz = ex.getClass.getName.split('.').last

    s"$clazz$msg @ $frame"
  }

  implicit class StackTraceOps(private val e: Throwable) extends AnyVal with StackTracing {
    /** Format the stack trace, returning the prefix consisting of frames that satisfy
     *  a given predicate.
     *  The format is similar to the typical case described in the Javadoc
     *  for [[java.lang.Throwable#printStackTrace()*]].
     *  If a stack trace is truncated, it will be followed by a line of the form
     *  `... 3 elided`, by analogy to the lines `... 3 more` which indicate
     *  shared stack trace segments.
     *  @param p the predicate to select the prefix
     */
    def stackTracePrefixString(p: StackTraceElement => Boolean): String = stackTracePrefixString(e)(p)
  }

  implicit class `quickie stack dump`(private val sc: StringContext) extends AnyVal {
    @deprecated("For debug only", since="forever")
    def trace(args: Any*): Unit = new Throwable(sc.s(args: _*)).printStackTrace()
  }

  lazy val trace = new SimpleTracer(System.out)

  // These four deprecated since 2.10.0 are still used in
  // the sbt 0.13 compiler interface.
  @deprecated("Moved to scala.reflect.internal.util.Position", "2.10.0")
  type Position = scala.reflect.internal.util.Position
  @deprecated("Moved to scala.reflect.internal.util.NoPosition", "2.10.0")
  val NoPosition = scala.reflect.internal.util.NoPosition
  @deprecated("Moved to scala.reflect.internal.util.FakePos", "2.10.0")
  val FakePos = scala.reflect.internal.util.FakePos
  @deprecated("Moved to scala.reflect.internal.util.FakePos", "2.10.0")
  type FakePos = scala.reflect.internal.util.FakePos

  // These three were still used in scala-refactoring.
  @deprecated("Moved to scala.reflect.internal.util.RangePosition", "2.10.0")
  type RangePosition = scala.reflect.internal.util.RangePosition
  @deprecated("Moved to scala.reflect.internal.util.SourceFile", "2.10.0")
  type SourceFile = scala.reflect.internal.util.SourceFile
  @deprecated("Moved to scala.reflect.internal.util.BatchSourceFile", "2.10.0")
  type BatchSourceFile = scala.reflect.internal.util.BatchSourceFile

  @deprecated("Moved to scala.reflect.internal.util.AbstractFileClassLoader", "2.11.0")
  type AbstractFileClassLoader = scala.reflect.internal.util.AbstractFileClassLoader

  @deprecated("Moved to scala.reflect.internal.util.ScalaClassLoader", "2.11.0")
  val ScalaClassLoader = scala.reflect.internal.util.ScalaClassLoader

  @deprecated("Moved to scala.reflect.internal.util.ScalaClassLoader", "2.11.0")
  type ScalaClassLoader = scala.reflect.internal.util.ScalaClassLoader
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.eas.server;

import com.eas.client.login.PlatypusPrincipal;
import com.eas.script.AlreadyPublishedException;
import com.eas.script.HasPublished;
import com.eas.script.ScriptFunction;
import com.eas.script.Scripts;
import com.eas.server.scripts.ModulesJSFacade;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.internal.runtime.JSType;

/**
 * A client session
 *
 *

 * This object is created to represent a session with successfully authenticated
 * client. It is used to associate various resources such as tasks with a a
 * client. Whenever a session is cleanup()-ed, the resources are
 * deleted.
 Method rollback of database client is also invoked.
 *
 * @author pk, mg refactoring
 */
public class Session implements HasPublished {

    protected JSObject published;
    //
    private final String sessionId;
    private final AtomicLong ctime = new AtomicLong();
    private final AtomicLong atime = new AtomicLong();
    private final Map<String, JSObject> modulesInstances = new HashMap<>();
    private int maxInactiveInterval = 3600000; // 1 hour
    private Scripts.Space space;
    private PlatypusPrincipal principal;
    private final JSObject jsModules = new ModulesJSFacade(this);

    /**
     * Creates a new session with given session id.
     *
     * @param aSessionId unique session id.
     */
    public Session(String aSessionId) {
        super();
        sessionId = aSessionId;
        ctime.set(System.currentTimeMillis());
        atime.set(ctime.get());
    }

    public Scripts.Space getSpace() {
        return space;
    }

    public void setSpace(Scripts.Space aValue) {
        space = aValue;
    }

    /**
     * Warning!!! Don't call this getter. It is provided only for TSA Server
     * authentication process. Instead use Scripts.getContext().getPrincipal()
     * please.
     *
     * @return
     */
    public PlatypusPrincipal getPrincipal() {
        return principal;
    }

    public void setPrincipal(PlatypusPrincipal aValue) {
        principal = aValue;
    }

    /**
     * Deletes all resources belonging to this session.
     */
    public void cleanup() {
        // server modules
        modulesInstances.clear();
        // data in client's transaction
    }

    /**
     * Returns the creation time of this session (server time).
     *
     * @return session creation time.
     */
    public long getCTime() {
        return ctime.get();
    }

    /**
     * Returns the last access time of this session (server time).
     *
     *

     * The last access time is the last time accessed() was called. This
     * mechanism is used to track down sessions which have been idle for a long
     * time, i.e. possible zombies.

     *
     * @return last access time.
     */
    public long getATime() {
        return atime.get();
    }

    /**
     * Mark that this session was just accessed by its client, update last
     * access time.
     *
     *

     * The last access time is the last time accessed() was called. This
     * mechanism is used to track down sessions which have been idle for a long
     * time, i.e. possible zombies.

     *
     *

     * Call this method once for each client request inside this session.

     *
     * @return new last access time.
     */
    public long accessed() {
        atime.set(System.currentTimeMillis());
        return atime.get();
    }

    /*
     public void setPrincipal(PlatypusPrincipal aPrincipal) {
     String oldUserName = principal != null ? principal.getName() : null;
     String newUserName = aPrincipal != null ? aPrincipal.getName() : null;
     if (oldUserName == null ? newUserName != null : !oldUserName.equals(newUserName)) {
     userContext = null;
     if (newUserName != null && serverCore != null && serverCore.getDatabasesClient() != null) {
     try {
     Map<String, String> userProps = DatabasesClient.getUserProperties(serverCore.getDatabasesClient(), newUserName, null, null);
     userContext = userProps.get(ClientConstants.F_USR_CONTEXT);
     } catch (Exception ex) {
     Logger.getLogger(SessionManager.class.getName()).log(Level.WARNING, "Could not get user {0} properties (USR_CONTEXT, etc).", newUserName);
     }
     }
     }
     if (principal != null) {
     principal.setContext(null);
     }
     principal = aPrincipal;
     if (principal != null) {
     // let's update pricipal's
     principal.setContext(userContext);
     // pricipal's roles are processed by container, so there is no need to update them here
     }
     }
     */
    /**
     * Returns server module by name.
     *
     * @param aName
     * @return
     */
    public JSObject getModule(String aName) {
        return modulesInstances.get(aName);
    }

    public boolean containsModule(String aName) {
        return modulesInstances.containsKey(aName);
    }

    public void registerModule(JSObject aModule) {
        registerModule(null, aModule);
    }

    public void registerModule(String aName, JSObject aModule) {
        if (aName == null || aName.isEmpty()) {
            JSObject c = (JSObject) aModule.getMember("constructor");
            aName = JSType.toString(c.getMember("name"));
        }
        modulesInstances.put(aName, aModule);
    }

    public void unregisterModule(String aModuleName) {
        modulesInstances.remove(aModuleName);
    }

    public void unregisterModules() {
        modulesInstances.clear();
    }

    public Set<Map.Entry<String, JSObject>> getModulesEntries() {
        return Collections.unmodifiableSet(modulesInstances.entrySet());
    }

    /**
     * Returns this session's id.
     *
     * @return session id.
     */
    public String getId() {
        return sessionId;
    }

    public void setMaxInactiveInterval(int aInterval) {
        maxInactiveInterval = aInterval;
    }

    public int getMaxInactiveInterval() {
        return maxInactiveInterval;
    }

    public boolean isNew() {
        return false;
    }

    @ScriptFunction(jsDoc = ""
            + "/**\n"
            + " * Contains modules collection of this session.\n"
            + " */")
    public JSObject getModules() {
        return jsModules;
    }

    @Override
    public void setPublished(JSObject aValue) {
        if (published != null) {
            throw new AlreadyPublishedException();
        }
        published = aValue;
    }

    @Override
    public JSObject getPublished() {
        return published;
    }
}


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

describe Sprinkle::Installers::Transfer do
  include Sprinkle::Deployment

  before do
    @package = mock(Sprinkle::Package, :name => 'package', :sudo? => false)
    @empty = Proc.new { }
    @delivery = mock(Sprinkle::Deployment, :install => true)
		@source = 'source'
		@destination = 'destination'
    @installer = create_transfer(@source, @destination)
    @roles = []
    @deployment = deployment do
      delivery :capistrano
      installer do; prefix '/usr/bin'; end
    end
  end

  def create_transfer(source, dest, options={}, &block)
    i = Sprinkle::Installers::Transfer.new(@package, source, dest, options, &block)
    i.delivery = @delivery
		i
  end

  describe 'when created' do
    it 'should accept a source and destination to install' do
      @installer.source.should == @source
      @installer.destination.should == @destination
    end
  end

  describe 'during installation' do

    context "setting mode and owner" do
      before do
        @installer = create_transfer @source, @destination do
          mode "744"
          owner "root"
        end
        @installer_commands = @installer.install_sequence
      end

      it "should include command to set owner" do
        @installer_commands.should include("chmod 744 #{@destination}")
      end

      it "should include command to set mode" do
        @installer_commands.should include("chown root #{@destination}")
      end

    end

    context 'single pre/post commands' do
      before do
        @installer = create_transfer @source, @destination do
          pre :install, 'op1'
          post :install, 'op2'
        end
        @installer_commands = @installer.install_sequence
        @delivery = @installer.delivery
      end

      it "should call the pre and post install commands around the file transfer" do
        @installer_commands.should == ["op1",:TRANSFER, "op2"]
      end

      # it "should call transfer with recursive defaulted to nil" do
      #   @delivery.should_receive(:process).and_return
      #   @delivery.should_receive(:transfer).with(@package.name, @source, @destination, @roles, nil)
      # end

    end

    context 'multiple pre/post commands' do
      before do
        @installer = create_transfer @source, @destination do
          pre :install, 'op1', 'op1-1'
          post :install, 'op2', 'op2-1'
        end
        @installer_commands = @installer.install_sequence
        @delivery = @installer.delivery
      end

      it "should call the pre and post install commands around the file transfer" do
        @installer_commands.should == ["op1","op1-1",:TRANSFER, "op2","op2-1"]
      end

    end

		after do
      @installer.process @roles
    end
  end

	describe "if the :render flag is true" do
		before do
      @installer = create_transfer @source, @destination, :render => true
			@delivery = @installer.delivery
			@delivery.stub!(:render_template_file)
    end

		it "should render the source file as a template to a tempfile" do
			@tempfile = Tempfile.new("foo")
			@installer.should_receive(:render_template_file).with(@source, anything, @package.name).and_return(@tempfile)
			@delivery.stub!(:transfer)
		end

		it "should call transfer with recursive set to false" do
			@tempfile = Tempfile.new("foo")
			@installer.should_receive(:render_template_file).with(@source, anything, @package.name).and_return(@tempfile)
			@installer.options[:recursive].should == false
		end

		after do
      @installer.process @roles
    end
	end

	describe "if the :recursive flag is explicitly set to false" do
		before do
      @installer = create_transfer @source, @destination, :recursive => false
    end

		it "should call transfer with recursive set to false" do
			delivery = @installer.delivery
			@installer.options[:recursive].should == false
		end

		after do
      @installer.process @roles
    end
	end
end


text:
      :

        Google Plus

        Youtube

        Facebook

        Twitter


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/semc_button_corner_up_left_pressed" />
    <item android:state_focused="true" android:drawable="@drawable/semc_button_corner_up_left_focused" />
    <item android:drawable="@drawable/semc_button_corner_up_left" />
</selector>


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Plateforme Anelis</title>

  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">

  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">

  <link rel="stylesheet" href="plugins/iCheck/square/blue.css">

S'identifier

    <form action="starter.html" method="post">

        <input type="email" class="form-control" placeholder="Email">

        <input type="password" class="form-control" placeholder="Password">

              <input type="checkbox"> Se souvenir de moi

          <button type="submit" class="btn btn-primary btn-block btn-flat">Connexion</button>

    </form>

    J'ai oublié mon mot de passe


text:
package mavliwala.nazmuddin.zoloassignment.forgotpassword.presenters;

import android.content.Context;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;

import mavliwala.nazmuddin.domain.forgotpassword.ForgotPasswordUseCase;
import mavliwala.nazmuddin.zoloassignment.R;
import mavliwala.nazmuddin.zoloassignment.forgotpassword.views.ForgotPasswordView;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

/**
 * Created by nazmuddinmavliwala on 30/07/17.
 */

@RunWith(MockitoJUnitRunner.class)
public class ForgotPasswordPresenterTest {

    public static final String EMAIL_CANNOT_BE_EMPTY = "Email cannot be empty";
    public static final String INVALID_EMAIL = "Invalid email";

    @Mock
    ForgotPasswordView view;

    @Mock
    ForgotPasswordUseCase useCase;

    @Mock
    Context context;
    private ForgotPasswordPresenter presenter;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        when(this.context.getString(R.string.empty_email_error)).thenReturn(EMAIL_CANNOT_BE_EMPTY);
        when(this.context.getString(R.string.invalid_email_error)).thenReturn(INVALID_EMAIL);
        when(this.view.getContext()).thenReturn(this.context);
        this.presenter = new ForgotPasswordPresenter(this.view,this.useCase,null);
    }

    @Test
    public void showReturnEmptyEmailError_WhenEmailISEmpty() throws Exception {
        this.presenter.validate(null);
        verify(this.view).showError(EMAIL_CANNOT_BE_EMPTY);
    }

    @Test
    public void shouldReturnInvalidEmailError_WhenEmailIsInvalid() throws Exception {
        this.presenter.validate("defgv3gb");
        verify(this.view).showError(INVALID_EMAIL);
    }

    @Test
    public void validate_HappyCase() throws Exception {
        this.presenter.validate("nazam@gmail.com");
        verify(this.view).onSuccessFullValidation();
    }
}


text:
import {StyleSheet} from 'react-native';

export default StyleSheet.create({
  container: {
    alignItems: 'center',
    backgroundColor: '#31AACC',
    justifyContent: 'center',
    marginTop: -5,
    paddingBottom: 20,
    paddingTop: 10
  },
  header: {
    color: '#fff',
    fontSize: 20,
  }
});


text:
require "active_support/core_ext/string/conversions"

module ActiveRecord
  module Associations
    # Keeps track of table aliases for ActiveRecord::Associations::JoinDependency
    class AliasTracker # :nodoc:
      def self.create(connection, initial_table, joins)
        if joins.empty?
          aliases = Hash.new(0)
        else
          aliases = Hash.new { |h, k|
            h[k] = initial_count_for(connection, k, joins)
          }
        end
        aliases[initial_table] = 1
        new(connection, aliases)
      end

      def self.initial_count_for(connection, name, table_joins)
        quoted_name = nil

        counts = table_joins.map do |join|
          if join.is_a?(Arel::Nodes::StringJoin)
            # quoted_name should be case ignored as some database adapters (Oracle) return quoted name in uppercase
            quoted_name ||= connection.quote_table_name(name)

            # Table names + table aliases
            join.left.scan(
              /JOIN(?:\s+\w+)?\s+(?:\S+\s+)?(?:#{quoted_name}|#{name})\sON/i
            ).size
          elsif join.is_a?(Arel::Nodes::Join)
            join.left.name == name ? 1 : 0
          elsif join.is_a?(Hash)
            join[name]
          else
            raise ArgumentError, "joins list should be initialized by list of Arel::Nodes::Join"
          end
        end

        counts.sum
      end

      # table_joins is an array of arel joins which might conflict with the aliases we assign here
      def initialize(connection, aliases)
        @aliases    = aliases
        @connection = connection
      end

      def aliased_table_for(table_name, aliased_name, type_caster)
        if aliases[table_name].zero?
          # If it's zero, we can have our table_name
          aliases[table_name] = 1
          Arel::Table.new(table_name, type_caster: type_caster)
        else
          # Otherwise, we need to use an alias
          aliased_name = @connection.table_alias_for(aliased_name)

          # Update the count
          aliases[aliased_name] += 1

          table_alias = if aliases[aliased_name] > 1
            "#{truncate(aliased_name)}_#{aliases[aliased_name]}"
          else
            aliased_name
          end
          Arel::Table.new(table_name, type_caster: type_caster).alias(table_alias)
        end
      end

      attr_reader :aliases

      private
        def truncate(name)
          name.slice(0, @connection.table_alias_length - 2)
        end
    end
  end
end


text:
package org.waveprotocol.wave.client.doodad.attachment;

import org.waveprotocol.box.attachment.AttachmentMetadata;
import org.waveprotocol.box.attachment.impl.AttachmentMetadataImpl;
import org.waveprotocol.wave.media.model.Attachment;

/**
 * @author akaplanov@gmail.com (A. Kaplanov)
 */
public class AttachmentImpl implements Attachment {

  private AttachmentMetadata metadata;
  private Status status = Status.NOT_UPLOADING;

  public AttachmentImpl() {
    metadata = new AttachmentMetadataImpl();
  }

  public void copyMetadata(AttachmentMetadata metadata) {
    this.metadata.copyFrom(metadata);
  }

  @Override
  public String getAttachmentId() {
    return metadata.getAttachmentId();
  }

  @Override
  public String getCreator() {
    return metadata.getCreator();
  }

  @Override
  public String getAttachmentUrl() {
    return metadata.getAttachmentUrl();
  }

  @Override
  public String getThumbnailUrl() {
    return metadata.getThumbnailUrl();
  }

  @Override
  public String getMimeType() {
    return metadata.getMimeType();
  }

  @Override
  public String getFilename() {
    return metadata.getFileName();
  }

  @Override
  public Long getSize() {
    return metadata.getSize();
  }

  @Override
  public ImageMetadata getContentImageMetadata() {
    if (metadata.hasImageMetadata()) {
      return new ImageMetadata() {

        @Override
        public int getWidth() {
          return metadata.getImageMetadata().getWidth();
        }

        @Override
        public int getHeight() {
          return metadata.getImageMetadata().getHeight();
        }
      };
    } else {
      return null;
    }
  }

  @Override
  public ImageMetadata getThumbnailImageMetadata() {
    if (metadata.hasThumbnailMetadata()) {
      return new ImageMetadata() {

        @Override
        public int getWidth() {
          return metadata.getThumbnailMetadata().getWidth();
        }

        @Override
        public int getHeight() {
          return metadata.getThumbnailMetadata().getHeight();
        }
      };
    } else {
      return null;
    }
  }

  @Override
  public long getUploadedByteCount() {
    throw new UnsupportedOperationException("Not supported yet.");
  }

  @Override
  public long getUploadRetryCount() {
    throw new UnsupportedOperationException("Not supported yet.");
  }

  @Override
  public boolean isMalware() {
    if (metadata.hasMalware()) {
      return metadata.getMalware();
    }
    return false;
  }

  @Override
  public Status getStatus() {
    return status;
  }

  public void setStatus(Status status) {
    this.status = status;
  }
}


text:
RSpec.describe 'OrderGroup' do
  let(:order_group) { ::RSpec::Mocks::OrderGroup.new }

  describe '#consume' do
    let(:ordered_1) { double :ordered? => true }
    let(:ordered_2) { double :ordered? => true }
    let(:unordered) { double :ordered? => false }

    before do
      order_group.register unordered
      order_group.register ordered_1
      order_group.register unordered
      order_group.register ordered_2
      order_group.register unordered
      order_group.register unordered
    end

    it 'returns the first ordered? expectation' do
      expect(order_group.consume).to eq ordered_1
    end
    it 'keeps returning ordered? expectation until all are returned' do
      expectations = 3.times.map { order_group.consume }
      expect(expectations).to eq [ordered_1, ordered_2, nil]
    end
  end
end


text:
package br.eti.rslemos.tools.collections;

import static junit.framework.Assert.fail;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;

public class OrderedMultiDimensionalMapUnitTest {
	@Test
	public void testOneDimensionalMap() {
		MultiDimensionalMap<String, Integer> map = new OrderedMultiDimensionalMap<String, Integer>(new PackedArray<Integer>(10));

		// info
		assertThat(map.dimensions(), is(equalTo(1)));
		assertThat(map.length(0), is(equalTo(0)));

		// storage
		map.put( 1, " 1");
		map.put( 2, " 2");
		map.put( 3, " 3");
		map.put( 4, " 4");
		map.put( 5, " 5");
		map.put( 6, " 6");
		map.put( 7, " 7");
		map.put( 8, " 8");
		map.put( 9, " 9");
		map.put(10, "10");

		assertThat(map.length(0), is(equalTo(10)));

		assertThat(map.get(" 1"), is(equalTo( 1)));
		assertThat(map.get(" 2"), is(equalTo( 2)));
		assertThat(map.get(" 3"), is(equalTo( 3)));
		assertThat(map.get(" 4"), is(equalTo( 4)));
		assertThat(map.get(" 5"), is(equalTo( 5)));
		assertThat(map.get(" 6"), is(equalTo( 6)));
		assertThat(map.get(" 7"), is(equalTo( 7)));
		assertThat(map.get(" 8"), is(equalTo( 8)));
		assertThat(map.get(" 9"), is(equalTo( 9)));
		assertThat(map.get("10"), is(equalTo(10)));

		// boundary check
		lengthAndExpectException(IllegalArgumentException.class, map, -1);
		lengthAndExpectException(IllegalArgumentException.class, map,  1);

		accessAndExpectException(IllegalArgumentException.class, map);
		accessAndExpectException(IllegalArgumentException.class, map, "key1", "key2");
		accessAndExpectException(IllegalArgumentException.class, map, "key1", "key2", "key3");
	}

	private static <K, V, E extends RuntimeException> void accessAndExpectException(Class<E> clazz, MultiDimensionalMap<K, V> map, K... key) {
		getAndExpectException(clazz, map, key);
		putAndExpectException(clazz, map, key);
	}

	private static <K, V, E extends RuntimeException> void putAndExpectException(Class<E> clazz, MultiDimensionalMap<K, V> map, K... key) {
		try {
			map.put(null, key);
			fail("Should have thrown " + clazz);
		} catch (RuntimeException expected) {
			if (!clazz.isInstance(expected))
				throw expected;
		}
	}

	private static <K, V, E extends RuntimeException> void getAndExpectException(Class<E> clazz, MultiDimensionalMap<K, V> map, K... key) {
		try {
			map.get(key);
			fail("Should have thrown " + clazz);
		} catch (RuntimeException expected) {
			if (!clazz.isInstance(expected))
				throw expected;
		}
	}

	private static <K, V, E extends RuntimeException> void lengthAndExpectException(Class<E> clazz, MultiDimensionalMap<K, V> map, int dimension) {
		try {
			map.length(dimension);
			fail("Should have thrown " + clazz);
		} catch (RuntimeException expected) {
			if (!clazz.isInstance(expected))
				throw expected;
		}
	}
}


text:
======================
For Statement Iterable
======================

Question
========

ADDQUESTION

Solution
========

.. literalinclude:: ../../languages/java/ForStatementIterable.java
   :language: java
   :tab-width: 4

.. runcode:: ../../languages/java/ForStatementIterable.java
   :language: java
   :codesite: ideone

Explanation
===========

.. git_changelog::

.. seealso::

   * :java-suggest-improve:`ForStatementIterable.java`
   * :java-better-explain:`ForStatementIterable.rst`


text:
package ge.edu.freeuni.sdp.snake.presenter;

import ge.edu.freeuni.sdp.snake.model.CommonGameFacadeFactory;
import ge.edu.freeuni.sdp.snake.model.GameFacade;
import ge.edu.freeuni.sdp.snake.model.GameFacadeFactory;
import ge.edu.freeuni.sdp.snake.model.HighScoreData;

public class PresenterFactory {

	private GameFacade game;
	private GameFacadeFactory gameFacadeFactory;

	public PresenterFactory() {
		this(new CommonGameFacadeFactory());
	}

	public PresenterFactory(GameFacadeFactory gameFacadeFactory) {
		this.gameFacadeFactory = gameFacadeFactory;

	}

	public LevelPresenter getLevelPresenter() {
		return new LevelPresenter();
	}

	public MazePresenter getMazePresenter() {
		game = gameFacadeFactory.getGameFacade();
		return new MazePresenter(game);
	}

	public GameOverPresenter getGameOverPresenter() {
		return new GameOverPresenter();
	}

	public HighScorePresenter getHighScorePresenter(){
		HighScoreData data = new HighScoreData();
		return new HighScorePresenter(data,game);
	}

}


text:
<?php

include_once dirname(__FILE__) . "/NotORM/Structure.php";
include_once dirname(__FILE__) . "/NotORM/Cache.php";
include_once dirname(__FILE__) . "/NotORM/Literal.php";
include_once dirname(__FILE__) . "/NotORM/Result.php";
include_once dirname(__FILE__) . "/NotORM/MultiResult.php";
include_once dirname(__FILE__) . "/NotORM/Row.php";
switch (JJDbConfig::$type) {
	case 'pdo':
		include_once dirname(__FILE__) . "/driver/JJPDO.php";
		break;
	case 'mysql':
		include_once dirname(__FILE__) . "/driver/JJMysql.php";
		break;
	case 'mysqli':
		include_once dirname(__FILE__) . "/driver/JJMysqli.php";
		break;
}
// friend visibility emulation
abstract class NotORM_Abstract {
	protected $connection, $driver, $structure, $cache;
	protected $notORM, $table, $primary, $rows, $referenced = array();

	protected $debug = false;
	protected $freeze = false;
	protected $rowClass = 'NotORM_Row';

	protected function access($key, $delete = false) {
	}

}
/** Database representation
 * @property-write mixed $debug = false Enable debuging queries, true for fwrite(STDERR, $query), callback($query, $parameters) otherwise
 * @property-write bool $freeze = false Disable persistence
 * @property-write string $rowClass = 'NotORM_Row' Class used for created objects
 * @property-write string $transaction Assign 'BEGIN', 'COMMIT' or 'ROLLBACK' to start or stop transaction
 */
class NotORM extends NotORM_Abstract {

	public $JJDAO;
	public $type;
	/** Create database representation
	 * @param PDO
	 * @param NotORM_Structure or null for new NotORM_Structure_Convention
	 * @param NotORM_Cache or null for no cache
	 */
	function __construct(NotORM_Structure $structure = null, NotORM_Cache $cache = null) {

		switch (JJDbConfig::$type) {
			case 'pdo':
				$this->JJDAO=new JJPDO();
				$this->type="pdo";
				$this->connection = $this->JJDAO->connection;
				$this->driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
				break;
			case 'mysql':
				$this->JJDAO=new JJMysql();
				$this->driver ='mysql';
				$this->type="mysql";
				break;
			case 'mysqli':
				$this->JJDAO=new JJMysqli();
				$this->driver ='mysql';
				$this->type="mysqli";
				break;
		}

		if (!isset($structure)) {
			$structure = new NotORM_Structure_Convention;
		}
		$this->structure = $structure;
		$this->cache = $cache;
	}

	/** Get table data to use as $db->table[1]
	 * @param string
	 * @return NotORM_Result
	 */
	function __get($table) {
		return new NotORM_Result($this->structure->getReferencingTable($table, ''), $this, true);
	}

	/** Set write-only properties
	 * @return null
	 */
	function __set($name, $value) {
		if ($name == "debug" || $name == "freeze" || $name == "rowClass") {
			$this->$name = $value;
		}
		if ($name == "transaction") {
			switch (strtoupper($value)) {
				case "BEGIN": return $this->connection->beginTransaction();
				case "COMMIT": return $this->connection->commit();
				case "ROLLBACK": return $this->connection->rollback();
			}
		}
	}
	/** Get table data
	 * @param string
	 * @param array (["condition"[, array("value")]]) passed to NotORM_Result::where()
	 * @return NotORM_Result
	 */
	function __call($table, array $where) {
		$return = new NotORM_Result($this->structure->getReferencingTable($table, ''), $this);
		if ($where) {
			call_user_func_array(array($return, 'where'), $where);
		}
		return $return;
	}

}


text:
This is a set of simple samples written in Ruby, which provide a minimal
example of Google AdSense integration within a command line application.

This starter project provides a great place to start your experimentation into
the AdSense Management API.

## Prerequisites

Please make sure that you're running Ruby 2.5+ and you've run
`gem install google-apis-adsense_v2` to install the Ruby client library for the
AdSense Management API v2.

## Setup Authentication

Before getting started, check the README on the Ruby client library
documentation page:
https://github.com/googleapis/google-api-ruby-client

To authenticate your application, you will need to add your Client ID and Client
Secret to the `client_secrets.json` file.

## Running the Samples

1. Run a sample from this directory:

        $ ruby get_all_ad_clients.rb

1. Some examples require an argument to be passed in on the command line. If
   the example shows a message to this effect, you might have to run a different
   example to get the ID required to pass in.

1. If this is the first example you've run, or if there's some other reason
   your OAuth tokens are not stored locally, complete the authorization steps
   in your browser.

1. Examine your shell output and verify the results.


text:
@font-face {
	font-family: 'GothamPro-Light';
	src: url('GothamPro-Light.eot?') format('eot'),
	     url('GothamPro-Light.otf')  format('opentype'),
	     url('GothamPro-Light.woff') format('woff'),
	     url('GothamPro-Light.ttf')  format('truetype'),
	     url('GothamPro-Light.svg#GothamPro-Light') format('svg');
}


text:
using System;
using System.IO;

namespace ITGlobal.MarkDocs.Source.Impl
{
    internal sealed class StaticDirectorySourceInfo : ISourceInfo
    {
        public StaticDirectorySourceInfo(string path)
        {
            SourceUrl = "file:///" + path;
            LastChangeTime = Directory.GetLastWriteTime(path);
            LastChangeId = Guid.NewGuid().ToString("N");
        }

        public string SourceUrl { get; }
        public string Version => "";
        public DateTime? LastChangeTime { get; }
        public string LastChangeId { get; }
        public string LastChangeDescription => null;
        public string LastChangeAuthor => null;
    }
}


text:
import isFuture from "date-fns/is_future";
import isPast from "date-fns/is_past";

var STATUS = {
    UPDATED     : "updated",
    UNPUBLISHED : "unpublished",
    SCHEDULED   : "scheduled",
    LIVE        : "live"
};

export default function getItemStatus(itemData) {
    var result = "...";

    if(isPast(itemData.unpublished_at)) {
        result = STATUS.UNPUBLISHED;
    } else if(isFuture(itemData.published_at)) {
        result = STATUS.SCHEDULED;
    } else if(isPast(itemData.published_at)) {
        result = STATUS.LIVE;
    } else if(itemData.updated_at) {
        result = STATUS.UPDATED;
    }

    return result;
}

// export function getItemStyleClass(itemData) {

// }