text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="82b3a38d-49a7-4add-979a-a787e80a727b" name="Default" comment="">
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/BezierPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/CSSRulePlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/ColorPropsPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/DirectionalRotationPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/EaselPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/KineticPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/Physics2DPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/PhysicsPropsPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/RaphaelPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/RoundPropsPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/ScrollToPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/TextPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/plugins/ThrowPropsPlugin.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/utils/Draggable.min.js" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/vendor/utils/SplitText.min.js" afterPath="" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/index.html" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/script.js" afterPath="$PROJECT_DIR$/js/script.js" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
    </list>
    <ignored path="ShootingGallery.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="DaemonCodeAnalyzer">
    <disable_hints />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="ShootingGallery" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="index.html" pinned="false" current="true" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state line="92" column="46" selection-start="2777" selection-end="2777" vertical-scroll-proportion="0.9603524" vertical-offset="1312" max-vertical-offset="2014">
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="script.js" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/js/script.js">
          <provider selected="true" editor-type-id="text-editor">
            <state line="92" column="129" selection-start="4160" selection-end="4160" vertical-scroll-proportion="0.0" vertical-offset="1805" max-vertical-offset="2698">
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FindManager">
    <FindUsagesManager>
      <setting name="OPEN_NEW_TAB" value="false" />
    </FindUsagesManager>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="GitLogSettings">
    <option name="myStructureFilterPaths" />
    <option name="myDateState">
      <MyDateState />
    </option>
  </component>
  <component name="HighlightingSettingsPerFile">
    <setting file="file://$PROJECT_DIR$/js/script.js" root0="SKIP_INSPECTION" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="changedFiles">
      <list>
        <option value="$PROJECT_DIR$/css/styles.css" />
        <option value="$PROJECT_DIR$/js/script.js" />
        <option value="$PROJECT_DIR$/index.html" />
      </list>
    </option>
  </component>
  <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
  <component name="ProjectFrameBounds">
    <option name="y" value="22" />
    <option name="width" value="1440" />
    <option name="height" value="874" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="true">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectReloadState">
    <option name="STATE" value="0" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="Scope" />
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="ShootingGallery" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="ShootingGallery" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="Shooting_Gallery_Complete" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="ShootingGallery" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="Shooting_Gallery_Complete" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="vendor" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="ShootingGallery" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="Shooting_Gallery_Complete" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="vendor" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="plugins" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="FullScreen" value="false" />
    <property name="DefaultHtmlFileTemplate" value="Html5" />
  </component>
  <component name="RunManager">
    <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
      <TestRunner />
      <method />
    </configuration>
    <configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console">
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug" singleton="true">
      <method />
    </configuration>
    <configuration default="true" type="PhpUnitRemoteRunConfigurationType" factoryName="PHPUnit on Server">
      <method />
    </configuration>
    <list size="0" />
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false" SSL_PROTOCOLS="sslv3">
    <option name="USER" value="" />
    <option name="PASSWORD" value="" />
    <option name="mySSHConnectionTimeout" value="30000" />
    <option name="mySSHReadTimeout" value="30000" />
    <option name="LAST_MERGED_REVISION" />
    <option name="MERGE_DRY_RUN" value="false" />
    <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
    <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
    <option name="IGNORE_SPACES_IN_MERGE" value="false" />
    <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
    <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
    <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
    <option name="FORCE_UPDATE" value="false" />
    <option name="IGNORE_EXTERNALS" value="false" />
    <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="82b3a38d-49a7-4add-979a-a787e80a727b" name="Default" comment="" />
      <created>1383089266651</created>
      <updated>1383089266651</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="0" y="22" width="1440" height="874" extended-state="0" />
    <editor active="false" />
    <layout>
      <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32891247" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27259684" sideWeight="0.6710875" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <option name="myTodoPanelSettings">
      <TodoPanelSettings />
    </option>
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/js/script.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="70" column="39" selection-start="3127" selection-end="3127" vertical-scroll-proportion="0.0" vertical-offset="1330" max-vertical-offset="2660">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state line="26" column="14" selection-start="381" selection-end="381" vertical-scroll-proportion="0.0" vertical-offset="247" max-vertical-offset="4332" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/script.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="70" column="39" selection-start="3128" selection-end="3128" vertical-scroll-proportion="0.0" vertical-offset="1330" max-vertical-offset="2660">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/../dwi/DwiList/js/ListApp.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="6650" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state line="77" column="39" selection-start="2440" selection-end="2440" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1862">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state line="150" column="8" selection-start="1942" selection-end="1942" vertical-scroll-proportion="0.0" vertical-offset="2751" max-vertical-offset="3477" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/script.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="73" column="59" selection-start="2934" selection-end="2934" vertical-scroll-proportion="0.0" vertical-offset="1387" max-vertical-offset="2242">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/../dwi/DwiList/js/ListApp.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="6650" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state line="36" column="44" selection-start="1448" selection-end="1448" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1121">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state line="40" column="15" selection-start="529" selection-end="529" vertical-scroll-proportion="0.0" vertical-offset="642" max-vertical-offset="1843" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/script.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="28" column="28" selection-start="1010" selection-end="1010" vertical-scroll-proportion="0.0" vertical-offset="532" max-vertical-offset="1159">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/../dwi/DwiList/js/ListApp.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="6650" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state line="5" column="16" selection-start="75" selection-end="75" vertical-scroll-proportion="0.0785124" vertical-offset="38" max-vertical-offset="4332" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/../dwi/DwiList/js/ListApp.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="6650" />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/script.js">
      <provider selected="true" editor-type-id="text-editor">
        <state line="92" column="129" selection-start="4160" selection-end="4160" vertical-scroll-proportion="0.0" vertical-offset="1805" max-vertical-offset="2698">
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state line="92" column="46" selection-start="2777" selection-end="2777" vertical-scroll-proportion="0.9603524" vertical-offset="1312" max-vertical-offset="2014">
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
$(function() {

    $("input,textarea").jqBootstrapValidation({
        preventSubmit: true,
        submitError: function($form, event, errors) {
            // additional error messages or events
        },
        submitSuccess: function($form, event) {
            // Prevent spam click and default submit behaviour
            $("#btnSubmit").attr("disabled", true);
            event.preventDefault();

            // get values from FORM
            var name = $("input#name").val();
            var age = $("input#age").val();
            var email = $("input#email").val();
            var highschool = $("input#highschool").val();
            var gender = $("input#gender").val();
            var firstName = name; // For Success/Failure Message
            // Check for white space in name for Success/Fail message
            if (firstName.indexOf(' ') >= 0) {
                firstName = name.split(' ').slice(0, -1).join(' ');
            }
            $.ajax({
                url: "https://zapier.com/hooks/catch/3kpxrl/",
                type: "POST",
                data: {
                    name: name,
                    age: age,
                    email: email,
                    highschool: highschool,
                    gender: gender
                },
                cache: false,
                success: function() {
                    // Enable button & show success message
                    $("#btnSubmit").attr("disabled", false);
                    $('#success').html("
");
                    $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
                        .append("</button>");
                    $('#success > .alert-success')
                        .append("Registration submitted. ");
                    $('#success > .alert-success')
                        .append('
');

                    //clear all fields
                    $('#contactForm').trigger("reset");
                },
                error: function() {
                    // Fail message
                    $('#success').html("
");
                    $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
                        .append("</button>");
                    $('#success > .alert-danger').append("Sorry " + firstName + ", it seems there was an error. Please contact me at kerwin@devacademy.co.nz!");
                    $('#success > .alert-danger').append('
');
                    //clear all fields
                    $('#contactForm').trigger("reset");
                },
            });
        },
        filter: function() {
            return $(this).is(":visible");
        },
    });

    $("a[data-toggle=\"tab\"]").click(function(e) {
        e.preventDefault();
        $(this).tab("show");
    });
});

// When clicking on Full hide fail/success boxes
$('#name').focus(function() {
    $('#success').html('');
});

redpajama_set_name: RedPajamaGithub


text:
import memoize from 'fast-memoize';

const KB = 1024;

export const getMinimalData = memoize((data) => {
  const content = JSON.stringify(data);
  if (content.length > KB) {
    return { message: '[WARNING] data is too large' };
  }
  return data;
});

export const getActionMinimalData = memoize((type, data) => ({ type, ...getMinimalData(data) }));

export function serialiseFunction(func) {
  const serialised = func.toString();
  const args = serialised.substring(serialised.indexOf('(') + 1, serialised.indexOf(')'));
  const body = serialised.substring(serialised.indexOf('{') + 1, serialised.lastIndexOf('}'));
  return { args, body };
}

export const str = memoize((value) => {
  if (value && value.message && value.stack) {
    return `{"message":"${value.message}","stack":"${value.stack.replace(/(\n)/gi, '\\n')}"}`;
  }
  return JSON.stringify(value);
});


text:
package de.mhus.aqua.mod.uiapp;

import java.io.PrintWriter;
import java.util.Map;

import de.mhus.aqua.api.AquaRequest;
import de.mhus.aqua.api.IUserRights;
import de.mhus.aqua.mod.uiapp.tst.ContGaga;
import de.mhus.aqua.mod.uiapp.wui.ITreeNode;
import de.mhus.aqua.mod.uiapp.wui.IWComponent;
import de.mhus.aqua.mod.uiapp.wui.WColumnSelector;
import de.mhus.aqua.mod.uiapp.wui.WKit;
import de.mhus.aqua.mod.uiapp.wui.WLayoutLCR;
import de.mhus.aqua.mod.uiapp.wui.WLayoutTopLR;
import de.mhus.aqua.mod.uiapp.wui.WTabPane;
import de.mhus.aqua.mod.uiapp.wui.IWTplInclude;
import de.mhus.aqua.mod.uiapp.wui.WTree;
import de.mhus.aqua.mod.uiapp.wui.WUtil.DIRECTION;
import de.mhus.lib.MCast;
import de.mhus.lib.MException;
import de.mhus.lib.MString;
import de.mhus.lib.cao.CaoException;
import de.mhus.lib.config.IConfig;
import de.mhus.lib.config.JsonConfig;

/**
 * This class implements the editor utility of the Ui application.
 *
 * @author mikehummel
 *
 */
public class ContainerEditorBox extends UiBox {

	private boolean adminMode = false;
	private WKit kit;
	private AquaRequest request;

	public ContainerEditorBox() throws MException {
		super();
	}

	private static de.mhus.lib.logging.Log log = de.mhus.lib.logging.Log
			.getLog(ContainerEditorBox.class);

	@Override
	public void initWElement(AquaRequest request, String id, IConfig config) throws MException {
		this.request = request;
		super.initWElement(request, id, config);
	}

	@Override
	public void doInit() throws MException {
		setTplName(Activator.instance().getId() + "/admin_box");
		kit = new WKit(request,Activator.instance(),"page_editor");
		setNls(kit.getNls());
		WTabPane tab = kit.createTabPane();
		tab.addTab("widgets", "Widgets");
		tab.addTab("layout",  "Layout");

		WColumnSelector widgetsTree = (WColumnSelector) kit.create(WColumnSelector.class);
		widgetsTree.setWidth("100%");
		AjaxTreeSource treeSource = new AjaxTreeSource(this) {

			@Override
			public ITreeNode[] getRoots() {

				return new ITreeNode[] {
					new GroupNode(".g","General",true)
				};

			}

			@Override
			public ITreeNode[] getChildren(String id) {
				if (id.equals(".g")) {
					ComponentInfo[] a;
					try {
						a = ((UiApplication)request.getNode().getApplication()).getPossibleUIComponents(request.getSession());
					} catch (CaoException e) {
						e.printStackTrace();
						return null;
					}
					ITreeNode[] b = new ITreeNode[a.length];
					for (int i = 0; i < a.length; i++) {
						b[i] = new WidgetNode(a[i]);
					}
					return b;
				}
				return null;
			}

		};
		widgetsTree.setSource(treeSource);

		AjaxAction selectAction = new AjaxAction(this) {

			{
				setExtra("+ \"&selection=\" + id");
			}
			@Override
			public AjaxActionDefinition[] doRequest(AquaRequest request) throws Exception {

				String id = request.getParameter("selection");
				log.t("selected", id);
				UiBox newBox = ((UiApplication)request.getNode().getApplication()).createBox(request, container, id );

				IWComponent ret = ((UiEditableContainer)container).appendBox(newBox);
				int defaultContainer = ((UiEditableContainer)container).getLayout().getDefaultContainer();

				BoxConfigDialog dialog = new BoxConfigDialog(request, container, newBox);
				dialog.show();

				return new AjaxActionDefinition[] {
						new AjaxActionDefinition(ACTION.FIRST,"#list" + defaultContainer,ret), //XXX
						new AjaxActionDefinition(ACTION.CONTENT,"#dialog_pane",dialog)
				};

			}

		};
		widgetsTree.setSelectAction(selectAction);

		tab.addChild("widgets", widgetsTree);

		// ---------------------------------------------------------------

		WColumnSelector layoutTree = (WColumnSelector) kit.create(WColumnSelector.class);
		layoutTree.setWidth("100%");

		AjaxTreeSource lts = new AjaxTreeSource(this) {

			@Override
			public ITreeNode[] getRoots() {

				return new ITreeNode[] {
						new GroupNode(".g","General",true)
					};
			}

			@Override
			public ITreeNode[] getChildren(String id) {
				if (id.equals(".g")) {
					ITreeNode[] out = new ITreeNode[] {
							new LayoutNode("LCR", WLayoutLCR.class.getCanonicalName()),
							new LayoutNode("TopLR", WLayoutTopLR.class.getCanonicalName())
					};
					return out;

				}
				return null;
			}
		};
		layoutTree.setSource(lts);

		AjaxAction lsa = new AjaxAction(this) {

			{
				setExtra("+ \"&selection=\" + id");
			}
			@Override
			public AjaxActionDefinition[] doRequest(AquaRequest request) throws Exception {
				String id = request.getParameter("selection");
				log.t("selected", id);
				container.getConfig().getConfig("layout").setProperty("type", id);
				container.createLayout();
				container.refreshLayout();
				return new AjaxActionDefinition[] {
						new AjaxActionDefinition(ACTION.CONTENT,"#dialog_pane",new IWComponent() {
							public void paint(AquaRequest data, PrintWriter stream) throws MException {
								Map<String, Object> attr = engine.createAttributes(null);
								engine.execute(ContainerEditorBox.this, "reload", attr, stream);
							}
						})
				};
			}
		};
		layoutTree.setSelectAction(lsa);

		tab.addChild("layout", layoutTree);

		addChild("elements", tab);

	}

	public void processAjax(AquaRequest request, PrintWriter writer) throws MException {

		if (!request.getNode().getAcl().hasRight(request.getSession(), IUserRights.EDIT))
			return;

		String action = request.getParameter("action");

		if ("on".equals(action)) {
//			AjaxAction ret = new AjaxAction(this) {
//
//				@Override
//				public AjaxActionDefinition[] doRequest(AquaRequest request) throws Exception {
//					return new AjaxActionDefinition[] {
//							new AjaxActionDefinition(ACTION.CONTENT, "", component)
//					};
//				}
//			};
			writer.print("{\"rc\":\"ok\",\"results\":[{\"a\":\"content\", \"n\":\"#admin_container\", \"v\":\"");
			PrintWriter w = new PrintWriter( new EncodeWriter(writer) );

			Map<String, Object> attr = engine.createAttributes(request);
			attr.put("admin", getId() );
			nls.initTpl(attr);
			adminMode = true;
			engine.execute(this, "on", attr, w);

			w.flush();
			writer.print("\"}]}");
			return;
		} else
		if ("cancel".equals(action)) {

			writer.print("{\"rc\":\"ok\",\"results\":[{\"a\":\"content\", \"n\":\"#admin_container\", \"v\":\"");
			PrintWriter w = new PrintWriter( new EncodeWriter(writer) );

			Map<String, Object> attr = engine.createAttributes(request);
			attr.put("admin", getId() );
			attr.put("active", request.getSession().isAdminActive());
			nls.initTpl(attr);
			adminMode = false;
			engine.execute(this, "reload", attr, w);

			w.flush();
			writer.print("\"}]}");

			try {
				container.loadConfig();
				container.refreshLayout();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			return;
		} else
		if ("save".equals(action)) {
			writer.print("{\"rc\":\"ok\",\"results\":[{\"a\":\"content\", \"n\":\"#admin_container\", \"v\":\"");
			PrintWriter w = new PrintWriter( new EncodeWriter(writer) );

			Map<String, Object> attr = engine.createAttributes(request);
			attr.put("admin", getId() );
			attr.put("active", request.getSession().isAdminActive());
			nls.initTpl(attr);
			adminMode = false;
			engine.execute(this, "reload", attr, w);

			w.flush();
			writer.print("\"}]}");

			container.getNode().setApplicationConfig(container.getSession().getUser(), container.getConfig());

			return;
		} else
		if ("savedefault".equals(action)) {
			writer.print("{\"rc\":\"ok\",\"results\":[{\"a\":\"content\", \"n\":\"#admin_container\", \"v\":\"");
			PrintWriter w = new PrintWriter( new EncodeWriter(writer) );

			Map<String, Object> attr = engine.createAttributes(request);
			attr.put("admin", getId() );
			attr.put("active", request.getSession().isAdminActive());
			nls.initTpl(attr);
			adminMode = false;
			engine.execute(this, "reload", attr, w);

			w.flush();
			writer.print("\"}]}");

			container.getNode().setApplicationConfig(container.getSession().getUser(), null);
			container.getNode().setApplicationConfig(container.getConfig());
			try {
				container.loadConfig();
				container.refreshLayout();
			} catch (Exception e) {
				log.i(e);
			}

			return;
		} else
		if ("move".equals(action)) {
			writer.print("{\"rc\":\"ok\",\"results\":[]}");
			String boxId = MString.afterIndex(request.getParameter("node"),'_');
			int list = MCast.toint(request.getParameter("list").substring("list".length()),-1);
			int pos  = MCast.toint(request.getParameter("pos"),-1);
			if (boxId == null || !boxId.startsWith("i") || list < 0 || pos < 0) return;
			((UiEditableContainer)container).moveBox(boxId,list,pos);
		} else
		if ("setup".equals(action)) {
			String boxId = MString.afterIndex(request.getParameter("node"),'_');
			UiBox box = container.getBox(boxId);
			request.setNode(container.getNode());
			BoxConfigDialog dialog = null;
			try {
				dialog = new BoxConfigDialog(request, container, box);
			} catch (Exception e) {
				log.e(e);
				return;
			}
			dialog.show();

			writer.print("{\"rc\":\"ok\",\"results\":[{\"a\":\"content\", \"n\":\"#dialog_pane\", \"v\":\"");
			PrintWriter w = new PrintWriter( new EncodeWriter(writer) );
			dialog.paint(request, w);
			w.flush();
			writer.print("\"}]}");
		} else
		if ("close".equals(action)) {
			String boxId = MString.afterIndex(request.getParameter("node"),'_');
			((UiEditableContainer)container).removeBox(boxId);
			writer.print("{\"rc\":\"ok\",\"results\":[{\"a\":\"remove\", \"n\":\"#box_"+boxId+"\", \"v\":\"");
			writer.print("\"}]}");
		}
		if ("resize".equals(action)) {
			String boxId = MString.afterIndex(request.getParameter("node"),'_');
			int height = MCast.toint(request.getParameter("height"),-1);
			UiBox box = container.getBox(boxId);
			if (box.canChangeHeight())
				box.setHeight(height);
			writer.print("{\"rc\":\"ok\",\"results\":[]}");
		}

		super.processAjax(request, writer);

	}

	@Override
	public String getTitle() {
		return kit.getNls().find("box_title=Admin");
	}

	@Override
	protected void doFillAttributes(AquaRequest data, Map<String, Object> attr) {

		try {
			if (request.getNode().getAcl().hasRight(request.getSession(), IUserRights.EDIT)) {
				if (adminMode) {
					attr.put(SECTION, "on");
				} else {
					attr.put(SECTION, "off");
				}
				attr.put("active", true );
			} else {
				attr.put(SECTION, "off");
				attr.put("active", false );
			}
		} catch (CaoException e) {
			log.i(e);
		}
	}

	static class GroupNode implements ITreeNode {

		private String title;
		private String id;
		private boolean group;

		public GroupNode(String id, String title, boolean isGroup) {
			this.title = title;
			this.id = id;
			this.group = isGroup;
		}
		@Override
		public String getTitle() {
			return title;
		}

		@Override
		public String getIconClass() {
			return "";
		}

		@Override
		public boolean hasChildren() {
			return group;
		}

		@Override
		public boolean isExpanded() {
			return false;
		}

		@Override
		public String getId() {
			return id;
		}
	}

	static class LayoutNode implements ITreeNode {

		private String title;
		private String id;

		public LayoutNode(String title, String id) {
			this.title = title;
			this.id = id;
		}
		@Override
		public String getTitle() {
			return title;
		}

		@Override
		public String getIconClass() {
			return "";
		}

		@Override
		public boolean hasChildren() {
			return false;
		}

		@Override
		public boolean isExpanded() {
			return false;
		}

		@Override
		public String getId() {
			return id;
		}

	}

	static class WidgetNode implements ITreeNode {

		private ComponentInfo info;

		public WidgetNode(ComponentInfo info) {
			this.info = info;
		}

		@Override
		public String getTitle() {
			return info.getTitle();
		}

		@Override
		public String getIconClass() {
			return "";
		}

		@Override
		public boolean hasChildren() {
			return false;
		}

		@Override
		public boolean isExpanded() {
			return false;
		}

		@Override
		public String getId() {
			return info.getId();
		}

	}

	@Override
	public boolean canChangeHeight() {
		return false;
	}

	@Override
	public void setHeight(int height) {

	}

	@Override
	public int getHeight() {
		return -1;
	}

	@Override
	public boolean isVisible() {
		return false;
	}

}


text:
package fr.imie.jdbc.DTO;

public class PromotionDTO {

	private Integer id;
	private String libelle;

	public PromotionDTO() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the libelle
	 */
	public String getLibelle() {
		return libelle;
	}

	/**
	 * @param libelle the libelle to set
	 */
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}

}


text:
//
//  XLYConstraintPrivate.h
//
//  Created by kaizei on 14/11/22.
//  Copyright (c) 2014年 kaizei. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "XLYConstraint.h"
#import "XLYViewAttribute.h"

@protocol XLYConstraintsGenerationProtocol <NSObject>

@property (nonatomic, assign) NSLayoutFormatOptions directionOption;
- (NSArray *)resultConstraints;

@end

#pragma mark - XLYConstraint

@interface XLYViewAttribute ()

@property (nonatomic, strong) UIView *view;
@property (nonatomic, assign) NSLayoutAttribute ns_layoutAttribute;

@end

@interface XLYEnhancedViewAttribute ()

@property (nonatomic, strong) XLYViewAttribute *viewAttribute;

@property (nonatomic, assign) CGFloat layoutMultiplier;
@property (nonatomic, assign) UILayoutPriority layoutPriority;
@property (nonatomic, assign) CGFloat layoutConstant;

@end

@interface XLYConstraint () <XLYConstraintsGenerationProtocol>

@property (nonatomic, strong) XLYViewAttribute *firstViewAttribute;
@property (nonatomic, strong) XLYViewAttribute *secondViewAttribute;

@property (nonatomic, assign) NSLayoutRelation relation;

@property (nonatomic, assign) CGFloat layoutMultiplier;
@property (nonatomic, assign) UILayoutPriority layoutPriority;
@property (nonatomic, assign) CGFloat layoutConstant;

@end

#pragma mark - composite constraints support

@interface XLYViewSizeAttribute ()

// should be XLYViewAttribute or XLYEnhancedViewAttribute
@property (nonatomic, strong) id widthAttribute;
@property (nonatomic, strong) id heightAttribute;

@end

@interface XLYSizeConstraint() <XLYConstraintsGenerationProtocol>

@property (nonatomic, strong) XLYViewSizeAttribute *firstAttribute;
@property (nonatomic, strong) XLYViewSizeAttribute *seconAttribute;

@end

@interface XLYViewCenterAttribute ()

@property (nonatomic, strong) id centerXAttribute;
@property (nonatomic, strong) id centerYAttribute;

@end

@interface XLYCenterConstraint() <XLYConstraintsGenerationProtocol>

@property (nonatomic, strong) XLYViewCenterAttribute *firstAttribute;
@property (nonatomic, strong) XLYViewCenterAttribute *seconAttribute;

@end

@interface XLYViewEdgeAttribute ()

@property (nonatomic, strong) id topAttribute;
@property (nonatomic, strong) id leadingAttribute;
@property (nonatomic, strong) id bottomAttribute;
@property (nonatomic, strong) id trailingAttribute;

@end

@interface XLYEdgeConstraint() <XLYConstraintsGenerationProtocol>

@property (nonatomic, strong) XLYViewEdgeAttribute *firstAttribute;
@property (nonatomic, strong) XLYViewEdgeAttribute *secondAttribute;

@end

#pragma mark - view addition
@interface UIView (XLAutoLayoutAdditionPrivate)

- (XLYViewAttribute *)xly_layoutAttribute:(NSLayoutAttribute)attribute;

/**
 *  find the closet common superview with another view.
 *  @return the closet common superview or 'nil' if 'view' is nil.
 */
- (UIView *)xly_closestCommonSuperviewWithView:(UIView *)view;
+ (UIView *)xly_ClosestCommonSuperviewForView1:(UIView *)view1 view2:(UIView *)view2;

@end

#pragma mark - NSLayoutConstraint addition
@interface NSLayoutConstraint (XLAutoLayoutAdditionPrivate)

/// add the raw constraint to current helper
+ (void)xly_addRawConstraint:(id<XLYConstraintsGenerationProtocol>)constraint;

+ (NSArray *)xly_makeWithDirection:(NSLayoutFormatOptions)directionOption
                        autoActive:(BOOL)autoActive
                       constraints:(dispatch_block_t)block;

@end


text:
import urlparse

from django.core.urlresolvers import resolve
from django.shortcuts import render, redirect
from django.views.decorators.http import require_POST
from django.views.decorators.cache import never_cache
from django.views.generic import CreateView
from camp.models import EmailSubscriber
from camp.forms import BootstrapErrorList
from sked.models import Event

def index(request):
    pass

def login(request):
    referer = request.META.get('HTTP_REFERER')
    try:
        path = urlparse.urlparse(referer).path
    except:
        path = None

    if referer and urlparse.urlparse(referer).netloc == request.META.get('HTTP_HOST'):
        try:
            resolve(path)
        except:
            path = None
    else:
        path = None

    if request.user.is_anonymous():
        if path:
            request.session['next'] = path
        else:
            request.session['next'] = '/'
        return render(request, 'public_login.html')
    else:
        return redirect('/logged-in/')

def logged_in(request):
    if request.user.is_staff and not request.session.get('next'):
        return redirect('/admin/')
    else:
        try:
            del request.session['next']
        except:
            pass
        return redirect(request.session.get('next', '/'))

@require_POST
def sponsor_contact(request):
    pass

@require_POST
@never_cache
def email_subscribe(request):
    email = request.POST.get('email')
    event = Event.objects.current()
    subscriber = None
    if email and event:
        try:
            subscriber = EmailSubscriber.objects.get_or_create(event_id=event.id, email=email)
            template = 'camp/partials/success.html'
            error = None
        except:
            template = 'camp/partials/email_subscriber_form.html'
            error = 'There was an error subscribing you.'
    else:
        template = 'camp/partials/email_subscriber_form.html'
        error = 'Please provide an email address.'

    return render(request, template, {
                  email: email,
                  event: event,
                  subscriber: subscriber,
                  error: error,
                  }, content_type='text/html')


text:
require "chef/chef_fs/file_system/base_fs_object"

class Chef
  module ChefFS
    module FileSystem
      module Memory
        class MemoryFile < Chef::ChefFS::FileSystem::BaseFSObject
          def initialize(name, parent, value)
            super(name, parent)
            @value = value
          end
          def read
            return @value
          end
        end
      end
    end
  end
end


text:
module Locomotive
  module API
    module Resources

      class ContentTypeResource < Grape::API

        resource :content_types do

          entity_klass = Entities::ContentTypeEntity

          before do
            setup_resource_methods_for(:content_types)
            authenticate_locomotive_account!
          end

          desc 'Index of content_types'
          get '/' do
            authorize ContentType, :index?

            present content_types, with: entity_klass
          end

          desc 'Show a content_type'
          params do
            requires :id, type: String, desc: 'ContentTypeResource ID'
          end
          route_param :id do
            get do
              authorize content_type, :show?

              present content_type, with: entity_klass
            end
          end

          desc 'Create a content_type'
          params do
            requires :content_type, type: Hash do
              requires :name
              requires :slug
              optional :description
              requires :fields, type: Array do
                requires :name
                requires :type
                optional :label
                optional :hint
                optional :required
                optional :localized
                optional :unique
                optional :default
                optional :position
                optional :text_formatting
                optional :select_options
                optional :target
                optional :inverse_of
                optional :order_by
                optional :ui_enabled
              end
              optional :order_by
              optional :order_direction
              optional :group_by
              optional :label_field_name
              optional :entry_template
              optional :raw_item_template # deprecated
              optional :display_settings
              optional :public_submission_enabled
              optional :public_submission_account_emails
              optional :public_submission_title_template
            end
          end
          post do
            authorize ContentType, :create?

            form = form_klass.new(current_site, content_type_params)
            persist_from_form(form)

            present content_type, with: entity_klass
          end

          desc 'Update a ContentTypeResource (or create one)'
          params do
            requires :id, type: String, desc: 'ContentTypeResource ID or Slug'
            requires :content_type, type: Hash do
              requires :name
              optional :slug
              optional :description
              optional :fields, type: Array do
                requires :name
                optional :type
                optional :label
                optional :hint
                optional :required
                optional :localized
                optional :unique
                optional :default
                optional :position
                optional :text_formatting
                optional :select_options
                optional :target
                optional :inverse_of
                optional :order_by
                optional :ui_enabled
                optional :_destroy
              end
              optional :order_by
              optional :order_direction
              optional :group_by
              optional :label_field_name
              optional :entry_template
              optional :raw_item_template # deprecated
              optional :display_settings
              optional :public_submission_enabled
              optional :public_submission_account_emails
              optional :public_submission_title_template
            end
          end
          put ':id' do
            if @content_type = current_site.content_types.by_id_or_slug(params[:id]).first
              authorize @content_type, :update?
            else
              authorize ContentType, :create?
              @content_type = current_site.content_types.build
            end

            form = form_klass.new(current_site, content_type_params)
            persist_from_form(form)

            present content_type, with: entity_klass
          end

          desc "Delete a content_type"
          params do
            requires :id, type: String, desc: 'ContentType ID or SLUG'
          end
          delete ':id' do
            content_type = current_site.content_types.by_id_or_slug(params[:id]).first

            raise ::Mongoid::Errors::DocumentNotFound.new(current_site.content_types, params) if content_type.nil?

            authorize content_type, :destroy?

            content_type.destroy

            present content_type, with: entity_klass
          end

          desc 'Delete all content types'
          delete '/' do
            auth :destroy_all?

            number = current_site.content_types.count

            current_site.content_types.destroy_all

            present({ deletions: number })
          end

        end

      end

    end
  end
end


text:
> A simple, configurable clock

## Install

```sh
$ npm install --save clockwise
```

## Usage

```js
var Clock = require('clockwise')
var clock = new Clock()
clock.time() // => current time

clock.set(function timer () {
  return 1000
})
clock.time() // => time is 1000
```

## API

### `new Clock()`

Constructs a new clock instance that defaults to the normal clock

### `clock.time()` -> `Integer`

Returns the current time

### `clock.set(timer)` -> `clock`

##### `timer`

*Required*
Type: `function`

The new function to use to generate the current time

### `clock.restore()` -> `clock`

Restores the clock to the normal behavior

## License

MIT © [Ben Drucker](http://bendrucker.me)


text:
package com.jivesoftware.os.miru.stream.plugins.filter;

import com.google.common.base.Optional;
import com.jivesoftware.os.miru.api.MiruHost;
import com.jivesoftware.os.miru.api.MiruQueryServiceException;
import com.jivesoftware.os.miru.api.activity.MiruPartitionId;
import com.jivesoftware.os.miru.plugin.solution.MiruPartitionResponse;
import com.jivesoftware.os.miru.plugin.solution.MiruRemotePartition;
import com.jivesoftware.os.miru.plugin.solution.MiruRemotePartitionReader;
import com.jivesoftware.os.miru.plugin.solution.MiruRequest;
import com.jivesoftware.os.mlogger.core.EndPointMetrics;
import com.jivesoftware.os.mlogger.core.MetricLogger;
import com.jivesoftware.os.mlogger.core.MetricLoggerFactory;

import static com.jivesoftware.os.miru.stream.plugins.filter.AggregateCountsConstants.FILTER_PREFIX;
import static com.jivesoftware.os.miru.stream.plugins.filter.AggregateCountsConstants.INBOX_ALL_QUERY_ENDPOINT;

/**
 *
 */
public class AggregateCountsInboxAllRemotePartition implements MiruRemotePartition<AggregateCountsQuery, AggregateCountsAnswer, AggregateCountsReport> {

    private static final MetricLogger LOG = MetricLoggerFactory.getLogger();
    private static final EndPointMetrics endPointMetrics = new EndPointMetrics("process", LOG);

    private final MiruRemotePartitionReader remotePartitionReader;

    public AggregateCountsInboxAllRemotePartition(MiruRemotePartitionReader remotePartitionReader) {
        this.remotePartitionReader = remotePartitionReader;
    }

    private String getEndpoint(MiruPartitionId partitionId) {
        return FILTER_PREFIX + INBOX_ALL_QUERY_ENDPOINT + "/" + partitionId.getId();
    }

    @Override
    public MiruPartitionResponse<AggregateCountsAnswer> askRemote(MiruHost host,
        MiruPartitionId partitionId,
        MiruRequest<AggregateCountsQuery> request,
        Optional<AggregateCountsReport> report) throws MiruQueryServiceException {
        return remotePartitionReader.read("aggregateCountsInboxAll",
            host,
            getEndpoint(partitionId),
            request,
            AggregateCountsAnswer.class,
            report,
            endPointMetrics,
            AggregateCountsAnswer.EMPTY_RESULTS);
    }

}


text:
package android.app;

import com.koushikdutta.monojavabridge.MonoBridge;
import com.koushikdutta.monojavabridge.MonoProxy;

public class SearchManager_OnDismissListenerDelegateWrapper extends com.koushikdutta.monojavabridge.MonoProxyBase implements MonoProxy, android.app.SearchManager.OnDismissListener
{
	static
	{
		MonoBridge.link(SearchManager_OnDismissListenerDelegateWrapper.class, "onDismiss", "()V", "");

	}

	public native void onDismiss();

}


text:
package org.wso2.carbon.event.processor.storm.topology.component;

import backtype.storm.task.TopologyContext;
import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.tuple.Tuple;
import org.apache.log4j.Logger;
import org.wso2.carbon.databridge.commons.thrift.utils.HostAddressFinder;
import org.wso2.carbon.event.processor.storm.common.event.client.EventClient;
import org.wso2.carbon.event.processor.storm.common.management.client.ManagerServiceClient;
import org.wso2.carbon.event.processor.storm.common.management.client.ManagerServiceClientCallback;
import org.wso2.carbon.event.processor.storm.topology.util.SiddhiUtils;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.config.SiddhiConfiguration;
import org.wso2.siddhi.core.util.collection.Pair;
import org.wso2.siddhi.query.api.definition.StreamDefinition;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Publish events processed by Siddhi engine to CEP publisher
 */
public class EventPublisherBolt extends BaseBasicBolt implements ManagerServiceClientCallback {
    private transient Logger log = Logger.getLogger(EventPublisherBolt.class);
    /**
     * Exported stream IDs. Must declare output filed for each exported stream
     */
    private String[] exportedStreamIDs;
    /**
     * All stream definitions processed
     */
    private String[] streamDefinitions;
    /**
     * Queries processed by Siddhi engine. Required to extract field definitions of implicitly declared stream
     * definitions
     */
    private String[] queries;
    /**
     * Keep track of relevant data bridge stream id for a given Siddhi stream id
     */
    private Map<String, org.wso2.carbon.databridge.commons.StreamDefinition> siddhiStreamIdToDataBridgeStreamMap
            = new HashMap<String, org.wso2.carbon.databridge.commons.StreamDefinition>();

    private transient EventClient eventClient = null;

    private String executionPlanName;

    private String logPrefix;

    private int tenantId = -1234;
    /**
     * CEP Manager service host
     */
    private String cepManagerHost;
    /**
     * CEP manager service port
     */
    private int cepManagerPort;

    private String trustStorePath;
    private String trustStorePassword;

    private SiddhiManager siddhiManager;

    public EventPublisherBolt(String cepManagerHost, int cepManagerPort, String trustStorePath, String[] streamDefinitions, String[] queries, String[] exportedStreamIDs, String executionPlanName) {
        this.exportedStreamIDs = exportedStreamIDs;
        this.streamDefinitions = streamDefinitions;
        this.cepManagerHost = cepManagerHost;
        this.cepManagerPort = cepManagerPort;
        this.queries = queries;
        this.executionPlanName = executionPlanName;
        this.trustStorePath = trustStorePath;
        this.trustStorePassword = "wso2carbon";
        this.logPrefix = "{" + executionPlanName + ":" + tenantId + "}";
    }

    @Override
    public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) {
        if (siddhiManager == null) {
            init(); // TODO : Understand why this init is required
        }

        if (eventClient != null) {
            org.wso2.carbon.databridge.commons.StreamDefinition databridgeStream = siddhiStreamIdToDataBridgeStreamMap.get(tuple.getSourceStreamId());

            if (databridgeStream != null) {
                try {
                    if (log.isDebugEnabled()) {
                        log.debug(logPrefix + "Event published to CEP Publisher =>" + tuple.toString());
                    }
                    eventClient.sendEvent(tuple.getValues().toArray());
                } catch (IOException e) {
                    log.error(logPrefix + "Error while publishing event to CEP publisher", e);
                }
            } else {
                log.warn(logPrefix + "Tuple received for unknown stream " + tuple.getSourceStreamId() + ". Discarding event : " + tuple.toString());
            }
        } else {
            log.warn("Dropping the event since the data publisher is not yet initialized for " + executionPlanName + ":" + tenantId);
        }
    }

    @Override
    public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {

    }

    @Override
    public void prepare(Map stormConf, TopologyContext context) {
        super.prepare(stormConf, context);
        init();
    }

    private void init() {
        // TODO : remove siddhi related stream definitions. Use only exported streams
        log = Logger.getLogger(EventPublisherBolt.class);
        siddhiManager = new SiddhiManager(new SiddhiConfiguration());
        System.setProperty("javax.net.ssl.trustStore", trustStorePath);//"/home/sajith/wso2cep-4.0.0-SNAPSHOT/samples/producers/performance-test/src/main/resources/client-truststore.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);

        if (streamDefinitions != null) {
            for (String definition : streamDefinitions) {
                if (definition.contains("define stream")) {
                    siddhiManager.defineStream(definition);
                } else if (definition.contains("define partition")) {
                    siddhiManager.definePartition(definition);
                } else {
                    throw new RuntimeException("Invalid definition : " + definition);
                }
            }
        }

        if (queries != null) {
            for (String query : queries) {
                siddhiManager.addQuery(query);
            }
        }

        String thisHostIp = null;
        try {
            thisHostIp = HostAddressFinder.findAddress("localhost");
        } catch (SocketException e) {
            log.error("Cannot find IP address of the host");
        }

        for (String streamDefinitionId : exportedStreamIDs) {
            StreamDefinition siddhiStreamDefinition = siddhiManager.getStreamDefinition(streamDefinitionId);
            org.wso2.carbon.databridge.commons.StreamDefinition databridgeStreamDefinition = SiddhiUtils.toFlatDataBridgeStreamDefinition(siddhiStreamDefinition);
            siddhiStreamIdToDataBridgeStreamMap.put(siddhiStreamDefinition.getStreamId(), databridgeStreamDefinition);
        }
        // Connecting to CEP manager service to get details of CEP publisher
        ManagerServiceClient client = new ManagerServiceClient(cepManagerHost, cepManagerPort, this);
        client.getCepPublisher(executionPlanName, tenantId, 30, thisHostIp);
    }

    @Override
    public void onResponseReceived(Pair<String, Integer> endpoint) {
        synchronized (this) {
            try {
                for (Map.Entry<String, org.wso2.carbon.databridge.commons.StreamDefinition> entry : siddhiStreamIdToDataBridgeStreamMap.entrySet()) {
                    eventClient = new EventClient("tcp://" + endpoint.getOne() + ":" + endpoint.getTwo(), siddhiManager.getStreamDefinition(entry.getValue().getStreamId()));
                    log.error("Error while creating event client");
                }
            } catch (Exception e) {
                log.error("Error while creating event client");
            }
            log.info(logPrefix + "EventPublisherBolt connecting to CEP Publisher at " + endpoint.getOne() + ":" + endpoint.getTwo());
        }
    }
}


text:
(function(__global) {
  var loader = $__System;
  var hasOwnProperty = Object.prototype.hasOwnProperty;
  var indexOf = Array.prototype.indexOf || function(item) {
    for (var i = 0, l = this.length; i < l; i++)
      if (this[i] === item)
        return i;
    return -1;
  }

  function readMemberExpression(p, value) {
    var pParts = p.split('.');
    while (pParts.length)
      value = value[pParts.shift()];
    return value;
  }

  function getGlobalValue(exports) {
    if (typeof exports == 'string')
      return readMemberExpression(exports, __global);

    if (!(exports instanceof Array))
      throw new Error('Global exports must be a string or array.');

    var globalValue = {};
    var first = true;
    for (var i = 0; i < exports.length; i++) {
      var val = readMemberExpression(exports[i], __global);
      if (first) {
        globalValue['default'] = val;
        first = false;
      }
      globalValue[exports[i].split('.').pop()] = val;
    }
    return globalValue;
  }

  // bare minimum ignores
  var ignoredGlobalProps = ['_g', 'sessionStorage', 'localStorage', 'clipboardData', 'frames', 'frameElement', 'external',
      'mozAnimationStartTime', 'webkitStorageInfo', 'webkitIndexedDB', 'mozInnerScreenY', 'mozInnerScreenX'];

  var globalSnapshot;

  function forEachGlobal(callback) {
    if (Object.keys)
      Object.keys(__global).forEach(callback);
    else
      for (var g in __global) {
        if (!hasOwnProperty.call(__global, g))
          continue;
        callback(g);
      }
  }

  function forEachGlobalValue(callback) {
    forEachGlobal(function(globalName) {
      if (indexOf.call(ignoredGlobalProps, globalName) != -1)
        return;
      try {
        var value = __global[globalName];
      }
      catch (e) {
        ignoredGlobalProps.push(globalName);
      }
      callback(globalName, value);
    });
  }

  loader.set('@@global-helpers', loader.newModule({
    prepareGlobal: function(moduleName, exports, globals) {
      // disable module detection
      var curDefine = __global.define;
      __global.define = undefined;

      // set globals
      var oldGlobals;
      if (globals) {
        oldGlobals = {};
        for (var g in globals) {
          oldGlobals[g] = __global[g];
          __global[g] = globals[g];
        }
      }

      // store a complete copy of the global object in order to detect changes
      if (!exports) {
        globalSnapshot = {};

        forEachGlobalValue(function(name, value) {
          globalSnapshot[name] = value;
        });
      }

      // return function to retrieve global
      return function() {
        var globalValue;

        if (exports) {
          globalValue = getGlobalValue(exports);
        }
        else {
          globalValue = {};
          var singleGlobal;
          var multipleExports;

          forEachGlobalValue(function(name, value) {
            if (globalSnapshot[name] === value)
              return;
            if (typeof value == 'undefined')
              return;
            globalValue[name] = value;

            if (typeof singleGlobal != 'undefined') {
              if (!multipleExports && singleGlobal !== value)
                multipleExports = true;
            }
            else {
              singleGlobal = value;
            }
          });
          globalValue = multipleExports ? globalValue : singleGlobal;
        }

        // revert globals
        if (oldGlobals) {
          for (var g in oldGlobals)
            __global[g] = oldGlobals[g];
        }
        __global.define = curDefine;

        return globalValue;
      };
    }
  }));

})(typeof self != 'undefined' ? self : global);


text:
namespace SuperMassive
{
    using System;
    using System.Globalization;
    using System.Security.Cryptography;
    using System.Text;
    using Properties;

    /// <summary>
    /// Provides utilities to generate random primitives.
    /// </summary>
    public static class Randomizer
    {
        private const string RANDOM_POSSIBLE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        private static readonly char[] _randomChars = RANDOM_POSSIBLE_CHARS.ToCharArray();
        private static readonly Random _random = new Random();

        /// <summary>
        /// Gets a random int between 0 and max (half-inclusive)
        /// </summary>
        /// <param name="max">Maximum excluded value</param>
        /// <returns>A random generated integer</returns>
        public static int GetInt(int max = int.MaxValue)
        {
            return _random.Next(max);
        }

        /// <summary>
        /// Gets a random int between min and max (half-inclusive)
        /// </summary>
        /// <param name="min">Minimum included value</param>
        /// <param name="max">Maximum excluded value</param>
        /// <returns>A random generated integer</returns>
        public static int GetInt(int min, int max)
        {
            return GetInt(max - min) + min;
        }

        /// <summary>
        /// Gets a random float between 0 and 1 (full inclusive)
        /// </summary>
        /// <returns>A random generated float</returns>
        public static float GetFloat()
        {
            return GetFloat(1);
        }

        /// <summary>
        /// Gets a random float between 0 and max (full inclusive)
        /// </summary>
        /// <param name="max">Maximum included value</param>
        /// <returns>A random generated float</returns>
        public static float GetFloat(float max)
        {
            if (max < 0.0f) throw new ArgumentOutOfRangeException("max", Resources.GENERIC_GUARD_FAILURE_VALUESTRICTLYPOSITIVE);

            return (float)_random.NextDouble() * max;
        }

        /// <summary>
        /// Gets a random float between min and max.
        /// </summary>
        /// <param name="min">Minimum included value</param>
        /// <param name="max">Maximum included value</param>
        /// <returns>A random generated float</returns>
        public static float GetFloat(float min, float max)
        {
            if (max < min)
            {
                throw new ArgumentOutOfRangeException(
                nameof(max),
                string.Format(
                    CultureInfo.CurrentCulture,
                    Resources.GENERIC_GUARD_FAILURE_ARGUMENT_MUSTBE_GREATERTHAN_WITHFORMAT,
                    min,
                    max));
            }

            return GetFloat(max - min) + min;
        }

        /// <summary>
        /// Generates a random string suitable for security related uses.
        /// </summary>
        /// <param name="length">The length of the generated string</param>
        /// <returns>A random secured string</returns>
        /// <exception cref="ArgumentException">Argument length is null or negative</exception>
        public static string GetSecureRandomString(int? length = 64)
        {
            if (!length.HasValue || length.Value <= 0)
            {
                throw new ArgumentException(Resources.GENERIC_GUARD_FAILURE_VALUEPOSITIVE, "length");
            }

            byte[] buffer = new byte[length.Value];
            using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
            {
                rng.GetNonZeroBytes(buffer);
            }

            StringBuilder result = new StringBuilder(length.Value);
            foreach (byte b in buffer)
            {
                result.Append(_randomChars[b % _randomChars.Length]);
            }

            return result.ToString();
        }

        /// <summary>
        /// Generates a fast random string, unsuitable for secure uses.
        /// </summary>
        /// <param name="length">The length of the generated string</param>
        /// <returns>Returns a random string</returns>
        /// <exception cref="ArgumentException">Argument length is null or negative</exception>
        public static string GetRandomString(int? length = 64)
        {
            if (!length.HasValue || length.Value <= 0)
            {
                throw new ArgumentException(Resources.GENERIC_GUARD_FAILURE_VALUEPOSITIVE, "length");
            }

            char[] result = new char[length.Value];
            for (int i = 0; i < length.Value; i++)
            {
                result[i] = _randomChars[_random.Next(_randomChars.Length)];
            }

            return new string(result);
        }

        /// <summary>
        /// Generates one Bernoulli Trial.
        /// </summary>
        /// <param name="rnd">The random value to use.</param>
        /// <param name="p">The probability of generating a one (between 0 and 1).</param>
        /// <returns>A random sample from the Bernoulli distribution.</returns>
        public static int DoBernoulliTrial(double rnd, double p)
        {
            if (rnd < p)
            {
                return 1;
            }

            return 0;
        }

        /// <summary>
        /// Generates one Bernoulli Trial.
        /// </summary>
        /// <param name="p">The probability of generating a one (between 0 and 1).</param>
        /// <returns>A random sample from the Bernoulli distribution.</returns>
        public static int DoBernoulliTrial(double p)
        {
            if (GetFloat(1) < p)
                return 1;
            return 0;
        }

        /// <summary>
        /// A simple flip coin trial. Returns 0 or 1 with equal probability.
        /// </summary>
        /// <returns>1 or 0, indicated the result of the flip coin.</returns>
        public static int FlipCoin()
        {
            return DoBernoulliTrial(0.5);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<com.balysv.materialripple.MaterialRippleLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:clickable="true"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20px"
    app:mrl_rippleAlpha="0.05">

    <TextView
        android:id="@+id/tvItem"
        style="@style/mid_black"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:padding="10px"
        android:text="相册"/>
</com.balysv.materialripple.MaterialRippleLayout>


text:
<?php

namespace RectorPrefix20210615;

if (\class_exists('tx_sysaction_task')) {
    return;
}
class tx_sysaction_task
{
}
\class_alias('tx_sysaction_task', 'tx_sysaction_task', \false);


text:
Active Matches

  {{ matchPlayers(matchInfo) }} : {{ matchInfo.identifier }}

<create-match-form></create-match-form>