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

public class  DataInfo{
    private float m_graphNum;
    private float m_frameTime;
    private float m_frameInterval;
    private float m_luaConsuming;
    private float m_funConsuming;
    private int m_frameID;
    public DataInfo(float graphNum)
    {
        m_graphNum = graphNum;
    }
    public DataInfo(float graphNum, float frameTime)
    {
        m_graphNum = graphNum;
        m_frameTime = frameTime;
    }

    public DataInfo(float graphNum, float frameTime, float frameInterval)
    {
        m_graphNum = graphNum;
        m_frameTime = frameTime;
        m_frameInterval = frameInterval;
    }

    public DataInfo(float graphNum, float frameTime, float frameInterval, int frameID)
    {
        m_graphNum = graphNum;
        m_frameTime = frameTime;
        m_frameInterval = frameInterval;
        m_frameID = frameID;
    }

    public float FunConsuming
    {
        get
        {
            return m_funConsuming;
        }

        set { m_funConsuming = value; }
    }

    public float LuaConsuming
    {
        get
        {
            return m_luaConsuming;
        }

        set { m_luaConsuming = value; }
    }

    public float GraphNum
    {
        get
        {
            return m_graphNum;
        }

        set { m_graphNum = value; }
    }

    public float FrameTime
    {
        get
        {
            return m_frameTime;
        }

        set { m_frameTime = value; }
    }

    public float FrameInterval
    {
        get
        {
            return m_frameInterval;
        }

        set { m_frameInterval = value; }
    }

    public int FrameID
    {
        get
        {
            return m_frameID;
        }

        set { m_frameID = value; }
    }
}

public class GraphItDataInternalLuaPro
{
    public GraphItDataInternalLuaPro( int subgraph_index )
    {
        mDataInfos = new List<DataInfo>();
        mMin = 0.0f;
        mMax = 0.0f;

        switch(subgraph_index)
        {
            case 0:
                mColor = new Color( 0, 0.85f, 1, 1);
                break;
            case 1:
                mColor = Color.yellow;
                break;
            case 2:
                mColor = Color.green;
                break;
            case 3:
                mColor = Color.red;
                break;
            default:
                mColor = Color.green;
                break;
        }
    }
    public List<DataInfo> mDataInfos;
    public float mMin;
    public float mMax;
    public Color mColor;
}

public class GraphItDataLuaPro
{
    public const int DEFAULT_SAMPLES = 2048;
    public const int RECENT_WINDOW_SIZE = 120;

    public Dictionary<string, GraphItDataInternalLuaPro> mData = new Dictionary<string, GraphItDataInternalLuaPro>();

    public string mName;

    public int mCurrentIndex;
    public bool mInclude0;

    public bool mReadyForUpdate;
    public bool mFixedUpdate;

    public int mWindowSize;

    public bool mSharedYAxis;

    protected bool mHidden;
    protected float mHeight;

    public GraphItDataLuaPro( string name)
    {
        mName = name;

        mData = new Dictionary<string, GraphItDataInternalLuaPro>();

        mCurrentIndex = 0;
        mInclude0 = true;

        mReadyForUpdate = false;
        mFixedUpdate = false;

        mWindowSize = DEFAULT_SAMPLES;

        mSharedYAxis = false;
        mHidden = false;
        mHeight = 175;

        if (PlayerPrefs.HasKey(mName + "_height"))
        {
            SetHeight(PlayerPrefs.GetFloat(mName + "_height"));
        }
        if (PlayerPrefs.HasKey(mName + "_hidden"))
        {
            SetHidden(PlayerPrefs.GetInt(mName + "_hidden")==1);
        }
    }

    public int GraphLength()
    {
        return mCurrentIndex / mData.Count;
    }

    public float GetMin( string subgraph )
    {
        if (mSharedYAxis)
        {
            bool min_set = false;
            float min = 0;
            foreach (KeyValuePair<string, GraphItDataInternalLuaPro> entry in mData)
            {
                GraphItDataInternalLuaPro g = entry.Value;
                if (!min_set)
                {
                    min = g.mMin;
                    min_set = true;
                }
                min = Math.Min(min, g.mMin);
            }
            return min;
        }
        else
        {
            if (!mData.ContainsKey(subgraph))
            {
                mData[subgraph] = new GraphItDataInternalLuaPro(mData.Count);
            }
            return mData[subgraph].mMin;
        }
    }

    public float GetMax( string subgraph )
    {
        if (mSharedYAxis)
        {
            bool max_set = false;
            float max = 0;
            foreach (KeyValuePair<string, GraphItDataInternalLuaPro> entry in mData)
            {
                GraphItDataInternalLuaPro g = entry.Value;
                if (!max_set)
                {
                    max = g.mMax;
                    max_set = true;
                }
                max = Math.Max(max, g.mMax);
            }
            return max;
        }
        else
        {
            if (!mData.ContainsKey(subgraph))
            {
                mData[subgraph] = new GraphItDataInternalLuaPro(mData.Count);
            }
            return mData[subgraph].mMax;
        }
    }

    public float GetHeight()
    {
        return mHeight;
    }
    public void SetHeight( float height )
    {
        mHeight = height;
    }
    public void DoHeightDelta(float delta)
    {
        SetHeight( Mathf.Max(mHeight + delta, 50) );
        PlayerPrefs.SetFloat( mName+"_height", GetHeight() );
    }

    public bool GetHidden()
    {
        return mHidden;
    }
    public void SetHidden(bool hidden)
    {
        mHidden = hidden;
        PlayerPrefs.SetInt(mName + "_hidden", GetHidden() ? 1 : 0 );
    }

}

public class GraphItLuaPro : MonoBehaviour
{

#if UNITY_EDITOR
    public const string BASE_GRAPH = "base";
    public const string VERSION = "1.2.0";
    public Dictionary<string, GraphItDataLuaPro> Graphs = new Dictionary<string, GraphItDataLuaPro>();
    static GraphItLuaPro mInstance = null;
#endif

    public static GraphItLuaPro Instance
    {
        get
        {
#if UNITY_EDITOR
            if( mInstance == null )
            {
                GameObject go = new GameObject("GraphIt");
                go.hideFlags = HideFlags.HideAndDontSave;
                mInstance = go.AddComponent<GraphItLuaPro>();
            }
            return mInstance;
#else
            return null;
#endif
        }
    }

    public static void Clear()
    {
        if (!mInstance)
            return;
        foreach (KeyValuePair<string, GraphItDataLuaPro> kv in mInstance.Graphs)
        {
            GraphItDataLuaPro g = kv.Value;
            g.mCurrentIndex = 0;
            foreach (KeyValuePair<string, GraphItDataInternalLuaPro> entry in g.mData)
            {
                GraphItDataInternalLuaPro gdi = entry.Value;
                gdi.mDataInfos.Clear();
            }
        }
    }

    /// <summary>
    /// Optional setup function that allows you to specify both the inclusion of Y-axis 0, and how many samples to track.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="include_0"></param>
    /// <param name="sample_window"></param>
    public static void GraphSetup(string graph, bool include_0, int sample_window)
    {
#if UNITY_EDITOR
        GraphSetupInclude0(graph, include_0);
        GraphSetupSampleWindowSize(graph, sample_window);
#endif
    }

    /// <summary>
    /// Optional setup function that allows you to specify both the inclusion of Y-axis 0.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="subgraph"></param>
    /// <param name="include_0"></param>
    public static void GraphSetupInclude0(string graph, bool include_0)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        g.mInclude0 = include_0;
#endif
    }

    /// <summary>
    /// Optional setup function that allows you to specify the initial height of a graph.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="subgraph"></param>
    /// <param name="height"></param>
    public static void GraphSetupHeight(string graph, float height)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        g.SetHeight(height);
#endif
    }

    /// <summary>
    /// Optional setup function that allows you to specify if the graph is hidden or not by default
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="subgraph"></param>
    /// <param name="include_0"></param>
    public static void GraphSetupHidden(string graph, bool hidden)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        g.SetHidden(hidden);
#endif
    }

    /// <summary>
    /// Optional setup function that allows you to specify how many samples to track.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="sample_window"></param>
    public static void GraphSetupSampleWindowSize(string graph, int sample_window)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        int samples = Math.Max(sample_window, GraphItDataLuaPro.RECENT_WINDOW_SIZE + 1);
        g.mWindowSize = samples;
        //foreach (KeyValuePair<string, GraphItDataInternalLuaPro> entry in g.mData)
        //{
        //    //GraphItDataInternalLuaPro _g = entry.Value;
        //    //_g.mDataPoints = new float[samples];
        //}
#endif
    }

    /// <summary>
    /// Optional setup function that allows you to specify the color of the graph.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="color"></param>
    public static void GraphSetupColour(string graph, Color color)
    {
#if UNITY_EDITOR
        GraphSetupColour(graph, BASE_GRAPH, color);
#endif
    }

    /// <summary>
    /// Optional setup function that allows you to specify the color of the subgraph.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="subgraph"></param>
    /// <param name="color"></param>
    public static void GraphSetupColour(string graph, string subgraph, Color color)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        if (!g.mData.ContainsKey(subgraph))
        {
            g.mData[subgraph] = new GraphItDataInternalLuaPro(g.mData.Count);
        }
        g.mData[subgraph].mColor = color;
#endif
    }

    /// <summary>
    /// Log floating point data for this frame. Mutiple calls to this with the same graph will add logged values together.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="subgraph"></param>
    /// <param name="f"></param>
    public static void Log(string graph, string subgraph, List<DataInfo> diList)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        if (!g.mData.ContainsKey(subgraph))
        {
            g.mData[subgraph] = new GraphItDataInternalLuaPro(g.mData.Count);
        }
        foreach (var di in diList)
        {
            g.mData[subgraph].mDataInfos.Add(di);
        }
        Instance.Graphs[graph].mCurrentIndex += diList.Count;
#endif
    }

    /// <summary>
    /// Allows you to switch between sharing the y-axis on a graph for all subgraphs, or for them to be independent.
    /// </summary>
    /// <param name="graph"></param>
    /// <param name="shared_y_axis"></param>
    public static void ShareYAxis(string graph, bool shared_y_axis)
    {
#if UNITY_EDITOR
        if (!Instance.Graphs.ContainsKey(graph))
        {
            Instance.Graphs[graph] = new GraphItDataLuaPro(graph);
        }

        GraphItDataLuaPro g = Instance.Graphs[graph];
        g.mSharedYAxis = shared_y_axis;
#endif
    }
}


