/* Microsoft Xbox
326253
private function detectXbox($ua)
    {
        /* Xbox 360 */

        if (preg_match('/Xbox\)$/u', $ua, $match)) {
            $this->data->os->reset();
            $this->data->device->setIdentification([
                'manufacturer'  =>  'Microsoft',
                'model'         =>  'Xbox 360',
                'type'          =>  Constants\DeviceType::GAMING,
                'subtype'       =>  Constants\DeviceSubType::CONSOLE
            ]);
        }

        /* Xbox One */

        if (preg_match('/Xbox One\)/u', $ua, $match)) {
            if ($this->data->isOs('Windows Phone', '=', '10')) {
                $this->data->os->name = 'Windows';
                $this->data->os->version->alias = '10';
            }

            if (!$this->data->isOs('Windows', '=', '10')) {
                $this->data->os->reset();
            }

            $this->data->device->setIdentification([
                'manufacturer'  =>  'Microsoft',
                'model'         =>  'Xbox One',
                'type'          =>  Constants\DeviceType::GAMING,
                'subtype'       =>  Constants\DeviceSubType::CONSOLE
            ]);
        }
    }
339412
function( local ) {
            // IE11 does not support window.ActiveXObject so we just try to
            // create one to see if it is supported.
            // See: http://msdn.microsoft.com/en-us/library/ie/dn423948%28v=vs.85%29.aspx
            var supportActiveX;
            try {
                /* global ActiveXObject:true */
                supportActiveX = !!new ActiveXObject( "Microsoft.XMLHTTP" );
            } catch( e ) {
                supportActiveX = false;
            }

            if ( supportActiveX ) {
                if ( window.XMLHttpRequest ) {
                    $.createAjaxRequest = function( local ) {
                        if ( local ) {
                            return new ActiveXObject( "Microsoft.XMLHTTP" );
                        }
                        return new XMLHttpRequest();
                    };
                } else {
                    $.createAjaxRequest = function() {
                        return new ActiveXObject( "Microsoft.XMLHTTP" );
                    };
                }
            } else if ( window.XMLHttpRequest ) {
                $.createAjaxRequest = function() {
                    return new XMLHttpRequest();
                };
            } else {
                throw new Error( "Browser doesn't support XMLHttpRequest." );
            }
            return $.createAjaxRequest( local );
        }
394997
function getPiecesLeft() {
    $.getJSON("/games/" + enc($.cookie("game")) +
              "/pieces", function(data) {
        $(GAMEPIECES).empty();
        var npieces = 0;
        for (var i in data)
            npieces += data[i].count;
        $(GAMEPIECES).html(npieces);
    });
}
1236559
function deleteThing (x) {
        console.log('deleteThing: ' + x)
        var ds = kb.statementsMatching(x).concat(kb.statementsMatching(undefined, undefined, x))
        var targets = {}
        ds.map(function (st) { targets[st.why.uri] = st })
        var agenda = [] // sets of statements of same dcoument to delete
        for (var target in targets) {
          agenda.push(ds.filter(function (st) { return st.why.uri === target }))
          console.log('   Deleting ' + agenda[agenda.length - 1].length + ' triples from ' + target)
        }
        function nextOne () {
          if (agenda.length > 0) {
            updater.update(agenda.shift(), [], function (uri, ok, body) {
              if (!ok) {
                complain('Error deleting all trace of: ' + x + ': ' + body)
                return
              }
              nextOne()
            })
          } else {
            console.log('Deleting resoure ' + x.doc())
            kb.fetcher.delete(x.doc())
              .then(function () {
                console.log('Delete thing ' + x + ': complete.')
              })
              .catch(function (e) {
                complain('Error deleting thing ' + x + ': ' + e)
              })
          }
        }
        nextOne()
      }
153014
function Player(params) {
  this.platformID = this.key = params.key;
  this.kills = params.kills;
  this.deaths = params.deaths;
  this.name = params.name;
  this.rank = params.rank;
  this.weapon = params.weapon;
}
1201369
def get(cls, xuid, scid, clip_id):
        '''
        
        '''
        url = (
            'https://gameclipsmetadata.xboxlive.com/users'
            '/xuid(%(xuid)s)/scids/%(scid)s/clips/%(clip_id)s' % {
                'xuid': xuid,
                'scid': scid,
                'clip_id': clip_id,
            }
        )
        resp = xbox.client._get(url)

        # scid does not seem to matter when fetching clips,
        # as long as it looks like a uuid it should be fine.
        # perhaps we'll raise an exception in future
        if resp.status_code == 404:
            msg = 'Could not find clip: xuid=%s, scid=%s, clip_id=%s' % (
                xuid, scid, clip_id,
            )
            raise ClipNotFound(msg)

        data = resp.json()

        # as we don't have the user object let's
        # create a lazily evaluated proxy object
        # that will fetch it only when required
        user = UserProxy(xuid)
        return cls(user, data['gameClip'])
