text:
/**
 * Created by Estevao on 23-07-2015.
 */
(function () {
  'use strict';

  require('chai').should();
  var showdown = require('showdown'),
      ghostextra = require('../src/showdown-ghost-extra.js'),
      fs = require('fs'),
      cases = fs.readdirSync('test/cases/')
          .filter(filter())
          .map(map('test/cases/')),
      issues = fs.readdirSync('test/issues/')
          .filter(filter())
          .map(map('test/issues/')),
      options = fs.readdirSync('test/options/')
        .filter(filter())
        .map(map('test/options/'));

  /////////////////////////////////////////////////////////////////////////////
  // Test cases
  //
  describe('Ghost Extra Extension cases testcase', function () {
    var converter = new showdown.Converter({extensions: [ghostextra]});
    for (var i = 0; i < cases.length; ++i) {
      it(cases[i].name, assertion(cases[i], converter));
    }
  });

  describe('Ghost Extra Extension issues testcases', function () {
    var converter = new showdown.Converter({extensions: [ghostextra]});
    for (var i = 0; i < issues.length; ++i) {
      it(issues[i].name, assertion(issues[i], converter));
    }
  });

  describe('Ghost Extra Extension with options enabled testcase', function () {
    var converter = new showdown.Converter({
      extensions: [ghostextra],
      omitExtraWLInCodeBlocks: true,
      parseImgDimensions: true,
      simplifiedAutoLink: true,
      excludeTrailingPunctuationFromURLs: true,
      literalMidWordUnderscores: true,
      strikethrough: true,
      tables: true,
      tablesHeaderId: true,
      ghCodeBlocks: true,
      tasklists: true,
      smoothLivePreview: true,
      simpleLineBreaks: true,
      requireSpaceBeforeHeadingText: true,
      ghMentions: false,
      encodeEmails: true
    });

    for (var i = 0; i < options.length; ++i) {
      it(options[i].name, assertion(options[i], converter));
    }
  });

  /////////////////////////////////////////////////////////////////////////////
  // Test cases
  //
  function filter() {
    return function (file) {
      var ext = file.slice(-3);
      return (ext === '.md');
    };
  }

  function map(dir) {
    return function (file) {
      var name = file.replace('.md', ''),
          htmlPath = dir + name + '.html',
          html = fs.readFileSync(htmlPath, 'utf8'),
          mdPath = dir + name + '.md',
          md = fs.readFileSync(mdPath, 'utf8');

      return {
        name:     name.replace(/_/g, ' '),
        input:    md,
        expected: html
      };
    };
  }

  //Normalize input/output
  function normalize(testCase) {

    // Normalize line returns
    testCase.expected = testCase.expected.replace(/\r/g, '');
    testCase.actual = testCase.actual.replace(/\r/g, '');

    // Ignore all leading/trailing whitespace
    testCase.expected = testCase.expected.split('\n').map(function (x) {
      return x.trim();
    }).join('\n');
    testCase.actual = testCase.actual.split('\n').map(function (x) {
      return x.trim();
    }).join('\n');

    return testCase;
  }

  function assertion(testCase, converter) {
    return function () {
      testCase.actual = converter.makeHtml(testCase.input);
      testCase = normalize(testCase);

      // Compare
      testCase.actual.should.equal(testCase.expected);
    };
  }
})();


text:
/**
 * Calculates the complex conjugate of the integer
 *
 * @return {Integer}
 */
conjugate() : Integer {
	return this.copy();
}

redpajama_set_name: RedPajamaGithub


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

moduleForComponent('select-option', 'Integration | Component | select option', {
  integration: true
});

test('it renders', function(assert) {
  assert.expect(2);

  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{select-option}}`);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    {{#select-option}}
      template block text
    {{/select-option}}
  `);

  assert.equal(this.$().text().trim(), 'template block text');
});


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Keith Beatty 2017 - Converted to jUnit 4.12
 * Keith Beatty 2019 - Converted to jUnit 5.x
 */