text:
package orz.Type.Primitive;

import orz.Type.Value;

import java.util.ArrayList;

/**
 * Created by sicongfeng on 16/2/19.
 */

public abstract class PrimitiveFunction extends Value {
    public String name;
    public int arity;

    public PrimitiveFunction(String name, int arity) {
        this.name = name;
        this.arity = arity;
    }

    public abstract Value apply(ArrayList<Value> args);

    public String toString() {
        return name;
    }

}

redpajama_set_name: RedPajamaGithub


text:
/* andreas08 - an open source xhtml/css website layout by Andreas Viklund - http://andreasviklund.com . Free to use in any way and for any purpose as long as the proper credits are given to the original designer. Version: 1.0, November 28, 2005 */

/**************** Body and tag styles ****************/

*{margin:0; padding:0;}

body{
font:76% Verdana,Tahoma,Arial,sans-serif;
line-height:1.4em;
text-align:center;
color:#303030;
background:#e8eaec;
}

a{
color:#467aa7;
font-weight:bold;
text-decoration:none;
background-color:inherit;
}

a:hover{color:#2a5a8a; text-decoration:none; background-color:inherit;}
a img{border:none;}

p{padding:0 0 1.6em 0;}
p form{margin-top:0; margin-bottom:20px;}

img.left,img.center,img.right{padding:4px; border:1px solid #a0a0a0;}
img.left{float:left; margin:0 12px 5px 0;}
img.center{display:block; margin:0 auto 5px auto;}
img.right{float:right; margin:0 0 5px 12px;}

/**************** Header and navigation styles ****************/

#container{
width:760px;
margin:20px auto;
padding:1px 0;
text-align:left;
background:#ffffff;
color:#303030;
border:2px solid #a0a0a0;
}

#header{
height:110px;
width:758px;
margin:0 1px 1px 1px;
background:#467aa7;
color:#ffffff;
}

#header h1{
padding:35px 0 0 20px;
font-size:2.4em;
background-color:inherit;
color:#ffffff;
letter-spacing:-2px;
font-weight:normal;
}

#header h2{
margin:10px 0 0 40px;
font-size:1.4em;
background-color:inherit;
color:#f0f2f4;
letter-spacing:-1px;
font-weight:normal;
}

#navigation{
height:2.2em;
line-height:2.2em;
width:758px;
margin:0 1px;
background:#578bb8;
color:#ffffff;
}

#navigation li{
float:left;
list-style-type:none;
border-right:1px solid #ffffff;
white-space:nowrap;
}

#navigation li a{
display:block;
padding:0 10px;
font-size:0.8em;
font-weight:normal;
text-transform:uppercase;
text-decoration:none;
background-color:inherit;
color: #ffffff;
}

* html #navigation a {width:1%;}

#navigation .selected,#navigation a:hover{
background:#80b0da;
color:#ffffff;
text-decoration:none;
}

/**************** Content styles ****************/

#content{
float:left;
width:530px;
font-size:0.9em;
padding:20px 0 0 20px;
}

#content h2{
display:block;
margin:0 0 16px 0;
font-size:1.7em;
font-weight:normal;
letter-spacing:-1px;
color:#505050;
background-color:inherit;
}

#content h2 a{font-weight:normal;}
#content h3{margin:0 0 5px 0; font-size:1.4em; letter-spacing:-1px;}
#content a:hover,#subcontent a:hover{text-decoration:underline;}
#content ul,#content ol{margin:0 5px 16px 35px;}
#content dl{margin:0 5px 10px 25px;}
#content dt{font-weight:bold; margin-bottom:5px;}
#content dd{margin:0 0 10px 15px;}

/**************** Sidebar styles ****************/

#subcontent{
float:right;
width:170px;
padding:20px 20px 10px 0;
line-height:1.4em;
}

#subcontent h2{
display:block;
margin:0 0 15px 0;
font-size:1.6em;
font-weight:normal;
text-align:left;
letter-spacing:-1px;
color:#505050;
background-color:inherit;
}

#subcontent p{margin:0 0 16px 0; font-size:0.9em;}

/**************** Menublock styles ****************/

.menublock{margin:0 0 20px 8px; font-size:0.9em;}
.menublock li{list-style:none; display:block; padding:2px; margin-bottom:2px;}
.menublock li a{font-weight:bold; text-decoration:none;}
.menublock li a:hover{text-decoration:none;}
.menublock li ul{margin:3px 0 3px 15px; font-size:1em; font-weight:normal;}
.menublock li ul li{margin-bottom:0;}
.menublock li ul a{font-weight:normal;}

/**************** Searchbar styles ****************/

#searchbar{margin:0 0 20px 0;}
#searchbar form fieldset{margin-left:10px; border:0 solid;}

#searchbar #s{
height:1.2em;
width:110px;
margin:0 5px 0 0;
border:1px solid #a0a0a0;
}

#searchbar #searchbutton{
width:auto;
padding:0 1px;
border:1px solid #808080;
font-size:0.9em;
text-align:center;
}

/**************** Footer styles ****************/

#footer{
clear:both;
width:758px;
padding:5px 0;
margin:0 1px;
font-size:0.9em;
color:#f0f0f0;
background:#467aa7;
}

#footer p{padding:0; margin:0; text-align:center;}
#footer a{color:#f0f0f0; background-color:inherit; font-weight:bold;}
#footer a:hover{color:#ffffff; background-color:inherit; text-decoration: underline;}

/**************** Misc classes and styles ****************/

