text:
/**
 * @fileoverview Skype Panamericana Chatstyle main JS library
 * @author Margus Holland <margusholland@me.com>
 * @author Martin Kapp <meister@me.com>
 * @version 1.1
*/

/*
 * Copyright (c) 2011 Skype Technologies S.A. All rights reserved.
 */

if (typeof SCS == "undefined") {
	var SCS = {};
}

/**
 * Creates ID's for any item
 * @base SCS
 * @class Construct a new SCS.Identifier object
 * @constructor
 */
SCS.Identifier = function() {

	/**
	 * Create 16 character random string to be used as ID
	 * @private
	 * @return 16 character long alphanumeric string
	 * @type {String}
	 */
	var _randomString = function() {
		var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
		var strLength = 16;
		var rndString = "";
		for (var i=0; i< strLength; i++) {
			var rnum = Math.floor(Math.random() * chars.length);
			rndString += chars.substring(rnum, rnum+1);
		}
		return rndString;
	};

	/**
	 * Add new ID to an element
	 * @param {String} id ID to add to HTML markup first item
	 * @param {String} html HTML markup
	 * @return HTML with with an ID added to the first element
	 * @type {String}
	 */
	this.addId = function(html, id) {
		if (typeof id == "undefined" || id == "") {
			var id = _randomString();
		}
		$(html).each(function() {
			$html = $(this).attr("id", id);
		});
		return $html.get(0);
	};
};

/**
 * Errorhandler
 * @base SCS
 * @class Construct a new errorhandler object
 * @constructor
 */
SCS.ErrorHandler = function() {
	var _statuses = {
		"200": "OK",
		"510": "Can't find conversation",
		"511": "Can't find item",
		"512": "Index must be integer and >= 0",
		"513": "ID empty or undefined",
		"514": "Unknown value",
		"515": "Cocoa display controller dC undefined"
	};

	/**
	 * Return humanreadable status code description for 200, 510, 511, 512, 513, 514, 515
	 * @param {int} code Status code
	 * @param {fname} fname Name of the function to return as part of the string
	 * @return Status string or false if unknown code
	 * @type {String}
	 */
	this.showError = function(code, fname) {
		var errString = "";
		if (typeof code != "undefined") {
			if (typeof _statuses[code] == "undefined") {
				return false;
			}
			if (typeof fname != "undefined" && fname != "") {
				errString = fname + " : " + "["+code+"] " +	 _statuses[code];
			} else {
				errString = "["+code+"] " +	 _statuses[code];
			}
			if (typeof debug != "undefined" && debug == true) {
				console.log(errString);
			}
			return errString;
		} else {
			return false;
		}
	};
};

/**
 * Main conversation class
 * @base SCS
 * @class Construct a new SCS.Conversation object
 * @constructor
 */
