result_timeup : "で時間切れにより" turn "手の勝ち"
510183
def parse_result_timeup
      s0 = @current_pos
      if match_str("で時間切れにより") != :failed
        if parse_turn != :failed
          if match_str("手の勝ち") != :failed
            @reported_pos = s0
            "TIME_UP"
          else
            @current_pos = s0
            :failed
          end
        else
          @current_pos = s0
          :failed
        end
      else
        @current_pos = s0
        :failed
      end
    end
1079047
function (selector, callbackFn, timeout) {
                    var self = this,
                        startTime = Date.now(),
                        timeoutInterval = 150,
                        testRunning = false,
                    //if evaluate succeeds, invokes callback w/ true, if timeout,
                    // invokes w/ false, otherwise just exits
                        testForSelector = function () {

                            var elapsedTime = Date.now() - startTime;

                            if (elapsedTime > timeout) {
                                self.options.debug && console.log('warning: timeout occurred while waiting for selector:"%s"'.yellow, selector);
                                callbackFn(false);
                                return;
                            }

                            self.evaluate(function (selectorToEvaluate) {
                                return document.querySelectorAll(selectorToEvaluate).length;
                            }, function (result) {
                                testRunning = false;
                                if (result > 0) {//selector found
                                    callbackFn(true);
                                }
                                else {
                                    setTimeout(testForSelector, timeoutInterval);
                                }
                            }, selector);
                        };

                    timeout = timeout || 10000; //default timeout is 2 sec;
                    setTimeout(testForSelector, timeoutInterval);
                }
422843
function refresh($target) {
                var PREFIX = ["-webkit-", ""];
                var valid = function (prop) {
                    return (prop && "none" !== prop);
                };
                var dataUrl;
                for (var i = 0, n = PREFIX.length; i < n; i++) {
                    if (!valid(dataUrl)) {
                        dataUrl = $target.css(PREFIX[i] + "mask-image");
                        if (valid(dataUrl)) {
                            // iOS では url(data***); 内に '"' は入らない
                            var match = dataUrl.match(/(url\(data:image\/svg\+xml;)([\s\S]*)?(base64,[\s\S]*\))/);
                            if (match) {
                                dataUrl = match[1] + "bust=" + Date.now().toString(36) + ";" + match[3];
                            }
                            else {
                                dataUrl = null;
                            }
                        }
                    }
                    if (valid(dataUrl)) {
                        $target.css(PREFIX[i] + "mask-image", dataUrl);
                    }
                }
                return $target;
            }
906795
def parse_result
      s0 = @current_pos
      if match_str("まで") != :failed
        s2 = match_digits!
        if s2 != :failed
          if match_str("手") != :failed
            s4 = @current_pos
            if match_str("で") != :failed
              if parse_turn != :failed
                if match_str("手の") != :failed
                  s8 = parse_result_toryo
                  s8 = parse_result_illegal if s8 == :failed
                  s4 = if s8 != :failed
                         @reported_pos = s4
                         s8
                       else
                         @current_pos = s4
                         :failed
                       end
                else
                  @current_pos = s4
                  s4 = :failed
                end
              else
                @current_pos = s4
                s4 = :failed
              end
            else
              @current_pos = s4
              s4 = :failed
            end
            if s4 == :failed
              s4 = parse_result_timeup
              if s4 == :failed
                s4 = parse_result_chudan
                if s4 == :failed
                  s4 = parse_result_jishogi
                  if s4 == :failed
                    s4 = parse_result_sennichite
                    if s4 == :failed
                      s4 = parse_result_tsumi
                      s4 = parse_result_fuzumi if s4 == :failed
                    end
                  end
                end
              end
            end
            if s4 != :failed
              if parse_nl != :failed || eos?
                @reported_pos = s0
                s4
              else
                @current_pos = s0
                :failed
              end
            else
              @current_pos = s0
              :failed
            end
          else
            @current_pos = s0
            :failed
          end
        else
          @current_pos = s0
          :failed
        end
      else
        @current_pos = s0
        :failed
      end
    end
758245
function getRemainingTimeBonus(events, timeBonus) {
  const turnCount = getTurnCount(events);
  const remainingTimeBonus = timeBonus - turnCount;
  return Math.max(remainingTimeBonus, 0);
}
510166
def times( &action )
      i = @function.variable INT, 'i'
      @function << "#{@function.indent}for ( #{i} = 0; " +
                   "#{i} != #{self}; #{i}++ ) {\n"
      @function.indent_offset +1
      action.call i
      @function.indent_offset -1
      @function << "#{@function.indent}};\n"
      self
    end