.splitcontentleft{float:left; width:48%;}
.splitcontentright{float:right; width:48%;}
.clear{clear:both;}
.small{font-size:0.8em;}
.hide{display:none;}
.textcenter{text-align:center;}
.textright{text-align:right;}
.important{color:#f02025; background-color:inherit; font-weight:bold;}

.box{
margin:0 0 20px 0;
padding:10px;
border:1px solid #c0c0c0;
background-color:#fafbfc;
color:#505050;
line-height:1.5em;
}


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace SimplementE.TaskPad.Business.Integrations
{
    public static class SlackHelper
    {
        [DataContract]
        private class playload
        {
            [DataMember]
            public string text { get; set; }

            [DataMember]
            public string username { get; set; }

            [DataMember]
            public string icon_url { get; set; }
            [DataMember]
            public string channel { get; set; }
        }

        public static void SendSimpleWebHookMessage(string text, string channel = null, string username=null, string userimg=null)
        {
            string url = MyConnectionStrings.Slack;
            if (string.IsNullOrEmpty(url))
                return;

            playload p = new playload();
            text = Uri.EscapeDataString(text);
            p.text = text;
            if (string.IsNullOrEmpty(username))
                p.username = "simplement-e";
            else
                p.username = username;
            if (string.IsNullOrEmpty(userimg))
                p.icon_url = "https://simplementedata.blob.core.windows.net/simplementesite/logo_avec_fond_bleu_144.png";
            else
                p.icon_url = userimg;
            if (!string.IsNullOrEmpty(channel))
                p.channel = channel;
            RestWebServiceClientHelper.Raw(url, "POST", "payload=" + JsonConvert.SerializeObject(p));
        }
    }
}


text:
require 'spec_helper'

describe ChartMogul::ChartMogulError do
  let(:message) { 'This is a test error' }

  subject { ChartMogul::ChartMogulError.new(message, http_status: http_status) }

  context 'when a HTTP status is supplied' do
    let(:http_status) { 404 }

    it 'generates the correct error message' do
      expect(subject.to_s).to eq('This is a test error (HTTP Status: 404)')
    end
  end

  context 'when a HTTP status is not supplied' do
    let(:http_status) { nil }

    it 'generates the correct error message' do
      expect(subject.to_s).to eq('This is a test error')
    end
  end
end


text:
package com.atlassian.jira.plugins.dvcs.service.admin;

import org.codehaus.jackson.map.ObjectMapper;
import org.testng.annotations.Test;

import java.io.IOException;

import static org.fest.assertions.api.Assertions.assertThat;

public class DevSummaryCachePrimingStatusTest
{
    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
    private static final Exception PREVIOUS_ERROR = new Exception("previous exception");
    private static final int ISSUE_KEY_COUNT = 1000;
    private static final int TOTAL_ISSUE_KEY_COUNT = 2000;
    private static final int PULL_REQUEST_COUNT = 200;
    private static final int TOTAL_PULL_REQUEST_COUNT = 400;

    @Test
    public void shouldBeAbleToStartExclusivelyIfNoPrimingRunning()
    {
        assertStartExclusively(false, true);
    }

    @Test
    public void shouldNotBeAbleToStartExclusivelyIfPrimingRunning()
    {
        assertStartExclusively(true, false);
    }

    /**
     * Convenience method for asserting whether a priming operation has started.
     *
     * @param alreadyStarted whether the operation should already appear to be started
     * @param expectedToBeStarted the new expected state of the operation
     */
    private static void assertStartExclusively(
            final boolean alreadyStarted, final boolean expectedToBeStarted)
    {
        // Set up
        final DevSummaryCachePrimingStatus status =
                new DevSummaryCachePrimingStatus(alreadyStarted, ISSUE_KEY_COUNT, TOTAL_ISSUE_KEY_COUNT, PULL_REQUEST_COUNT,
                        TOTAL_PULL_REQUEST_COUNT, PREVIOUS_ERROR, true, "FOO");

        // Invoke
        final boolean started = status.startExclusively(TOTAL_ISSUE_KEY_COUNT, TOTAL_PULL_REQUEST_COUNT);

        // Check
        assertThat(started).isEqualTo(expectedToBeStarted);
    }

    /**
     * Convenience method for asserting the state of a DevSummaryCachePrimingStatus.
     *
     * @param status the instance to check
     * @param expectedError the expected value
     * @param expectedIssueKeyCount the expected value
     * @param expectedInProgress the expected value
     * @param expectedTotalIssueCount the expected value
     * @param expectedToBeStopped whether the status is expected to be stopped
     */
    private static void assertStatus(final DevSummaryCachePrimingStatus status, final Exception expectedError,
            final boolean expectedInProgress, final int expectedIssueKeyCount, final int expectedTotalIssueCount,
            final int expectedPullRequestCount, final int expectedTotalPullRequestCount,
            final boolean expectedToBeStopped)
    {
        assertThat(status.getError()).isEqualTo(expectedError);
        assertThat(status.isInProgress()).isEqualTo(expectedInProgress);
        assertThat(status.getIssueKeyCount()).isEqualTo(expectedIssueKeyCount);
        assertThat(status.getTotalIssueKeyCount()).isEqualTo(expectedTotalIssueCount);
        assertThat(status.getPullRequestCount()).isEqualTo(expectedPullRequestCount);
        assertThat(status.getTotalPullRequestCount()).isEqualTo(expectedTotalPullRequestCount);
        assertThat(status.isStopped()).isEqualTo(expectedToBeStopped);
    }

    @Test
    public void newStatusShouldHaveCorrectInitialState()
    {
        final DevSummaryCachePrimingStatus status = new DevSummaryCachePrimingStatus();

        assertStatus(status, null, false, 0, 0, 0, 0, false);
    }

    @Test
    public void failedShouldRetainIssueCounts()
    {
        final Exception exception = new Exception("oops");
        final DevSummaryCachePrimingStatus status =
                new DevSummaryCachePrimingStatus(true, ISSUE_KEY_COUNT, TOTAL_ISSUE_KEY_COUNT, PULL_REQUEST_COUNT,
                        TOTAL_PULL_REQUEST_COUNT, null, true, "FOO");

        status.failed(exception, "FPP");

        assertStatus(status, exception, false, ISSUE_KEY_COUNT, TOTAL_ISSUE_KEY_COUNT,
                PULL_REQUEST_COUNT, TOTAL_PULL_REQUEST_COUNT, false);
    }

    @Test
    public void startingPrimingShouldClearPreviousState()
    {
        final int previousTotalIssueCount = 1;
        final int previousTotalPullRequestCount = 2;
        final DevSummaryCachePrimingStatus status =
                new DevSummaryCachePrimingStatus(false, ISSUE_KEY_COUNT, previousTotalIssueCount,
                        PULL_REQUEST_COUNT, previousTotalPullRequestCount, PREVIOUS_ERROR, true, "FOO");
        status.startExclusively(TOTAL_ISSUE_KEY_COUNT, TOTAL_PULL_REQUEST_COUNT);

        assertStatus(status, null, true, 0, TOTAL_ISSUE_KEY_COUNT, 0, TOTAL_PULL_REQUEST_COUNT,
                false);
    }

    @Test
    public void startingNextIssueShouldIncrementThePrimingIssueCount()
    {
        final DevSummaryCachePrimingStatus status = new DevSummaryCachePrimingStatus();
        status.startExclusively(TOTAL_ISSUE_KEY_COUNT, TOTAL_PULL_REQUEST_COUNT);

        final int numberInBatch = 50;
        int result = status.completedIssueKeyBatch(numberInBatch);

        assertThat(numberInBatch).isEqualTo(result);

        assertStatus(status, null, true, numberInBatch, TOTAL_ISSUE_KEY_COUNT,
                0, TOTAL_PULL_REQUEST_COUNT, false);
    }

    @Test
    public void startingNextPRShouldIncrementThePRCount()
    {
        final DevSummaryCachePrimingStatus status = new DevSummaryCachePrimingStatus();
        status.startExclusively(TOTAL_ISSUE_KEY_COUNT, TOTAL_PULL_REQUEST_COUNT);

        status.completedPullRequestIssueKeyBatch(10);

        assertStatus(status, null, true, 0, TOTAL_ISSUE_KEY_COUNT,
                10, TOTAL_PULL_REQUEST_COUNT, false);
    }

    @Test
    public void successfulPrimingShouldRetainItsValues()
    {
        final DevSummaryCachePrimingStatus status = new DevSummaryCachePrimingStatus();
        final int totalIssueCount = 2;
        final int totalPRCount = 1;
        status.startExclusively(totalIssueCount, totalPRCount);
        status.completedIssueKeyBatch(2);
        status.completedPullRequestIssueKeyBatch(1);

        status.finished("FOO");

        // Finished but we didn't manually stop so expect stopped to be false
        assertStatus(status, null, false, totalIssueCount, totalIssueCount,
                totalPRCount, totalPRCount, false);
    }

    @Test
    public void stoppingShouldSetStoppedFlag()
    {
        final DevSummaryCachePrimingStatus status = new DevSummaryCachePrimingStatus();
        status.startExclusively(0, 0);

        status.stopped();

        assertStatus(status, null, true, 0, 0, 0, 0, true);
    }

    @Test
    public void shouldBeRoundTrippableViaJson() throws Exception
    {
        final DevSummaryCachePrimingStatus statusIn = new DevSummaryCachePrimingStatus(true, ISSUE_KEY_COUNT,
                TOTAL_ISSUE_KEY_COUNT, PULL_REQUEST_COUNT, TOTAL_PULL_REQUEST_COUNT, null, false, "FOO");

        final String json = OBJECT_MAPPER.writeValueAsString(statusIn);

        final DevSummaryCachePrimingStatus statusOut = OBJECT_MAPPER.readValue(json, DevSummaryCachePrimingStatus.class);
        assertStatus(statusOut,
                statusIn.getError(),
                statusIn.isInProgress(),
                statusIn.getIssueKeyCount(),
                statusIn.getTotalIssueKeyCount(),
                statusIn.getPullRequestCount(),
                statusIn.getTotalPullRequestCount(),
                statusIn.isStopped()
        );
    }

    @Test
    public void jsonShouldIncludeErrorDetailsIfPrimingFailed() throws IOException
    {
        final String errorMessage = "Oops!";

        final DevSummaryCachePrimingStatus status = new DevSummaryCachePrimingStatus(true, ISSUE_KEY_COUNT,
                TOTAL_ISSUE_KEY_COUNT, PULL_REQUEST_COUNT, TOTAL_PULL_REQUEST_COUNT, new Exception(errorMessage), false, "FOO");

        status.startExclusively(TOTAL_ISSUE_KEY_COUNT, TOTAL_PULL_REQUEST_COUNT);
        final String timeTaken = "foo";
        status.failed(new Exception(errorMessage), timeTaken);

        final String json = OBJECT_MAPPER.writeValueAsString(status);

        assertThat(json).contains(errorMessage);
        assertThat(json).contains(status.getTimeTaken());
    }
}


text:
// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {assert} from 'chrome://resources/js/assert_ts.js';
import {addWebUIListener, removeWebUIListener, WebUIListener} from 'chrome://resources/js/cr.m.js';

import {aboutInfo} from './about.js';
import {getAllNodes, requestIncludeSpecificsInitialState, requestListOfTypes, SyncNode, SyncNodeMap} from './chrome_sync.js';
import {log} from './sync_log.js';

const dumpToTextButton = document.querySelector<HTMLElement>('#dump-to-text');
assert(dumpToTextButton);
const dataDump = document.querySelector<HTMLElement>('#data-dump');
assert(dataDump);
dumpToTextButton.addEventListener('click', function() {
  // TODO(akalin): Add info like Chrome version, OS, date dumped, etc.

  let data = '';
  data += '======\n';
  data += 'Status\n';
  data += '======\n';
  data += JSON.stringify(aboutInfo, null, 2);
  data += '\n';
  data += '\n';

  data += '===\n';
  data += 'Log\n';
  data += '===\n';
  data += JSON.stringify(log.entries, null, 2);
  data += '\n';

  dataDump.textContent = data;
});

const allFields = [
  'ID',
  'IS_UNSYNCED',
  'IS_UNAPPLIED_UPDATE',
  'BASE_VERSION',
  'BASE_VERSION_TIME',
  'SERVER_VERSION',
  'SERVER_VERSION_TIME',
  'PARENT_ID',
  'SERVER_PARENT_ID',
  'IS_DEL',
  'SERVER_IS_DEL',
  'modelType',
  'SERVER_SPECIFICS',
  'SPECIFICS',
];

function versionToDateString(version: string) {
  // TODO(mmontgomery): ugly? Hacky? Is there a better way?
  const epochLength = Date.now().toString().length;
  const epochTime = parseInt(version.slice(0, epochLength), 10);
  const date = new Date(epochTime);
  return date.toString();
}

/**
 * @param node A JavaScript represenation of a sync entity.
 * @return A string representation of the sync entity.
 */
function serializeNode(node: SyncNode): string[] {
  const includeSpecifics =
      document.querySelector<HTMLInputElement>('#include-specifics');
  assert(includeSpecifics);
  return allFields.map(function(field) {
    let fieldVal;
    if (field === 'SERVER_VERSION_TIME') {
      const version = node['SERVER_VERSION'];
      if (version != null) {
        fieldVal = versionToDateString(version);
      }
    }
    if (field === 'BASE_VERSION_TIME') {
      const version = node['BASE_VERSION'];
      if (version != null) {
        fieldVal = versionToDateString(version);
      }
    } else if (
        (field === 'SERVER_SPECIFICS' || field === 'SPECIFICS') &&
        (!includeSpecifics.checked)) {
      fieldVal = 'REDACTED';
    } else if (
        (field === 'SERVER_SPECIFICS' || field === 'SPECIFICS') &&
        includeSpecifics.checked) {
      fieldVal = JSON.stringify(node[field]);
    } else {
      fieldVal = (node as unknown as {[key: string]: string})[field];
    }
    return fieldVal || '';
  });
}

/**
 * @param type The name of a sync model type.
 * @return True if the type's checkbox is selected.
 */
function isSelectedDatatype(type: string): boolean {
  const typeCheckbox = document.querySelector<HTMLInputElement>(`#${type}`);
  // Some types, such as 'Top level folder', appear in the list of nodes
  // but not in the list of selectable items.
  if (typeCheckbox == null) {
    return false;
  }
  return typeCheckbox.checked;
}

function makeBlobUrl(data: string): string {
  const textBlob = new Blob([data], {type: 'octet/stream'});
  const blobUrl = window.URL.createObjectURL(textBlob);
  return blobUrl;
}

function makeDownloadName() {
  // Format is sync-data-dump-$epoch-$year-$month-$day-$OS.csv.
  const now = new Date();
  const friendlyDate =
      [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('-');
  const name = [
    'sync-data-dump',
    friendlyDate,
    Date.now(),
    navigator.platform,
  ].join('-');
  return [name, 'csv'].join('.');
}

function makeDateUserAgentHeader() {
  const now = new Date();
  const userAgent = window.navigator.userAgent;
  const dateUaHeader = [now.toISOString(), userAgent].join(',');
  return dateUaHeader;
}

/**
 * Builds a summary of current state and exports it as a downloaded file.
 *
 * @param nodesMap Summary of local state by model type.
 */
function triggerDataDownload(nodesMap: SyncNodeMap) {
  // Prepend a header with ISO date and useragent.
  const output = [makeDateUserAgentHeader()];
  output.push('=====');

  const aboutInfoString = JSON.stringify(aboutInfo, null, 2);
  output.push(aboutInfoString);

  // Filter out non-selected types.
  const selectedTypesNodes = nodesMap.filter(function(x) {
    return isSelectedDatatype(x.type);
  });

  // Serialize the remaining nodes and add them to the output.
  selectedTypesNodes.forEach(function(typeNodes) {
    output.push('=====');
    output.push(typeNodes.nodes.map(serializeNode).join('\n'));
  });

  const outputString = output.join('\n');

  const anchor =
      document.querySelector<HTMLAnchorElement>('#dump-to-file-anchor');
  assert(anchor);
  anchor.href = makeBlobUrl(outputString);
  anchor.download = makeDownloadName();
  anchor.click();
}

function createTypesCheckboxes(types: string[]) {
  const containerElt =
      document.querySelector<HTMLElement>('#node-type-checkboxes');
  assert(containerElt);

  types.map(function(type: string) {
    const div = document.createElement('div');

    const checkbox = document.createElement('input');
    checkbox.id = type;
    checkbox.type = 'checkbox';
    checkbox.checked = true;
    div.appendChild(checkbox);

    const label = document.createElement('label');
    // Assigning to label.for doesn't work.
    label.setAttribute('for', type);
    label.innerText = type;
    div.appendChild(label);

    containerElt.appendChild(div);
  });
}

let listOfTypesListener: WebUIListener|null = null;

function onReceivedListOfTypes(response: {types: string[]}) {
  const types = response.types;
  types.sort();
  createTypesCheckboxes(types);
  assert(listOfTypesListener);
  removeWebUIListener(listOfTypesListener);
}

function onReceivedIncludeSpecificsInitialState(
    response: {includeSpecifics: boolean}) {
  const captureSpecifics =
      document.querySelector<HTMLInputElement>('#capture-specifics');
  assert(captureSpecifics);
  captureSpecifics.checked = response.includeSpecifics;
}

document.addEventListener('DOMContentLoaded', function() {
  listOfTypesListener =
      addWebUIListener('onReceivedListOfTypes', onReceivedListOfTypes);
  requestListOfTypes();

  addWebUIListener(
      'onReceivedIncludeSpecificsInitialState',
      onReceivedIncludeSpecificsInitialState);
  requestIncludeSpecificsInitialState();
});

const dumpToFileLink = document.querySelector<HTMLElement>('#dump-to-file');
assert(dumpToFileLink);
dumpToFileLink.addEventListener('click', function() {
  getAllNodes(triggerDataDownload);
});


text:
/**
 * Created by gokhanyavas on 30.04.2017.
 */
public class DecoratorPatternDemo {
    public static void main(String[] args) {

        Shape circle = new Circle();

        Shape redCircle = new RedShapeDecorator(new Circle());

        Shape redRectangle = new RedShapeDecorator(new Rectangle());
        System.out.println("Circle with normal border");
        circle.draw();

        System.out.println("\nCircle of red border");
        redCircle.draw();

        System.out.println("\nRectangle of red border");
        redRectangle.draw();
    }
}


text:
'use strict';

var DataGrid  = require('../DataGrid')
var React     = require('react')
var TestUtils = require('react-dom/test-utils');

var TABLE_CLASS         = 'z-table'
var ROW_CLASS           = 'z-row'
var GROUP_ROW_CLASS		= 'z-group-row'
var GROUPED_ROW_CLASS	= 'z-grouped'
var CELL_CLASS          = 'z-cell'
var CELL_TEXT_CLASS     = 'z-text'
var ALIGN_RIGHT_CLASS   = 'z-align-right'
var SORT_ASC_CLASS      = 'z-asc'
var SORT_DESC_CLASS     = 'z-desc'
var COLUMN_HEADER_CLASS = 'z-column-header'

var testUtils = require('../utils')

var render        = testUtils.render
var findWithClass = testUtils.findWithClass
var tryWithClass  = testUtils.tryWithClass
var generateMockData = testUtils.generateMockData

describe('DataGrid Test Suite -  Grouping',function() {

	xit('check groupBy prop works',function() {

		var data = generateMockData({type : 'local',len : 10})
		// prepare data for grouping
		data.map(function(row,index) {
			if(index%2) {
				row.country = 'USA'
			} else {
				row.country = 'India'
			}
		})

		var columns = [
		    { name: 'index', title: '#', width: 50 },
		    { name: 'firstName'},
		    { name: 'lastName'  },
		    { name: 'city' },
		    { name: 'email' },
		    { name: 'country'}
		];

		var table = render(
            DataGrid({
                idProperty: 'id',
                dataSource: data,
                columns   : columns,
                style	  : { height : 400 },
                groupBy	  : ['country']
            })
        )

        var groupHeaders = tryWithClass(table,GROUP_ROW_CLASS)
        groupHeaders.length.should.equal(2)
        React.findDOMNode(groupHeaders[0]).textContent.should.equal('India')
        React.findDOMNode(groupHeaders[1]).textContent.should.equal('USA')

        var groupedRows = tryWithClass(table,GROUPED_ROW_CLASS)
        groupedRows.length.should.equal(10)
        groupedRows.map(function(row,index) {
        	var cells = tryWithClass(row,CELL_CLASS)
        	if(index < 5) {
        		React.findDOMNode(cells[5]).textContent.should.equal('India')
        	} else {
        		React.findDOMNode(cells[5]).textContent.should.equal('USA')
        	}
        })

	})
})


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Object extension tests</title>

  <link rel="stylesheet" href="qunit.css" />


text:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

import { initialize as formForInitializer } from 'dummy/instance-initializers/form-for-initializer';
import config from 'dummy/config/environment';

moduleForComponent('form-controls/button', 'Integration | Component | {{form-controls/button}}', {
  integration: true,

  teardown() {
    delete config['ember-form-for'];
  }
});

test('It renders a button', function(assert) {
  this.render(hbs`{{form-controls/button}}`);
  assert.equal(this.$('button').length, 1, 'Button is rendered');
});

test('The type of the button is "button"', function(assert) {
  this.render(hbs`{{form-controls/button}}`);
  assert.equal(this.$('button').attr('type'), 'button', 'Type is button');
});

test('It can be passed a label value', function(assert) {
  this.render(hbs`{{form-controls/button label="TEST"}}`);
  assert.equal(this.$('button').text().trim(), 'TEST', 'The text on the button is TEST');
});

test('The label can also be a block', function(assert) {
  this.render(hbs`{{#form-controls/button}}TEST{{/form-controls/button}}`);
  assert.equal(this.$('button').text().trim(), 'TEST', 'The text on the button is TEST');
});

test('It can have a label value specified as a positional param', function(assert) {
  this.render(hbs`{{form-controls/button "Click Me"}}`);
  assert.equal(this.$('button').text().trim(), 'Click Me', 'Button has "Click Me" as label');
});

test('Clicking the button triggers the click action', function(assert) {
  assert.expect(1);
  this.on('click', () => assert.ok(true));
  this.render(hbs`{{form-controls/button click=(action 'click')}}`);
  this.$('button').trigger('click');
});

test('I can set and configure custom buttonClasses', function(assert) {
  config['ember-form-for'] = {
    buttonClasses: ['custom-class-1']
  };

  formForInitializer(this.container);

  this.set('buttonClasses', ['custom-class-2']);
  this.render(hbs`{{form-controls/button class=buttonClasses}}`);

  assert.equal(this.$('.custom-class-1').length, 1);
  assert.equal(this.$('.custom-class-2').length, 1);
});

test('I can set the disabled attribute', function(assert) {
  this.render(hbs`{{form-controls/button disabled=true}}`);
  assert.equal(this.$('button').attr('disabled'), 'disabled', 'disabled is set to true');
});

test('I can set the aria-controls attribute', function(assert) {
  this.render(hbs`{{form-controls/button aria-controls="foo"}}`);
  assert.equal(this.$('button').attr('aria-controls'), 'foo', 'aria-controls is set to foo');
});


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>digiGame: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

digiGame

Main Page

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

 All Classes Functions

Area Member List

This is the complete list of members for Area, including all inherited members.

anyAction()	Area	inline

Area(Character *m)	Area	inline

checkAlza(int X, int Y)	Area	inline

checkHome(int X, int Y)	Area	inline

checkItem()	Area	inline

checkLabel(int X, int Y)	Area	inline

checkMod(int x)	Area	inline

checkWork(int X, int Y)	Area	inline

complete()	Area	inline

endGame()	Area	inline

getRight(int X)	Area	inline

lastPicture()	Area	inline

load()	Area	inline

loadAllParts()	Area	inline

manWalk()	Area	inline

save(bool s)	Area	inline

selectItem(int positionOfIt) (defined in Area)	Area	inline

setDestinationX(int X, int Y)	Area	inline

setMan(bool actual, bool last)	Area	inline

setStr(QString str)	Area	inline

speak() (defined in Area)	Area	inline

special()	Area	inline

useItem() (defined in Area)	Area	inline

~Area()	Area	inline

Generated on Fri Dec 19 2014 21:25:12 for digiGame by

     1.8.8


text:
require 'faker'

church_names = [
  '1st Baptist', 'Community Bible', 'Bible Church', 'United Methodist',
  'Cornerstone', 'Covenant', 'Grace', 'Cross', 'Life', 'Mount Zion',
  'Promise', 'Providence', 'Redeemer', 'St David', 'St John', 'St Paul',
  'St Peter'
]

FactoryGirl.define do
  factory :person, class: RestoreStrategies::OrganizationPerson do
    given_name { Faker::Name.first_name }
    family_name { Faker::Name.last_name }
    church { church_names[Random.rand(church_names.length - 1)] }
    email { Faker::Internet.email }
    telephone { Faker::PhoneNumber.phone_number }
    street_address { Faker::Address.street_address }
    address_locality { Faker::Address.city }
    address_region { Faker::Address.state }
    postal_code {  Faker::Address.zip }
  end
end


text:
using LegendaryClient.Logic;
using PVPNetConnect.RiotObjects.Platform.Catalog.Icon;
using PVPNetConnect.RiotObjects.Platform.Summoner.Icon;
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;

namespace LegendaryClient.Windows
{
    /// <summary>
    /// Interaction logic for ChooseProfilePicturePage.xaml
    /// </summary>
    public partial class ChooseProfilePicturePage : Page
    {
        public ChooseProfilePicturePage()
        {
            InitializeComponent();
            GetIcons();
        }

        private async void GetIcons()
        {
            SummonerIconInventoryDTO PlayerIcons = await Client.PVPNet.GetSummonerIconInventory(Client.LoginPacket.AllSummonerData.Summoner.SumId);
            foreach (Icon ic in PlayerIcons.SummonerIcons)
            {
                Image champImage = new Image();
                champImage.Height = 64;
                champImage.Width = 64;
                champImage.Margin = new Thickness(5, 5, 5, 5);
                var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ic.IconId + ".png"), UriKind.Absolute);
                champImage.Source = new BitmapImage(uriSource);
                champImage.Tag = ic.IconId;
                SummonerIconListView.Items.Add(champImage);
            }
            for (int i = 0; i < 29; i++)
            {
                Image champImage = new Image();
                champImage.Height = 64;
                champImage.Width = 64;
                champImage.Margin = new Thickness(5, 5, 5, 5);
                var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", i + ".png"), UriKind.Absolute);
                champImage.Source = new BitmapImage(uriSource);
                champImage.Tag = i;
                SummonerIconListView.Items.Add(champImage);
            }
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            Client.OverlayContainer.Visibility = Visibility.Hidden;
        }

        private async void SetButton_Click(object sender, RoutedEventArgs e)
        {
            if (SummonerIconListView.SelectedItem != null)
            {
                Image m = (Image)SummonerIconListView.SelectedItem;
                int SummonerIcon = Convert.ToInt32(m.Tag);
                await Client.PVPNet.UpdateProfileIconId(SummonerIcon);
                Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId = SummonerIcon;
                Client.SetChatHover();
                var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", SummonerIcon + ".png"), UriKind.RelativeOrAbsolute);
                Client.MainPageProfileImage.Source = new BitmapImage(uriSource);
            }
            Client.OverlayContainer.Visibility = Visibility.Hidden;
            Client.done = true;
        }
    }
}