78841
function(url, win, attributes) {

        var o = {
            id:   "yui__dyn_" + (nidx++),
            type: "text/css",
            rel:  "stylesheet",
            href: url
        };

        if (attributes) {
            lang.augmentObject(o, attributes);
        }

        return _node("link", o, win);
    }
493169
function createProgram(shaderArray) {
			var newProgram = glContext.createProgram();

			for (var shaderIndex = 0; shaderIndex < shaderArray.length; ++shaderIndex) {
					glContext.attachShader(newProgram, shaderArray[shaderIndex]);
			}
			glContext.linkProgram(newProgram);

			// Check for errors during linking
			var status = glContext.getProgramParameter(newProgram, glContext.LINK_STATUS);
			if (!status) {
					var infoLog = glContext.getProgramInfoLog(newProgram);
					console.log("Unable to link Kinect WebGL program. Error:" + infoLog);
					glContext.deleteProgram(newProgram);
					return null;
			}

			return newProgram;
	}
87517
function DetectXbox()
   {
      if (stripos($this->useragent, $this->deviceXbox) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
981845
function getPricing(xmlNode) {
  var pricingExtNode;
  var princingData = {};

  var extensions = xmlNode.querySelectorAll('Extension');
  // Nodelist.forEach is not supported in IE and Edge
  // Workaround given here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10638731/
  Array.prototype.forEach.call(extensions, function(node) {
    if (node.getAttribute('type') === 'StickyPricing') {
      pricingExtNode = node;
    }
  });

  if (pricingExtNode) {
    var priceNode = pricingExtNode.querySelector('Price');
    princingData = {
      currency: priceNode.getAttribute('currency'),
      price: priceNode.textContent || priceNode.innerText
    };
  } else {
    utils.logWarn('PREBID - ' + BIDDER_CODE + ': Can\'t get pricing data. Is price awareness enabled?');
  }

  return princingData;
}
882665
function(message) {
    if (this.sendData % 200 == 0){
      console.log("Kinect data being sent from kinect");
      console.log(message);
    }
    this.sendData = this.sendData +1;
    if (true) {
      //Set the kinect data to the raw values from the kinect
      for(var key in message){
        KinectState[key] = message[key];
      }

      if (this.currentState == 1){
        //We don't have any person data yet.
      }else if (this.currentState == 2){
        var h = KinectState.head;
        User.updateObj(User.head,h.x,h.y,h.z, h.xmm, h.ymm);
      }
      else if (this.currentState == 3)
      {
        var h = KinectState.head;
        var l = KinectState.leftHand;
        var r = KinectState.rightHand;
        var el = KinectState.leftElbow;
        var er = KinectState.rightElbow;
        User.updateObj(User.head,h.x,h.y,h.z, h.xmm, h.ymm);

        User.updateObj(User.hands.left, l.x,l.y,l.z, l.xmm, l.ymm);
        User.updateObj(User.hands.right, r.x,r.y,r.z, r.xmm, r.ymm);

        User.updateObj(User.elbows.left, el.x, el.y, el.z, el.xmm, el.ymm);
        User.updateObj(User.elbows.right, er.x, er.y, er.z, er.xmm, er.ymm);
      }
      //Tell the app the state has changed
      this.setState(KinectState.phase);
    }
  }
1163359
public static void asXml(Writer writer, WxOutMsg msg) {
        try {
            Writer _out = writer;
            if (DEV_MODE) {
                writer = new StringWriter();
            }
            writer.write("<xml>\n");
            writer.write(tag("ToUserName", cdata(msg.getToUserName())));
            writer.write(tag("FromUserName", cdata(msg.getFromUserName())));
            writer.write(tag("CreateTime", "" + msg.getCreateTime()));
            writer.write(tag("MsgType", cdata(msg.getMsgType())));
            switch (WxMsgType.valueOf(msg.getMsgType())) {
            case text:
                writer.write(tag("Content", cdata(msg.getContent())));
                break;
            case image:
                writer.write(tag("Image", tag("MediaId", msg.getImage().getMediaId())));
                break;
            case voice:
                writer.write(tag("Voice", tag("MediaId", msg.getVoice().getMediaId())));
                break;
            case video:
                writer.write("<Video>\n");
                writer.write(tag("MediaId", cdata(msg.getVideo().getMediaId())));
                if (msg.getVideo().getTitle() != null)
                    writer.write(tag("Title", cdata(msg.getVideo().getTitle())));
                if (msg.getVideo().getDescription() != null)
                    writer.write(tag("Description", cdata(msg.getVideo().getDescription())));
                writer.write("</Video>\n");
                break;
            case music:
                writer.write("<Music>\n");
                WxMusic music = msg.getMusic();
                if (music.getTitle() != null)
                    writer.write(tag("Title", cdata(music.getTitle())));
                if (music.getDescription() != null)
                    writer.write(tag("Description", cdata(music.getDescription())));
                if (music.getMusicUrl() != null)
                    writer.write(tag("MusicUrl", cdata(music.getMusicUrl())));
                if (music.getHQMusicUrl() != null)
                    writer.write(tag("HQMusicUrl", cdata(music.getHQMusicUrl())));
                writer.write(tag("ThumbMediaId", cdata(music.getThumbMediaId())));
                writer.write("</Music>\n");
                break;
            case news:
                writer.write(tag("ArticleCount", "" + msg.getArticles().size()));
                writer.write("<Articles>\n");
                for (WxArticle article : msg.getArticles()) {
                    writer.write("<item>\n");
                    if (article.getTitle() != null)
                        writer.write(tag("Title", cdata(article.getTitle())));
                    if (article.getDescription() != null)
                        writer.write(tag("Description", cdata(article.getDescription())));
                    if (article.getPicUrl() != null)
                        writer.write(tag("PicUrl", cdata(article.getPicUrl())));
                    if (article.getUrl() != null)
                        writer.write(tag("Url", cdata(article.getUrl())));
                    writer.write("</item>\n");
                }
                writer.write("</Articles>\n");
                break;
            case transfer_customer_service:
                if (msg.getKfAccount() != null) {
                    writer.write("<TransInfo>\n");
                    writer.write(tag("KfAccount", cdata(msg.getKfAccount().getAccount())));
                    writer.write("</TransInfo>\n");
                }
                break;
            default:
                break;
            }
            writer.write("</xml>");
            if (DEV_MODE) {
                String str = writer.toString();
                log.debug("Outcome >>\n" + str);
                _out.write(str);
            }
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
    }
728735
function (xpcKey) {
    if ($bc_$5.pN) {
      try {
        $bc_$5.pN.app.invalidateXPCService(xpcKey);
      } catch (e) {
        console.error(e);
      }
    }
  }
104969
function rule(analyzer) {
	var re = {
		property: /^(\*|-ms-filter)/,
		selector: /^(\* html|html\s?>\s?body) /,
		value: /progid:DXImageTransform\.Microsoft|!ie$/
	};

	analyzer.setMetric('oldIEFixes');

	// * html // below IE7 fix
	// html>body // IE6 excluded fix
	// @see http://blogs.msdn.com/b/ie/archive/2005/09/02/460115.aspx
	analyzer.on('selector', function(rule, selector) {
		if (re.selector.test(selector)) {
			analyzer.incrMetric('oldIEFixes');
			analyzer.addOffender('oldIEFixes', selector);
		}
	});

	// *foo: bar // IE7 and below fix
	// -ms-filter // IE9 and below specific property
	// !ie // IE 7 and below equivalent of !important
	// @see http://www.impressivewebs.com/ie7-ie8-css-hacks/
	analyzer.on('declaration', function(rule, property, value) {
		if (re.property.test(property) || re.value.test(value)) {
			analyzer.incrMetric('oldIEFixes');
			analyzer.addOffender('oldIEFixes', format('%s {%s: %s}', rule.selectors.join(', '), property, value));
		}
	});
}
280305
function msb (x) {
  return (
    x & 0xF0
    ? x & 0xC0 ? x & 0x80 ? 8 : 7 : x & 0x20 ? 6 : 5
    : x & 0x0C ? x & 0x08 ? 4 : 3 : x & 0x02 ? 2 : x
  )
}
987747
function WixLabel() {

    this.isValid = function() {
        //TODO provide slightly better validation
        return this.name !== null
            && this.description !== null;
    };

    this.toJSON = function() {
        var _this = this;
        return {
            name : _this.name,
            description : _this.description
        };
    };
}
1307765
function () {
    // main code
    var x = new StablePriorityQueue(function (a, b) {
        return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0) ;
    });
    x.add({name:"Jack", age:31});
    x.add({name:"Anna", age:111});
    x.add({name:"Jack", age:46});
    x.add({name:"Jack", age:11});
    x.add({name:"Abba", age:31});
    x.add({name:"Abba", age:30});
    while (!x.isEmpty()) {
        console.log(x.poll());
    }
    x = new StablePriorityQueue(function(a, b) {
          return a.energy - b.energy;
    });
    [{ name: 'player', energy: 10},
     { name: 'monster1', energy: 10},
     { name: 'monster2', energy: 10},
     { name: 'monster3', energy: 10}
    ].forEach(function(o){
          x.add(o);
    })
    while (!x.isEmpty()) {
        console.log(x.poll());
    }

}