SCS.Conversation = function() {
	var self = this;
	var _container;
	var _scrolltimer = false;
	var _mode = {};

	/**
	 * Conversation init
	 * @private
	 */
	this._init = function() {
		if (_container.length > 0) {
			var _layoutCheck = function() {
				var w = _container.width();
				if (w < 540) {
					_container.addClass("compact");
					if (_mode.name != "compact") {
						_mode.name = "compact";
						_mode.left = 23;
						_mode_right = 23;
						dC.setMode_leftMargin_rightMargin_(_mode.name, _mode.left, _mode.right);
					}
				} else {
					_container.removeClass("compact");
					if (_mode.name != "default") {
						_mode.name = "default";
						_mode.left = 76;
						_mode_right = 150;
						dC.setMode_leftMargin_rightMargin_(_mode.name, _mode.left, _mode.right);
					}

				}

				if (self._nearBottom()) {
					self.scrollToEnd();
				}
			};

			$(window).scroll(function() {
				if (window.scrollY < 11 && _scrolltimer == false) {
					dC.scrollWindowToTopEvent();
					_scrolltimer = true;
				}
				if (window.scrollY > 10) {
					_scrolltimer = false;
				}
			});

			// Change layout on init and resize
			_layoutCheck();
			$(window).resize(_layoutCheck);

			// Just for a very short instance, force window to redraw all items - rendring bug in Safari
			$(".item").css("display", "none");
			setTimeout(function() {
				$(".item").css("display", "block");
			}, 1);

			return SCS.err.showError(200, "_init");
		} else {
			return SCS.err.showError(510, "_init");
		}
	};

	/**
	 * Check for display controller status
	 * @private
	 */
	this._dc = function() {
		if (typeof dC == "undefined") {
			return SCS.err.showError(515, "_dc");
		} else {
			return SCS.err.showError(200, "_dc");
		}
	};

	/**
	 * Shared functions for items
	 * @private
	 */
	this._item = function() {
		if (_container.length > 0) {
			$(".item .head .sender a:not(.profile)").live("click", function(e) {
				var $a = $(this);
				// Start private conversation with the contact
				e.preventDefault();
				dC.openConversationWithIdentity_($a.attr("href"));
			});
			$(".item .head .sender img, .item .head .sender span.profile").live("click", function(e) {
				var $i = $(this);
				// Open profile of the current user
				if ($i.attr("data-sender")) {
					dC.showProfileOfIdentity_($i.attr("data-sender"));
				}
			});
			$(".item button").live("click", function(e) {
				var $b = $(this);
				var $i = $(this).closest(".item");

				// Open context menu
				if ($b.hasClass("actions")) {
					dC.showContextMenuForID_topOffset_leftOffset_($i.attr("id"), $b.offset().top, $b.offset().left);
				}
			});
			return SCS.err.showError(200, "_item");
		} else {
			return SCS.err.showError(510, "_item");
		}
	};

	/**
	 * Add link actions to history items
	 * @private
	 */
	this._history = function() {
		if (_container.length > 0) {
			$(".item.history a").live("click", function(e) {
				var $a = $(this);
				var $nt = $(this).closest(".history");
				e.preventDefault();
				dC.loadHistoryInDays_($a.attr("href"));
			});
			return SCS.err.showError(200, "_history");
		} else {
			return SCS.err.showError(510, "_history");
		}
	};

	/**
	 * Add play & stop voicemail functionality
	 * @private
	 */
	this._voicemail = function() {
		if (_container.length > 0) {
			$(".item.voicemail button").live("click", function() {
				var $b = $(this);
				var $vm = $(this).closest(".voicemail");

				// Play/stop voicemail
				if ($b.hasClass("control")) {
					var $played = $(".progress", $vm);
					if ($(this).hasClass("stop")) {
						if (dC.stopVoicemailWithID_($vm.attr("id"))) {
							self.voicemailStop($vm.attr("id"));
						}
					} else {
						if (dC.playVoicemailWithID_($vm.attr("id"))) {
							self.voicemailPlay($vm.attr("id"));
						}
					}
				}

				// Delete voicemail
				if ($b.hasClass("delete")) {
					if (dC.stopVoicemailWithID_($vm.attr("id"))) {
						if (dC.deleteVoicemailWithID_($vm.attr("id"))) {
							$vm.animate({"opacity": 0, "height": 0}, 750, function() {
								$vm.remove();
							});
						}
					}
				}
			});
			return SCS.err.showError(200, "_voicemail");
		} else {
			return SCS.err.showError(510, "_voicemail");
		}
	};

	/**
	 * Message functions
	 * @private
	 */
	this._message = function() {
		if (_container.length > 0) {
			$(".item.message button").live("click", function(e) {
				var $b = $(this);
				var $m = $(this).closest(".message");

				// Edit message
				if ($b.hasClass("edit")) {
					dC.startMessageEditWithID_($m.attr("id"));
				}

				// Delete message
				if ($b.hasClass("delete")) {
					dC.removeMessageWithID_($m.attr("id"));
				}
			});
			$(".item.message.editable").live("mouseover", function() {
				var $m = $(this);

				// Ask from SkyLib if message is editable and remove editable status if False
				if (!dC.isMessageEditable_($m.attr("id"))) {
					$m.removeClass("editable");
				}

			});
			$(".item.message.editable .body").live("dblclick", function(e) {
				var $m = $(this).closest(".item");
				if ($m.find(".editMode").length > 0) {
					return;
				}

				if (dC.isMessageEditableInline_($m.attr("id"))) {
					if (dC.startMessageInlineEditWithID_body_($m.attr("id"), $(".body", $m).html())) {
						self.messageStartInlineEdit($m.attr("id"));
					}
				}
			});

			// Cancel message editmode on "Escape"
			$(window).bind("keyup", function(e) {
				if (e.which == 27) {
					$(".item .editMode").each(function() {
						var $m = $(this).closest(".item");
						if (dC.cancelMessageInlineEditWithID_($m.attr("id"))) {
							self.messageEndInlineEdit($m.attr("id"));
						}
					});
				}

			});

			// Cancel inline editing if clicked somewhere else on the body
			$("body").bind("click", function(e) {
				if ($(e.target).hasClass("editMode")) {
					return;
				}
				$(".item .editMode").each(function() {
					var $m = $(this).closest(".item");
					if (dC.cancelMessageInlineEditWithID_($m.attr("id"))) {
						self.messageEndInlineEdit($m.attr("id"));
					}
				});
			});

			// Save the message on "Enter" and allow line breaks with "Shift-Enter"
			$(".item.message.editable .editMode").live("keydown", function(e) {
				var $mb = $(this);
				var $m = $mb.closest(".item");
				if (e.which == 13) {
					if (!e.shiftKey) {
						e.preventDefault();
						if (dC.stopMessageInlineEditAndSaveWithID_body_($m.attr("id"), $mb.html())) {
							self.messageEndInlineEdit($m.attr("id"));
						}
					}
				}
			});

			return SCS.err.showError(200, "_message");
		} else {
			return SCS.err.showError(510, "_message");
		}
	};

	/**
	 * Add file transfer item functionality
	 * @private
	 */
	this._transfer = function() {
		if (_container.length > 0) {

			// Open/close sub transfers in transfer item
			$(".item.transfer .main .name").live("click", function() {
				var $link = $(this);
				var $ft = $link.closest(".transfer");
				if ($(".sub", $ft).length > 0) {
					if ($link.hasClass("open")) {
						$link.removeClass("open");
						$(".sub", $ft).removeClass("open");
					} else {
						$link.addClass("open");
						$(".sub", $ft).addClass("open");
					}
				}
			});

			// Icon in transfer
			$(".item.transfer .icon").live("dblclick", function() {
				var $icon = $(this);
				var $ft = $icon.closest(".transfer");
				var $ins = $icon.closest(".instance");
				dC.doubleClickIconWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins));
			});

			// Buttons in transfer item
			$(".item.transfer button").live("click", function() {
				var $b = $(this);
				var $ft = $b.closest(".transfer");
				var $ins = $b.closest(".instance");

				// Accept transfers
				if ($b.hasClass("accept")) {
					if (dC.acceptTransferWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins))) {
						self.transferAccept($ft.attr("id"), $(".instance", $ft).index($ins));
					}
				}

				// Decline transfers
				if ($b.hasClass("decline")) {
					if (dC.cancelTransferWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins))) {
						self.transferCancel($ft.attr("id"), $(".instance", $ft).index($ins));
					}
				}

				// Cancel running transfers
				if ($b.hasClass("cancel")) {
					if (dC.cancelTransferWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins))) {
						self.transferCancel($ft.attr("id"), $(".instance", $ft).index($ins));
					}
				}

				// Delete transfers
				if ($b.hasClass("delete")) {
					if (dC.deleteTransferWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins))) {
						self.transferDelete($ft.attr("id"), $(".instance", $ft).index($ins));
					}
				}

				// Quicklook file
				if ($b.hasClass("quicklook")) {
					dC.showTransferInQuickLookWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins));
				}

				// Reveal transfer in Finder
				if ($b.hasClass("reveal")) {
					dC.revealTransferInFinderWithID_index_($ft.attr("id"), $(".instance", $ft).index($ins));
				}
			});
			return SCS.err.showError(200, "_transfer");
		} else {
			return SCS.err.showError(510, "_transfer");
		}
	};

	/**
	 * Check if current scrollposition is near the bottom of the screen
	 * @private
	 */
	this._nearBottom = function() {
		return (document.body.scrollTop+window.innerHeight >= document.body.offsetHeight-106);
	};

	/**
	 * Append an item to end of the conversation and add an ID to the item
	 * @param {String} html HTML markup of the item to be added
	 * @param {Boolean} scroll If conversation should scroll to bottom after item is added
	 * @return Response code with description
	 * @type {String}
	 * @see #prependItem
	 * @see #appendBulk
	 */
 	this.appendItem = function(html, scroll) {
 		// alert(html)
 		var $html = $(html);
 		var $links = $html.find('.body a');
 		$links.each(function(){
 			var $el = $(this)
 			var href = $el.attr('href')
 			var isImage = false;
 			if(href.indexOf('cl.ly') != -1 && href.indexOf('image') != -1){
 				href += '/content';
 				isImage = true;
 			} else if(href.indexOf('instagram.com') != -1 || href.indexOf('instagr.am') != -1){
 				href += '/media';
 				isImage = true;
 			}
 			if(href && (
 				(isImage ||
 				(href.indexOf('jpg') != -1) ||
 				(href.indexOf('jpeg') != -1) ||
 				(href.indexOf('gif') != -1) ||
 				(href.indexOf('png') != -1))){
 				$el.replaceWith('');
 			}
 		});
 		if (_container.length > 0) {
 			var atEnd = self._nearBottom();
 			if ($("#typing").length > 0) {
 				$("#conversation #typing").before($html);
 			} else {
 				_container.append($html);
 			}
 			if (scroll && atEnd) {
 				self.scrollToEnd();
 			}
 			return SCS.err.showError(200, "appendItem");
 		} else {
 			return SCS.err.showError(510, "appendItem");
 		}
 	};

	/**
	 * Scroll the conversation to a specific item
	 * @param {String} id ID of item to scroll to
	 * @return Response code with description
	 * @type {String}
	 */
	this.scrollToItem = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "scrollToItem");
		}
		if (_container.length > 0) {
			var $i = $("#"+id);
			if ($i.length > 0) {
				window.scrollTo(0,$i.get(0).offsetTop);
				return SCS.err.showError(200, "scrollToItem");
			} else {
				return SCS.err.showError(511, "scrollToItem");
			}
		} else {
			return SCS.err.showError(510, "scrollToItem");
		}
	};

	/**
	 * Prepend an item to the beggining of the conversation and add an ID to the item
	 * @param {String} html HTML markup of the item to be added
	 * @param {Boolean} scroll If conversation should scroll to bottom after item is added
	 * @return Response code with description
	 * @type {String}
	 * @see #appendItem
	 * @see #appendBulk
	 */
	this.prependItem = function(html, scroll) {
		if (_container.length > 0) {
			_container.prepend(html);
			if (scroll && self._nearBottom()) {
				self.scrollToEnd();
			}
			return SCS.err.showError(200, "prependItem");
		} else {
			return SCS.err.showError(510, "prependItem");
		}
	};

	/**
	 * Append a large chunk of messages at once
	 * @param {String} html HTML markup to add as a bulk string
	 * @param {Boolean} scroll If conversation should scroll to bottom after item is added
	 * @param {String} origin ID of item used as the entry point
	 * @param {String} location Add content before of after origin element. Possible values: before | after
	 * @return Response code with description
	 * @type {String}
	 * @see #appendItem
	 * @see #prependItem
	 */
	this.appendBulk = function(html, scroll, origin, location) {
		if (_container.length > 0) {
			var atEnd = self._nearBottom();
			if (typeof origin != "undefined" && origin != "" && $("#"+origin).length > 0 && typeof location != "undefined") {
				if (location == "before") {
					$("#conversation #"+origin).before(html);
				} else if (location == "after") {
					$("#conversation #"+origin).after(html);
				} else {
					return SCS.err.showError(514, "appendBulk");
				}
			} else {
				if ($("#typing").length > 0) {
					$("#conversation #typing").before(html);
				} else {
					_container.append(html);
				}
			}
			if (scroll && atEnd) {
				self.scrollToEnd();
			}
			return SCS.err.showError(200, "appendBulk");
		} else {
			return SCS.err.showError(510, "appendBulk");
		}
	};

	/**
	 * Remove an item from the conversation
	 * @param {String} id ID of item to remove
	 * @param {Boolean} scroll If conversation should scroll to bottom after item is removed
	 * @return Response code with description
	 * @type {String}
	 * @see #appendItem
	 * @see #prependItem
	 * @see #appendBulk
	 */
	this.removeItem = function(id, scroll) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "removeItem");
		}
		if (_container.length > 0) {
			var $i = $("#"+id);
			if ($i.length > 0) {
				$("#"+id).remove();
				if (scroll || (self._nearBottom() && scroll != false)) {
					self.scrollToEnd();
				}
				return SCS.err.showError(200, "removeItem");
			} else {
				return SCS.err.showError(511, "scrollToItem");
			}
		} else {
			return SCS.err.showError(510, "removeItem");
		}
	};

	/**
	 * Update typing indicator
	 * @param {String} status Possible values: show | hide
	 * @param {String} html Markup to replace current content (if empty, indicator is hidden)
	 * @param {Boolean} scroll If conversation should scroll to bottom after HTML is added
	 * @return Response code with description
	 * @type {String}
	 */
	this.typingUpdate = function(html, status, scroll) {
		if (_container.length > 0) {
			if (status == "hide" || html == "") {
				$("#typing").addClass("invisible");
			} else {
				if ($("#typing").length > 0) {
					$("#typing").remove();
				}
				_container.append(html);
			}
			if (scroll || (self._nearBottom() && scroll != false)) {
				self.scrollToEnd();
			}
			return SCS.err.showError(200, "typingUpdate");
		} else {
			return SCS.err.showError(510, "typingUpdate");
		}
	};

	/**
	 * Scroll the conversation all the way to the end
	 * @return Response code with description
	 * @type {String}
	 */
	this.scrollToEnd = function() {
		if (_container.length > 0) {
			window.scrollTo(0,_container.outerHeight());
			return SCS.err.showError(200, "scrollToEnd");
		} else {
			return SCS.err.showError(510, "scrollToEnd");
		}
	};

	/**
	 * Accept a transfer
	 * @deprecated
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the transfer to select
	 * @return Response code with description
	 * @type {String}
	 * @see #transferCancel
	 */
	this.transferAccept = function(id, index) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "transferAccept");
		}
		if (_container.length > 0) {
			var $ft = $("#"+id);
			if ($ft.length > 0) {
				if (typeof index != "undefined" && typeof index == "number" && index >= 0) {
					if (index == 0) {
						$(".instance", $ft).addClass("running");
						$(".progress", $ft).css("width", "auto");
					} else {
						$(".instance:eq("+index+")", $ft).addClass("running");
						$(".progress:eq("+index+")", $ft).css("width", "auto");
					}
					return SCS.err.showError(200, "transferAccept");
				} else {
					return SCS.err.showError(512, "transferAccept");
				}
			} else {
				return SCS.err.showError(511, "transferAccept");
			}
		} else {
			return SCS.err.showError(510, "transferAccept");
		}
	};

	/**
	 * Cancel a transfer
	 * @deprecated
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the transfer to select
	 * @return Response code with description
	 * @type {String}
	 * @see #transferAccept
	 */
	this.transferCancel = function(id, index) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "transferCancel");
		}
		if (_container.length > 0) {
			var $ft = $("#"+id);
			if ($ft.length > 0) {
				if (typeof index != "undefined" && typeof index == "number" && index >= 0) {
					if (index == 0) {
						$(".instance", $ft).addClass("completed cancelled").removeClass("running waiting");
					} else {
						$(".instance:eq("+index+")", $ft).addClass("completed cancelled").removeClass("running waiting");
					}
					return SCS.err.showError(200, "transferCancel");
				} else {
					return SCS.err.showError(512, "transferCancel");
				}
			} else {
				return SCS.err.showError(511, "transferCancel");
			}
		} else {
			return SCS.err.showError(510, "transferCancel");
		}
	};

	/**
	 * Remove waiting status from a transfer
	 * @deprecated
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the transfer to select
	 * @return Response code with description
	 * @type {String}
	 * @see #transferCancel
	 */
	this.transferReady = function(id, index) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "transferReady");
		}
		if (_container.length > 0) {
			var $ft = $("#"+id);
			if ($ft.length > 0) {
				if (typeof index != "undefined" && typeof index == "number" && index >= 0) {
					if (index == 0) {
						$(".instance", $ft).removeClass("waiting");
					} else {
						$(".instance:eq("+index+")", $ft).removeClass("waiting");
					}
					return SCS.err.showError(200, "transferReady");
				} else {
					return SCS.err.showError(512, "transferReady");
				}
			} else {
				return SCS.err.showError(511, "transferReady");
			}
		} else {
			return SCS.err.showError(510, "transferReady");
		}
	};

	/**
	 * Set transfer position for file transfer
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the transfer to select
	 * @param {int} percentage Progressbar fill percentage
	 * @param {String} text Set as status text
	 * @param {Boolean} connecting (Optional) Set to true if transfer has gone to connecting status
	 * @return Response code with description
	 * @type {String}
	 */
	this.transferPosition = function(id, index, percentage, text, connecting) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "transferPosition");
		}
		if (typeof index != "number" || index < 0) {
			return SCS.err.showError(512, "transferPosition");
		}
		if (typeof text == "undefined") {
			text = "";
		}
		if (percentage > 100) {
			percentage = 100;
		} else if (percentage < 0) {
			percentage = 0;
		}
		$ft = $("#"+id+"");
		if (_container.length > 0) {
			if ($ft.length > 0 && $(".progress:eq("+index+")", $ft).length > 0 && $(".size:eq("+index+")", $ft).length > 0) {
				if (typeof connecting == "undefined" || connecting == false) {
					$(".progress:eq("+index+")", $ft).removeClass("hidden").css("width", percentage+"%");
				} else {
					$(".progress:eq("+index+")", $ft).addClass("hidden").css("width", "");
				}
				$(".size:eq("+index+")", $ft).html(text);
				return SCS.err.showError(200, "transferPosition");
			} else {
				return SCS.err.showError(511, "transferPosition");
			}
		} else {
			return SCS.err.showError(510, "transferPosition");
		}
	};

	/**
	 * Complete a transfer
	 * @deprecated
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the transfer to select
	 * @return Response code with description
	 * @type {String}
	 */
	this.transferComplete = function(id, index) {
		if (_container.length > 0) {
			var $ft = $("#"+id);
			if ($ft.length > 0) {
				if (typeof index != "undefined" && typeof index == "number" && index >= 0) {
					if (index == 0) {
						$(".instance", $ft).addClass("completed").removeClass("running");
					} else {
						$(".instance:eq("+index+")", $ft).addClass("completed").removeClass("running");
					}
					return SCS.err.showError(200, "transferComplete");
				} else {
					return SCS.err.showError(512, "transferComplete");
				}
			} else {
				return SCS.err.showError(511, "transferComplete");
			}
		} else {
			return SCS.err.showError(510, "transferComplete");
		}
	};

	/**
	 * Update transfer status in the head
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the time element to select
	 * @param {String} status Set the classname for the status, possible values: cancelled | sending | rejected | sent | missing
	 * @param {String} text Set as status text
	 * @return Response code with description
	 * @type {String}
	 */
	this.transferUpdateHead = function(id, index, status, text) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "transferUpdateHead");
		}
		var $ft = $("#"+id+"");
		if (typeof text == "undefined") {
			text = "";
		}
		if (typeof index != "number" || typeof index == "undefined") {
			return SCS.err.showError(512, "transferUpdateHead");
		}
		if (_container.length > 0) {
			if ($ft.length > 0 && $(".time:eq("+index+")", $ft).length > 0) {
				$(".time:eq("+index+")", $ft).removeClass("cancelled rejected sending sent missing").addClass(status).html(text);
				return SCS.err.showError(200, "transferUpdateHead");
			} else {
				return SCS.err.showError(511, "transferUpdateHead");
			}
		} else {
			return SCS.err.showError(510, "transferUpdateHead");
		}
	};

	/**
	 * Update transfer objects in a transfer item
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the transfer
	 * @param {String} status Set the classname for the status, possible values: waiting | running | connecting | completed | cancelled | failed | missing
	 * @return Response code with description
	 * @type {String}
	 */
	this.transferUpdateStatus = function(id, index, status) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "transferUpdateStatus");
		}
		var $ft = $("#"+id+"");
		if (typeof text == "undefined") {
			text = "";
		}
		if (typeof index != "number" || typeof index == "undefined") {
			return SCS.err.showError(512, "transferUpdateStatus");
		}
		if (_container.length > 0) {
			if ($ft.length > 0 && $(".instance:eq("+index+")", $ft).length > 0) {
				$(".instance:eq("+index+")", $ft).removeClass("waiting running connecting completed cancelled failed missing").addClass(status);
				return SCS.err.showError(200, "transferUpdateStatus");
			} else {
				return SCS.err.showError(511, "transferUpdateStatus");
			}
		} else {
			return SCS.err.showError(510, "transferUpdateStatus");
		}
	};

	/**
	 * Play a voicemail
	 * @param {String} id ID of item to select
	 * @return Response code with description
	 * @type {String}
	 * @see #voicemailStop
	 */
	this.voicemailPlay = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "voicemailPlay");
		}
		var $vm = $("#"+id+"");
		if (_container.length > 0) {
			if ($vm.length > 0) {
				$vm.removeClass("new");
				$(".control", $vm).removeClass("play").addClass("stop");
				$(".progress", $vm).removeClass("hidden").css("width", "");
				return SCS.err.showError(200, "voicemailPlay");
			} else {
				return SCS.err.showError(511, "voicemailPlay");
			}
		} else {
			return SCS.err.showError(510, "voicemailPlay");
		}
	};

	/**
	 * Stop a voicemail
	 * @param {String} id ID of item to select
	 * @return Response code with description
	 * @type {String}
	 * @see #voicemailPlay
	 */
	this.voicemailStop = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "voicemailStop");
		}
		var $vm = $("#"+id+"");
		if (_container.length > 0) {
			if ($vm.length > 0) {
				$(".control", $vm).removeClass("stop").addClass("play");
				$(".progress", $vm).addClass("hidden").css("width","");
				return SCS.err.showError(200, "voicemailStop");
			} else {
				return SCS.err.showError(511, "voicemailStop");
			}
		} else {
			return SCS.err.showError(510, "voicemailStop");
		}
	};

	/**
	 * Set voicemail play progress
	 * @param {String} id ID of item to select
	 * @param {String} percentage Playhead location percentage
	 * @param {String} time Voicemail played time
	 * @return Response code with description
	 * @type {String}
	 */
	this.voicemailPosition = function(id, percentage, time) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "voicemailPosition");
		}
		if (typeof time == "undefined") {
			time = "";
		}
		if (percentage > 100) {
			percentage = 100;
		} else if (percentage < 0) {
			percentage = 0;
		}
		var $vm = $("#"+id+"");
		if (_container.length > 0) {
			if ($vm.length > 0 && $(".progress", $vm).length > 0 && $(".played", $vm).length > 0) {
				$(".progress", $vm).removeClass("hidden").css("width", percentage+"%");
				$(".played", $vm).html(time);
				return SCS.err.showError(200, "voicemailPosition");
			} else {
				return SCS.err.showError(511, "voicemailPosition");
			}
		} else {
			return SCS.err.showError(510, "voicemailPosition");
		}
	};

	/**
	 * Update SMS status
	 * @param {String} id ID of item to select
	 * @param {int} index Index of the SMS head to select
	 * @param {String} status Set the classname for the status, possible values: sending | failed | sent
	 * @param {String} text Set as status text
	 * @return Response code with description
	 * @type {String}
	 */
	this.smsUpdateStatus = function(id, index, status, text) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "smsUpdateStatus");
		}
		var $s = $("#"+id+"");
		if (typeof text == "undefined") {
			text = "";
		}
		if (typeof index != "number" || typeof index == "undefined") {
			return SCS.err.showError(512, "smsUpdateStatus");
		}
		if (_container.length > 0) {
			if ($s.length > 0 && $(".time:eq("+index+")", $s).length > 0) {
				$(".time:eq("+index+")", $s).removeClass("failed sending sent").addClass(status).html(text);
				return SCS.err.showError(200, "smsUpdateStatus");
			} else {
				return SCS.err.showError(511, "smsUpdateStatus");
			}
		} else {
			return SCS.err.showError(510, "smsUpdateStatus");
		}
	};

	/**
	 * Mark message as read (works for both SMS and chat messages)
	 * @param {String} id ID of item to select
	 * @param {String} status Possible values read | unread | edited | deleted | sending
	 * @return Response code with description
	 * @type {String}
	 */
	this.messageMarkAs = function(id, status) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageMarkAs");
		}
		var $m = $("#"+id+"");
		if (_container.length > 0) {
			if ($m.length > 0) {
				if (status == "read") {
					$m.addClass(status);
				} else if (status == "unread") {
					$m.removeClass("read");
				} else {
					$m.removeClass("edited deleted sending").addClass(status);
				}
				return SCS.err.showError(200, "messageMarkAs");
			} else {
				return SCS.err.showError(511, "messageMarkAs");
			}
		} else {
			return SCS.err.showError(510, "messageMarkAs");
		}
	};

	/**
	 * Enable editing a message
	 * @param {String} id ID of item to select
	 * @return Response code with description
	 * @type {String}
	 * @see #messageDisableEdit
	 */
	this.messageEnableEdit = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageEnableEdit");
		}
		var $m = $("#"+id+"");
		if (_container.length > 0) {
			if ($m.length > 0) {
				$m.addClass("editable");
				return SCS.err.showError(200, "messageEnableEdit");
			} else {
				return SCS.err.showError(511, "messageEnableEdit");
			}
		} else {
			return SCS.err.showError(510, "messageEnableEdit");
		}
	};

	/**
	 * Disable editing a message
	 * @param {String} id ID of item to select
	 * @return Response code with description
	 * @type {String}
	 * @see #messageEnableEdit
	 */
	this.messageDisableEdit = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageDisableEdit");
		}
		var $m = $("#"+id+"");
		if (_container.length > 0) {
			if ($m.length > 0) {
				$m.removeClass("editable");
				return SCS.err.showError(200, "messageDisableEdit");
			} else {
				return SCS.err.showError(511, "messageDisableEdit");
			}
		} else {
			return SCS.err.showError(510, "messageDisableEdit");
		}
	};

	/**
	 * Update message contents, used after editing or deleting (=set message content as empty) a message
	 * @param {String} id ID of item to select
	 * @param {String} message Message contents, use null if no need to update
	 * @param {String} time Time slot contents, use null if no need to update
	 * @status {String} status (Optional) Set the message status. Possible values: deleted | edited
	 * @return Response code with description
	 * @type {String}
	 */
	this.messageUpdate = function(id, message, time, status) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageUpdate");
		}
		var $m = $("#"+id+"");
		$(".emoticon", $m).deleteSprite();
		if (_container.length > 0) {
			if ($m.length > 0 && $m.hasClass("message")) {
				if (status != "undefined" && status != null) {
					self.messageMarkAs(id, status);
				}
				if (message != null) {
					$(".body", $m).html(message);
				}
				if (time != null) {
					$(".time", $m).html(time);
				}
				$m.css('display', 'inline').css('display', 'block');
				updateEmoticonSprites();
				updateImagesForCurrentScaleFactor();
				return SCS.err.showError(200, "messageUpdate");
			} else if ($m.length > 0 && $m.hasClass("emote")) {
				if (status != "undefined" && status != null) {
					self.messageMarkAs(id, status);
				}
				if (message != null) {
					$(".body", $m).html(message);
				}
				if (time != null) {
					$(".time", $m).html(time);
				}
				updateEmoticonSprites();
				updateImagesForCurrentScaleFactor();
				return SCS.err.showError(200, "messageUpdate");
			} else {
				return SCS.err.showError(511, "messageUpdate");
			}
		} else {
			return SCS.err.showError(510, "messageUpdate");
		}
	};

	/**
	 * Update video message's thumbnail image, used to set image path for thumbnail which is received asynchronously
	 * @param {int} videoMessageId id of video message
	 * @param {String} full path to video message thumbnail image
	 * @return Response code with description
	 * @type {String}
	 */
	this.videoMessageUpdateThumbnail = function(videoMessageId, thumbnailPath) {
		var img = $("#videoMessageThumbnailImageFor_"+videoMessageId).get(0);
		if (img) {
			img.src = "file://localhost"+thumbnailPath;
			img.onload = function() {
				this.style.width = 120 + "px";
				this.style.height = "inherit";
				this.style.backgroundColor = "inherit";
				this.style.borderWidth = "1px";

				var imageHeight = (120 / this.naturalWidth) * this.naturalHeight;
				var marginTop = imageHeight - 34 - 10 + 2;

				var childNodes = this.parentNode.childNodes;
				var i;
				for (i=0; i < childNodes.length; i++) {
					if (childNodes[i].className == 'playicon avatar') {
						if (imageHeight > 30) {
							childNodes[i].style.marginTop = marginTop + "px";
							childNodes[i].style.marginLeft = "-126px";
						}
						else {
							childNodes[i].style.marginTop = "1px";
							childNodes[i].style.height = imageHeight + "px";
							childNodes[i].style.width = imageHeight + "px";
							childNodes[i].style.marginLeft = "-126px";
						}
						break;
					}
				}
				var heightDifference = imageHeight - 80.0;
				if (heightDifference > 0) {
					scrollBy(0.0, heightDifference);
				}
			}
			return SCS.err.showError(200, "videomessageUpdateThumbnail");
		}
		else {
			return SCS.err.showError(511, "videomessageUpdateThumbnail");
		}
	};

	/**
	 * Toggle message followup status
	 * @param {String} id ID of item to select
	 * @param {Boolean} followup If true, sets message to be a followup message
	 * @return Response code with description
	 * @type {String}
	 */
	this.messageFollowupStatus = function(id, followup) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageFollowupStatus");
		}
		var $m = $("#"+id+"");
		if (_container.length > 0) {
			if ($m.length > 0 && $m.hasClass("message")) {
				if (followup == false) {
					$m.removeClass("followup");
				} else {
					$m.addClass("followup");
				}
				return SCS.err.showError(200, "messageFollowupStatus");
			} else {
				return SCS.err.showError(511, "messageFollowupStatus");
			}
		} else {
			return SCS.err.showError(510, "messageFollowupStatus");
		}
	};

	/**
	 * Start inline editing of a messsage
	 * @param {String} id ID of item to select
	 * @type {String}
	 */
	this.messageStartInlineEdit = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageStartInlineEdit");
		}
		var $m = $("#"+id+"");
		if (_container.length > 0) {
			if ($m.length > 0 && $m.hasClass("message")) {
				$m.find(".body").attr("contentEditable", "true").addClass("editMode");
				return SCS.err.showError(200, "messageStartInlineEdit");
			} else {
				return SCS.err.showError(511, "messageStartInlineEdit");
			}
		} else {
			return SCS.err.showError(510, "messageStartInlineEdit");
		}
	};

	/**
	 * End inline editing of a messsage
	 * @param {String} id ID of item to select
	 * @type {String}
	 */
	this.messageEndInlineEdit = function(id) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "messageEndInlineEdit");
		}
		var $m = $("#"+id+"");
		if (_container.length > 0) {
			if ($m.length > 0 && $m.hasClass("message")) {
				$m.find(".body").attr("contentEditable", "false").removeClass("editMode");
				return SCS.err.showError(200, "messageEndInlineEdit");
			} else {
				return SCS.err.showError(511, "messageEndInlineEdit");
			}
		} else {
			return SCS.err.showError(510, "messageEndInlineEdit");
		}
	};

	/**
	 * Show close button form chat area
	 * @returns void
	 */
	this.showChatCloseButton = function() {
		var $button = $(".chatCloseButton");
		if (!$button.length) {
			$button = $("

");
			$button.attr("aria-label", dC.localizedStringForKey_("ButtonTitle_Close"));
			$button.attr("title", dC.localizedStringForKey_("ButtonTitle_Close"));
			$button.bind("click", function() {
				dC.hideLiveChat();
			});
			_container.append($button);
			return SCS.err.showError(200, "showChatCloseButtonCreated");
		} else {
			$button.show();
		}
		return SCS.err.showError(200, "showChatCloseButtonShown");
	};

	/**
	 * Hides close button in the chat area
	 * @returns void
	 */
	this.hideChatCloseButton = function() {
		var $button = $(".chatCloseButton");
		if ($button.length) {
			$button.hide();
			return SCS.err.showError(200, "hideChatCloseButton");
		}
		return SCS.err.showError(511, "hideChatCloseButton");
	};

	/**
	 * Get info from an item if it's visible in the viewport
	 * @param {String} id ID of the item to ask
	 * @param {Boolean} partly (Optional) Set to true to allow partial viewport visibility of an item
	 * @returns true if the item is in viewport, false if out of the viewport. If error, returns response code with description.
	 * @type {Boolean} or {String}
	 */
	this.isInViewport = function(id, partly) {
		if (typeof id == "undefined" || id == "") {
			return SCS.err.showError(513, "isInViewport");
		}
		var $i = $("#"+id+"");
		if (_container.length > 0) {
			if ($i.length > 0) {
				var sTop = window.scrollY;
				var sBottom = window.scrollY + window.innerHeight;
				var itemPos = $i.position().top + $i.outerHeight();
				if (partly) {
					itemPos =  $i.position().top;
				}
				if (itemPos >= sTop && itemPos <= sBottom) {
					return true;
				} else {
					return false;
				}
			} else {
				return SCS.err.showError(511, "isInViewport");
			}
		} else {
			return SCS.err.showError(510, "isInViewport");
		}
	};

	/**
	 * Init SCS.Conversation object
	 * @return Response code with description
	 * @type {String}
	 */
	this.init = function() {
		_container = $("#conversation");
		self._dc();
		self._init();
		self._item();
		self._history();
		self._message();
		self._voicemail();
		self._transfer();
		return SCS.err.showError(200, "init");
	};

};