text:
package com.ctrip.platform.dal.dao.unittests;

import com.ctrip.platform.dal.dao.unitbase.MySqlDatabaseInitializer;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;

public class DalTableDaoMySqlTest extends DalTableDaoTestStub {
	private static MySqlDatabaseInitializer initializer = new MySqlDatabaseInitializer();
	public DalTableDaoMySqlTest() {
		super(initializer.DATABASE_NAME, initializer.diff);
	}

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		initializer.setUpBeforeClass();
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
 		initializer.tearDownAfterClass();
	}

	@Before
	public void setUp() throws Exception {
		initializer.setUp2();
	}

	@After
	public void tearDown() throws Exception {
		initializer.tearDown();
	}
}


text:
#region Copyright
//
// DotNetNuke® - http://www.dotnetnuke.com
// Copyright (c) 2002-2014
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion

using System.Web.UI;

namespace DotNetNuke.Services.Tokens
{
    public class HtmlTokenReplace : TokenReplace
    {
        public HtmlTokenReplace(Page page)
            : base(Scope.NoSettings)
        {
            PropertySource["css"] = new CssPropertyAccess(page);
            PropertySource["js"] = new JavaScriptPropertyAccess(page);
            PropertySource["javascript"] = new JavaScriptPropertyAccess(page);
            PropertySource["antiforgerytoken"] = new AntiForgeryTokenPropertyAccess();
        }
    }
}