package com.b12kab.tmdblibrary.services;

import com.b12kab.tmdblibrary.BaseTestCase;
import com.b12kab.tmdblibrary.TestData;
import com.b12kab.tmdblibrary.entities.FindResults;
import com.b12kab.tmdblibrary.entities.MovieAbbreviated;
import com.b12kab.tmdblibrary.entities.Person;
import com.b12kab.tmdblibrary.entities.TvEpisode;
import com.b12kab.tmdblibrary.entities.TvSeason;
import com.b12kab.tmdblibrary.entities.TvShow;
import com.b12kab.tmdblibrary.enumerations.ExternalSource;

import org.junit.jupiter.api.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

public class FindServiceTest extends BaseTestCase {
    private static final SimpleDateFormat JSON_STRING_DATE = new SimpleDateFormat("yyy-MM-dd");

    static final String movieTitle = "Inglourious Basterds";
    static final String ImdbMovieId = "tt0361748";
    static final String ImdbPersonId = "nm0000093";
    static final String ImdbTvId = "tt0903747";
    static final String ImdbTvIdName = "Breaking Bad";
    static final String ImdbTvSeasonId = "30272";
    static final String ImdbTvSeasonName = "Season 1";
    static final String ImdbTvEpisodeId = "tt0959621";

    @Test
    public void test_find_movie() throws ParseException {
        final String funcName = "test_find_movie ";
        FindResults results = null;

        try
        {
            results = getManager().findService().find(ImdbMovieId, ExternalSource.IMDB_ID, null).execute().body();
        }
        catch (Exception e)
        {
            fail("Exception occurred on " + funcName + ": " + e.toString());
        }

        assertNotNull(results, funcName + "results is null");
        assertNotNull(results.movie_results, funcName + "results movie_results is null");
        assertTrue(results.movie_results.size() > 0, funcName + "results movie_results < 1");

        MovieAbbreviated movie = results.movie_results.get(0);
        assertNotNull(movie, funcName + "movie is null");
        assertFalse(movie.isAdult(), funcName + "movie adult is not false");

        assertNotNull(movie.getBackdrop_path(), funcName + "movie getBackdrop_path() is null");
        assertTrue(movie.getId() > 0, funcName + "movie id is < 1");

        assertNotNull(movie.getOriginal_title(), funcName + "movie getOriginal_title() is null");
        assertEquals(movieTitle, movie.getOriginal_title(),funcName + "movie getOriginal_title() is not " + movieTitle);

        assertNotNull(movie.getRelease_date(), funcName + "movie getRelease_date() is null");
        assertEquals(JSON_STRING_DATE.parse("2009-08-19"), movie.getRelease_date(), funcName + "movie getRelease_date() is not 2009-08-21");

        assertNotNull(movie.getPoster_path(), funcName + "movie getPoster_path() is null");

        assertNotNull(movie.getPopularity(), funcName + "movie getPopularity() is null");

        assertNotNull(movie.getTitle(), funcName + "movie getTitle() is null");
        assertEquals(movieTitle, movie.getTitle(), funcName + "movie getTitle() is not " + movieTitle);

        assertNotNull( movie.getVote_average(), funcName + "movie vote_average is null");
        assertTrue(movie.getVote_average() > 0, funcName + "movie vote_average is < 1");

        assertNotNull(movie.getVote_count(), funcName + "movie vote_count is null");
        assertTrue(movie.getVote_count() > 0, funcName + "movie vote_count is < 1");
    }