/**
 * Create new identification object on startup
 * @private
 */
SCS.id = new SCS.Identifier();

/**
 * Create new conversation object on page start
 * @private
 */
SCS.conv = new SCS.Conversation();

/**
 * Create new conversation object on page start
 * @private
 */
SCS.err = new SCS.ErrorHandler();

$(function() {
	SCS.conv.init();
});


text:
reqlang
=======

A language to write software requirements, based on xtext

redpajama_set_name: RedPajamaGithub


text:
titus.inspector.parser.Underscore
=================================

.. autoclass:: titus.inspector.parser.Underscore
    :members:
    :undoc-members:
    :show-inheritance:


text:
import React from 'react';
import PropTypes from 'prop-types';
import { Link, Spacer, Loader, FullWidthRow } from '../helpers';
import { Row, Col } from '@freecodecamp/react-bootstrap';
import { apiLocation } from '../../../config/env.json';
import { randomQuote } from '../../utils/get-words';

import './intro.css';

const propTypes = {
  complete: PropTypes.bool,
  isSignedIn: PropTypes.bool,
  name: PropTypes.string,
  navigate: PropTypes.func,
  pending: PropTypes.bool,
  slug: PropTypes.string,
  username: PropTypes.string
};

function Intro({
  isSignedIn,
  username,
  name,
  navigate,
  pending,
  complete,
  slug
}) {
  if (pending && !complete) {
    return (
      <>
        <Spacer />
        <Loader />
        <Spacer />
      </>
    );
  } else if (isSignedIn) {
    const { quote, author } = randomQuote();
    return (
      <>
        <Row>
          <Col sm={10} smOffset={1} xs={12}>
            <Spacer />

              {name
                ? 'Welcome back, ' + name + '.'
                : 'Welcome to freeCodeCamp.org'}

            <Spacer />
          </Col>
        </Row>
        <FullWidthRow className='button-group'>
          <Link
            className='btn btn-lg btn-primary btn-block'
            to={`/${username}`}
          >
            View my Portfolio
          </Link>
          <Link className='btn btn-lg btn-primary btn-block' to='/settings'>
            Update my account settings
          </Link>
        </FullWidthRow>
        <Spacer />
        <Row className='text-center quote-partial'>
          <Col sm={10} smOffset={1} xs={12}>

                <q>{quote}</q>

                  {author}

          </Col>
        </Row>
        <Row>
          <Col sm={10} smOffset={1} xs={12}>
            <Spacer />

              If you are new to coding, we recommend you{' '}
              <Link to={slug}>start at the beginning</Link>.

          </Col>
        </Row>
      </>
    );
  } else {
    return (
      <>
        <Row>
          <Col sm={10} smOffset={1} xs={12}>
            <Spacer />

              Welcome to freeCodeCamp.org

            <Spacer />

Learn to code.

Build projects.

Earn certifications.

              Since 2014, more than 40,000 freeCodeCamp.org graduates have
              gotten jobs at tech companies including:

Apple

Google

Amazon

Microsoft

Spotify

          </Col>
          <Col sm={10} smOffset={1} xs={12}>
            <button
              className={'btn-cta-big signup-btn btn-cta center-block'}
              onClick={() => {
                navigate(`${apiLocation}/signin`);
              }}
            >
              Sign in to save your progress (it's free)
            </button>
          </Col>
        </Row>
        <Spacer />
      </>
    );
  }
}

Intro.propTypes = propTypes;
Intro.displayName = 'Intro';

export default Intro;


text:
export const BIG_ENDIAN = "big_endian";
export const LITTLE_ENDIAN = "little_endian";

export class Buffer {
	constructor(src, offset = 0, length, endian = BIG_ENDIAN) {
		if(src instanceof Buffer) {
			if(typeof length === "undefined") {
				length = src.length - offset;
			}
			endian = src.endian;
			this._view = new DataView(src.view.buffer, src.offset + offset, length);
		}
		else if(src instanceof ArrayBuffer) {
			if(typeof length === "undefined") {
				length = src.byteLength - offset;
			}
			this._view = new DataView(src, offset, length);
		}

		this._offset = offset;
		this._cursor = 0;
		this._endian = endian;
	}

	get view() {
		return this._view;
	}

	get length() {
		return this._view.buffer.byteLength;
	}

	get endian() {
		return this._endian;
	}

	set endian(value) {
		this._endian = value;
	}

	get offset() {
		return this._offset;
	}

	get cursor() {
		return this._cursor;
	}

	set cursor(v) {
		this._cursor = v;
	}

	get eof() {
		return this._cursor === this.view.byteLength;
	}

	_moveCursor(x) {
		const oldCursor = this._cursor;
		this._cursor += x;
		return oldCursor;
	}

	getInt8() {
		return this._view.getInt8( this._moveCursor(1) );
	}

	getUint8() {
		return this._view.getUint8( this._moveCursor(1) );
	}

	getInt16() {
		return this._view.getInt16( this._moveCursor(2), this._endian === LITTLE_ENDIAN );
	}

	getUint16() {
		return this._view.getUint16( this._moveCursor(2), this._endian === LITTLE_ENDIAN );
	}

	getInt32() {
		return this._view.getInt32( this._moveCursor(4), this._endian === LITTLE_ENDIAN );
	}

	getUint32() {
		return this._view.getUint32( this._moveCursor(4), this._endian === LITTLE_ENDIAN );
	}

	getFloat32() {
		return this._view.getFloat32( this._moveCursor(4), this._endian === LITTLE_ENDIAN );
	}

	getFloat64() {
		return this._view.getFloat64( this._moveCursor(8), this._endian === LITTLE_ENDIAN );
	}

	read(length) {
		const data = new Buffer( this._view.buffer.slice(this._cursor, this._cursor + length) );
		this._cursor += length;
		return data;
	}

	readInt8(length) {
		const data = new Int8Array( this._view.buffer.slice(this._cursor, this._cursor + length) );
		this._cursor += length;
		return data;
	}

	getASCIIString(length) {
		let str = "";
		while(!this.eof && str.length < length) {
			let b = this.getUint8();
			if(b !== 0) { //null terminator
				str += String.fromCharCode( b );
			}
		}
		return str;
	}
}


text:
import Header from './header'
import React from 'react'

class SearchView extends React.Component {

    constructor(props) {
        super(props)
        this.state = {
            trials: props.trialColl.models[0].get('trials')
        }
    }

    render() {
        return (

                <SearchBody />
                <AllResults trial = {this.state.trials}/>

        )
    }
}

class SearchBody extends React.Component {

    _handleSearch(evt) {
        evt.preventDefault()
        location.hash = 'searchResults/' + evt.target.cancerType.value
        console.log(location.hash)
    }

    render() {
        return (
            <form className = 'searchBody' onSubmit = {this._handleSearch}>
                <input type = 'text' name = 'cancerType' placeholder = 'Cancer Type' />
                <input type = 'text' placeholder = 'Cancer Stage' />
                <input type = 'number' placeholder = 'Your age' />

Location:

                <input type = 'text' placeholder = 'City'/>
                <input type = 'text' placeholder = 'State'/>

Gender:

                <input type = 'radio' name = 'gender' value = 'female' />Female
                <input type = 'radio' name = 'gender' value = 'male' />Male
                <button type = 'submit'>Search</button>
            </form>
        )
    }
}

class AllResults extends React.Component {

    constructor(props) {
        super(props)
        // console.log('searchResults props', props)

        this.state = {
            trialArray: props.trial
        }
    }

    _getJSXArray(trialArray) {
        let newArray = []

        trialArray.forEach( (trial) => {
            newArray.push(<Trial trialModel = {trial} />
            )
        })
        return newArray
    }

    render() {
        return (

                {this._getJSXArray(this.state.trialArray)}

        )
    }
}

class Trial extends React.Component {
    constructor(props) {
        super(props)
        // console.log('trial props', props)

        this.state = {
            trialModel: props.trialModel
        }
        // console.log(this.state)
    }

    _getDetails(evt){
        evt.preventDefault()
        location.hash = 'trialDetails/' + this.state.trialModel.nct_id
    }

    render() {
        return (

 this._getDetails(evt)}>{this.state.trialModel.brief_title}

Description: {this.state.trialModel.brief_summary}

Principal Investigator: {this.state.trialModel.principal_investigator}

Lead Organization: {this.state.trialModel.lead_org}

Start Date: {this.state.trialModel.start_date}

        )
    }
}