1307498
function (time) {
      var split = time.split(':');
      var hour = parseInt(split[0]);
      var mn = parseInt(split[1]);

      if (this.settings.hour === 12) {
        var matches = time.match(/([0-1]?[0-9]):?([0-5][0-9])?\s?(am|pm|p)?/);
        var ind = matches[3];
        if (!ind) {
          ind = 'am';
        }

        hour = parseInt(matches[1]);
        mn = parseInt(matches[2]);

        if (!mn) {
          mn = 0;
        }

        if (hour === 12 && ind === 'am') {
          hour = 0;
        }
        if (hour === 12 && (ind === 'pm' || ind === 'p')) {
          ind = 'am';
        }
        if (ind === 'pm' || ind === 'p') {
          hour += 12;
        }
      }

      var position = 0;
      position += hour * this.periodInterval;
      position += mn / 60 * this.periodInterval;

      if (Math.floor(position) !== position) {
        return -1;
      }

      return position;
    }
787740
def special2csa(str)
      {
        "中断" => "CHUDAN",
        "投了" => "TORYO",
        "持将棋" => "JISHOGI",
        "千日手" => "SENNICHITE",
        "詰み" => "TSUMI",
        "不詰" => "FUZUMI",
        "切れ負け" => "TIME_UP",
        "反則勝ち" => "ILLEGAL_ACTION", # 直前の手が反則(先頭に+か-で反則した側の情報を含める必要が有る)
        "反則負け" => "ILLEGAL_MOVE" # ここで手番側が反則，反則の内容はコメントで表現
      }[str] || (raise ParseError)
    end
393475
function(){
		// this.bodyが空の場合はEncode.jsの仕様により対象外
		// カンペンには以下のパズルは存在しないのでURL_KANPENPも対象外
		if(!this.body || (this.type!==URL_PZPRV3 && this.type!==URL_PZPRAPP)){ return;}
		
		switch(this.pid){
		case 'ichimaga':
			if     (this.pflag.indexOf('m')>=0){ this.pid = 'ichimagam';}
			else if(this.pflag.indexOf('x')>=0){ this.pid = 'ichimagax';}
			else                               { this.pid = 'ichimaga'; }
			break;
		case 'icelom':
			if(this.pflag.indexOf('a')<0){ this.pid = 'icelom2';}
			break;
		case 'pipelink':
			if(this.body.match(/[0-9]/)){ this.pid = 'pipelinkr';}
			break;
		case 'bonsan':
			if(this.pflag.indexOf('c')<0){
				var col = this.cols, row = this.rows;
				if(this.body.substr(0,((((col-1)*row+4)/5)|0)+(((col*(row-1)+4)/5)|0)||0).match(/[^0]/)){
					this.pid = 'heyabon';
				}
			}
			break;
		case 'kramma':
			if(this.pflag.indexOf('c')<0){
				var len=(this.cols-1)*(this.rows-1), cc=0;
				for(var i=0;i<this.body.length;i++){
					var ca = this.body.charAt(i);
					if(ca.match(/\w/)){
						cc += parseInt(ca,36);
						if(cc<len){ this.pid = 'kramman'; break;}
					}
					else if(ca === '.'){ cc+=36;}
					if(cc>=len){ break;}
				}
			}
			break;
		}
	}
