text:
angular.module('common.directives', ['common.assets']);

angular.module('common.directives').directive('commonModalError', [ '$rootScope', '$http', '$location', '$timeout', 'ERROR_DIALOG_TEMPLATE', 'LOADING_16_IMAGE', function ($rootScope, $http, $location, $timeout, ERROR_DIALOG_TEMPLATE, LOADING_16_IMAGE) {
    return {
        restrict: 'E',
        replace: true,
        scope: {},
        templateUrl: ERROR_DIALOG_TEMPLATE,

        link: function (scope, element, attrs) {
            var errorDate;

            scope.loadingImage = LOADING_16_IMAGE;

            function setDetailsButton(show) {
                if (show) {
                    scope.detailButtonText = 'Hide Details';
                } else {
                    scope.detailButtonText = 'Show Details';
                }
                scope.showDetails = show;
            }

            $rootScope.$on('showError', function (event, message) {
                errorDate = new Date();
                scope.inProgress = false;
                scope.title = message.title;
                scope.body = [];
                scope.details = [];
                scope.hasDetails = false;
                setDetailsButton(message.showDetails || false);

                if (message.body) {
                    if (angular.isArray(message.body)) {
                        scope.body = message.body;
                    } else {
                        scope.body.push(message.body);
                    }
                }

                if (message.details) {
                    if (angular.isArray(message.details)) {
                        scope.details = message.details;
                    } else {
                        scope.details.push(message.details);
                    }

                    scope.hasDetails = scope.details.length > 0;
                }

                if (angular.isNumber(message.timeout)) {
                    $timeout(function () {
                        element.modal('hide');
                    }, message.timeout);
                }

                element.modal('show');
            });

            scope.onToggleShowDetails = function () {
                setDetailsButton(!scope.showDetails);
            };
        }
    };
}]);

angular.module('common.directives').directive('commonModalProgress', [ '$rootScope', 'PROGRESS_DIALOG_TEMPLATE', function ($rootScope, PROGRESS_DIALOG_TEMPLATE) {
    return {
        restrict: 'E',
        replace: true,
        scope: {},
        templateUrl: PROGRESS_DIALOG_TEMPLATE,

        link: function (scope, element, attrs) {
            $rootScope.$on('showProgress', function (event, message) {
                scope.title = message.title;
                scope.body = message.body;
                element.modal('show');
            });
            $rootScope.$on('hideProgress', function (event) {
                element.modal('hide');
            });
        }
    };
}]);

angular.module('common.directives').directive('commonModalConfirmation', [ '$rootScope', 'CONFIRMATION_DIALOG_TEMPLATE', 'LOADING_16_IMAGE', function ($rootScope, CONFIRMATION_DIALOG_TEMPLATE, LOADING_16_IMAGE) {
    return {
        restrict: 'E',
        replace: true,
        scope: {},
        templateUrl: CONFIRMATION_DIALOG_TEMPLATE,

        link: function (scope, element, attrs) {
            scope.loadingImage = LOADING_16_IMAGE;

            $rootScope.$on('showConfirmation', function (event, message) {
                scope.title = message.title;
                scope.body = [];
                scope.buttons = [];
                scope.inProgress = false;

                if (message.warningLevel) {
                    scope.warningLevel = "modal-" + message.warningLevel;
                }

                if (message.body) {
                    if (angular.isArray(message.body)) {
                        scope.body = message.body;
                    } else {
                        scope.body.push(message.body);
                    }
                }

                if (message.buttons) {
                    if (angular.isArray(message.buttons)) {
                        scope.buttons = message.buttons;
                    } else {
                        scope.buttons.push(message.buttons);
                    }
                }

                element.modal('show');
            });

            scope.onButtonClick = function (callback) {
                scope.inProgress = true;
                if (callback) {
                    try {
                        callback();
                    }
                    catch (e) {
                        element.modal('hide');
                        var errorMessage = {
                            title: 'JS Error:  ' + callback.name,
                            body: e.message
                        };
                        $rootScope.$emit('showError', errorMessage);
                    }
                }
                element.modal('hide');
                scope.inProgress = false;
            };
        }
    };
}]);

angular.module('common.directives').directive('uiSelect2ClickFixer', function () {
    return {
        link: function (scope, element, attrs) {
            element.parent().bind('click', function (event) {
                event.stopPropagation();
            });
        }
    };
});


text:
__source__ = 'https://leetcode.com/problems/word-pattern/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/word-pattern.py
# Time:  O(n)
# Space: O(c), c is unique count of pattern
#
# Description: Leetcode # 290. Word Pattern
#
# Given a pattern and a string str, find if str follows the same pattern.
#
# Here follow means a full match, such that there is a bijection
# between a letter in pattern and a non-empty word in str.
#
# Examples:
# pattern = "abba", str = "dog cat cat dog" should return true.
# pattern = "abba", str = "dog cat cat fish" should return false.
# pattern = "aaaa", str = "dog cat cat dog" should return false.
# pattern = "abba", str = "dog dog dog dog" should return false.
#
# Notes:
# You may assume pattern contains only lowercase letters,
# and str contains lowercase letters separated by a single space.
#
#
# Companies
# Dropbox Uber Tesla
# Related Topics
# Hash Table
# Similar Questions
# Isomorphic Strings Word Pattern II
#
from itertools import izip  # Generator version of zip.
import unittest
class Solution(object):
    def wordPattern(self, pattern, str):
        """
        :type pattern: str
        :type str: str
        :rtype: bool
        """
        if len(pattern) != self.wordCounts(str):
            return False

        w2p, p2w = {}, {}

        for p, w in izip(pattern, self.wordGenerator(str)):
            if w not in w2p and p not in p2w:
                # Build mapping. Space: O(c)
                w2p[w] = p
                p2w[p] = w
            elif w not in w2p or w2p[w] != p:
                # Contradict mapping.
                return False
        return True

    def wordCounts(self, str):
        cnt = 1 if str else 0
        for c in str:
            if c == ' ':
                cnt += 1
        return cnt

     # Generate a word at a time without saving all the words.
    def wordGenerator(self, str):
        w = ""
        for c in str:
            if c == ' ':
                yield w
                w = ""
            else:
                w += c
        yield w

# Time:  O(n)
# Space: O(n)
class Solution2(object):
    def wordPattern(self, pattern, str):
        """
        :type pattern: str
        :type str: str
        :rtype: bool
        """
        words = str.split() #Space O(n)
        if len(pattern) != len(words):
            return False

        w2p, p2w = {}, {}
        for p, w in izip(pattern, words):
            if w not in w2p and p not in p2w:
                # Build mapping. Space: O(c)
                w2p[w] = p
                p2w[p] = w
            elif w not in w2p or w2p[w] != p:
                 # Contradict mapping.
                return False
        return True

class TestMethods(unittest.TestCase):
    def test_Local(self):
        self.assertEqual(1, 1)

if __name__ == '__main__':
    unittest.main()

Java = '''
# Thought:
#
# 1ms 99.02%
class Solution {
    public boolean wordPattern(String pattern, String str) {
        String[] strs = str.split(" ");
        if (pattern.length() != strs.length) {
            return false;
        }
        String[] mapping = new String[26];
        Set<String> set = new HashSet<>();
        for (int i = 0; i < pattern.length(); i++) {
            int index = pattern.charAt(i) - 'a';
            if (mapping[index] == null) {
                if (set.contains(strs[i])) {
                    return false;
                }
                mapping[index] = strs[i];
                set.add(strs[i]);
            } else {
                if (!mapping[index].equals(strs[i])) {
                    return false;
                }
            }
        }
        return true;
    }
}

# 1ms 99.02%
class Solution {
    public boolean wordPattern(String pattern, String str) {
        String[] arr= str.split(" ");
        HashMap<Character, String> map = new HashMap<Character, String>();
        if(arr.length!= pattern.length())
            return false;
        for(int i=0; i<arr.length; i++){
            char c = pattern.charAt(i);
            if(map.containsKey(c)){
                if(!map.get(c).equals(arr[i]))
                    return false;
            }else{
                if(map.containsValue(arr[i]))
                    return false;
                map.put(c, arr[i]);
            }
        }
        return true;
    }
}

# 1ms 99.02%
class Solution {
    //pattern = "abba", str = "dog dog dog dog"
    public boolean wordPattern(String pattern, String str) {
        String[] arr = str.split(" ");
        if (pattern.length() != arr.length) return false;
        Map<Character, String> map = new HashMap<Character, String>();
        for (int i = 0; i< arr.length; i++) {
            char key = pattern.charAt(i);
            if (map.containsKey(key)) {
                if (!map.get(key).equals(arr[i])) return false;
            }else {
                if (map.containsValue(arr[i])) return false;
                map.put(key, arr[i]);
            }
        }
        return true;
    }
}
'''

redpajama_set_name: RedPajamaGithub


text:
function cleanURL(url) {
	if (url.indexOf("?") > -1) {
		url = url.slice(0, url.indexOf("?"));
	}

	return url;
}

// delete element if it exists
function tryDelete(selector) {
	var $delete_this = $(selector);
	if ($delete_this.length) {
		$delete_this.remove();
	}
}

function hideAllEpisodes() {
	$("#sidebar ul li").each(function(id, li){
		resetSearchResults(li);
		$(li).hide();
	});
}