text:
module Terrestrial
  module Cli
    class FileFinder

      EXCLUDED_FOLDERS = [
        /Carthage\//,
        /Pods\//,
        /Tests\//
      ]

      EXCLUDED_FILES = [
        "LaunchScreen.storyboard"
      ]

      def self.find(directory, extensions)
        self.new(directory, extensions).find
      end

      def initialize(directory, extensions)
        @directory  = directory
        @extensions = extensions
      end

      def find
        Dir[@directory + "/**/*.*"]
          .map {|f| relative_path(f) }
          .reject {|f| excluded_folders(f) }
          .select {|f| @extensions.include?(File.extname(f)) }
          .reject {|f| excluded_files(f) }
          .select {|f| valid_paths(f) }
      end

      private

      def relative_path(file)
        Pathname.new(file)
          .relative_path_from(Pathname.new(@directory))
          .to_s
      end

      def valid_paths(f)
        # Some files need to be in specific places to count
        # as "real files". For example, strings.xml files should
        # only be read if they are in /res/values/strings.xml
        #
        # Add rules here as needed.

        case File.extname(f)
        when ".xml"
          f.end_with? "/res/values/strings.xml"
        else
          true
        end
      end

      def excluded_folders(path)
        EXCLUDED_FOLDERS.any? { |folder| path.scan(folder).any? }
      end

      def excluded_files(path)
        EXCLUDED_FILES.any? { |name| File.basename(path) == name }
      end
    end
  end
end


text:
package com.yammer.dropwizard.authenticator.tests;

import com.yammer.dropwizard.authenticator.*;
import com.yammer.dropwizard.authenticator.healthchecks.LdapHealthCheck;
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.auth.AuthDynamicFeature;
import io.dropwizard.auth.AuthValueFactoryProvider;
import io.dropwizard.auth.Authenticator;
import io.dropwizard.auth.CachingAuthenticator;
import io.dropwizard.auth.basic.BasicCredentialAuthFilter;
import io.dropwizard.auth.basic.BasicCredentials;
import io.dropwizard.setup.Environment;

public class ExampleAppTest {
    static class ExampleAppConfiguration extends Configuration {
        private LdapConfiguration ldap = new LdapConfiguration();

        LdapConfiguration getLdapConfiguration() {
            return ldap;
        }
    }

    static class ExampleApp extends Application<ExampleAppConfiguration> {
        @Override
        public void run(ExampleAppConfiguration configuration, Environment environment) throws Exception {
            final LdapConfiguration ldapConfiguration = configuration.getLdapConfiguration();

            Authenticator<BasicCredentials, User> ldapAuthenticator = new CachingAuthenticator<>(
                    environment.metrics(),
                    new ResourceAuthenticator(new LdapAuthenticator(ldapConfiguration)),
                    ldapConfiguration.getCachePolicy());

            environment.jersey().register(new AuthDynamicFeature(
                    new BasicCredentialAuthFilter.Builder<User>()
                            .setAuthenticator(ldapAuthenticator)
                            .setRealm("LDAP")
                            .buildAuthFilter()));

            environment.jersey().register(new AuthValueFactoryProvider.Binder<>(User.class));

            environment.healthChecks().register("ldap", new LdapHealthCheck<>(
                    new ResourceAuthenticator(new LdapCanAuthenticate(ldapConfiguration))));
        }
    }
}


text:
 <rd-widget>
 		<rd-widget-body>
 			Current medicine
 			<button ng-if="isEdit" style="float: right;" class="btn btn-default" ng-click="toggleDeleteBtn()">Cancel</button>
 			<button ng-if="!isEdit" style="float: right;" class="btn btn-default" ng-click="toggleDeleteBtn()">Edit</button>

{{desc.title}}

 				<button style="float: right;" ng-if="isEdit" class="btn btn-danger" ng-click="deleteMedicine(desc.title)">delete</button>

Take {{desc.amount}} pill(s) per time

Side effect: {{desc.side_effect}}

 		</rd-widget-body>
 </rd-widget>


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Fixed Bottom Navbar Example</title>

<link rel="stylesheet" href="{{ site.path }}/assets/{{ version.docs }}/dist/css/figuration.min.css">

    Fixed Navbar
    <button class="navbar-toggle" type="button" data-cfw="collapse" data-cfw-collapse-target="#navbarR3">
        ≡
    </button>

                Home

                Link

                Disabled

                Dropup

Action

Another action

Something else here

        <form class="form-inline ms-auto">
            <input class="form-control me-0_25" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-info" type="submit">Search</button>
        </form>

Fixed Bottom Navbar Example

            This example page shows off how a bottom-aligned navbar and its responsive behaviors.
            This navbar will remain fixed at the bottom of your browser's viewport as you scroll.

            In order to experience the responsive behavior of the navbar, you will have to resize your browser above and below the lg breakpoint.

            View navbar docs »


text:
#import "Example.h"

#import "ACTcpStream.h"

@interface Example () <ACTcpStreamServerDelegate>

@property (nonatomic) BOOL isServer;
@property (nonatomic) BOOL isClient;
@property (nonatomic, strong) NSString *hostname;
@property (nonatomic) int port;

@end

@implementation Example

- (instancetype) initServerWithPort:(int)port
{
    self = [super init];
    if (self)
    {
        _isServer = YES;
        _isClient = NO;
        _port = port;
    }
    return self;
}

- (instancetype) initClientWithHostname:(NSString *)hostname port:(int)port
{
    self = [super init];
    if (self)
    {
        _isServer = NO;
        _isClient = YES;
        _port = port;
        _hostname = hostname;
    }
    return self;
}

- (void)run
{
    if (self.isServer)
        [self runServer];
    else
        [self runClient];
}

- (void)runClient
{
    ACTcpStreamClient *client;
    client = [[ACTcpStreamClient alloc] initWithHostname:self.hostname
                                                    port:self.port];
    ACTcpStreamConnection *connection = [client connect];

    if (!connection)
    {
        NSLog(@"Couldn't connect");
        return;
    }

    NSFileHandle *kbd = [NSFileHandle fileHandleWithStandardInput];
    uint8_t buffer[1024];
    NSInteger len = 0;

    while (connection.isConnected)
    {
        @autoreleasepool
        {
            fprintf(stdout, "input: ");

            // get some input from user - stdin

            NSData *inputData = [kbd availableData];

            // send the input to the server
            len = [connection.writeStream write:inputData.bytes
                                maxLength:inputData.length];
            if (len == -1)
            {
                NSLog(@"Error writing to stream: %@", connection.writeStream.streamError);
                continue;
            }

            NSLog(@"written %li bytes", (long)len);

            // receive data from server

            len = [connection.readStream read:buffer maxLength:1024];

            if (len == -1)
            {
                NSLog(@"Error reading from stream: %@", connection.readStream.streamError);
                continue;
            }

            fprintf(stdout, "read (%li): %s", (long)len,  buffer);
        }
    }

    NSLog(@"No longer connected");
}