export default SearchView


text:
BeastCode Developer Blog

Uncompiled Jekyll source code for beastcode.github.io


text:
require_relative './spec_helper'

require 'capybara'
require 'capybara/dsl'

Capybara.app = Lotus::Container.new

class MiniTest::Spec
  include Capybara::DSL
end


text:
<?xml version="1.0"?>

<config>
    <sections>
        <rss translate="label" module="rss">
            RSS Feeds
            <tab>catalog</tab>
            <frontend_type>text</frontend_type>
            <sort_order>80</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <config translate="label">
                    Rss Config
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <active translate="label">
                            Enable RSS
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <backend_model>rss/system_config_backend_links</backend_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                    </fields>
                </config>

                <wishlist translate="label">
                    Wishlist
                    <frontend_type>text</frontend_type>
                    <sort_order>2</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                         <active translate="label">
                            Enable RSS
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                    </fields>
                </wishlist>

                <catalog translate="label">
                    Catalog
                    <frontend_type>text</frontend_type>
                    <sort_order>3</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <new translate="label">
                            New Products
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </new>
                        <special translate="label">
                            Special Products
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>11</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </special>
                        <salesrule translate="label">
                            Coupons/Discounts
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>12</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </salesrule>
                        <tag translate="label">
                            Tags Products
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>13</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </tag>
                        <category translate="label">
                            Top Level Category
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>14</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </category>
                    </fields>
                </catalog>

                <order>
                    Order
                    <frontend_type>text</frontend_type>
                    <sort_order>4</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                         <status_notified translate="label">
                            Customer Order Status Notification
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </status_notified>
                    </fields>
                </order>

            </groups>
        </rss>
    </sections>