    @Test
    public void test_find_people() {
        final String funcName = "test_find_people ";
        FindResults results = null;
        try
        {
            results = getManager().findService().find(ImdbPersonId, ExternalSource.IMDB_ID, null).execute().body();
        }
        catch (Exception e)
        {
            fail( "Exception occurred on " + funcName + ": " + e.toString());
        }

        assertNotNull(results, funcName + "results is null");
        assertNotNull(results.person_results, funcName + "results List person_results is null");
        assertTrue(results.person_results.size() > 0, funcName + "results List person_results size < 1");

        Person person = results.person_results.get(0);
        assertNotNull(person, funcName + "person is null" );
        assertNotNull(person.id, funcName + "person id is null");
        assertNotNull(person.name, funcName + "person name is null");
        assertEquals(TestData.PERSON_NAME, person.name, funcName + "person name is not the same as " + TestData.PERSON_NAME);
        assertNotNull(person.profile_path, funcName + "person profile_path is null");
    }

    @Test
    public void test_find_tv_show() {
        final String funcName = "test_find_tv_show ";
        FindResults results = null;
        try {
            results = getManager().findService().find(ImdbTvId, ExternalSource.IMDB_ID, null).execute().body();
        }
        catch (Exception e)
        {
            fail( "Exception occurred on " + funcName + ": " + e.toString());
        }

        assertNotNull(results, funcName + "results is null");
        assertNotNull(results.tv_results, funcName + "results tv_results is null");
        assertTrue(results.tv_results.size() > 0, funcName + "results tv_results is < 1");

        TvShow show = results.tv_results.get(0);
        assertNotNull(show, funcName + "show is null");
        assertNotNull(show.id, funcName + "show id is null");
        assertNotNull(show.original_name, funcName + "show original_name is null");
        assertEquals(ImdbTvIdName, show.original_name, funcName + "show original_name is not" + ImdbTvIdName);
        assertEquals(ImdbTvIdName, show.name, funcName + "show name is not" + ImdbTvIdName);
        assertNotNull(show.first_air_date, funcName + "show first_air_date is null");
        assertNotNull(show.backdrop_path, funcName + "show backdrop_path is null");
        assertNotNull(show.poster_path, funcName + "show poster_path is null");
        assertNotNull(show.popularity, funcName + "show popularity is null");
        assertTrue(show.popularity > 0, funcName + "show popularity is < 1");
        assertNotNull(show.vote_average, funcName + "show vote_average is null");
        assertTrue(show.vote_average > 0, funcName + "show vote_average is < 1");
        assertNotNull(show.vote_count, funcName + "show vote_count is null");
        assertTrue(show.vote_count > 0, funcName + "show vote_count is < 1");
    }

    @Test
    public void test_find_tv_season() {
        final String funcName = "test_find_tv_season ";
        FindResults results = null;

        try {
            results = getManager().findService().find(ImdbTvSeasonId, ExternalSource.TVDB_ID, null).execute().body();
        }
        catch (Exception e)
        {
            fail( "Exception occurred on " + funcName + ": " + e.toString());
        }

        assertNotNull(results, funcName + "results is null");
        assertNotNull(results.tv_season_results, funcName + "results tv_season_results is null");
        assertTrue(results.tv_season_results.size() > 0, funcName + "results tv_season_results List < 1");

        TvSeason season = results.tv_season_results.get(0);
        assertNotNull(season, funcName + "season is null");
        assertNotNull(season.air_date, funcName + "season air_date is null");
        assertNotNull(season.name, funcName + "season name is null");
//        assertTrue(season.name.equals(ImdbTvSeasonName), funcName + "season name is not equal to " + ImdbTvSeasonName);
        assertNotNull(season.id, funcName + "season id is null");
//        assertNotNull(season.poster_path, funcName + "season poster_path is null");
        assertNotNull(season.season_number, funcName + "season season_number is null");
//        assertTrue(season.season_number == 1, funcName + "season season_number is != 1");
    }