513294
function(){
		var lines = this.qdata.split("\n"), col = 0, row = 0;
		delete this.qdata;
		
		/* サイズを表す文字列 */
		if(this.type===FILE_PBOX_XML){
			row = +this.body.querySelector('size').getAttribute('row');
			col = +this.body.querySelector('size').getAttribute('col');
			if(this.pid==="slither"||this.pid==='kakuro'){ row--; col--;}
		}
		else if(this.type===FILE_PBOX && this.pid==="kakuro"){
			row = +lines.shift() - 1;
			col = +lines.shift() - 1;
		}
		else if(this.pid==="sudoku"){
			row = col = +lines.shift();
		}
		else{
			row = +lines.shift();
			col = +lines.shift();
		}
		if(row<=0 || col<=0){ return false;}
		this.rows = row;
		this.cols = col;
		
		/* サイズ以降のデータを取得 */
		if(this.type===FILE_PZPR){
			var historypos = null, str = "", strs = [], isinfo = false;
			for(var i=0;i<lines.length;i++){
				/* かなり昔のぱずぷれファイルは最終行にURLがあったので、末尾扱いする */
				if(lines[i].match(/^http\:\/\//)){ break;}
				
				/* info行に到達した場合 */
				if(lines[i].match(/info:\{/)){ historypos=i; isinfo = true; break;}
				
				/* 履歴行に到達した場合 */
				if(lines[i].match(/history:\{|__HISTORY__/)){ historypos=i; break;}
				
				strs.push(lines[i]);
			}
			this.body += strs.join('\n');
			
			/* 履歴部分の読み込み */
			if(historypos!==null && !!JSON){
				var count = 0, cnt;
				for(var i=historypos;i<lines.length;i++){
					str += lines[i];
					
					cnt = count;
					count += (lines[i].match(/\{/g)||[]).length;
					count -= (lines[i].match(/\}/g)||[]).length;
					if(cnt>0 && count===0){ break;}
				}
			}
			
			/* 履歴出力があったら入力する */
			if(!!JSON){
				if(isinfo && (str.substr(0,5)==="info:")){
					var info = JSON.parse(str.substr(5));
					this.metadata.update(info.metadata);
					this.history = info.history || '';
				}
				else if(str.substr(0,8)==="history:"){
					this.history = JSON.parse(str.substr(8));
				}
			}
		}
		else if(this.type===FILE_PBOX){
			this.body = lines.join("\n");
		}
		else if(this.type===FILE_PBOX_XML){
			if(!!this.body){
				var metanode = this.body.querySelector('property'), meta = this.metadata;
				meta.author = metanode.querySelector('author').getAttribute('value');
				meta.source = metanode.querySelector('source').getAttribute('value');
				meta.hard   = metanode.querySelector('difficulty').getAttribute('value');
				var commentnode = metanode.querySelector('comment');
				meta.comment= (!!commentnode ? commentnode.childNodes[0].data : '');
			}
		}
		
		return true;
	}
457675
function Time(name, ...rest) {
    let h = (methodDescriptor)=>{
        let {key, descriptor} = methodDescriptor;

        let fn = descriptor.value;
        let timer;

        let timeStart;
        let timeEnd;
        if (console != null && typeof console.time === 'function') {
            timeStart = console.time;
            timeEnd = console.timeEnd;
        } else {
            timeStart = ()=>{
                timer = Date.now();
            };

            timeEnd = (name)=>{
                let abstime = Date.now() - timer;

                console.log(name, '：', abstime);
            };
        }

        descriptor.value = function(...args) {
            timeStart(name || key);
            let r = fn.apply(this, args);

            if (r && typeof r.then === 'function') {
                return r.then((succ)=>{
                    timeEnd(name || key);
                    return Promise.resolve(succ);
                }, (fail)=>{
                    timeEnd(name || key);
                    return Promise.reject(fail);
                });
            } else {
                timeEnd(name || key);
                return r;
            }
        };

        return {
            ...methodDescriptor,
            descriptor,
        };
    };

    if (typeof name === 'string') {
        return h;
    } else {
        let args = [name, ...rest];
        name = void(0);
        h(...args);
    }
}
775613
private void convertMinuteTerm(final ConditionDateFormatter formatter) {
        
        final int termSize = formatter.getTerms().size();
        for(int i=0; i < termSize; i++) {
            final Term<Calendar> term = formatter.getTerms().get(i);
            if(!(term instanceof DateTerm.MonthTerm)) {
                continue;
            }
            
            if(isMinuteTerm(i, formatter.getTerms())) {
                // '分'の項に入れ替える
                final DateTerm.MonthTerm monthTerm = (DateTerm.MonthTerm) term;
                formatter.getTerms().set(i, DateTerm.minute(monthTerm.getFormat()));
            }
            
        }
        
    }
38736
public function rewind()
	{
		//1行目はヘッダ行なので読み飛ばす
		$this->position = 1;
		
		if(!$this->lines){
			
			//CSVを読み込み
			$giscsv = new Dm_Geocoder_GISCSV($this->prefectureCode);
			$buf = $giscsv->read();
			
			//1行ごとに分解
			$ret = array();
			$lines = explode("\r\n", $buf);
			array_pop($lines);
			foreach ($lines as $line) {
				$ret[] = $line;
			}
			
			$this->lines = $ret;
		}
	}
535141
function leadingEdge(time) {
    // Reset any `maxWait` timer.
    lastInvokeTime = time;
    // 为 trailing edge 触发函数调用设定定时器
    timerId = setTimeout(timerExpired, wait);
    // leading = true 执行函数
    return leading ? invokeFunc(time) : result;
  }
395204
@Override
    public void turn(boolean right) {
	int penalty = Timing.getInstance().TURN;
	log.trace("[turn] Waiting {} cycles", penalty);
	turnsControl.waitTurns(penalty, "Turn");
	robot.turn(right);
    }
1349071
function( from, to, unit ) {
		this.startTime = now();
		this.start = from;
		this.end = to;
		this.unit = unit || this.unit || "px";
		this.now = this.start;
		this.pos = this.state = 0;

		var self = this;
		function t( gotoEnd ) {
			return self.step(gotoEnd);
		}

		t.elem = this.elem;

		if ( t() && jQuery.timers.push(t) && !timerId ) {
			timerId = setInterval(jQuery.fx.tick, 13);
		}
	}
91080
function(lastope){
		// 前回と同じ場所なら前回の更新のみ
		var property = this.property;
		if( lastope.group    === this.group &&
			lastope.property === this.property  &&
			lastope.num      === this.old   &&
			lastope.bx       === this.bx    &&
			lastope.by       === this.by    &&
			(property === 'qnum'  || 
			 property === 'qnum2' ||
			 property === 'qchar' ||
			 property === 'anum'  ||
			(property === 'snum' && lastope.pos === this.pos))
		)
		{
			lastope.num = this.num;
			return true;
		}
		return false;
	}