- (void)runServer
{
    ACTcpStreamServer *server;
    server = [[ACTcpStreamServer alloc] initWithListeningPort:self.port];
    server.delegate = self;

    [server startListening];

    [[NSRunLoop currentRunLoop] run];
}

- (void)tcpStreamServer:(ACTcpStreamServer *)server
     receivedConnection:(ACTcpStreamConnection *)connection
{
    uint8_t buffer[1024];
    NSInteger len = 0;

    while (connection.isConnected)
    {
        // we are an echo server
        // read data and then send the data back

        NSLog(@"Waiting for data from client...");

        len = [connection.readStream read:buffer maxLength:1024];

        if (len == -1)
        {
            NSLog(@"Error reading from stream: %@", connection.readStream.streamError);
            continue;
        }

        fprintf(stdout, "received (%li): %s", (long)len, buffer);

        len = [connection.writeStream write:buffer
                            maxLength:len];

        if (len == -1)
        {
            NSLog(@"Error writing to stream: %@", connection.writeStream.streamError);
            continue;
        }
    }

    NSLog(@"No longer connected");
}

@end


text:
/*
 */
package org.apache.taverna.server.master.worker;
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.net.URI;
import java.util.List;

import org.apache.taverna.server.master.common.Status;

/**
 * Profile of the getters and setters in a worker system. Ensures that the
 * persisted state matches the public view on the state model at least fairly
 * closely.
 *
 * @author Donal Fellows
 */
public interface WorkerModel extends PolicyLimits {

	/**
	 * @param defaultLifetime
	 *            how long a workflow run should live by default, in minutes.
	 */
	public abstract void setDefaultLifetime(int defaultLifetime);

	/**
	 * @return how long a workflow run should live by default, in minutes.
	 */
	public abstract int getDefaultLifetime();

	/**
	 * @param maxRuns
	 *            the maximum number of extant workflow runs
	 */
	public abstract void setMaxRuns(int maxRuns);

	/**
	 * @param factoryProcessNamePrefix
	 *            the prefix used for factory processes in RMI
	 */
	public abstract void setFactoryProcessNamePrefix(
			String factoryProcessNamePrefix);

	/**
	 * @return the prefix used for factory processes in RMI
	 */
	public abstract String getFactoryProcessNamePrefix();

	/**
	 * @param executeWorkflowScript
	 *            the script to run to actually run a workflow
	 */
	public abstract void setExecuteWorkflowScript(String executeWorkflowScript);

	/**
	 * @return the script to run to actually run a workflow
	 */
	public abstract String getExecuteWorkflowScript();

	/**
	 * @param extraArgs
	 *            the extra arguments to pass into the workflow runner
	 */
	public abstract void setExtraArgs(String[] extraArgs);

	/**
	 * @return the extra arguments to pass into the workflow runner
	 */
	public abstract String[] getExtraArgs();

	/**
	 * @param waitSeconds
	 *            the number of seconds to wait for subprocesses to start
	 */
	public abstract void setWaitSeconds(int waitSeconds);

	/**
	 * @return the number of seconds to wait for subprocesses to start
	 */
	public abstract int getWaitSeconds();

	/**
	 * @param sleepMS
	 *            milliseconds to wait between polling for a started
	 *            subprocess's status
	 */
	public abstract void setSleepMS(int sleepMS);

	/**
	 * @return milliseconds to wait between polling for a started subprocess's
	 *         status
	 */
	public abstract int getSleepMS();

	/**
	 * @param serverWorkerJar
	 *            the full path name of the file system access worker
	 *            subprocess's implementation JAR
	 */
	public abstract void setServerWorkerJar(String serverWorkerJar);

	/**
	 * @return the full path name of the file system access worker subprocess's
	 *         implementation JAR
	 */
	public abstract String getServerWorkerJar();

	/**
	 * @param javaBinary
	 *            the full path name to the Java binary to use
	 */
	public abstract void setJavaBinary(String javaBinary);

	/**
	 * @return the full path name to the Java binary to use
	 */
	public abstract String getJavaBinary();

	/**
	 * @param registryPort
	 *            what port is the RMI registry on
	 */
	public abstract void setRegistryPort(int registryPort);

	/**
	 * @return what port is the RMI registry on
	 */
	public abstract int getRegistryPort();

	/**
	 * @param registryHost
	 *            what host (network interface) is the RMI registry on
	 */
	public abstract void setRegistryHost(String registryHost);

	/**
	 * @return what host (network interface) is the RMI registry on
	 */
	public abstract String getRegistryHost();

	/**
	 * @param serverForkerJar
	 *            the full path name of the impersonation engine's
	 *            implementation JAR
	 */
	public abstract void setServerForkerJar(String serverForkerJar);

	/**
	 * @return the full path name of the impersonation engine's implementation
	 *         JAR
	 */
	public abstract String getServerForkerJar();

	/**
	 * @param passwordFile
	 *            the full path name of a file containing a password to use with
	 *            sudo (or empty for none)
	 */
	public abstract void setPasswordFile(String passwordFile);

	/**
	 * @return the full path name of a file containing a password to use with
	 *         sudo (or empty for none)
	 */
	public abstract String getPasswordFile();

	/**
	 * @param operatingLimit
	 *            the maximum number of runs in the
	 *            {@linkplain Status#Operating operating} state at once
	 */
	public abstract void setOperatingLimit(int operatingLimit);

	@Override
	void setPermittedWorkflowURIs(List<URI> permittedWorkflows);

	/**
	 * @return the full path name of the RMI registry subprocess's
	 *         implementation JAR
	 */
	String getRegistryJar();

	/**
	 * @param rmiRegistryJar
	 *            the full path name of the RMI registry subprocess's
	 *            implementation JAR
	 */
	void setRegistryJar(String rmiRegistryJar);

	/**
	 * @return whether a run should generate provenance information by default
	 */
	boolean getGenerateProvenance();

	/**
	 * @param generateProvenance
	 *            whether a run should generate provenance information by
	 *            default
	 */
	void setGenerateProvenance(boolean generateProvenance);
}


text:
using System;

namespace Android.Widget
{
	public class CheckedChangedEventArgs : EventArgs
	{
	    private readonly bool @checked;

	    public CheckedChangedEventArgs(bool @checked)
	    {
	        this.@checked = @checked;
	    }

        /// <summary>
        /// Gets the checked state of the sender
        /// </summary>
	    public bool IsChecked
	    {
	        get { return @checked; }
	    }
	}
}


text:
from synergine.test.TestDisplay import TestDisplay

class TestRunerDisplay(TestDisplay):

    _name = 'test_runner'

    def need_to_run_core(self):
        return True


text:
package com.stepstone.stepper.adapter;

import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;

import com.stepstone.stepper.Step;
import com.stepstone.stepper.viewmodel.StepViewModel;

/**
 * Interface to be used as model to {@link com.stepstone.stepper.StepperLayout}.
 */
public interface StepAdapter {

    Boolean isStepValid(int position);
    /**
     * Create each step of the {@link com.stepstone.stepper.StepperLayout}.
     * @param position The position of the {@link PagerAdapter} to be used inside the {@link ViewPager}.
     * @return the step to be used inside the {@link com.stepstone.stepper.StepperLayout}.
     */
    Step createStep(@IntRange(from = 0) int position);

    /**
     * Finds the given step without creating it.
     * @see FragmentPagerAdapter#makeFragmentName(int, long)
     * @param position step position
     * @return step fragment
     */
    Step findStep(@IntRange(from = 0) int position);

    /**
     * Returns the view information to be used to display the step.
     * @param position step position
     * @return view information
     */
    @NonNull
    StepViewModel getViewModel(@IntRange(from = 0) int position);

    /**
     * Get the step count.
     * @return the quantity of steps
     */
    @IntRange(from = 0)
    int getCount();

    /**
     * Method for internal purpose. Should not be inherited.
     * @return the adapter to be used in the {@link ViewPager}.
     */
    PagerAdapter getPagerAdapter();
}


text:
using BuildHelper.Log;
using EnsureThat;
using System;
using System.Linq;
using System.ServiceProcess;

namespace BuildHelper.OS
{
    internal class ServiceHelper
	{
		private readonly IExtensionLogger m_ExtensionLogger;

		public ServiceHelper(IExtensionLogger extensionLogger)
		{
			Ensure.That(() => extensionLogger).IsNotNull();
			m_ExtensionLogger = extensionLogger;
		}

		/// <summary>
		/// Starts service if it's stopped. Returns True if service was started.
		/// </summary>
		public bool StartServiceIfNeeded(string serviceName, int timeout = 30)
		{
			Ensure.That(() => serviceName).IsNotNullOrEmpty();
			if (ServiceIsRunning(serviceName))
				return false;

			ServiceController sc = null;
			try
			{
				sc = new ServiceController(serviceName);
				if (sc.Status == ServiceControllerStatus.Stopped)
				{
					WriteStatus($"Starting {serviceName}");
					sc.Start();
					sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(timeout));
				}
				if (sc.Status == ServiceControllerStatus.StartPending)
				{
					WriteStatus($"Starting {serviceName}");
					sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(timeout));
				}
			}
			catch (Exception ex)
			{
				WriteException(ex);
				WriteStatus($"Failed to start service {serviceName} more information exists in the activity log.");
				return false;
			}
			finally
			{
				if (sc != null)
					sc.Dispose();
			}