    @Test
    public void test_find_tv_episode() {
        final String funcName = "test_find_tv_episode ";
        FindResults results = null;
        try {
            results = getManager().findService().find(ImdbTvEpisodeId, ExternalSource.IMDB_ID, null).execute().body();
        }
        catch (Exception e)
        {
            fail( "Exception occurred on " + funcName + ": " + e.toString());
        }

        assertNotNull(results, funcName + "results is null");
        assertNotNull(results.tv_episode_results, funcName + "results List tv_episode_results is null");
        assertTrue(results.tv_episode_results.size() > 0, funcName + "results List tv_episode_results size < 1");

        TvEpisode episode = results.tv_episode_results.get(0);
        assertNotNull(episode, funcName + "episode is null");
        assertNotNull(episode.air_date, funcName + "episode air_date is null");
        assertNotNull(episode.episode_number, funcName + "episode episode_number is null");
        assertTrue(episode.episode_number > 0, funcName + "episode episode_number < 1");
        assertNotNull(episode.name, funcName + "episode name is null");
        assertNotNull(episode.id, funcName + "episode id is null");
        assertNotNull(episode.season_number, funcName + "episode season_number is null");
        assertTrue(episode.season_number == 1, funcName + "episode season_number < 1");
        assertNotNull(episode.still_path, funcName + "episode still_path is null");
        assertNotNull(episode.vote_average, funcName + "episode vote_average is null");
        assertTrue(episode.vote_average > 0, funcName + "episode vote_average is < 1");
        assertNotNull(episode.vote_count, funcName + "episode vote_count is null");
        assertTrue(episode.vote_count > 0, funcName + "episode vote_count is < 1");
    }
}


text:
package fr.pizzeria.ihm.menu.options;

import java.util.Scanner;

import org.apache.commons.codec.digest.DigestUtils;

import fr.pizzeria.dao.IClientDao;
import fr.pizzeria.exceptions.DaoException;
import fr.pizzeria.factory.IDaoFactory;
import fr.pizzeria.ihm.menu.ConnectionMenu;
import fr.pizzeria.model.Client;

public class ConnecterClientOptionMenu extends AbstractOptionMenu {

	private static final String CONNECTION_LIBELLE_MENU = "Se connecter";
	private static final String CONNECTION_MSG = "Connection";

	public ConnecterClientOptionMenu(Scanner scanner, IDaoFactory daoFact) {
		super(CONNECTION_LIBELLE_MENU, scanner, daoFact);
	}

	@Override
	public boolean execute() {
		IClientDao clientDao = daoFact.createClientDao();

		boolean continuer = true;
		System.out.println(CONNECTION_MSG);
		Client newClient = saisieCredentials(sc,clientDao);
		try {
			clientDao.saveClient(newClient);
		} catch (DaoException e) {
			e.printStackTrace();
		}
		if (newClient != null) {

			ConnectionMenu menu = new ConnectionMenu(sc, newClient, daoFact);
			menu.afficher();

		}

		return continuer;
	}

	private Client saisieCredentials(Scanner sc, IClientDao clientDao) {

		System.out.println(MENU_MSG_SAISIE_EMAIL);
		String email = sc.next();
		System.out.println(MENU_MSG_SAISIE_PASSWORD);
		String password = DigestUtils.md5Hex(sc.next());

		return clientDao.connect(email,password);
	}

}


text:
<?php

if(!isLoggedIn()) redirect(1,'login');

echo '
'.lang('module_titles_txt_12',true).'
';