</config>


text:
Nightwatch.js — Example
====

This is an example showing how to integrate End-to-End-testing with Nightwatch.js and the Selenium server into a Grunt-workflow.

## Prerequisites

In order for the Selenium server to get running you have to have the current JDK installed on your system. Additionally the `java`-binary has to be in your `$PATH`-variable. But don't worry — Selenium will tell you when it's missing.

## Installation

Clone this repository, install the Node modules and make the `./grunt`-file executable, if you don't have `grunt-cli` installed globally. That's all!

```bash
$ git copy git@github.com:herschel666/nightwatch-example.git
$ cd nightwatch-example
$ npm install
# Making the `./grunt`-file executable
$ chmod +x ./grunt
```

This gets you a [Selenium-standalone](https://www.npmjs.org/package/selenium-standalone)-server, the [Nightwatch.js-runner](http://nightwatchjs.org/) and a local Grunt-environment including the CLI.

## Running the tests

Before running the tests you need a second server for delivering the actual website. At the moment, the Nightwatch-runner listens to [127.0.0.1:8000](http://127.0.0.1:8000). To get started fastly I recommend you to use the Python SimpleHTTPServer.

```bash
$ python -m SimpleHTTPServer
```

If the website's server is running, you can eventually start the test-runner.

```bash
$ ./grunt test
```

## The Grunt-task

The Grunt-task (there are actually two!) looks for `java` in your `$PATH`-variable. If it's there, the Selenium server is started. It gets one second to get running. After that the Testrunner starts. When it's done, the Selenium server gets killed. That's it.

If someone can provide me a proper callback for the startup of the Selenium server that gets me rid of the `setTimeout`-hack, I'd be really grateful!

## Questions & Suggestions

If you have a question, open an issue.

If you have an improvement, fork this repo, create a feature-branch, add your improvement and make a pull request. Thanks in advance!

## License

Copyright (c) 2014 Emanuel Kluge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the Software), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace Hermes
{
    class Program
    {
        [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);

        private const uint MOUSEEVENTF_LEFTDOWN = 0x02;
        private const uint MOUSEEVENTF_LEFTUP = 0x04;
        private const uint MOUSEEVENTF_RIGHTDOWN = 0x08;
        private const uint MOUSEEVENTF_RIGHTUP = 0x10;

        public static void DoMouseClick()
        {
            uint x = (uint)Cursor.Position.X;
            uint y = (uint)Cursor.Position.Y;
            mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, x, y, 0, 0);
        }

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new TrayIcon());
        }
    }
}


text:
require_relative '../../data_import/v3/builders/team_builder'
#require_relative '../../../strategies/sql_converter'

=begin

= V3::TeamAnalysisResultProcessor

  - Goggles framework vers.:  4.00.821
  - author: Steve A.

 Strategy class delegated to process (check & serialize) a single DataImportTeamAnalysisResult
 instance.

 Produces a detailed verbose text log of the analysis as well as a list of
 any SQL actions that that have been carried out during the serialization.