			WriteStatus($"Service {serviceName} has started.");
			return true;
		}

		/// <summary>
		/// Stops service if it's running. Returns True if service was stopped.
		/// </summary>
		public bool StopServiceIfNeeded(string serviceName, int timeout = 30)
		{
			Ensure.That(() => serviceName).IsNotNullOrEmpty();
			if (!ServiceIsRunning(serviceName))
				return false;

			ServiceController sc = null;
			try
			{
				sc = new ServiceController(serviceName);
				if (sc.Status == ServiceControllerStatus.Running)
				{
					WriteStatus($"Stopping {serviceName} ...");
					sc.Stop();
					sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(timeout));
				}
				if (sc.Status == ServiceControllerStatus.StopPending)
				{
					WriteStatus($"Stopping {serviceName} ...");
					sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(timeout));
				}
			}
			catch (Exception ex)
			{
				WriteException(ex);
				WriteStatus($"Failed to stop service {serviceName} more information exists in the activity log.");
				return false;
			}
			finally
			{
				if (sc != null)
					sc.Dispose();
			}

			WriteStatus($"Service {serviceName} has stoped.");
			return true;
		}

		private bool ServiceIsRunning(string serviceName)
		{
			ServiceController[] scServices = null;
			try
			{
				scServices = ServiceController.GetServices();

				var service = scServices.SingleOrDefault(s =>
					s.ServiceName.Equals(serviceName, StringComparison.OrdinalIgnoreCase));

				if (service == null)
					return false;

				return service.Status != ServiceControllerStatus.Stopped;
			}
			finally
			{
				if (scServices != null)
					foreach (var service in scServices)
						service.Dispose();
			}
		}

		private void WriteStatus(string message)
		{
			m_ExtensionLogger.WriteStatus(message);
		}

		private void WriteException(Exception exception)
		{
			m_ExtensionLogger.WriteException(exception);
		}
	}
}


text:
package com.medievallords.carbyne.donator.listeners;

import com.medievallords.carbyne.Carbyne;
import com.medievallords.carbyne.donator.GamemodeManager;
import com.medievallords.carbyne.donator.tasks.GamemodeTask;
import com.medievallords.carbyne.utils.MessageManager;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.event.TownRemoveResidentEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.*;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

/**
 * Created by Dalton on 6/13/2017.
 */
public class GameModeListener implements Listener {

    private Carbyne main = Carbyne.getInstance();

    private GamemodeManager gamemodeManager;
    @Getter
    private HashMap<Player, Boolean> taskCheck;

    public GameModeListener(GamemodeManager gamemodeManager) {
        this.gamemodeManager = gamemodeManager;
        this.taskCheck = new HashMap<>();
    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent e) {
        Player player = e.getPlayer();
        if (gamemodeManager.getFlyPlayers().contains(player)) {
            player.setAllowFlight(false);
            player.setFlying(false);
            gamemodeManager.getFlyPlayers().remove(player);
        }
        if (gamemodeManager.getGmPlayers().contains(player)) {
            player.setGameMode(GameMode.SURVIVAL);
            gamemodeManager.getGmPlayers().remove(player);
        }
    }

    @EventHandler
    public void onPlotChange(PlayerChangePlotEvent e) {
        Player player = e.getPlayer();

        if (player.hasPermission("carbyne.commands.gamemode.ignore") || player.isOp())
            return;

        if (!gamemodeManager.getFlyPlayers().contains(player) && !gamemodeManager.getGmPlayers().contains(player))
            return;

        TownBlock tb = null;

        try {
            tb = e.getTo().getTownBlock();
        } catch (Exception ignore) {}

        if (tb == null) {
            taskPlayer(player);
            return;
        }

        Resident res = null;
        try {
            res = TownyUniverse.getDataSource().getResident(player.getName());
        } catch (NotRegisteredException ignore) {}

        Town town = null;
        try {
            town = tb.getTown();
        } catch (NotRegisteredException ignore) {}

        if (town == null) {
            taskPlayer(player);
            return;
        }

        try {
            if (town == res.getTown()) {
                taskCheck.put(player, true);
                return;
            }
        } catch (NotRegisteredException ignore) {}

        Nation nation = null;
        try {
            if ((nation = res.getTown().getNation()) == null)
                if (nation.equals(town.getNation())) {
                    taskCheck.put(player, true);
                    return;
                }
        } catch (NotRegisteredException ignore) {}

        taskPlayer(player);
    }

    @EventHandler
    public void onTownLeave(TownRemoveResidentEvent e) {
        Player player = Bukkit.getPlayer(e.getResident().getName());

        if (player == null) {
            OfflinePlayer offline = Bukkit.getPlayer(e.getResident().getName());

            if (offline == null) return;

            if (gamemodeManager.getFlightTowns().containsKey(offline.getUniqueId())) {
                gamemodeManager.getFlightTowns().remove(offline.getUniqueId());

                List<String> temp = main.getDonatorTownsConfiguration().getStringList("FlightTowns");
                for (String entry : temp) {
                    String[] splitEntry = entry.split(",");
                    if (splitEntry[0].equalsIgnoreCase(offline.getUniqueId().toString())) {
                        temp.remove(entry);
                        break;
                    }
                }

                main.getDonatorTownsConfiguration().set("FlightTowns", temp);
                try {
                    main.getDonatorTownsConfiguration().save(main.getDonatorTownsFile());
                } catch (IOException ignore) {
                }
            }

            if (gamemodeManager.getCreativeTowns().containsKey(offline.getUniqueId())) {
                gamemodeManager.getCreativeTowns().remove(offline.getUniqueId());
                List<String> temp = main.getDonatorTownsConfiguration().getStringList("CreativeTowns");
                for (String entry : temp) {
                    String[] entrySplit = entry.split(",");
                    if (entrySplit[0].equalsIgnoreCase(offline.getUniqueId().toString())) {
                        temp.remove(entry);
                        break;
                    }
                }

                main.getDonatorTownsConfiguration().set("CreativeTowns", temp);
                try {
                    main.getDonatorTownsConfiguration().save(main.getDonatorTownsFile());
                } catch (IOException ignore) {
                }
            }
            return;
        }

        if (gamemodeManager.getFlightTowns().containsKey(player.getUniqueId())) {
            gamemodeManager.getFlightTowns().remove(player.getUniqueId());
            MessageManager.sendMessage(player, "&cTown flight has been disabled!");

            List<String> temp = main.getDonatorTownsConfiguration().getStringList("FlightTowns");
            for (String entry : temp) {
                String[] splitEntry = entry.split(",");
                if (splitEntry[0].equalsIgnoreCase(player.getUniqueId().toString())) {
                    temp.remove(entry);
                    break;
                }
            }

            main.getDonatorTownsConfiguration().set("FlightTowns", temp);
            try {
                main.getDonatorTownsConfiguration().save(main.getDonatorTownsFile());
            } catch (IOException ignore) {}
        }

        if (gamemodeManager.getCreativeTowns().containsKey(player.getUniqueId())) {
            gamemodeManager.getCreativeTowns().remove(player.getUniqueId());
            MessageManager.sendMessage(player, "&cTown creative is disabled!");
            List<String> temp = main.getDonatorTownsConfiguration().getStringList("CreativeTowns");
            for (String entry : temp) {
                String[] entrySplit = entry.split(",");
                if (entrySplit[0].equalsIgnoreCase(player.getUniqueId().toString())) {
                    temp.remove(entry);
                    break;
                }
            }

            main.getDonatorTownsConfiguration().set("CreativeTowns", temp);
            try {
                main.getDonatorTownsConfiguration().save(main.getDonatorTownsFile());
            } catch (IOException ignore) {}
        }
    }

    private void taskPlayer(Player player) {
        if(GamemodeTask.hasActiveTasks.containsKey(player)) return;
        if (gamemodeManager.getFlyPlayers().contains(player))
            MessageManager.sendMessage(player, "&cYou have left your town, flight will be disabled in 5...");
        else
            MessageManager.sendMessage(player, "&cYou have left your town, Creative will be disabled in 5...");
        taskCheck.put(player, false);
        GamemodeTask gamemodeTask = new GamemodeTask(gamemodeManager, this, player);
        gamemodeTask.runTaskTimerAsynchronously(main, 20L, 20L);
        GamemodeTask.hasActiveTasks.put(player, gamemodeTask);
    }

}


text:
\documentclass[a4paper,12pt,twoside]{StyleThese}
\input{preamble/packages.input.tex}
\input{preamble/newcommands.input.tex}
\input{preamble/definitions.input.tex}
\input{preamble/hyphenation.input.tex}
\input{preamble/layout.input.tex}

\begin{document}

%\import{gestionprojet}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{Chapters/titlepage}
%\input{Chapters/remerciements}
%\input{couverture}
%\input{couv2}

\end{document}


text:
import logging

from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import transaction
from rest_framework import exceptions

from waldur_core.structure import models as structure_models
from waldur_core.structure.backend import ServiceBackend
from waldur_mastermind.marketplace import models as marketplace_models
from waldur_mastermind.marketplace import plugins
from waldur_mastermind.marketplace.utils import import_resource_metadata
from waldur_mastermind.marketplace_openstack import (
    CORES_TYPE,
    INSTANCE_TYPE,
    RAM_TYPE,
    STORAGE_MODE_DYNAMIC,
    STORAGE_MODE_FIXED,
    STORAGE_TYPE,
    TENANT_TYPE,
    VOLUME_TYPE,
)
from waldur_openstack.openstack import models as openstack_models
from waldur_openstack.openstack_tenant import backend as openstack_tenant_backend

logger = logging.getLogger(__name__)
TenantQuotas = openstack_models.Tenant.Quotas

def get_offering_category_for_tenant():
    return marketplace_models.Category.objects.get(default_tenant_category=True)

def get_offering_name_for_instance(tenant):
    return 'Virtual machine in %s' % tenant.name

def get_offering_category_for_instance():
    return marketplace_models.Category.objects.get(default_vm_category=True)

def get_offering_name_for_volume(tenant):
    return 'Volume in %s' % tenant.name

def get_offering_category_for_volume():
    return marketplace_models.Category.objects.get(default_volume_category=True)

def get_category_and_name_for_offering_type(offering_type, service_settings):
    if offering_type == INSTANCE_TYPE:
        category = get_offering_category_for_instance()
        name = get_offering_name_for_instance(service_settings)
        return category, name
    elif offering_type == VOLUME_TYPE:
        category = get_offering_category_for_volume()
        name = get_offering_name_for_volume(service_settings)
        return category, name

def create_offering_components(offering):
    fixed_components = plugins.manager.get_components(TENANT_TYPE)

    for component_data in fixed_components:
        marketplace_models.OfferingComponent.objects.create(
            offering=offering, **component_data._asdict()
        )

def import_volume_metadata(resource):
    import_resource_metadata(resource)
    volume = resource.scope
    resource.backend_metadata['size'] = volume.size

    if volume.instance:
        resource.backend_metadata['instance_uuid'] = volume.instance.uuid.hex
        resource.backend_metadata['instance_name'] = volume.instance.name
    else:
        resource.backend_metadata['instance_uuid'] = None
        resource.backend_metadata['instance_name'] = None

    if volume.type:
        resource.backend_metadata['type_name'] = volume.type.name
    else:
        resource.backend_metadata['type_name'] = None

    resource.save(update_fields=['backend_metadata'])