function showAllEpisodes() {
	$("#sidebar ul li").each(function(id, li){
		resetSearchResults(li);
		$(li).show();
	});
}

// reset search results
function resetSearchResults(li) {
	$(li).removeAttr("data-begin");
	$(li).show();

	$(li).children().slice(1).remove();

	tryDelete(".search-result");
}

// get variables from URL
function getQueryVariable(variable, query_url) {
	query_url = typeof query_url !== 'undefined' ? query_url : window.location;

	var query_link = document.createElement("a");
	query_link.href = query_url;
	var query = query_link.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if(pair[0] == variable){return pair[1];}
	}
	return(false);
}

// download data for new episode or use cache if possible
function loadContent(url, back_forward) {
	$("#loader").show();

	var search_timestamp = getQueryVariable("timestamp", url);

	if (cached_data.hasOwnProperty(url) == 1) {
		updateContent(cached_data[url], search_timestamp, back_forward);
	} else {
		$.ajax({
			url: domain + "content",
			dataType: "json",
			data: {id: cleanURL(url)},
			async: true,
			success: function(content) {
				if ($.parseJSON(content.Cache) === true) {
					cached_data[url] = content;
				}

				updateContent(content, search_timestamp, back_forward);
			},
			error: function(xhr, textStatus, error) {
				window.location.href = url;
			}
		});
	}
}