try {

	if(!mconfig('active')) throw new Exception(lang('error_47',true));

	$Character = new Character();
	$AccountCharacters = $Character->AccountCharacter($_SESSION['username']);
	if(!is_array($AccountCharacters)) throw new Exception(lang('error_46',true));

	if(check_value($_POST['submit'])) {
		try {
			$Character->setUserid($_SESSION['userid']);
			$Character->setUsername($_SESSION['username']);
			$Character->setCharacter($_POST['character']);
			$Character->CharacterReset();
		} catch(Exception $ex) {
			message('error', $ex->getMessage());
		}
	}

	echo '
';
		echo '
';
			echo '	';
			echo ''.lang('resetcharacter_txt_1',true).'	';
			echo ''.lang('resetcharacter_txt_2',true).'	';
			echo ''.lang('resetcharacter_txt_3',true).'	';
			echo ''.lang('resetcharacter_txt_4',true).'	';
			echo '	';
		echo '
';

		foreach($AccountCharacters as $thisCharacter) {
			$characterData = $Character->CharacterData($thisCharacter);
			$characterIMG = $Character->GenerateCharacterClassAvatar($characterData[_CLMN_CHR_CLASS_]);

			echo '<form action="" method="post">';
				echo '<input type="hidden" name="character" value="'.$characterData[_CLMN_CHR_NAME_].'"/>';
				echo '
';
					echo ''.$characterIMG.'	';
					echo ''.$characterData[_CLMN_CHR_NAME_].'	';
					echo ''.$characterData[_CLMN_CHR_LVL_].'	';
					echo ''.number_format($characterData[_CLMN_CHR_ZEN_]).'	';
					echo ''.number_format($characterData[_CLMN_CHR_RSTS_]).'	';
					echo '<button name="submit" value="submit" class="btn btn-primary">'.lang('resetcharacter_txt_5',true).'</button>	';
				echo '
';
			echo '</form>';
		}
	echo '
';

	echo '
';
		if(mconfig('required_level') >= 1) echo '
'.langf('resetcharacter_txt_6', array(mconfig('required_level'))).'
';
		if(mconfig('zen_cost') >= 1) echo '
'.langf('resetcharacter_txt_7', array(number_format(mconfig('zen_cost')))).'
';
		if(mconfig('credit_cost') >= 1) echo '
'.langf('resetcharacter_txt_9', array(number_format(mconfig('credit_cost')))).'
';
		if(mconfig('maximum_resets') >= 1) echo '
'.langf('resetcharacter_txt_10', array(number_format(mconfig('maximum_resets')))).'
';
		if(mconfig('credit_reward') >= 1) echo '
'.langf('resetcharacter_txt_8', array(number_format(mconfig('credit_reward')))).'
';
		if(mconfig('clear_inventory') == 1) echo '
'.lang('resetcharacter_txt_11').'
';
	echo '
';

} catch(Exception $ex) {
	message('error', $ex->getMessage());
}


text:
using System;
using System.Globalization;
using System.Net.Http;
using System.Threading.Tasks;

using Amazon.Security;

namespace Amazon.Rds;

public sealed class RdsService
{
    private readonly AwsRegion _region;
    private readonly IAwsCredential _credential;

    public RdsService(AwsRegion region, IAwsCredential credential)
    {
        ArgumentNullException.ThrowIfNull(region);
        ArgumentNullException.ThrowIfNull(credential);

        _region = region;
        _credential = credential;
    }

    public async Task<AuthenticationToken> GetAuthenticationTokenAsync(GetAuthenticationTokenRequest request)
    {
        // Ensure the underlying credential is renewed
        if (_credential.ShouldRenew)
        {
            await _credential.RenewAsync().ConfigureAwait(false);
        }

        var date = DateTime.UtcNow;

        var scope = new CredentialScope(DateOnly.FromDateTime(date), _region, AwsService.RdsDb);

        var requestUri = new Uri($"https://{request.HostName}:{request.Port}?Action=connect&DBUser={request.UserName}");

        var url = new Uri(SignerV4.GetPresignedUrl(_credential, scope, date, request.Expires, HttpMethod.Get, requestUri));

        return new AuthenticationToken(
            value   : string.Create(CultureInfo.InvariantCulture, $"{url.Host}:{url.Port}/{url.Query}"),
            issued  : date,
            expires : date + request.Expires
        );
    }

    public AuthenticationToken GetAuthenticationToken(GetAuthenticationTokenRequest request)
    {
        return GetAuthenticationTokenAsync(request).GetAwaiter().GetResult();
    }
}

// http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html