def import_instance_metadata(resource):
    import_resource_metadata(resource)
    instance = resource.scope
    resource.backend_metadata['internal_ips'] = instance.internal_ips
    resource.backend_metadata['external_ips'] = instance.external_ips
    resource.save(update_fields=['backend_metadata'])

def get_offering(offering_type, service_settings):
    try:
        return marketplace_models.Offering.objects.get(
            scope=service_settings, type=offering_type
        )
    except ObjectDoesNotExist:
        logger.warning(
            'Marketplace offering is not found. ' 'ServiceSettings ID: %s',
            service_settings.id,
        )
    except MultipleObjectsReturned:
        logger.warning(
            'Multiple marketplace offerings are found. ' 'ServiceSettings ID: %s',
            service_settings.id,
        )

def import_quotas(offering, quotas, field):
    source_values = {row['name']: row[field] for row in quotas.values('name', field)}
    storage_mode = offering.plugin_options.get('storage_mode') or STORAGE_MODE_FIXED

    result_values = {
        CORES_TYPE: source_values.get(TenantQuotas.vcpu.name, 0),
        RAM_TYPE: source_values.get(TenantQuotas.ram.name, 0),
    }

    if storage_mode == STORAGE_MODE_FIXED:
        result_values[STORAGE_TYPE] = source_values.get(TenantQuotas.storage.name, 0)
    elif storage_mode == STORAGE_MODE_DYNAMIC:
        volume_type_values = {
            k: v for (k, v) in source_values.items() if k.startswith('gigabytes_')
        }
        result_values.update(volume_type_values)

    return result_values

def _apply_quotas(target, quotas):
    for name, limit in quotas.items():
        target.set_quota_limit(name, limit)

def import_usage(resource):
    tenant = resource.scope

    if not tenant:
        return

    resource.current_usages = import_quotas(resource.offering, tenant.quotas, 'usage')
    resource.save(update_fields=['current_usages'])

def import_limits(resource):
    """
    Import resource quotas as marketplace limits.
    :param resource: Marketplace resource
    """
    tenant = resource.scope

    if not tenant:
        return

    resource.limits = import_quotas(resource.offering, tenant.quotas, 'limit')
    resource.save(update_fields=['limits'])

def map_limits_to_quotas(limits, offering):
    quotas = {
        TenantQuotas.vcpu.name: limits.get(CORES_TYPE),
        TenantQuotas.ram.name: limits.get(RAM_TYPE),
        TenantQuotas.storage.name: limits.get(STORAGE_TYPE),
    }

    quotas = {k: v for k, v in quotas.items() if v is not None}

    # Filter volume-type quotas.
    volume_type_quotas = dict(
        (key, value)
        for (key, value) in limits.items()
        if key.startswith('gigabytes_') and value is not None
    )

    # Common storage quota should be equal to sum of all volume-type quotas.
    if volume_type_quotas:
        if 'storage' in quotas:
            raise exceptions.ValidationError(
                'You should either specify general-purpose storage quota '
                'or volume-type specific storage quota.'
            )

        # Initialize volume type quotas as zero, otherwise they are treated as unlimited
        for volume_type in openstack_models.VolumeType.objects.filter(
            settings=offering.scope
        ):
            volume_type_quotas.setdefault('gigabytes_' + volume_type.name, 0)

        quotas['storage'] = ServiceBackend.gb2mb(sum(list(volume_type_quotas.values())))
        quotas.update(volume_type_quotas)

    # Convert quota value from float to integer because OpenStack API fails otherwise
    quotas = {k: int(v) for k, v in quotas.items()}

    return quotas

def update_limits(order_item):
    tenant = order_item.resource.scope
    backend = tenant.get_backend()
    quotas = map_limits_to_quotas(order_item.limits, order_item.offering)
    backend.push_tenant_quotas(tenant, quotas)
    with transaction.atomic():
        _apply_quotas(tenant, quotas)
        for target in structure_models.ServiceSettings.objects.filter(scope=tenant):
            _apply_quotas(target, quotas)

def import_limits_when_storage_mode_is_switched(resource):
    tenant = resource.scope

    if not tenant:
        return

    storage_mode = (
        resource.offering.plugin_options.get('storage_mode') or STORAGE_MODE_FIXED
    )

    raw_limits = {quota.name: quota.limit for quota in tenant.quotas.all()}
    raw_usages = {quota.name: quota.usage for quota in tenant.quotas.all()}

    limits = {
        CORES_TYPE: raw_limits.get(TenantQuotas.vcpu.name, 0),
        RAM_TYPE: raw_limits.get(TenantQuotas.ram.name, 0),
    }

    if storage_mode == STORAGE_MODE_FIXED:
        limits[STORAGE_TYPE] = raw_usages.get(TenantQuotas.storage.name, 0)
    elif storage_mode == STORAGE_MODE_DYNAMIC:
        volume_type_limits = {
            k: v for (k, v) in raw_usages.items() if k.startswith('gigabytes_')
        }
        limits.update(volume_type_limits)

    resource.limits = limits
    resource.save(update_fields=['limits'])

def push_tenant_limits(resource):
    tenant = resource.scope
    backend = tenant.get_backend()
    quotas = map_limits_to_quotas(resource.limits, resource.offering)
    backend.push_tenant_quotas(tenant, quotas)
    with transaction.atomic():
        _apply_quotas(tenant, quotas)
        for target in structure_models.ServiceSettings.objects.filter(scope=tenant):
            _apply_quotas(target, quotas)

def restore_limits(resource):
    order_item = (
        marketplace_models.OrderItem.objects.filter(
            resource=resource,
            type__in=[
                marketplace_models.OrderItem.Types.CREATE,
                marketplace_models.OrderItem.Types.UPDATE,
            ],
        )
        .order_by('-created')
        .first()
    )

    if not order_item:
        return

    if not isinstance(order_item.resource.scope, openstack_models.Tenant):
        return

    update_limits(order_item)

def import_instances_and_volumes_of_tenant(tenant):

    try:
        service_settings = structure_models.ServiceSettings.objects.get(scope=tenant)
    except structure_models.ServiceSettings.DoesNotExist:
        logger.error(
            'An import of instances and volumes is impossible because service settings do not exist.'
            'Tenant: %s' % tenant
        )
        return

    tenant_backend = openstack_tenant_backend.OpenStackTenantBackend(service_settings)

    for instance in tenant_backend.get_importable_instances():
        tenant_backend.import_instance(instance['backend_id'], tenant.project)

    for volume in tenant_backend.get_importable_volumes():
        tenant_backend.import_volume(volume['backend_id'], tenant.project)


text:
module Casein
  module ConfigHelper

    # Name of website or client — used throughout Casein.
    def casein_config_website_name
      'Coffee Buddy'
    end

    # Filename of logo image. Ideally, it should be a transparent PNG around 140x30px
    def casein_config_logo
      'coffee_buddy_logo.png'
    end

    # The server hostname where Casein will run
    def casein_config_hostname
      if Rails.env.production?
        'http://www.caseincms.com'
      else
        'http://0.0.0.0:3000'
      end
    end

    # The sender address used for email notifications
    def casein_config_email_from_address
      'donotreply@caseincms.com'
    end

    # The initial page the user is shown after they sign in or click the logo. Probably this should be set to the first tab.
    # Do not point this at casein/index!
    def casein_config_dashboard_url
      url_for :controller => :casein, :action => :blank
    end

    # A list of stylesheets to include. Do not remove the core casein/casein, but you can change the load order, if required.
    def casein_config_stylesheet_includes
      %w[casein/casein casein/custom]
    end

    # A list of JavaScript files to include. Do not remove the core casein/casein, but you can change the load order, if required.
    def casein_config_javascript_includes
      %w[casein/casein casein/custom]
    end

  end
end


text:
lume = require "libs.lume"
oldprint = print
print = DEBUG and lume.trace or function () end
assert = lume.assert

-- autobatch = require "libs.autobatch"
lurker = require "libs.lurker"
Object = require "libs.classic"
lovebird = require "libs.lovebird"
flux = require "libs.flux"
tick = require "libs.tick"
coil = require "libs.coil"
json = require "libs.json"
HC = require "libs.HC"
-- require "imgui"
gifcat = require "libs.gifcat"
--Guess I have this one going for me
buddies = require "libs.buddies"

local libs = {}

libs.lovebird = arg[2] == "lovebird"

function libs.update(dt)
	tick.update(dt)
	flux.update(dt)
	coil.update(dt)
	lurker.update(dt)
	if libs.lovebird then lovebird.update(dt) end
end

return libs


text:
layout: page
title: Noble Family Reunion
date: 2016-05-24
author: Dennis Pope
tags: weekly links, java
status: published
summary: Ut hendrerit aliquam pulvinar. Mauris molestie dolor.
banner: images/banner/office-01.jpg
booking:
  startDate: 04/02/2019
  endDate: 04/07/2019
  ctyhocn: STLPPHX
  groupCode: NFR
published: true
---
Quisque faucibus dui in elit mollis bibendum. In in ante aliquam, porta enim vitae, pulvinar nunc. Vivamus pretium eu arcu nec varius. Suspendisse ante nisi, suscipit a porttitor vitae, condimentum id sapien. Sed sagittis lacus sed magna venenatis, non porttitor nisl tincidunt. Nam sed nulla nec neque auctor interdum. Nam quis molestie justo. Sed porttitor lobortis nunc blandit rhoncus. Ut aliquet ultrices faucibus.

* Curabitur vitae nisi vehicula, varius dolor at, tincidunt lorem
* Donec sit amet nisi semper, rutrum lacus a, efficitur nulla.

Maecenas eleifend lacinia velit in ullamcorper. Maecenas vel nibh a quam gravida finibus eu vitae mi. Donec fringilla libero eu purus pulvinar, aliquet gravida mauris venenatis. Maecenas nec augue purus. Pellentesque porta eleifend ipsum, a porttitor ipsum. Proin fermentum nunc mi, at feugiat ex maximus vel. Integer nec efficitur nisl. Quisque eu massa ut quam faucibus ullamcorper.