=end
class V3::TeamAnalysisResultProcessor
  include SqlConverter

  attr_reader :logger, :flash, :sql_executable_log, :process_log,
              :committed_rows
  #-- -------------------------------------------------------------------------
  #++

  # Creates a new instance.
  # When the logger is not given the default is to use the current Rails.logger.
  #
  def initialize( logger = nil, flash = nil )
    @logger = logger || Rails.logger
    @flash  = flash  || {}
    @sql_executable_log = ''                        # SQL diff log
    @process_log        = ''                        # Full process log
    @committed_rows     = []                        # Array of committed rows (currently used only in specs)
  end
  #-- -------------------------------------------------------------------------
  #++

  # Processes an instance of DataImportTeamAnalysisResult.
  # Returns +true+ on success; +false+ otherwise.
  #
  def run( team_analysis_result, is_confirmed, team_alias_override_id )
    raise ArgumentError.new() unless team_analysis_result.instance_of?( DataImportTeamAnalysisResult )
    update_logs(
      "\r\n-------------------------------------------------------------------------------------------------------------\r\n" <<
      "\r\nProcessing #{is_confirmed ? 'CONFIRMED' : 'unconfirmed'} #{team_analysis_result}..."
    )
    is_ok = true
    team_name = team_analysis_result.searched_team_name
                                                    # Use the alias override, if set:
    if team_alias_override_id.to_i > 0
      team_analysis_result.chosen_team_id = team_alias_override_id
      # Make sure a TeamAffiliation will be skipped for this phase of the analysis
      # (since there is a team ID override, the TeamAffiliation may be already existing):
      team_analysis_result.best_match_name = ''
      team_analysis_result.rebuild_sql_text()       # (No need to save the instance, since rows will be deleted at the end -- and if something goes wrong, hopefully we still have the log files...)
      update_logs( "Using team_id alias override = #{team_alias_override_id} for '#{team_name}'..." )
    end

    # NOTE: team_id will always refer to an instance of Team, not DataImportTeam!
    #       (Thus, if it is not zero and a linked TeamAffiliation is missing, we'll know
    #        that we can create one.)
    team_id   = team_analysis_result.chosen_team_id
    # NOTE: season_id will always refer to an instance of Season, not DataImportSeason!
    season_id = team_analysis_result.desired_season_id
    @sql_executable_log << "\r\n-- Processing:...'#{team_name}':\r\n"
                                                    # -- Can ADD new Team? (Default action for unconfirmed team_analysis_results)
    if (! is_confirmed) || team_analysis_result.can_insert_team
      begin
        team_builder = V3::TeamBuilder.build_from_parameters(
          team_analysis_result.data_import_session,
          team_name,
          team_analysis_result.season,
          true # During this phase, we have to force_team_or_swimmer_creation
        )
        committed_row = team_builder.result_row
        update_logs( "Created new #{committed_row.class}, ID: #{committed_row.id}." ) if committed_row
        # Make sure a TeamAffiliation will be skipped for this phase of the
        # analysis (we need to make sure that only actual Teams will be used
        # not secondary/temporary entities):
        team_id = nil if committed_row.instance_of?( DataImportTeam )
      rescue
        update_logs( "\r\n*** V3::TeamAnalysisResultProcessor: exception caught during DataImportTeam building! (Name:'#{team_name}')", :error )
        update_logs( "*** #{ $!.to_s }\r\n", :error ) if $!
        @flash[:error] = "#{I18n.t(:something_went_wrong)} ['#{ $!.to_s }']"
        is_ok = false
      end
    end
                                                    # -- Can ADD new Team Alias?
    if ( is_ok && team_id.to_i > 0 && is_confirmed && team_analysis_result.can_insert_alias )
      begin
        DataImportTeamAlias.transaction do          # Let's make sure other threads have not already done what we want to do:
          if ( DataImportTeamAlias.where(name: team_name, team_id: team_id).none? )
            committed_row = DataImportTeamAlias.new(
              name:     team_name,
              team_id:  team_id
            )
            committed_row.save!                     # raise automatically an exception if save is not successful
            @committed_rows << committed_row
            team_alias = Team.find_by_id( team_id )
            @sql_executable_log << "-- aliased with: '#{team_alias.name}' (ID:#{team_alias.id})\r\n" if team_alias
            @sql_executable_log << to_sql_insert( committed_row, false ) # (No user comment)
          else
            @logger.info( "\r\n*** V3::TeamAnalysisResultProcessor: WARNING: skipping DataImportTeamAlias creation because was (unexpectedly) found already existing! (Name:'#{team_name}', team_id:#{team_id})" ) if @logger
          end
        end
      rescue
        update_logs( "\r\n*** V3::TeamAnalysisResultProcessor: exception caught during DataImportTeamAlias save! (Name:'#{team_name}', team_id:#{team_id})", :error )
        update_logs( "*** #{ $!.to_s }\r\n", :error ) if $!
        @flash[:error] = "#{I18n.t(:something_went_wrong)} ['#{ $!.to_s }']"
        is_ok = false
      end
    end
                                                    # -- Can ADD new TeamAffiliation?
    if ( is_ok && team_id.to_i > 0 && is_confirmed && team_analysis_result.can_insert_affiliation )
      begin
        TeamAffiliation.transaction do              # Let's make sure other threads have not already done what we want to do:
          if ( TeamAffiliation.where(
                  team_id:    team_id,
                  season_id:  season_id
               ).none? )
            committed_row = TeamAffiliation.new(
              name:                       team_name,# Use the actual provided name instead of the result_row.name
              team_id:                    team_id,
              season_id:                  season_id,
              is_autofilled:              true,     # signal that we have guessed some of the values
              must_calculate_goggle_cup:  false,
              user_id:                    1         # (don't care)
              # XXX Unable to guess team affiliation number (not filled-in, to be added by hand)
            )
            committed_row.save!                     # raise automatically an exception if save is not successful
            @committed_rows << committed_row
            @sql_executable_log << to_sql_insert( committed_row, false ) # (No user comment)
          else
            update_logs( "\r\n*** V3::TeamAnalysisResultProcessor: WARNING: skipping TeamAffiliation creation because was (unexpectedly) found already existing! (Name:'#{team_name}', team_id:#{team_id}, season_id:#{season_id})", :error )
          end
        end
      rescue
        update_logs( "\r\n*** V3::TeamAnalysisResultProcessor: exception caught during TeamAffiliation save! (Name:'#{team_name}', team_id:#{team_id}, season_id:#{season_id})", :error )
        update_logs( "*** #{ $!.to_s }\r\n", :error ) if $!
        @flash[:error] = "#{I18n.t(:something_went_wrong)} ['#{ $!.to_s }']"
        is_ok = false
      end
    end
                                                    # Rebuild corrected log files:
    if ( is_confirmed )
      @process_log << team_analysis_result.analysis_log_text
    else
      @process_log << "\r\n                    [[[ '#{team_name}' ]]]  -- search overridden:\r\n\r\n   => NOT FOUND.\r\n"
    end
    @process_log << "\r\n----8<---- (Original suggested statements:) ----" << team_analysis_result.sql_text
    @process_log << "----8<----\r\n"
    is_ok
  end
  #-- -------------------------------------------------------------------------
  #++

  private

  # Stores the text +msg+ into the log & logger.
  def update_logs( msg, method = :info )
    @logger.send( method, msg ) if @logger
    @process_log << (msg + "\r\n")
  end
  #-- -------------------------------------------------------------------------
  #++
end


text:
using System;
using System.Collections.Generic;

namespace NCMB.Internal
{
	//Increment操作の履歴操作を扱う
	internal class NCMBIncrementOperation : INCMBFieldOperation
	{

		private object amount;

		public NCMBIncrementOperation (object amount)
		{
			this.amount = amount;
		}

		public object Encode ()
		{
			Dictionary<string, object> dic = new Dictionary<string, object> ();
			dic.Add ("__op", "Increment");
			dic.Add ("amount", this.amount);
			return dic;
		}

		public INCMBFieldOperation MergeWithPrevious (INCMBFieldOperation previous)
		{
			if (previous == null) {
				return this;
			}

			if ((previous is NCMBDeleteOperation)) {
				return new NCMBSetOperation (this.amount);
			}

			if ((previous is NCMBSetOperation)) {
				object value = ((NCMBSetOperation)previous).getValue ();
				if (value is string || value == null) {
					throw new  InvalidOperationException ("You cannot increment a non-number.");
				}
				return new NCMBSetOperation (NCMBObject._addNumbers (value, this.amount));
			}

			if ((previous is NCMBIncrementOperation)) {
				object oldAmount = (((NCMBIncrementOperation)previous).amount);
				return new NCMBIncrementOperation (NCMBObject._addNumbers (oldAmount, this.amount));
			}
			throw new  InvalidOperationException ("Operation is invalid after previous operation.");
		}

		public object Apply (object oldValue, NCMBObject obj, string key)
		{
			if (oldValue == null) {
				return this.amount;
			}
			if (oldValue is string || oldValue == null) {
				throw new  InvalidOperationException ("You cannot increment a non-number.");

			}
			return NCMBObject._addNumbers (oldValue, this.amount);
		}

	}
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "tbl_postcategory".
 *
 * @property integer $id
 * @property integer $categoryId
 * @property integer $postId
 */
class PostCategory extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tbl_postcategory';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['categoryId', 'postId'], 'required'],
            [['categoryId', 'postId'], 'integer']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'categoryId' => Yii::t('app', 'Category ID'),
            'postId' => Yii::t('app', 'Post ID'),
        ];
    }
}