// replace old episode data with current episode data
function updateContent(episode_data, search_timestamp, back_forward) {
	// get current episode
	var $current_episode = $("[data-episode='" + episode_data.Identifier + "']");

	// update video
	if (search_timestamp) {
		player.loadVideoById(episode_data.YouTube, search_timestamp);
	} else {
		player.cueVideoById(episode_data.YouTube);
	}

	// change header
	$("#container h2").text(site_name + " #" + episode_data.Number);

	// update current episode
	$("nav ul").attr("data-current", episode_data.Identifier);

	// change date published
	var $published_time = $(".published time");
	$published_time.attr("datetime", episode_data.DateTime);
	$published_time.text(episode_data.Date);

	// change author name if timestamp is available
	tryDelete(".author");
	if (((episode_data.Timeline).hasOwnProperty("Author") == 1) && (episode_data.Timeline.Author.Name !== "")) {
		var $link = $("", {"class": "author", "title": "Timeline Author", "href": episode_data.Timeline.Author.Link});
		$link.append($("", {"class": "icon-user"}));
		$link.append($("").text(episode_data.Timeline.Author.Name));
		$(".info").append($link);
	}

	// get comment count if possible
	tryDelete(".comments");
	if (episode_data.Reddit !== "") {
		var $comments_link = $("", {"class": "comments", "title": "Discussion Comments", "href": "http://www.reddit.com/comments/" + episode_data.Reddit});
		var $icon = $("", {"class": "icon-comments"});
		var $comment_text = $("", {"data-reddit": episode_data.Reddit});
		$comment_text.text("Comments");

		$comments_link.append($icon);
		$comments_link.append($comment_text);

		$(".published").after($comments_link);

		setCommentCount($comment_text, episode_data.Reddit);
	}

	// update horizontal timeline if possible
	tryDelete("#timeline-horizontal");
	if ((episode_data.Timeline).hasOwnProperty("Timestamps") == 1) {
		var $timeline_horizontal = $("
", {"id": "timeline-horizontal", "class": "section"});
		$timeline_horizontal.append($("
").addClass("section-header").text("Timeline"));

		var $line = $("
", {"class": "timeline"});
		$.each(episode_data.Timeline.Timestamps, function(timestamp_id, timestamp_data) {
			var $timelink = $("", {"class": "timelink", "href": episode_data.Link + "?timestamp=" + timestamp_data.Begin, "data-begin": timestamp_data.Begin, "data-end": timestamp_data.End});
			var $topic = $("
", {"class": "topic"}).css({"width": timestamp_data.Width + "%"});
			var $tooltip = $("
", {"class": "tooltip", "id": timestamp_id});
			if (timestamp_data.Begin > (episode_data.YouTubeLength / 2)) {
				$tooltip.addClass("right");
			}
			var $triangle = $("
", {"class": "triangle"});
			var $span = $("").text(timestamp_data.Value);
			$tooltip.append($triangle);
			$tooltip.append($span);
			$topic.append($tooltip);
			$timelink.append($topic);
			$line.append($timelink);
		});

		$timeline_horizontal.append($line);

		$("#timeline-clear").after($timeline_horizontal);
	}

	// update timestamp table if possible
	tryDelete("#timeline-vertical");
	if ((episode_data.Timeline).hasOwnProperty("Timestamps") == 1) {
		var $timeline_vertical = $("
", {"id": "timeline-vertical", "class": "section"});
		var $thead = $("
");
		var $head_row = $("
");
		var $time_column = $("").text("Time");
		var $event_column = $("").text("Event");
		$head_row.append($time_column);
		$head_row.append($event_column);
		$thead.append($head_row);
		$timeline_vertical.append($thead);

		var $tbody = $("
");
		$.each(episode_data.Timeline.Timestamps, function(timestamp_id, timestamp_data) {
			var $body_row = $("
");
			var $timestamp = $("", {"class": "timestamp"});
			var $timelink = $("", {"class": "timelink", "href": episode_data.Link + "?timestamp=" + timestamp_data.Begin, "data-begin": timestamp_data.Begin, "data-end": timestamp_data.End}).text(timestamp_data.HMS);
			var $event = $("", {"class": "event"});
			if (timestamp_data.URL !== "") {
				$event.append($("", {"target": "_blank", "href": timestamp_data.URL}).text(timestamp_data.Value));
			} else {
				$event.text(timestamp_data.Value);
			}
			$timestamp.append($timelink);
			$body_row.append($timestamp);
			$body_row.append($event);
			$tbody.append($body_row);
		});

		$timeline_vertical.append($tbody);

		$("#footer-links").before($timeline_vertical);
	}

	// update active episode on the sidebar
	$("nav li").removeAttr("id");
	$current_episode.attr("id", "active");

	// update hosts box
	$("#video").after(generatePeople("hosts", "Hosts", episode_data.People));

	// update guests box
	$("#hosts").after(generatePeople("guests", "Guests", episode_data.People));

	// update sponsors box
	$("#timeline-clear").before(generatePeople("sponsors", "Sponsors", episode_data.People));

	// close sidebar if open
	var $sidebar = $(".sidebar");
	if ($sidebar.hasClass("toggled")) {
		$sidebar.removeClass("toggled");
	}

	// add page to history and update page title
	document.title = "Episode #" + episode_data.Number + " \u00B7 " + site_name;

	if (!back_forward) {
		if (search_timestamp) {
			history.pushState(null, null, episode_data.Link + "?timestamp=" + search_timestamp);
		} else {
			history.pushState(null, null, episode_data.Link);
		}
	}

	// hide loader
	$("#loader").hide();
}

// fetch reddit comment count
function setCommentCount(element, reddit_id) {
	$.ajax({
		url: "http://www.reddit.com/comments/" + reddit_id + ".json",
		dataType: "json",
		async: true,
		success: function(data) {
			element.text(data[0].data.children[0].data.num_comments + " Comments");
		},
		error: function(xhr, textStatus, error) {
			element.text("Comments");
		}
	});
}

// generate people containers
function generatePeople(id, name, data) {
	tryDelete("#" + id);
	if (data.hasOwnProperty(name) == 1) {
		var $people = $("
", {"id": id, "class": "section items"});
		var $header = $("
").addClass("section-header").text(name);

		$people.append($header);

		$.each(data[name], function(person_id, person_data) {
			$people.append(generatePerson(person_data.ID, person_data.Name, person_data.URL));
		});

		return $people;
	}
}

// generate person image
function generatePerson(id, name, url) {
	var $link = $("", {"class": "item", "target": "_blank", "href": domain + "person/" + id, title: name});
	var $avatar = $("", {"class": "person-image", "alt": name, "src": domain + "img/people/" + id + ".png"});

	$link.append($avatar);

	return $link;
}

// load YT player
var player;
function onYouTubePlayerAPIReady() {
	player = new YT.Player("player", {
		events: {
			"onReady": onPlayerReady,
			"onStateChange": onPlayerStateChange
		}
	});
}

// setup pushState, handle search, and seek to timestamp
var cached_data = [];
function onPlayerReady() {
	// handle search query
	var search_query = getQueryVariable("query");
	if (search_query) {
		$("#search-field").val(search_query).trigger("input");
	}

	// seek to timestamp
	var search_timestamp = getQueryVariable("timestamp");
	if (search_timestamp) {
		// track in analytics
		if (typeof _gaq !== "undefined") {
			_gaq.push(["_trackEvent", "Timeline", "Seek", $("nav ul").attr("data-current"), parseInt(search_timestamp, 10)]);
		}
	}

	if ($("body").attr("data-type") == "episode") {
		var first_load = true;

		// check if pushState is available
		if (!!(window.history && history.pushState)) {
			// episode click interceptor
			$(document).on("click", "nav a", function(e) {
				// cancel navigation
				e.preventDefault();

				href = $(this).attr("href");

				// track page view
				if (typeof _gaq !== "undefined") {
					_gaq.push(["_trackPageview", "/" + href.replace(domain, "")]);
				}

				loadContent(href, false);

				// change the fact that this is not the original page load
				first_load = false;
			});

			// add popstate listener to catch back and forward navigation
			window.addEventListener("popstate", function() {
				// only do something if it's not the first page load
				if (!first_load) {
					loadContent(location.href, true);
				}
			});
		}
	}
}

// toggle timestamp checker
function onPlayerStateChange() {
	if (player.getPlayerState() === 1) {
		time_updater = setInterval(updateTime, 1000);
	} else {
		time_updater = null;
	}
}

// repeatedly check timestamp
var video_time = 0;
var time_updater = null;
function updateTime() {
	var old_time = video_time;
	if (player && player.getCurrentTime) {
		video_time = player.getCurrentTime();
	}
	if (video_time !== old_time) {
		onProgress(video_time);
	}
}

// highlight active timestamp
function onProgress(currentTime) {
	$(".timelink").each(function(timelink_id, timelink){
		if ((currentTime > $(timelink).attr("data-begin")) && (currentTime < $(timelink).attr("data-end"))) {
			if ($(timelink).parent().prop("tagName").toLowerCase() == "td") {
				$(timelink).parent().parent().addClass("active-timestamp-vertical");
			} else {
				$(timelink).children(":first").addClass("active-timestamp-horizontal");
			}
		} else {
			if ($(timelink).parent().prop("tagName").toLowerCase() == "td") {
				$(timelink).parent().parent().removeClass("active-timestamp-vertical");
			} else {
				$(timelink).children(":first").removeClass("active-timestamp-horizontal");
			}
		}
	});
}

$(document).ready(function() {
	// add YT script tag
	var tag = document.createElement("script");
	var firstScriptTag = document.getElementsByTagName("script")[0];
	tag.src = "https://www.youtube.com/player_api";
	firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

	// scroll to active episode
	if (document.getElementById("active")) {
		$("#sidebar").animate({scrollTop:$("#active").position().top},1000);
	}

	// load comment count on load
	if (document.getElementById("comments")) {
		setCommentCount($("#comments"), document.getElementById("comments").getAttribute("data-reddit"));
	}

	// collapsible sidebar
	$(".toggle-menu").click(function(e){
		e.preventDefault();
		$(".sidebar").toggleClass("toggled");
	});

	// capture timestamp click events
	$(document).on("click", "a.timelink", function() {
		// seek to timestamp
		player.seekTo($(this).attr("data-begin"));
		document.getElementsByTagName("header")[0].scrollIntoView();

		// add URL to history
		history.pushState(null, null, window.location.protocol + "//" + window.location.hostname + window.location.pathname + "?timestamp=" + $(this).attr("data-begin"));

		// track in analytics
		if (typeof _gaq !== "undefined") {
			_gaq.push(["_trackEvent", "Timeline", "Seek", $("nav ul").attr("data-current"), parseInt($(this).attr("data-begin"), 10)]);
		}

		return false;
	});

	// live search
	var search_timer;
	var previous_search;
	$("#search-field").on("propertychange input", function() {
		clearTimeout(search_timer);
		var search_value = this.value;

		search_timer = setTimeout(function() {
			if ($.trim(search_value) !== "") {
				if (previous_search != search_value) {
					// track search in analytics
					if (typeof _gaq !== "undefined") {
						_gaq.push(["_trackEvent", "Search", "Search", search_value]);
					}

					$("#search-error").hide();

					$.ajax({
						url: domain + "search",
						dataType: "json",
						data: {"query": search_value},
						async: true,
						success: function(results_json) {
							previous_search = search_value;

							// hide all episodes
							hideAllEpisodes();

							if (!jQuery.isEmptyObject(results_json)) {
								$.each(results_json, function(episode_identifier, episode_timestamps) {
									// show only returned episodes
									var $episode = $("li[data-episode='" + episode_identifier + "']");

									$.each(episode_timestamps, function(timestamp_id, episode_timestamp) {
										var $result_link = $episode.children(":first");

										var $search_result = $("").attr("href", "#");
										$search_result.attr("data-begin", episode_timestamp.Timestamp);
										$search_result.attr("href", $result_link.attr("href") + "?timestamp=" + episode_timestamp.Timestamp);

										var $search_text = $("").addClass("search-result").attr("title", episode_timestamp.Value).html("" + episode_timestamp.HMS + " - " + episode_timestamp.Value + "");
										$search_result.append($search_text);

										$episode.append($search_result);
									});

									$episode.show();
								});
							}
						},
						error: function(xhr, textStatus, error) {
							$("#search-error").show();
							hideAllEpisodes();
						}
					});
				}
			} else {
				// reset episode list
				previous_search = "";

				$("#search-error").hide();
				showAllEpisodes();
			}
		}, 200);
	});
});


text: Sample app for Material in 30 minutes talk


text:
const DrawCard = require('../../drawcard.js');

class AeronDamphair extends DrawCard {

    setupCardAbilities() {
        this.reaction({
            when: {
                onCardSaved: event => event.card.getType() === 'character'
            },
            handler: context => {
                let card = context.event.card;
                if(card.kneeled) {
                    card.controller.standCard(card);
                    this.game.addMessage('{0} uses {1} to stand {2}', this.controller, this, card);
                } else {
                    card.controller.kneelCard(card);
                    this.game.addMessage('{0} uses {1} to kneel {2}', this.controller, this, card);
                }
            }
        });
    }

}

AeronDamphair.code = '04071';

module.exports = AeronDamphair;


text:
.comment a.user:hover, .comment .user.hoverlink {
  font-weight: bold;
}


text:
package com.clarifi.reporting.ermine

import Document._
import scalaz.{ Order, Ordering }
import scalaz.Scalaz._

/** a Loc is an abstract possibly built-in location
  *
  * @author EAK
  */

sealed abstract class Loc extends Located {
  def loc = this
  def orElse(l: Loc): Loc
  def unifiedWith(l: Loc): Loc = orElse(l)
  def inferred: Loc = this // inferred from something at this location, not at this location
  def instantiatedBy(l: Loc): Loc = orElse(l) // instantated from an Annot or a Forall at l
  def checked: Loc = this // implied by checking the current location
  def generalized: Loc = this
}

object Loc {
  implicit def relocatableLoc: Relocatable[Loc] = new Relocatable[Loc] {
    def setLoc(old: Loc, loc: Loc) = loc
  }
  object builtin extends Loc {
    override def report(msg: Document, rest: Document*) = vsep(msg :: rest.toList)
    def orElse(l: Loc) = l
    override def toString = "-"
    override def msg(s: String) = s + " (builtin)"
  }
  def locOrder: Order[Loc] = Order.order((a, b) => (a, b) match {
    case (`builtin`, `builtin`) => Ordering.EQ
    case (`builtin`, _) => Ordering.LT
    case (_, `builtin`) => Ordering.GT
    case (a: Pos, b: Pos) => a ?|? b
    case (Inferred(a), Inferred(b)) => a ?|? b
    case (a: Pos, Inferred(b)) => (a ?|? b) |+| Ordering.LT
    case (Inferred(a), b: Pos) => (a ?|? b) |+| Ordering.GT
  })
}

case class Inferred(p: Pos) extends Loc {
  override def report(msg: Document, rest: Document*): Document = p.report(msg :+: "inferred from", rest :_*)
  override def toString = "inferred from " + p.toString
  override def orElse(l : Loc) = l match {
    case p : Pos => p
    case _       => this
  }
}

/** A Pos is a location that actually occurs in a source file. */
case class Pos(fileName: String, current: String, line: Int, column: Int, ending: Boolean) extends Loc {
  /** new Pos("foo.e", contents) -- will construct a position that points to the start of a file with the given contents */
  def bump(c: Char, i: String, o: Int) =
    if   (c == '\n') {
      val ix = i.indexOf('\n', o)
      if (ix == -1) Pos(fileName, i substring o, line + 1, 1, true)
      else Pos(fileName, i.substring(o, ix), line + 1, 1, false)
    }
    else if (c == '\t') Pos(fileName, current, line, column + (8 - column % 8), ending)
    else Pos(fileName, current, line, column + 1, ending)

  override def report(msg: Document, rest: Document*): Document = vsep(
    (fileName :: ":" :: line.toString :: ":" :: column.toString :: ":" :+: msg) ::
    (current :: text(if (ending) "<EOF>" else "")) ::
    ((" " * (column - 1)) :: text("^")) ::
    rest.toList
  )

  override def inferred: Loc = Inferred(this)

  override def toString = fileName + "(" + line + ":" + column + ")" // report("position").toString
  override def hashCode = (fileName, line, column).hashCode
  override def equals(a: Any) = a match {
    case Pos(ofileName, _, oline, ocolumn, oending) => fileName == ofileName && line == oline && column == ocolumn && ending == oending
    case _ => false
  }
  override def msg(s: String): String = s + " at " + fileName + ":" + line + ":" + column
  def orElse(l: Loc) = this
}

object Pos {
  def start(fileName: String, contents: String) = {
    val current = contents.takeWhile(_ != '\n')
    Pos(fileName, current, 1, 1, current.length == contents.length)
  }
  implicit def posOrder: Order[Pos] = new Order[Pos] {
    def order(p: Pos, q: Pos): Ordering = (p.fileName ?|? q.fileName) |+| (p.line ?|? q.line) |+| (p.column ?|? q.column)
  }
}

/** Located types know how to transform errors to give better location information */

trait Located {
  def loc: Loc
  def report(msg: Document, rest: Document*): Document = loc.report(msg, rest:_*)
  def die(msg: Document, rest: Document*): Nothing = throw Death(loc.report(msg, rest:_*))
  def error(msg: Document, rest: Document*): Nothing = sys.error(loc.report(msg, rest:_*).toString)
  def msg(s: String): String = loc.msg(s)
}

/** A relocatable instance for a Locatable type knows how to change its current location */
abstract class Relocatable[T <: Located] {
  def setLoc(t: T, loc: Loc): T
}

object Relocatable {
  def preserveLoc[A <: Located, B<:Located:Relocatable](sub: Map[A,B]): PartialFunction[A,B] = {
    case x if sub.contains(x) => setLoc(sub(x),x.loc)
  }
}


text:
require 'abid/dsl/job'

module Abid
  module DSL
    # Abid::DSL::Task wrapper
    class AbidJob < Job
      def_delegators :play, :worker
      def_delegator :play, :concerned, :concerned?
      def_delegator :play, :needed,    :needed?

      def initialize(task, params)
        super
        @play = task.internal.new(params)
        @play.call_action(:setup)
      end
      attr_reader :play
      private :play

      def execute(args)
        if dryrun?
          trace_execute
          return
        end
        play.call_action(:safe_action)
        play.call_action(:action, args) unless preview?
        run(args)
      ensure
        play.call_action(:after, $ERROR_INFO) unless dryrun? || preview?
      end

      def run(args)
        if play.method(:run).arity.zero?
          play.run
        else
          play.run(args)
        end
      end

      def prerequisites
        ps = task.prerequisite_tasks.map { |preq| [preq, params] } \
           + play.prerequisite_tasks

        ps.map do |preq, params|
          task.application.job_manager[preq.name, params]
        end
      end

      def volatile?
        play.volatile || task.application.options.disable_state
      end

      def trace_execute
        task.application.trace "** Execute (dry run) #{task.name}"
      end
      private :trace_execute
    end
  end
end


text:
{{ partial "header.html" . }}

    {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
    {{ range $paginator.Pages }}

{{ .Title }}

            on {{ .Date.Format "Mon, Jan 02, 2006" }} by {{ .Site.Author.name }} · {{ .ReadingTime }} min reading time

{{ .Summary }}

            {{ if .Truncated }}
 ... ...
 {{ end }}

        {{ if .Truncated }}
Read more →
{{ end }}

    {{ end }}
    {{ template "_internal/pagination.html" . }}

{{ partial "footer.html" . }}

{{ "" | safeHTML }}


text:
import argparse
import fnmatch
import os
import re
import sys

# List of CSS properties to be removed.
CSS_PROPERTIES_TO_REMOVE = [
  '-moz-appearance',
  '-moz-box-sizing',
  '-moz-flex-basis',
  '-moz-user-select',

  '-ms-align-content',
  '-ms-align-self',
  '-ms-flex',
  '-ms-flex-align',
  '-ms-flex-basis',
  '-ms-flex-line-pack',
  '-ms-flexbox',
  '-ms-flex-direction',
  '-ms-flex-pack',
  '-ms-flex-wrap',
  '-ms-inline-flexbox',
  '-ms-user-select',

  '-webkit-align-content',
  '-webkit-align-items',
  '-webkit-align-self',
  '-webkit-animation',
  '-webkit-animation-duration',
  '-webkit-animation-iteration-count',
  '-webkit-animation-name',
  '-webkit-animation-timing-function',
  '-webkit-flex',
  '-webkit-flex-basis',
  '-webkit-flex-direction',
  '-webkit-flex-wrap',
  '-webkit-inline-flex',
  '-webkit-justify-content',
  '-webkit-transform',
  '-webkit-transform-origin',
  '-webkit-transition',
  '-webkit-transition-delay',
  '-webkit-transition-property',
  '-webkit-user-select',
]

# Regex to detect a CSS line of interest (helps avoiding edge cases, like
# removing the 1st line of a multi-line CSS rule).
CSS_LINE_REGEX = '^\s*[^;\s]+:\s*[^;]+;\s*(/\*.+/*/)*\s*$';

def ProcessFile(filename):
  # Gather indices of lines to be removed.
  indices_to_remove = [];
  with open(filename) as f:
    lines = f.readlines()
    for i, line in enumerate(lines):
      if ShouldRemoveLine(line):
        indices_to_remove.append(i)

  if len(indices_to_remove):
    print('stripping CSS from: ' + filename)

  # Process line numbers in descinding order, such that the array can be
  # modified in-place.
  indices_to_remove.reverse()
  for i in indices_to_remove:
    del lines[i]

  # Reconstruct file.
  with open(filename, 'w') as f:
    for l in lines:
      f.write(l)
  return

def ShouldRemoveLine(line):
  pred = lambda p: re.search(CSS_LINE_REGEX, line) and re.search(p, line)
  return any(pred(p) for p in CSS_PROPERTIES_TO_REMOVE)

def main(argv):
  parser = argparse.ArgumentParser('Strips CSS rules not needed by Chrome')
  parser.add_argument(
      '--file_extension', choices=['js', 'html'], required=True)
  opts = parser.parse_args(sys.argv[1:])

  files_to_process = [os.path.join(dirpath, f)
    for dirpath, dirnames, files in os.walk('components-chromium')
    for f in fnmatch.filter(files, '*.' + opts.file_extension)]

  for f in files_to_process:
    ProcessFile(f)

if __name__ == '__main__':
  main(sys.argv[1:])


text:
from ballast.compat import basestring

class BallastException(Exception):

    _DEFAULT_MSG = 'An unexpected error occurred'

    def __init__(self, msg=None, cause=None):

        assert msg is None or isinstance(msg, basestring)
        assert cause is None or isinstance(cause, BaseException)

        self.cause = cause

        message = msg
        if message is None and cause is not None:
            message = cause.message
        elif message is None and cause is None:
            message = self._DEFAULT_MSG

        super(BallastException, self).__init__(message)

class NoReachableServers(BallastException):

    _DEFAULT_MSG = 'No reachable servers found!'

class BallastConfigurationException(BallastException):
    pass


text:
/*
 *  THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN
 *  VAIN.
 *
 *  @generated
 */
#pragma once

#include <memory>
#include <string>
#include <unordered_map>
#include <vector>

#include <mcrouter/lib/CacheClientStats.h>
#include <mcrouter/lib/carbon/connection/ExternalCarbonConnectionImpl.h>
#include <mcrouter/lib/carbon/connection/InternalCarbonConnectionImpl.h>
#include <mcrouter/lib/carbon/connection/PooledCarbonConnectionImpl.h>

#include "mcrouter/lib/carbon/example/gen/HelloGoodbyeMessages.h"
#include "mcrouter/lib/carbon/example/gen/HelloGoodbyeRouterInfo.h"

namespace hellogoodbye {

class HelloGoodbyeConnection {
 public:
  using RouterInfo = HelloGoodbyeRouterInfo;

  virtual ~HelloGoodbyeConnection() = default;

  virtual void sendRequestOne(
      const GoodbyeRequest&,
      carbon::RequestCb<GoodbyeRequest>) = 0;
  virtual void sendRequestOne(
      const HelloRequest&,
      carbon::RequestCb<HelloRequest>) = 0;

  virtual void sendRequestMulti(
      std::vector<std::reference_wrapper<const GoodbyeRequest>>&&,
      carbon::RequestCb<GoodbyeRequest>) = 0;
  virtual void sendRequestMulti(
      std::vector<std::reference_wrapper<const HelloRequest>>&&,
      carbon::RequestCb<HelloRequest>) = 0;

  virtual facebook::memcache::CacheClientCounters getStatCounters() const noexcept = 0;
  virtual std::unordered_map<std::string, std::string> getConfigOptions() = 0;
  virtual bool healthCheck() = 0;
  virtual std::unique_ptr<HelloGoodbyeConnection> recreate() = 0;
};

template <class Impl>
class HelloGoodbyeConnectionImpl : public HelloGoodbyeConnection {
 public:
  template <class... Args>
  explicit HelloGoodbyeConnectionImpl(Args&&... args)
      : impl_(std::forward<Args>(args)...) {}

  ~HelloGoodbyeConnectionImpl() = default;

  facebook::memcache::CacheClientCounters getStatCounters() const noexcept {
    return impl_.getStatCounters();
  }

  std::unordered_map<std::string, std::string> getConfigOptions() {
    return impl_.getConfigOptions();
  }

  bool healthCheck() {
    return impl_.healthCheck();
  }

  std::unique_ptr<HelloGoodbyeConnection> recreate() {
    return impl_.template recreate<HelloGoodbyeConnectionImpl<Impl>>();
  }

  void sendRequestOne(
      const GoodbyeRequest& req,
      carbon::RequestCb<GoodbyeRequest> cb) {
    return impl_.sendRequestOne(req, std::move(cb));
  }
  void sendRequestOne(
      const HelloRequest& req,
      carbon::RequestCb<HelloRequest> cb) {
    return impl_.sendRequestOne(req, std::move(cb));
  }

  void sendRequestMulti(
      std::vector<std::reference_wrapper<const GoodbyeRequest>>&& reqs,
      carbon::RequestCb<GoodbyeRequest> cb) {
    return impl_.sendRequestMulti(std::move(reqs), std::move(cb));
  }
  void sendRequestMulti(
      std::vector<std::reference_wrapper<const HelloRequest>>&& reqs,
      carbon::RequestCb<HelloRequest> cb) {
    return impl_.sendRequestMulti(std::move(reqs), std::move(cb));
  }

 private:
  Impl impl_;
};

using HelloGoodbyePooledConnection =
    HelloGoodbyeConnectionImpl<carbon::PooledCarbonConnectionImpl<HelloGoodbyeConnection>>;
using HelloGoodbyeInternalConnection =
    HelloGoodbyeConnectionImpl<carbon::InternalCarbonConnectionImpl<HelloGoodbyeConnection>>;
using HelloGoodbyeExternalConnection =
    HelloGoodbyeConnectionImpl<carbon::ExternalCarbonConnectionImpl<HelloGoodbyeRouterInfo>>;
} // namespace hellogoodbye


text:
type: section
layout: blog
image: blog.jpg
title: blog
aliases: [/blog/]
url: "/blogue/"
---


text:
<?php

namespace AppBundle\Form;

use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class AnswerType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('text', TextareaType::class, [
                'label' => '',
                'attr' => [
                    'placeholder' => 'Write your answer...'
                ]
            ])
            ->add('priority', EntityType::class, [
                'placeholder' => 'Choose Priority',
                'class' => 'AppBundle\Entity\Priority',
                'query_builder' => function(EntityRepository $repository){
                    return $repository->createQueryBuilder('p')->orderBy('p.id', 'ASC');
                },
                'choice_label' => 'name',
                'choice_value' => 'id',
                'multiple' => false,
                'expanded' => true,
                'label' => 'Priority',
                'required' => false
            ]);
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'AppBundle\Entity\Answer'
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'appbundle_answer';
    }

}


text:
import * as React from 'react';
import { SelectUnstyled, MultiSelectUnstyled } from '@mui/base';

declare module '@mui/base' {
  interface SelectUnstyledComponentsPropsOverrides {
    variant?: 'one' | 'two';
  }

  interface MultiSelectUnstyledComponentsPropsOverrides {
    variant?: 'a' | 'b';
  }
}

<SelectUnstyled componentsProps={{ root: { variant: 'one' } }} />;

// @ts-expect-error unknown variant
<SelectUnstyled componentsProps={{ root: { variant: 'three' } }} />;

<MultiSelectUnstyled componentsProps={{ root: { variant: 'a' } }} />;

// @ts-expect-error unknown variant
<MultiSelectUnstyled componentsProps={{ root: { variant: 'c' } }} />;


text:
package com.antoni.freenozzle;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;

public class GasCombustionActivity extends ActionBarActivity implements AdapterView.OnItemSelectedListener {

    private int mRorMMchoose = 0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gas_combustion);

        final int mOperation = getIntent().getIntExtra(MainActivity.mOperation, 0);

        // UI Operations
        final Spinner mSpinner = (Spinner) findViewById(R.id.spinner);
        mSpinner.setOnItemSelectedListener(this);

        // Create an ArrayAdapter using the string array and a default spinner layout
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.rormm_array, android.R.layout.simple_spinner_item);
        // Specify the layout to use when the list of choices appears
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        // Apply the adapter to the spinner
        mSpinner.setAdapter(adapter);

        Button mButton = (Button) findViewById(R.id.button);
        final EditText mPressure = (EditText) findViewById(R.id.editText);
        final EditText mTemperature = (EditText) findViewById(R.id.editText2);
        final EditText mRorMM = (EditText) findViewById(R.id.editText3);
        final EditText mGamma = (EditText) findViewById(R.id.editText4);

        mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent;
                if (mOperation == 1) {
                    // Go to design
                    intent = new Intent(GasCombustionActivity.this, DesignActivity.class);
                }
                else {
                    // Go to study
                    intent = new Intent(GasCombustionActivity.this, StudyActivity.class);
                }
                // Put all needed variables in Intent
                intent.putExtra("P0", Double.parseDouble(mPressure.getText().toString()));
                intent.putExtra("T0", Double.parseDouble(mTemperature.getText().toString()));
                double r = 0.0;
                if (mRorMMchoose == 0) {
                    r = Double.parseDouble(mRorMM.getText().toString());
                }
                else if (mRorMMchoose == 1) {
                    r = 8.314/Double.parseDouble(mRorMM.getText().toString())*1000.0;
                }
                intent.putExtra("r", r);
                intent.putExtra("gamma", Double.parseDouble(mGamma.getText().toString()));
                startActivity(intent);
            }
        });
    }

    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        // An item was selected. You can retrieve the selected item using
        String s = (String) parent.getItemAtPosition(pos);
        if (s.equals("r (J/(kg*K))")) {
            mRorMMchoose = 0;
        }
        else if (s.equals("MM (g/mol)")) {
            mRorMMchoose = 1;
        }
    }

    public void onNothingSelected(AdapterView<?> parent) {
        // Another interface callback
    }
}


text:
class TeleopShibaDemo
{
public:
    TeleopShibaDemo();

private:
    void joyCallback(const sensor_msgs::Joy::ConstPtr& joy);

    ros::NodeHandle nh_;

    int linear_, angular_;
    double l_scale_, a_scale_;
    ros::Publisher vel_pub_;
    ros::Subscriber joy_sub_;
};

TeleopShibaDemo::TeleopShibaDemo():
    linear_(1),
    angular_(2)
{

    nh_.param("axis_linear", linear_, linear_);
    nh_.param("axis_angular", angular_, angular_);
    nh_.param("scale_angular", a_scale_, a_scale_);
    nh_.param("scale_linear", l_scale_, l_scale_);

    vel_pub_ = nh_.advertise<turtlesim::Velocity>("turtle1/command_velocity", 1);

    joy_sub_= nh_.subscribe<sensor_msgs::Joy>("joy", 10, &TeleopShibaDemo::joyCallback, this);

}

void TeleopShibaDemo::joyCallback(const sensor_msgs::Joy::ConstPtr &joy) {
    turtlesim::Velocity vel;
    vel.angular = a_scale_*joy->axes[angular_];
    vel.linear = l_scale_*joy->axes[linear_];
    vel_pub_.publish(vel);
}

int main(int argc, char** argv)
{
    ros::init(argc, argv, "shiba_teleop_demo");
    TeleopShibaDemo shiba_teleop_demo;

    ros::spin();
}


text:
ALCHEMY_STRUCT(base_format_t,
  ALCHEMY_DATUM (uint32_t,                 word_0),
  ALCHEMY_DATUM (uint32_t,                 word_1),
  ALCHEMY_DATUM (uint32_t,                 word_2),
  ALCHEMY_DATUM (uint8_t,                  val),
  ALCHEMY_DATUM (nested_format_t,          nested),
  ALCHEMY_ARRAY (uint32_t, 3,              sequence)
);

namespace Hg
{

typedef base_format_t    message_type;

} // namespace Hg

//  ****************************************************************************
/// @brief TestMessageSuite Test Suite class.
///
class TestMessageSuite : public CxxTest::TestSuite
  , HgTestHelper<Hg::base_format_t::format_type, Hg::BufferedStoragePolicy >
{
public:

  TestMessageSuite()
  { }

  // Fixture Management ********************************************************
  // setUp will be called before each test case in order to setup common fixtures.
  virtual void setUp()
  { }

  // tearDown will be called after each test case to clean up common resources.
  virtual void tearDown()
  { }

protected:
  //  Constants ******************************************************************
  static const uint32_t  k_word_0               = 0xDEADC0DE;
  static const uint32_t  k_other_word_0         = 0xDEC0ADDE;
  static const uint32_t  k_word_1               = 0x12345678;
  static const uint32_t  k_other_word_1         = 0x78563412;
  static const uint32_t  k_word_2               = 0xABCDEF00;
  static const uint32_t  k_other_word_2         = 0x00EFCDAB;
  static const uint8_t   k_byte                 = 0xB1;
  static const uint32_t  k_bits_value           = 0x0DEC0DED;
  static const uint32_t  k_other_bits_value     = 0xED0DEC0D;

  static const uint32_t  k_bits_0               = 0xCC;       // 5  bits
  static const uint32_t  k_bits_1               = 0xA;        // 4  bits
  static const uint32_t  k_bits_2               = 0x7;        // 3  bits
  static const uint32_t  k_bits_3               = 0x6;        // 2  bits
  static const uint32_t  k_bits_4               = 0x1;        // 1  bit
  static const uint32_t  k_bits_5               = 0x1234;     // 16 bits
  static const uint32_t  k_bits_6               = 0x3;        // 1  bit;

  static const uint8_t   k_zero                 = 0xA7;
  static const uint16_t  k_one                  = 0xCE11;
  static const uint16_t  k_other_one            = 0x11CE;
  static const uint32_t  k_three                = 0x00112233;
  static const uint32_t  k_other_three          = 0x33221100;
  static const int16_t   k_four                 = int16_t(0xF00D);
  static const int16_t   k_other_four           = 0x0DF0;

  static const size_t    k_seq_0                = 0xFEE1600D;
  static const size_t    k_seq_1                = 0x0FEE1BAD;
  static const size_t    k_seq_2                = 0x0FEE101D;

  static const size_t    k_other_seq_0          = 0x0D60E1FE;
  static const size_t    k_other_seq_1          = 0xAD1BEE0F;
  static const size_t    k_other_seq_2          = 0x1D10EE0F;

  //  Typedefs *****************************************************************
  //  These typedefs allow the creation of the different msg field types
  //  with a simplified syntax for readability in the unit-tests.
  typedef Hg::BufferedStoragePolicy                              storage_type;
  typedef Hg::message_type                                       msg_type;
  typedef Hg::basic_msg<msg_type>::host_t                        SUT;
  typedef Hg::basic_msg<msg_type>::net_t                         SUT_net;
  typedef Hg::basic_msg<msg_type>::big_t                         SUT_big;
  typedef Hg::basic_msg<msg_type>::little_t                      SUT_little;

  typedef storage_type::data_type                                data_type;
  typedef storage_type::s_pointer                                s_pointer;

  // Helper Functions ************************************************************
  //  ****************************************************************************
  template <typename SUT_t>
  void PopulateBaseValues(SUT_t& msg)
  {
    msg.word_0       = k_word_0;
    msg.word_1       = k_word_1;
    msg.word_2       = k_word_2;
    msg.val          = k_byte;
    msg.nested.zero  = k_zero;
    msg.nested.one   = k_one;
    msg.nested.two   = k_bits_value;
    msg.nested.three = k_three;
    msg.nested.four  = k_four;

    msg.sequence[0]  = k_seq_0;
    msg.sequence[1]  = k_seq_1;
    msg.sequence[2]  = k_seq_2;
  }

  //  ****************************************************************************
  template <typename SUT_t>
  void PopulateOtherValues(SUT_t& msg)
  {
    msg.word_0       = k_other_word_0;
    msg.word_1       = k_other_word_1;
    msg.word_2       = k_other_word_2;
    msg.val          = k_byte;
    msg.nested.zero  = k_zero;
    msg.nested.one   = k_other_one;
    msg.nested.two   = k_other_bits_value;
    msg.nested.three = k_other_three;
    msg.nested.four  = k_other_four;

    msg.sequence[0]  = k_other_seq_0;
    msg.sequence[1]  = k_other_seq_1;
    msg.sequence[2]  = k_other_seq_2;
  }

public:
  // Test Cases ****************************************************************
  void TestHasDynamic_false();
  void TestDefaultCtor();
  void TestCopyCtor();
  void TestValueCtor();
  void TestAssignmentOperator();
  void Testempty();
  void Testempty_false();
  void TestSize();
  void Testis_host_order();
  void Testis_host_order_false();
  void TestAssign();
  void TestClear();
  void Testdata();

  // Special cases
  void TestSingleFieldMsg_Basic();
  void TestSingleFieldMsg_Nested();
  void TestSingleFieldMsg_Bitlist();

  //  Worker Functions *********************************************************
  void Testto_host();
  void Testto_network();
  void Testto_big_endian();
  void Testto_little_endian();
};

//  ****************************************************************************
void TestMessageSuite::TestHasDynamic_false()
{
  // SUT
  bool result = Hg::has_dynamic<msg_type::format_type>::value;

  // The msg buffer should not exist.
  TS_ASSERT(!result);
}

//  ****************************************************************************
void TestMessageSuite::TestDefaultCtor()
{
  // SUT
  SUT sut;

  // The msg buffer should not exist.
  TS_ASSERT(sut.empty());
}

//  ****************************************************************************
void TestMessageSuite::TestCopyCtor()
{
  SUT                 rhs;
  PopulateBaseValues (rhs);

  // SUT
  SUT sut(rhs);
  TS_ASSERT_SAME_DATA(rhs.data(), sut.data(), (unsigned int)sut.size());
}

//  ****************************************************************************
void TestMessageSuite::TestValueCtor()
{
  SUT                 rhs;
  PopulateBaseValues (rhs);
  // SUT
  SUT sut(rhs.data(), rhs.size());
  TS_ASSERT_SAME_DATA(rhs.data(), sut.data(), (unsigned int)sut.size());
}

//  ****************************************************************************
void TestMessageSuite::TestAssignmentOperator()
{
  SUT                rhs;
  PopulateBaseValues(rhs);

  // SUT
  SUT sut;
  sut = rhs;
  TS_ASSERT_SAME_DATA(rhs.data(), sut.data(), (unsigned int)sut.size());
}

//  ****************************************************************************
void TestMessageSuite::Testempty()
{
  // SUT
  SUT sut;
  TS_ASSERT(sut.empty());
}

//  ****************************************************************************
void TestMessageSuite::Testempty_false()
{
  // SUT
  SUT sut(get_buffer().get(), get_length());
  TS_ASSERT(!sut.empty());
}

//  ****************************************************************************
void TestMessageSuite::TestSize()
{
  // SUT
  SUT sut(get_buffer().get(), Hg::size_of<SUT::format_type>::value);
  TS_ASSERT_EQUALS(Hg::size_of<SUT::format_type>::value, sut.size());
}

//  ****************************************************************************
void TestMessageSuite::Testis_host_order()
{
  // SUT: Host order is defined within the type itself.
  //      Look at the typedef for details
  SUT sut;
  TS_ASSERT(sut.is_host_order());
}

//  ****************************************************************************
void TestMessageSuite::Testis_host_order_false()
{
  // SUT: Net order is defined within the type itself.
  //      Look at the typedef for details
  SUT_net sut;
  TS_ASSERT(!sut.is_host_order());
}

//  ****************************************************************************
void TestMessageSuite::TestAssign()
{
  SUT expected;
  PopulateBaseValues(expected);

  // SUT
  SUT sut;
  sut.assign(expected.data(), expected.size());

  // Verify the contents held in the input buffer were properly assigned to the msg.
  TS_ASSERT_EQUALS(expected.size(), sut.size());
  TS_ASSERT_SAME_DATA(expected.data(), sut.data(), (unsigned int)sut.size());
}

//  ****************************************************************************
void TestMessageSuite::TestClear()
{
  SUT sut(get_buffer().get(), get_length());
  TS_ASSERT(!sut.empty());

  // SUT
  sut.clear();

  TS_ASSERT(sut.empty());
}

//  ****************************************************************************
void TestMessageSuite::Testdata()
{
  // TODO: Add code to test that values are set to the interface, and can be read out of the data call.

  //SUT sut;
  //s_pointer spBuffer = get_buffer();
  //TS_ASSERT(sut.empty());

  //// SUT
  //SUT::buffer_type buffer = sut.buffer();
  //TS_ASSERT(buffer.empty());

  //// SUT
  //sut.assign(spBuffer.get(), 0);
  //buffer = sut.buffer();
  //TS_ASSERT(!buffer.empty());
  //TS_ASSERT_EQUALS(spBuffer, buffer.buffer());
}

//  ****************************************************************************
void TestMessageSuite::TestSingleFieldMsg_Basic()
{
  typedef Hg::single_t SingleMsg;

  SingleMsg sut;
  sut.only = 1001;

  TS_ASSERT_EQUALS(1001, sut.only);
}

//  ****************************************************************************
void TestMessageSuite::TestSingleFieldMsg_Nested()
{
  typedef Hg::single_nested_t SingleMsg;

  SingleMsg sut;
  sut.only.zero = 255;

  TS_ASSERT_EQUALS(255, sut.only.zero);
}

//  ****************************************************************************
void TestMessageSuite::TestSingleFieldMsg_Bitlist()
{
  typedef Hg::single_bit_t SingleMsg;

  SingleMsg sut;
  sut.only.lonely = 3;

  TS_ASSERT_EQUALS(1, (int)sut.only.lonely);
}

//  ****************************************************************************
void TestMessageSuite::Testto_host()
{
  // Populate the expected results.
  SUT_net expected;
  PopulateOtherValues(expected);

  // Perform two instances of this test.
  // 1) with data that requires a conversion.
  // 2) with data that does not require a conversion
  SUT_net sut;
  PopulateBaseValues(sut);

  SUT no_op_sut;
  PopulateOtherValues(no_op_sut);

  // SUT
  SUT result = to_host(sut);
  SUT no_op_result = to_host(no_op_sut);

  TS_ASSERT_SAME_DATA(expected.data(), result.data(), (unsigned int)sut.size());
  TS_ASSERT_SAME_DATA(expected.data(), no_op_result.data(), (unsigned int)no_op_sut.size());
}

//  ****************************************************************************
void TestMessageSuite::Testto_network()
{
  // Populate the expected results.
  SUT expected;
  PopulateOtherValues(expected);

  // Perform two instances of this test.
  // 1) with data that requires a conversion.
  // 2) with data that does not require a conversion
  SUT sut;
  PopulateBaseValues(sut);

  SUT_net no_op_sut;
  PopulateOtherValues(no_op_sut);

  // SUT
  SUT_net result = to_network(sut);
  SUT_net no_op_result = to_network(no_op_sut);

  TS_ASSERT_SAME_DATA(expected.data(), result.data(), (unsigned int)sut.size());
  TS_ASSERT_SAME_DATA(expected.data(), no_op_result.data(), (unsigned int)no_op_sut.size());
}

//  ****************************************************************************
void TestMessageSuite::Testto_big_endian()
{
  // Populate the expected results.
  SUT expected;
  PopulateOtherValues(expected);

  // Perform two instances of this test.
  // 1) with data that requires a conversion.
  // 2) with data that does not require a conversion
  SUT_little sut;
  PopulateBaseValues(sut);

  SUT_big no_op_sut;
  PopulateOtherValues(no_op_sut);

  // SUT
  SUT_big result = to_big_endian(sut);
  SUT_big no_op_result = to_big_endian(no_op_sut);

  TS_ASSERT_SAME_DATA(expected.data(), result.data(), (unsigned int)sut.size());
  TS_ASSERT_SAME_DATA(expected.data(), no_op_result.data(), (unsigned int)no_op_sut.size());
}

//  ****************************************************************************
void TestMessageSuite::Testto_little_endian()
{
  // Populate the expected results.
  SUT expected;
  PopulateOtherValues(expected);

  // Perform two instances of this test.
  // 1) with data that requires a conversion.
  // 2) with data that does not require a conversion
  SUT_big sut;
  PopulateBaseValues(sut);

  SUT_little no_op_sut;
  PopulateOtherValues(no_op_sut);

  // SUT
  SUT_little result        = to_little_endian(sut);
  SUT_little no_op_result  = to_little_endian(no_op_sut);

  TS_ASSERT_SAME_DATA(expected.data(), result.data(), (unsigned int)sut.size());
  TS_ASSERT_SAME_DATA(expected.data(), no_op_result.data(), (unsigned int)no_op_sut.size());
}

#endif


text:
class FBDemo : public QObject
{
    Q_OBJECT

public:
    explicit FBDemo(QObject *parent = 0);

signals:
    void extraTokensReady(const QVariantMap &extraTokens);
    void linkingFailed();
    void linkingSucceeded();

public slots:
    void doOAuth(O2::GrantFlow grantFlowType);
    void validateToken();

private slots:
    void onLinkedChanged();
    void onLinkingSucceeded();
    void onOpenBrowser(const QUrl &url);
    void onCloseBrowser();
    void onFinished();

private:
    O2Facebook *o2Facebook_;
};

#endif // FBDEMO_H


text:
package jtest.yaml.includeVars;

import static org.junit.Assert.*;

import org.junit.Test;

public class CheckIncludeVarsAndFilters {

	@Test
	public void test() {
		fail("Not yet implemented");
	}

}


text:
local module = require("hs.fs.internal")
return module


text:
#import <Foundation/Foundation.h>

#import "UAGlobal.h"

NS_ASSUME_NONNULL_BEGIN

/**
 * The UAConfig object provides an interface for passing common configurable values to [UAirship takeOff].
 * The simplest way to use this class is to add an AirshipConfig.plist file in your app's bundle and set
 * the desired options. The plist keys use the same names as the properties on this class. Older, all-caps
 * keys are still supported, but you should migrate your properties file to make use of a number of new options.
 */
@interface UAConfig : NSObject

///---------------------------------------------------------------------------------------
/// @name Resolved Values
///---------------------------------------------------------------------------------------

/**
 * The current app key (resolved using the inProduction flag).
 */
@property (nonatomic, readonly, nullable) NSString *appKey;

/**
 * The current app secret (resolved using the inProduction flag).
 */
@property (nonatomic, readonly, nullable) NSString *appSecret;

/**
 * The current log level for the library's UA_L<level> macros (resolved using the inProduction flag).
 */
@property (nonatomic, readonly) UALogLevel logLevel;

/**
 * The production status of this application. This may be set directly, or it may be determined
 * automatically if the detectProvisioningMode flag is set to `YES`.
 */
@property (nonatomic, assign, getter=isInProduction) BOOL inProduction;

/**
 * Toggles Urban Airship analytics. Defaults to `YES`. If set to `NO`, many UA features will not be
 * available to this application.
 */
@property (nonatomic, assign, getter=isAnalyticsEnabled) BOOL analyticsEnabled;

///---------------------------------------------------------------------------------------
/// @name Configuration Values
///---------------------------------------------------------------------------------------

/**
 * The development app key. This should match the application on go.urbanairship.com that is
 * configured with your development push certificate.
 */
@property (nonatomic, copy, nullable) NSString *developmentAppKey;

/**
 * The development app secret. This should match the application on go.urbanairship.com that is
 * configured with your development push certificate.
 */
@property (nonatomic, copy, nullable) NSString *developmentAppSecret;

/**
 * The production app key. This should match the application on go.urbanairship.com that is
 * configured with your production push certificate. This is used for App Store, Ad-Hoc and Enterprise
 * app configurations.
 */
@property (nonatomic, copy, nullable) NSString *productionAppKey;

/**
 * The production app secret. This should match the application on go.urbanairship.com that is
 * configured with your production push certificate. This is used for App Store, Ad-Hoc and Enterprise
 * app configurations.
 */
@property (nonatomic, copy, nullable) NSString *productionAppSecret;

/**
 * The log level used for development apps. Defaults to `UALogLevelDebug` (4).
 */
@property (nonatomic, assign) UALogLevel developmentLogLevel;

/**
 * The log level used for production apps. Defaults to `UALogLevelError` (1).
 */
@property (nonatomic, assign) UALogLevel productionLogLevel;

/**
 * The size in MB for the UA Disk Cache.  Defaults to 100.
 *
 * Only items that are small enough (1/20th of the size) of the cache will be
 * cached.
 *
 * Any size greater than 0 will cause the UA Disk Cache to become active.
 * UAURLProtocol will be registered as a NSURLProtocol.  Only requests whose
 * mainDocumentURL or URL that have been added as a cachable URL will be considered
 * for caching.  By defualt it includes all of the Rich Application Page URLs.
 *
 */
@property (nonatomic, assign) NSUInteger cacheDiskSizeInMB;

/**
 * If enabled, the UA library automatically registers for remote notifications when push is enabled
 * and intercepts incoming notifications in both the foreground and upon launch.
 *
 * Defaults to YES. If this is disabled, you will need to register for remote notifications
 * in application:didFinishLaunchingWithOptions: and forward all notification-related app delegate
 * calls to UAPush and UAInbox.
 */
@property (nonatomic, assign, getter=isAutomaticSetupEnabled) BOOL automaticSetupEnabled;

/**
 * An array of UAWhitelist entry strings.
 *
 * @note See UAWhitelist for pattern entry syntax.
 */
#if __has_feature(objc_generics)
@property (nonatomic, strong) NSArray<NSString *> *whitelist;
#else
@property (nonatomic, strong) NSArray *whitelist;
#endif

///---------------------------------------------------------------------------------------
/// @name Advanced Configuration Options
///---------------------------------------------------------------------------------------

/**
 * Apps may be set to self-configure based on the APS-environment set in the
 * embedded.mobileprovision file by using detectProvisioningMode. If
 * detectProvisioningMode is set to `YES`, the inProduction value will
 * be determined at runtime by reading the provisioning profile. If it is set to
 * `NO` (the default), the inProduction flag may be set directly or by using the
 * AirshipConfig.plist file.
 *
 * When this flag is enabled, the inProduction flag defaults to `YES` for safety
 * so that the production keys will always be used if the profile cannot be read
 * in a released app. Simulator builds do not include the profile, and the
 * detectProvisioningMode flag does not have any effect in cases where a profile
 * is not present. When a provisioning file is not present, the app will fall
 * back to the inProduction property as set in code or the AirshipConfig.plist
 * file.
 */
@property (nonatomic, assign) BOOL detectProvisioningMode;

/**
 * The Urban Airship device API url. This option is reserved for internal debugging.
 */
@property (nonatomic, copy) NSString *deviceAPIURL;

/**
 * The Urban Airship analytics API url. This option is reserved for internal debugging.
 */
@property (nonatomic, copy) NSString *analyticsURL;

/**
 * The Urban Airship landing page content url. This option is reserved for internal debugging.
 */
@property (nonatomic, copy) NSString *landingPageContentURL;

/**
 * If set to `YES`, the Urban Airship user will be cleared if the application is
 * restored on a different device from an encrypted backup.
 *
 * Defaults to `NO`.
 */
@property (nonatomic, assign) BOOL clearUserOnAppRestore;

/**
 * If set to `YES`, the application will clear the previous named user ID on a
 * re-install. Defaults to `NO`.
 */
@property (nonatomic, assign) BOOL clearNamedUserOnAppRestore;

/**
 * Flag indicating whether channel capture feature is enabled or not.
 *
 * Defaults to `YES`.
 */
@property (nonatomic, assign, getter=isChannelCaptureEnabled) BOOL channelCaptureEnabled;

/**
 * Flag indicating whether delayed channel creation is enabled. If set to `YES` channel
 * creation will not occur until channel creation is manually enabled.
 *
 * Defaults to `NO`.
 */
@property (nonatomic, assign, getter=isChannelCreationDelayEnabled) BOOL channelCreationDelayEnabled;

/**
 * Dictionary of custom config values.
 */
@property (nonatomic, copy) NSDictionary *customConfig;

///---------------------------------------------------------------------------------------
/// @name Factory Methods
///---------------------------------------------------------------------------------------

/**
 * Creates an instance using the values set in the `AirshipConfig.plist` file.
 * @return A UAConfig with values from `AirshipConfig.plist` file.
 */
+ (UAConfig *)defaultConfig;

/**
 * Creates an instance using the values found in the specified `.plist` file.
 * @param path The path of the specified file.
 * @return A UAConfig with values from the specified file.
 */
+ (UAConfig *)configWithContentsOfFile:(NSString *)path;

/**
 * Creates an instance with empty values.
 * @return A UAConfig with empty values.
 */
+ (UAConfig *)config;

///---------------------------------------------------------------------------------------
/// @name Utilities, Helpers
///---------------------------------------------------------------------------------------

/**
 * Validates the current configuration. In addition to performing a strict validation, this method
 * will log warnings and common configuration errors.
 * @return `YES` if the current configuration is valid, otherwise `NO`.
 */
- (BOOL)validate;

@end

NS_ASSUME_NONNULL_END


text:
DefineStatic(CONST_GENERAL_TAB)
DefineStatic(CONST_GENERAL_SPACE)
DefineStatic(CONST_GENERAL_NEWLINE)
DefineStatic(CONST_GENERAL_DELIM)
DefineStatic(CONST_GENERAL_OK)
DefineStatic(CONST_GENERAL_FAILED)
DefineStatic(CONST_GENERAL_YAW)
DefineStatic(CONST_GENERAL_PITCH)
DefineStatic(CONST_GENERAL_ROLL)
DefineStatic(CONST_GENERAL_UPTIME)
DefineStatic(CONST_GENERAL_DAY)
DefineStatic(CONST_GENERAL_HOUR)
DefineStatic(CONST_GENERAL_MIN)
DefineStatic(CONST_GENERAL_SEC)
DefineStatic(CONST_GENERAL_CYCLE)
DefineStatic(CONST_GENERAL_PRESSURE)
DefineStatic(CONST_GENERAL_PRESSURE_HPA)
DefineStatic(CONST_GENERAL_TEMP)
DefineStatic(CONST_GENERAL_COMPASS)
DefineStatic(CONST_GENERAL_DISTANCE)
DefineStatic(CONST_GENERAL_CM)

#ifdef DEBUG_OUTPUT
DefineStatic(CONST_DISPLAY_INIT)
#ifdef USE_LCD_NOKIA_5110
DefineStatic(CONST_DISPLAY_NOKIA5110)
#endif
#ifdef USE_LCD_ILI9341
DefineStatic(CONST_DISPLAY_ILI9341)
#endif
DefineStatic(CONST_DISPLAY_INITDONE)

DefineStatic(CONST_I2C_INIT)

DefineStatic(CONST_MOTSEN_INIT)
DefineStatic(CONST_MOTSEN_ACCELXYZ)
DefineStatic(CONST_MOTSEN_GYROXYZ)
DefineStatic(CONST_MOTSEN_INITDONE)

#ifdef USE_MPU6050
DefineStatic(CONST_MOTSEN_MPU6050)
#endif
#ifdef USE_MPU6050_DMP
DefineStatic(CONST_MOTSEN_MPU6050_OFFSETS)
DefineStatic(CONST_MOTSEN_MPU6050_DMPINIT)
DefineStatic(CONST_MOTSEN_MPU6050_DMPPACK)
DefineStatic(CONST_MOTSEN_MPU6050_MEMFAIL)
DefineStatic(CONST_MOTSEN_MPU6050_CFGFAIL)
DefineStatic(CONST_MOTSEN_MPU6050_OVERFLOW)
#endif

#ifdef USE_BMP085
DefineStatic(CONST_MOTSEN_BMP085)
#endif

#ifdef USE_HMC5883L
DefineStatic(CONST_MOTSEN_HMC5883L)
#endif

#endif //DEBUG_OUTPUT

void CS::init()
{
	CONST_GENERAL_TAB = F("\t");
	CONST_GENERAL_SPACE = F(" ");
	CONST_GENERAL_NEWLINE = F("\n");
	CONST_GENERAL_DELIM = F("=========");
	CONST_GENERAL_OK = F("OK");
	CONST_GENERAL_FAILED = F("FAILED");
	CONST_GENERAL_YAW = F("Yaw: ");
	CONST_GENERAL_PITCH = F("Pitch: ");
	CONST_GENERAL_ROLL = F("Roll: ");
	CONST_GENERAL_UPTIME = F("Up: ");
	CONST_GENERAL_DAY = F("d");
	CONST_GENERAL_HOUR = F("h");
	CONST_GENERAL_MIN = F("m");
	CONST_GENERAL_SEC = F("s");
	CONST_GENERAL_CYCLE = F("Cycle: ");
	CONST_GENERAL_PRESSURE = F("Pressure: ");
	CONST_GENERAL_PRESSURE_HPA = F("hPa");
	CONST_GENERAL_TEMP = F("Temp: ");
	CONST_GENERAL_COMPASS = F("Compass: ");
	CONST_GENERAL_DISTANCE = F("Dist: ");
	CONST_GENERAL_CM = F("cm");

#ifdef DEBUG_OUTPUT
	CONST_DISPLAY_INIT = F("Initializing Display");
#ifdef USE_LCD_NOKIA_5110
	CONST_DISPLAY_NOKIA5110 = F("LCD NOKIA_5110 has been selected.");
#endif
#ifdef USE_LCD_ILI9341
	CONST_DISPLAY_ILI9341 = F("LCD ILI9341 has been selected.");
#endif
	CONST_DISPLAY_INITDONE = F("Display Initialization is finished.");

	CONST_I2C_INIT = F("Initializing I2C bus...");

	CONST_MOTSEN_INIT = F("Initializing Motion Sensors");
	CONST_MOTSEN_ACCELXYZ = F("Accel xyz: ");
	CONST_MOTSEN_GYROXYZ = F("Gyro xyz: ");
	CONST_MOTSEN_INITDONE = F("Motion Sensors Initialization is finished.");

#ifdef USE_MPU6050
	CONST_MOTSEN_MPU6050 = F("MPU6050...");
#endif
#ifdef USE_MPU6050_DMP
	CONST_MOTSEN_MPU6050_OFFSETS = F("MPU6050 internal sensor offsets:");
	CONST_MOTSEN_MPU6050_DMPINIT = F("Initializing MPU6050 DMP... ");
	CONST_MOTSEN_MPU6050_DMPPACK = F("MPU6050 DMP Packet Size: ");
	CONST_MOTSEN_MPU6050_MEMFAIL = F(" - Initial memory load failed.");
	CONST_MOTSEN_MPU6050_CFGFAIL = F(" - DMP Config updates failed.");
	CONST_MOTSEN_MPU6050_OVERFLOW = F("MPU6050 DMP Overflow!");
#endif
#ifdef USE_BMP085
	CONST_MOTSEN_BMP085 = F("BMP085...");
#endif
#ifdef USE_HMC5883L
	CONST_MOTSEN_HMC5883L = F("HMC5883L...");
#endif

#endif //DEBUG_OUTPUT
}


text:
require 'ebay/types/listing_duration_definition'

module Ebay # :nodoc:
  module Types # :nodoc:
    # == Attributes
    #  array_node :listing_durations, 'ListingDuration', :class => ListingDurationDefinition, :default_value => []
    #  numeric_node :version, '@Version', :optional => true
    class ListingDurationDefinitions
      include XML::Mapping
      include Initializer
      root_element_name 'ListingDurationDefinitions'
      array_node :listing_durations, 'ListingDuration', :class => ListingDurationDefinition, :default_value => []
      numeric_node :version, '@Version', :optional => true
    end
  end
end


text:
module DesignManagement
  class MoveDesignsService < DesignService
    # @param user [User] The current user
    # @param [Hash] params
    # @option params [DesignManagement::Design] :current_design
    # @option params [DesignManagement::Design] :previous_design (nil)
    # @option params [DesignManagement::Design] :next_design (nil)
    def initialize(user, params)
      super(nil, user, params.merge(issue: nil))
    end

    def execute
      return error(:no_focus) unless current_design.present?
      return error(:cannot_move) unless ::Feature.enabled?(:reorder_designs, project, default_enabled: true)
      return error(:cannot_move) unless current_user.can?(:move_design, current_design)
      return error(:no_neighbors) unless neighbors.present?
      return error(:not_distinct) unless all_distinct?
      return error(:not_adjacent) if any_in_gap?
      return error(:not_same_issue) unless all_same_issue?

      move_nulls_to_end
      current_design.move_between(previous_design, next_design)
      current_design.save!
      success
    end

    def error(message)
      ServiceResponse.error(message: message)
    end

    def success
      ServiceResponse.success
    end

    private

    delegate :issue, :project, to: :current_design

    def move_nulls_to_end
      moved_records = current_design.class.move_nulls_to_end(issue.designs.in_creation_order)
      return if moved_records == 0

      current_design.reset
      next_design&.reset
      previous_design&.reset
    end

    def neighbors
      [previous_design, next_design].compact
    end

    def all_distinct?
      ids.uniq.size == ids.size
    end

    def any_in_gap?
      return false unless previous_design&.relative_position && next_design&.relative_position

      !previous_design.immediately_before?(next_design)
    end

    def all_same_issue?
      issue.designs.id_in(ids).count == ids.size
    end

    def ids
      @ids ||= [current_design, *neighbors].map(&:id)
    end

    def current_design
      params[:current_design]
    end

    def previous_design
      params[:previous_design]
    end

    def next_design
      params[:next_design]
    end
  end
end