text:
package com.amazonaws.services.codebuild.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * Information about the credentials for a GitHub, GitHub Enterprise, or Bitbucket repository.
 *

 *
 * @see AWS
 *      API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SourceCredentialsInfo implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The Amazon Resource Name (ARN) of the token.
     *

     */
    private String arn;
    /**
     *

     * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     *

     */
    private String serverType;
    /**
     *

     * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     * PERSONAL_ACCESS_TOKEN.
     *

     */
    private String authType;

    /**
     *

     * The Amazon Resource Name (ARN) of the token.
     *

     *
     * @param arn
     *        The Amazon Resource Name (ARN) of the token.
     */

    public void setArn(String arn) {
        this.arn = arn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the token.
     *

     *
     * @return The Amazon Resource Name (ARN) of the token.
     */

    public String getArn() {
        return this.arn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the token.
     *

     *
     * @param arn
     *        The Amazon Resource Name (ARN) of the token.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public SourceCredentialsInfo withArn(String arn) {
        setArn(arn);
        return this;
    }

    /**
     *

     * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     *

     *
     * @param serverType
     *        The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     * @see ServerType
     */

    public void setServerType(String serverType) {
        this.serverType = serverType;
    }

    /**
     *

     * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     *

     *
     * @return The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     * @see ServerType
     */

    public String getServerType() {
        return this.serverType;
    }

    /**
     *

     * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     *

     *
     * @param serverType
     *        The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see ServerType
     */

    public SourceCredentialsInfo withServerType(String serverType) {
        setServerType(serverType);
        return this;
    }

    /**
     *

     * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     *

     *
     * @param serverType
     *        The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, or BITBUCKET.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see ServerType
     */

    public SourceCredentialsInfo withServerType(ServerType serverType) {
        this.serverType = serverType.toString();
        return this;
    }

    /**
     *

     * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     * PERSONAL_ACCESS_TOKEN.
     *

     *
     * @param authType
     *        The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     *        PERSONAL_ACCESS_TOKEN.
     * @see AuthType
     */

    public void setAuthType(String authType) {
        this.authType = authType;
    }

    /**
     *

     * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     * PERSONAL_ACCESS_TOKEN.
     *

     *
     * @return The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     *         PERSONAL_ACCESS_TOKEN.
     * @see AuthType
     */

    public String getAuthType() {
        return this.authType;
    }

    /**
     *

     * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     * PERSONAL_ACCESS_TOKEN.
     *

     *
     * @param authType
     *        The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     *        PERSONAL_ACCESS_TOKEN.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AuthType
     */

    public SourceCredentialsInfo withAuthType(String authType) {
        setAuthType(authType);
        return this;
    }

    /**
     *

     * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     * PERSONAL_ACCESS_TOKEN.
     *

     *
     * @param authType
     *        The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, or
     *        PERSONAL_ACCESS_TOKEN.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AuthType
     */

    public SourceCredentialsInfo withAuthType(AuthType authType) {
        this.authType = authType.toString();
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getArn() != null)
            sb.append("Arn: ").append(getArn()).append(",");
        if (getServerType() != null)
            sb.append("ServerType: ").append(getServerType()).append(",");
        if (getAuthType() != null)
            sb.append("AuthType: ").append(getAuthType());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof SourceCredentialsInfo == false)
            return false;
        SourceCredentialsInfo other = (SourceCredentialsInfo) obj;
        if (other.getArn() == null ^ this.getArn() == null)
            return false;
        if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
            return false;
        if (other.getServerType() == null ^ this.getServerType() == null)
            return false;
        if (other.getServerType() != null && other.getServerType().equals(this.getServerType()) == false)
            return false;
        if (other.getAuthType() == null ^ this.getAuthType() == null)
            return false;
        if (other.getAuthType() != null && other.getAuthType().equals(this.getAuthType()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
        hashCode = prime * hashCode + ((getServerType() == null) ? 0 : getServerType().hashCode());
        hashCode = prime * hashCode + ((getAuthType() == null) ? 0 : getAuthType().hashCode());
        return hashCode;
    }

    @Override
    public SourceCredentialsInfo clone() {
        try {
            return (SourceCredentialsInfo) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.codebuild.model.transform.SourceCredentialsInfoMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
import os
here = lambda * x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)

PROJECT_ROOT = here('..')

root = lambda * x: os.path.join(os.path.abspath(PROJECT_ROOT), *x)

PROJECT_MODULE = '.'.join(__name__.split('.')[:-2])  # cut .settings.base

DEBUG = True

TEMPLATE_DEBUG = DEBUG

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': root('etc', 'development.db'),
    }
}

MEDIA_ROOT = root('static', 'uploads')
MEDIA_URL = '/static/uploads/'

STATIC_ROOT = root('static', 'assets')
STATIC_URL = '/static/assets/'

ADMIN_MEDIA_PREFIX = '/static/assets/admin/'

STATICFILES_DIRS = (
    root('staticfiles'),
)

ROOT_URLCONF = 'settings.urls'

TEMPLATE_DIRS = (
    root('templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.admindocs',

    # external
    'south',

)

SITE_ID = 1

TEST_EXCLUDE = ('django',)
TEST_RUNNER = 'settings.test_suite.AdvancedTestSuiteRunner'


text:
/*
 * Copyleft 2015
 * and other contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jam.metrics;

import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import javax.inject.Inject;
import org.jam.metrics.applicationmetricsapi.DBStore;
import org.jam.metrics.applicationmetricsapi.HawkularApm;
import org.jam.metrics.applicationmetricsapi.Metric;
import org.jam.metrics.applicationmetricslibrary2.CodeParams;

/**
 *
 * @author Panagiotis Sotiropoulos
 */
public class MetricsClass {
    private static AtomicInteger countAtomic;
    private static int count = 0;

    private static int count2 = 0;
    private static AtomicInteger i;
    private String metricUser="Niki";

    private CodeParams cp;

    @Inject
    MediumClass mediumClass;

    public static AtomicInteger getCountAtomic() {
        return countAtomic;
    }

    public static void setCountAtomic(AtomicInteger countAtomic) {
        MetricsClass.countAtomic = countAtomic;
    }

    public static int getCount() {
        return count;
    }

    public static void setCount(int count) {
        MetricsClass.count = count;
    }

    public static int getCount2() {
        return count2;
    }

    public static void setCount2(int count2) {
        MetricsClass.count2 = count2;
    }

    public static AtomicInteger getI() {
        return i;
    }

    public static void setI(AtomicInteger i) {
        MetricsClass.i = i;
    }

    public String getMetricUser() {
        return metricUser;
    }

    public MetricsClass(){
        countAtomic = new AtomicInteger(1);
        i = new AtomicInteger(1);
    }

    @Metric(fieldName = {"count"}, groupName = "myTestGroup")
    @DBStore(groupName = "myTestGroup", queryUpdateDB = {"StoreDBMetric","count"}, statementName = "statement_1")
    @HawkularApm(childMethods = {"mediumClass","mediumClass"}, groupName = "myTestGroup")
    public synchronized void getAndSetCountIncreased(Callable<Object> func) throws Exception {
        func.call();
        mediumClass.mediumClass();
        mediumClass.mediumClass();
    }

    @Metric(fieldName = {"count2"}, groupName = "myTestGroup")
    @DBStore(groupName = "myTestGroup", queryUpdateDB = {"StoreDBMetric","count2"}, statementName = "statement_1")
    @HawkularApm(childMethods = {"mediumClass","mediumClass"}, groupName = "myTestGroup")
    public synchronized void getAndSetCount2Increased(Callable<Object> func) throws Exception {
        func.call();
        mediumClass.mediumClass();
        mediumClass.mediumClass();
    }

}


text:
{% extends "base.html" %} {% block body %}

We're sorry!

The page  could not be found on this server.

{% endblock body %} {% block scripts %}

{% endblock %}


text:
    BUIP075: Counter BUIP of BUIP071
    Proposer: Gal Buki (@torusJKL)
    Submitted on: 2017-11-13
    Status: passed

Summary
-------

This BUIP is the same as BUIP071 with the following change.

The text:

> Additionally, this BUIP, if passed, would give BU's Lead Developer the
> authority to provide a bespoke version of the "Bitcoin Core" branch
> for miners which creates empty SegWit blocks.

is removed without providing any substitute.

Should BUIP071 remove the above text and not place another with the same
meaning in its place then this counter BUIP can be revoked and not made
available for vote.

Conflict of interest
--------------------

The author holds some BTC but mainly BCH.


text:
/** @jsx h */

import h from '../../helpers/h'

export default function (state) {
  return state
    .change()
    .delete()
    .state
    .change()
    .undo()
    .state
}

export const input = (
  <state>
    <document>
      <paragraph>
        <link>o<anchor />ne</link>
      </paragraph>
      <paragraph>
        <link>tw<focus />o</link>
      </paragraph>
    </document>
  </state>
)

export const output = input


text:
import { CancellationToken, Hover, HoverProvider, Position, Range, TextDocument, Uri } from "vscode";
import * as as from "../../shared/analysis_server_types";
import { Logger } from "../../shared/interfaces";
import { fsPath } from "../../shared/utils/fs";
import { cleanDartdoc } from "../../shared/vscode/extension_utils";
import { DasAnalyzerClient } from "../analysis/analyzer_das";

export class DartHoverProvider implements HoverProvider {
	constructor(private readonly logger: Logger, private readonly analyzer: DasAnalyzerClient) { }

	public async provideHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover | undefined> {
		try {
			const resp = await this.analyzer.analysisGetHover({
				file: fsPath(document.uri),
				offset: document.offsetAt(position),
			});

			if (token.isCancellationRequested || resp.hovers.length === 0)
				return;

			const hover = resp.hovers[0];
			const data = this.getHoverData(document.uri, hover);

			if (!data)
				return;

			const range = new Range(
				document.positionAt(hover.offset),
				document.positionAt(hover.offset + hover.length),
			);
			return new Hover(
				[{ language: "dart", value: data.displayString }, data.documentation || undefined],
				range.isSingleLine ? range : undefined, // Workaround for https://github.com/dart-lang/sdk/issues/35386
			);
		} catch (e) {
			this.logger.error(e);
		}
	}

	private getHoverData(documentUri: Uri, hover: as.HoverInformation): any {
		if (!hover.elementDescription) return undefined;

		// Import prefix tooltips are not useful currently.
		// https://github.com/dart-lang/sdk/issues/32735
		if (hover.elementKind === "import prefix") return undefined;

		const elementDescription = hover.elementDescription;
		const dartdoc: string | undefined = hover.dartdoc;
		const propagatedType = hover.propagatedType;

		let displayString: string = "";
		if (elementDescription) displayString += (hover.isDeprecated ? "(deprecated) " : "") + `${elementDescription}\n`;
		if (propagatedType) displayString += `propogated type: ${propagatedType.trim()}`;

		let documentation = cleanDartdoc(dartdoc);
		const containingLibraryName = hover.containingLibraryName;
		if (containingLibraryName)
			documentation = `*${containingLibraryName}*\n\n` + documentation;

		return {
			displayString: displayString.trim(),
			documentation: documentation.trim(),
		};
	}
}


text:
/* global __, setTimeout */

__.mixins.PubSub = {
	properties: {
		getSubscriptions: function(_key){
			if(!(this.subscriptions instanceof Array)){
				this.subscriptions = [];
			}
			if(typeof _key === 'undefined'){
				return this.subscriptions;
			}else{
				if(typeof this.subscriptions[_key] == 'undefined'){
					this.subscriptions[_key] = [];
				}
				return this.subscriptions[_key];
			}
		}
		,pub: function(_eventName, _data){
			var _this = this;
			//-#publish in separate thread
			setTimeout(function(){
				var _i = 0;
				var _subscription;
				var _subscriptions = _this.getSubscriptions(_eventName);
				var _subscriptionsLength = _subscriptions.length;
				for(; _i < _subscriptionsLength; ++_i){
					_subscription = _subscriptions[_i];
					_subscription.call(_this, _data || null);
				}
			}, 0);
		}
		,sub: function(_eventName, _callback){
			var _subscriptions = this.getSubscriptions(_eventName);
			_subscriptions.push(_callback);
		}
		,subscriptions: null
		,unsub: function(){

		}
	}
};


text:
package mil.nga.giat.geowave.core.store.adapter.statistics;

import mil.nga.giat.geowave.core.store.EntryVisibilityHandler;
import mil.nga.giat.geowave.core.store.base.DataStoreEntryInfo;
import mil.nga.giat.geowave.core.store.base.DataStoreEntryInfo.FieldInfo;

public class FieldTypeStatisticVisibility<T> implements
		EntryVisibilityHandler<T>
{
	private final Class<?> fieldType;

	public FieldTypeStatisticVisibility(
			final Class<?> fieldType ) {
		this.fieldType = fieldType;
	}

	@Override
	public byte[] getVisibility(
			final DataStoreEntryInfo entryInfo,
			final T entry ) {
		for (final FieldInfo<?> f : entryInfo.getFieldInfo()) {
			if ((f.getDataValue().getValue() != null)
					&& fieldType.isAssignableFrom(f.getDataValue().getValue().getClass())) {
				return f.getVisibility();
			}
		}
		return null;
	}

}


text:
import subprocess
from docutils import nodes
from distutils.version import LooseVersion
from sphinx import __version__ as sphinx_version
from sphinx.highlighting import PygmentsBridge
from pygments.formatters.latex import LatexFormatter

project = 'Data Plane Development Kit'

if LooseVersion(sphinx_version) >= LooseVersion('1.3.1'):
    html_theme = "sphinx_rtd_theme"
html_logo = '../logo/DPDK_logo_vertical_rev_small.png'
latex_logo = '../logo/DPDK_logo_horizontal_tag.png'
html_add_permalinks = ""
html_show_copyright = False
highlight_language = 'none'

version = subprocess.check_output(['make', '-sRrC', '../../', 'showversion']).decode('utf-8').rstrip()
release = version

master_doc = 'index'

# Figures, tables and code-blocks automatically numbered if they have caption
numfig = True

latex_documents = [
    ('index',
     'doc.tex',
     '',
     '',
     'manual')
]

# Latex directives to be included directly in the latex/pdf docs.
latex_preamble = r"""
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{xleftmargin=5mm}
"""

# Configuration for the latex/pdf docs.
latex_elements = {
    'papersize': 'a4paper',
    'pointsize': '11pt',
    # remove blank pages
    'classoptions': ',openany,oneside',
    'babel': '\\usepackage[english]{babel}',
    # customize Latex formatting
    'preamble': latex_preamble
}

# Override the default Latex formatter in order to modify the
# code/verbatim blocks.
class CustomLatexFormatter(LatexFormatter):
    def __init__(self, **options):
        super(CustomLatexFormatter, self).__init__(**options)
        # Use the second smallest font size for code/verbatim blocks.
        self.verboptions = r'formatcom=\footnotesize'

# Replace the default latex formatter.
PygmentsBridge.latex_formatter = CustomLatexFormatter

######## :numref: fallback ########
# The following hook functions add some simple handling for the :numref:
# directive for Sphinx versions prior to 1.3.1. The functions replace the
# :numref: reference with a link to the target (for all Sphinx doc types).
# It doesn't try to label figures/tables.

def numref_role(reftype, rawtext, text, lineno, inliner):
    """
    Add a Sphinx role to handle numref references. Note, we can't convert
    the link here because the doctree isn't build and the target information
    isn't available.
    """
    # Add an identifier to distinguish numref from other references.
    newnode = nodes.reference('',
                              '',
                              refuri='_local_numref_#%s' % text,
                              internal=True)
    return [newnode], []

def process_numref(app, doctree, from_docname):
    """
    Process the numref nodes once the doctree has been built and prior to
    writing the files. The processing involves replacing the numref with a
    link plus text to indicate if it is a Figure or Table link.
    """

    # Iterate over the reference nodes in the doctree.
    for node in doctree.traverse(nodes.reference):
        target = node.get('refuri', '')

        # Look for numref nodes.
        if target.startswith('_local_numref_#'):
            target = target.replace('_local_numref_#', '')

            # Get the target label and link information from the Sphinx env.
            data = app.builder.env.domains['std'].data
            docname, label, _ = data['labels'].get(target, ('', '', ''))
            relative_url = app.builder.get_relative_uri(from_docname, docname)

            # Add a text label to the link.
            if target.startswith('figure'):
                caption = 'Figure'
            elif target.startswith('table'):
                caption = 'Table'
            else:
                caption = 'Link'

            # New reference node with the updated link information.
            newnode = nodes.reference('',
                                      caption,
                                      refuri='%s#%s' % (relative_url, label),
                                      internal=True)
            node.replace_self(newnode)

def setup(app):
    if LooseVersion(sphinx_version) < LooseVersion('1.3.1'):
        print('Upgrade sphinx to version >= 1.3.1 for '
              'improved Figure/Table number handling.')
        # Add a role to handle :numref: references.
        app.add_role('numref', numref_role)
        # Process the numref references once the doctree has been created.
        app.connect('doctree-resolved', process_numref)


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wyam.Common;
using Wyam.Common.Documents;
using Wyam.Common.Modules;
using Wyam.Common.Execution;
using YamlDotNet.RepresentationModel;
using Wyam.Yaml.Dynamic;

namespace Wyam.Yaml
{
    /// <summary>
    /// Parses YAML content for each input document and stores the result in it's metadata.
    /// </summary>
    /// <remarks>
    /// Parses the content for each input document and then stores a dynamic object
    /// representing the first YAML document in metadata with the specified key. If no key is specified,
    /// then the dynamic object is not added. You can also flatten the YAML to add top-level pairs directly
    /// to the document metadata.
    /// </remarks>
    /// <category>Metadata</category>
    public class Yaml : IModule
    {
        private readonly bool _flatten;
        private readonly string _key;

        /// <summary>
        /// The content of the input document is parsed as YAML. All root-level scalars are added to the input document's
        /// metadata. Any more complex YAML structures are ignored. This is best for simple key-value YAML documents.
        /// </summary>
        public Yaml()
        {
            _flatten = true;
        }

        /// <summary>
        /// The content of the input document is parsed as YAML. A dynamic object representing the first YAML
        /// document is set as the value for the given metadata key. See YamlDotNet.Dynamic for more details
        /// about the dynamic YAML object. If flatten is true, all root-level scalars are also added
        /// to the input document's metadata.
        /// </summary>
        /// <param name="key">The metadata key in which to set the dynamic YAML object.</param>
        /// <param name="flatten">If set to <c>true</c>, all root-level scalars are also added to the input document's metadata.</param>
        public Yaml(string key, bool flatten = false)
        {
            _key = key;
            _flatten = flatten;
        }

        /// <inheritdoc />
        public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
        {
            return inputs
                .AsParallel()
                .SelectMany(context, input =>
                {
                    List<Dictionary<string, object>> documentMetadata = new List<Dictionary<string, object>>();
                    using (TextReader contentReader = new StringReader(input.Content))
                    {
                        YamlStream yamlStream = new YamlStream();
                        yamlStream.Load(contentReader);
                        foreach (YamlDocument document in yamlStream.Documents)
                        {
                            // If this is a sequence, get a document for each item
                            YamlSequenceNode rootSequence = document.RootNode as YamlSequenceNode;
                            if (rootSequence != null)
                            {
                                documentMetadata.AddRange(rootSequence.Children.Select(x => GetDocumentMetadata(x, context)));
                            }
                            else
                            {
                                // Otherwise, just get a single set of metadata
                                documentMetadata.Add(GetDocumentMetadata(document.RootNode, context));
                            }
                        }
                    }
                    if (documentMetadata.Count == 0 && _flatten)
                    {
                        return new[] { input };
                    }
                    return documentMetadata.Select(metadata => context.GetDocument(input, metadata));
                })
                .Where(x => x != null);
        }

        private Dictionary<string, object> GetDocumentMetadata(YamlNode node, IExecutionContext context)
        {
            Dictionary<string, object> metadata = new Dictionary<string, object>();

            // Get the dynamic representation
            if (!string.IsNullOrEmpty(_key))
            {
                metadata[_key] = new DynamicYaml(node);
            }

            // Also get the flat metadata if requested
            if (_flatten)
            {
                YamlMappingNode mappingNode = node as YamlMappingNode;
                if (mappingNode == null)
                {
                    throw new InvalidOperationException("Cannot flatten YAML content that doesn't have a mapping node at the root (or within a root sequence).");
                }

                // Map scalar-to-scalar children
                foreach (KeyValuePair<YamlNode, YamlNode> child in
                    mappingNode.Children.Where(y => y.Key is YamlScalarNode && y.Value is YamlScalarNode))
                {
                    metadata[((YamlScalarNode)child.Key).Value] = ((YamlScalarNode)child.Value).Value;
                }

                // Map simple sequences
                foreach (KeyValuePair<YamlNode, YamlNode> child in
                    mappingNode.Children.Where(y => y.Key is YamlScalarNode && y.Value is YamlSequenceNode && ((YamlSequenceNode)y.Value).All(z => z is YamlScalarNode)))
                {
                    metadata[((YamlScalarNode)child.Key).Value] = ((YamlSequenceNode)child.Value).Select(a => ((YamlScalarNode)a).Value).ToArray();
                }

                // Map object sequences
                foreach (KeyValuePair<YamlNode, YamlNode> child in
                    mappingNode.Children.Where(y => y.Key is YamlScalarNode && y.Value is YamlSequenceNode && ((YamlSequenceNode)y.Value).All(z => z is YamlMappingNode)))
                {
                    metadata[((YamlScalarNode)child.Key).Value] = ((YamlSequenceNode)child.Value).Select(a => context.GetDocument(GetDocumentMetadata(a, context))).ToArray();
                }

                // Note: No support for mixed sequences of YamlMappingNode and YamlScalarNode together
            }

            return metadata;
        }
    }
}