text:
package kg.apc.jmeter.functions;

import kg.apc.jmeter.JMeterPluginsUtils;
import org.apache.jmeter.engine.util.CompoundVariable;
import org.apache.jmeter.functions.AbstractFunction;
import org.apache.jmeter.functions.InvalidVariableException;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.threads.JMeterVariables;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

public class Env extends AbstractFunction {

    private static final List<String> desc = new LinkedList<String>();
    private static final String KEY = "__env";

    // Number of parameters expected - used to reject invalid calls
    private static final int MIN_PARAMETER_COUNT = 1;
    private static final int MAX_PARAMETER_COUNT = 3;

    static {
        desc.add("Name of environment variable");
        desc.add("Name of variable in which to store the result (optional)");
        desc.add("Default value");
    }

    private CompoundVariable[] values;

    /**
     * No-arg constructor.
     */
    public Env() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
            throws InvalidVariableException {
        String propertyName = values[0].execute();
        String propertyDefault = propertyName;
        if (values.length > 2) { // We have a 3rd parameter
            propertyDefault = values[2].execute();
        }
        String propertyValue = JMeterPluginsUtils.getEnvDefault(propertyName, propertyDefault);
        if (values.length > 1) {
            String variableName = values[1].execute();
            if (variableName.length() > 0) {// Allow for empty name
                final JMeterVariables variables = getVariables();
                if (variables != null) {
                    variables.put(variableName, propertyValue);
                }
            }
        }
        return propertyValue;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public synchronized void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
        checkParameterCount(parameters, MIN_PARAMETER_COUNT, MAX_PARAMETER_COUNT);
        values = parameters.toArray(new CompoundVariable[0]);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getReferenceKey() {
        return KEY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<String> getArgumentDesc() {
        return desc;
    }
}


text:
package org.apereo.cas.support.wsfederation.attributes;

import org.apereo.cas.util.ScriptingUtils;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.core.io.Resource;

import java.util.List;
import java.util.Map;

/**
 * This is {@link GroovyWsFederationAttributeMutator}.
 *
 * @author Misagh Moayyed
 * @since 6.0.0
 */
@RequiredArgsConstructor
@Slf4j
public class GroovyWsFederationAttributeMutator implements WsFederationAttributeMutator {
    private static final long serialVersionUID = -3864465057274774578L;

    private final transient Resource groovyScript;

    @Override
    public Map<String, List<Object>> modifyAttributes(final Map<String, List<Object>> attributes) {
        val map = ScriptingUtils.executeGroovyScript(this.groovyScript, new Object[]{attributes, LOGGER}, Map.class, true);
        LOGGER.debug("Attributes mutated by [{}] are calculated as [{}]", getClass().getSimpleName(), map);
        return map;
    }
}

redpajama_set_name: RedPajamaGithub


text:
var imdb = require('imdb-api');
var express = require('express');
var commonfunctions = require('../commonfiles/commonfunctions');
var HttpStatus = require('http-status-codes');
var Q = require('q');
var spawn = require('child_process').spawn;
//var app = express();
var Q = require('q');
var app = module.exports = express();
console.log("am in imdbapi");
app.get('/imdbapi2',function (req, res){
	    var imdbid = req.query.imdbid;
			try{
			  (function (exports) {
			  'use strict';
			  var Sequence = exports.Sequence || require('sequence').Sequence
			    , sequence = Sequence.create()
			    , err
			    ;

			/* Using sequence package to make callback sync for maintaining atomic DB transactions */
			sequence
				.then(function (next) {
						pythonmovieapi(imdbid)
						.then(function success(result) {
						console.log("after movieInfo_imdbreq----->",result);
							next(result);
						}, function failure(err) {
							logger.error("movieInfo_imdbreq fail: " + err);
							deferred.reject(err);
						});
					})
				.then(function (next, imdbMovieIds) {
					console.log(imdbMovieIds);
					if(imdbMovieIds.status_code!=34)
							res.send(imdbMovieIds);
					else
							res.status(HttpStatus.INTERNAL_SERVER_ERROR).send({
							error: HttpStatus.getStatusText(HttpStatus.INTERNAL_SERVER_ERROR) });
					})
		}('undefined' !== typeof exports && exports || new Function('return this')()));
	}
	catch(e){
		console.log("exception--------->",e);
	}
});
var pythonmovieapi = function (imdbd, imdbdata){
	console.log("imdbid in posterpath is",imdbd);
  var deferred = Q.defer();
  var backdropspaths=[];
  var py;
   	console.log("================inside imdbpy of actorscrap		==============",imdbd);
 	try{
	py = spawn('python', ["PY/synopsis.py",imdbd]);
 	py.stdout.on('data',function(movieDetails){
		var textChunk = movieDetails.toString('utf8');
		textChunk = textChunk.trim();
		console.log("----------movieDetails------------");
		console.log(movieDetails);
		console.log("----------textChunk------------");
		console.log(typeof(textChunk));
		textChunk = JSON.parse(textChunk);
		console.log(typeof(textChunk));
		console.log(textChunk);
		console.log(textChunk.plot)
		if(textChunk!="empty"){
			var result= movieobjparsing(textChunk);
			deferred.resolve(result);
		}else{
			console.log("sorry no person");
			deferred.resolve("sorry no person");
			}
	},function(err){console.log("err------>",err)});
	}
	catch(e){console.log("========================exception in imdbpy=================");
	console.log(e);
	}
   console.log("movies name after try catch------------->",imdbd);
 return deferred.promise;
};
function movieobjparsing(things){
        if(things=="sorry no person"){
	        movieobj = {
		        "status_code": 34,
		        "status_message": "The resource you requested could not be found."
	        };
	        deferred.resolve(movieobj);
		}
	    var movieobj ={};
		movieobj.release_date = things.release_date;
		if(typeof(things.genres)!="undefined"){
			var generslist=things.genres;
			var genre = generslist.split(",");
			var genrarr =[];
			for(var j =0;j<genre.length;j++){
				var genreobj ={};
				genreobj.id = j;
				genreobj.name = genre[j];
				genrarr.push(genreobj);
			}
			movieobj.genres = genrarr;
		}else{
			movieobj.genres = "Not Avialable";
		}
		var director=things.director;
		movieobj.director = director;
		var writer=things.writer;
		movieobj.writer = writer;
		var rating=things.rating;
		movieobj.vote_average = rating;
		var language = things.language;
		movieobj.original_language = language;
		console.log('the movie language is',language);
		if(rating=="N/A"){
			rating = "Not Avialable";
			movieobj.vote_average = rating;
		}
		var story=things.plot;
		movieobj.overview = story;
		if(story=="Sorry the stroy is unavialable for this movie"){
			story = things.plotline;
			movieobj.overview = story;
		}
		var title=things.title;
		movieobj.title = title;
		var imdbid = things.imdbid;
		movieobj.imdb_id = imdbid;
		var year = things.year;
		movieobj.year = year;
		var poster=things.poster;
		movieobj.poster_path = poster;
		var actors=things.actors;
		movieobj.actors = actors;
		console.log("imdb poster is", poster);
		if(poster.includes("N/A")){
		poster ="http://ia.media-imdb.com/images/M/MV5BMjAzOTcxMDA2Nl5BMl5BcG5nXkFtZTcwMTc1MzIzOA@@._V1_.png";
		movieobj.poster_path = poster;
		}
	return movieobj;
}
/*var GenericmovieInfo = function(messageText)
{
	var deferred = Q.defer();
	imdb.getReq({ id:messageText }, function(err, things)
	{
		   var movieobj ={};
			 if (err) {
			      console.log('Oops!!! No movie found with that name.\nCheck your spelling or try some other Popular Movie.\n', err);
						movieobj = {
							"status_code": 34,
							"status_message": "The resource you requested could not be found."
						};
						deferred.resolve(movieobj);
			 }
			 if(things){
				 console.log(things);
				 var releseDate=things.released;
				 var date = new Date(releseDate);
				 var year = date.getFullYear();
			     var month = date.getMonth()+1;
			     var dt = date.getDate();
					if (dt < 10) {
					  dt = '0' + dt;
					}
					if (month < 10) {
					  month = '0' + month;
					}
				 movieobj.release_date = year+'-' + month + '-'+dt;
				 var generslist=things.genres;
				 var genre = generslist.split(",");
			   var genrarr =[];
			   for(var j =0;j<genre.length;j++){
					var genreobj ={};
					genreobj.id = j;
					genreobj.name = genre[j];
					genrarr.push(genreobj);
			   }
			   movieobj.genres = genrarr;
				 var director=things.director;
				 movieobj.director = director;
				 var writer=things.writer;
				 movieobj.writer = writer;
				 var rating=things.rating;
				 movieobj.vote_average = rating;
				 var language = things.languages;
				 movieobj.original_language = language;
				 console.log('the movie language is',language);
				 if(rating.includes("N/A")){
				  rating = "Not Avialable";
				  movieobj.vote_average = rating;
				 }
				 var story=things.plot;
				 movieobj.overview = story;
				 if(story.includes("N/A")){
				  story = "Sorry the stroy is unavialable for this movie";
				  movieobj.overview = story;
				 }
				 var title=things.title;
				 movieobj.title = title;
				 var imdbid = things.imdbid;
				 movieobj.imdb_id = imdbid;
				 var year = things._year_data;
				 movieobj.year = year;
				 var poster=things.poster;
				 movieobj.poster_path = poster;
				 var actors=things.actors;
				 movieobj.actors = actors;
				 console.log("imdb poster is", poster);
				 if(poster.includes("N/A")){
				   poster ="http://ia.media-imdb.com/images/M/MV5BMjAzOTcxMDA2Nl5BMl5BcG5nXkFtZTcwMTc1MzIzOA@@._V1_.png";
				   movieobj.poster_path = poster;
				 }
				 //console.log("The imdb details is ","releseDate is" +releseDate,"actors are"+actors,"geners is"+geners,"director is"+director,"writer is"+writer,"story is"+story,"title is"+title,
				 //"poster is "+poster,"imdburl is"+imdburl);
				 deferred.resolve(movieobj);
		 }
		 });
return deferred.promise;
}*/

//app.listen(3000);


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="" basedir="." default="...">

    <!-- ==================================== -->
    <!--              Properties              -->
    <!-- ==================================== -->

    <property name="build.environment" value="default" />
    <property name="build.public_dir" value="${build.path}/public" />
    <property name="build.log_dir" value="${build.path}/storage/logs" />
    <property name="db.data_path" value="${build.path}/storage/database" />

    <!-- ==================================== -->
    <!--             Dependencies             -->
    <!-- ==================================== -->

    <import file="${phingy.path}/scripts/core/database.xml" />

    <!-- ==================================== -->
    <!--                Tasks                 -->
    <!-- ==================================== -->

    <target name="project:config" depends="build:config, db:config" hidden="true">
        <echo msg="Running project:config" />

        <if>
            <not>
                <isset property="app.debug" />
            </not>
            <then>
                <propertyPrompt
                    propertyName="app.debug"
                    defaultValue=""
                    promptText="Enable debug? (1,0)"
                    useExistingValue="true"
                />

                <phingcall target="build:save_config" />
            </then>
        </if>
    </target>

    <target name="project:build:before" hidden="true">
        <echo msg="Running project:build:before" />
    </target>

    <target name="project:build:after" hidden="true">
        <echo msg="Running project:build:after" />
        <phingcall target="wordpress:permissions" />
        <exec command="bin/wp dotenv salts generate" passthru="true" />
    </target>

    <target name="project:build:housekeeping" hidden="true">
        <echo msg="Running project:build:housekeeping" />
    </target>

    <!--
        Set WordPress permissions.
    -->

    <target name="wordpress:permissions" depends="project:config" hidden="true">
        <echo msg="Setup permissions for WordPress..." />
        <mkdir dir="${build.public_dir}/app/uploads" />
        <chmod file="${build.public_dir}/app/uploads" mode="0775" failonerror="false" />
        <echo msg="...done" />
    </target>

    <!--
        Install a new WordPress site.
    -->

    <target name="wordpress:install" depends="project:config, db:create" description="Install a new WordPress site">
        <echo msg="Installing WordPress..." />

        <input propertyname="wordpress.site_title" defaultValue="My WordPress Site">WordPress site title?</input>
        <input propertyname="wordpress.admin_user" defaultValue="">Admin username?</input>
        <input propertyname="wordpress.admin_pass" defaultValue="">Admin password?</input>
        <input propertyname="wordpress.admin_email" defaultValue="">Admin email (must be wrapped in single quotes)?</input>

        <exec command="bin/wp core install --url='""' --title='${wordpress.site_title}' --admin_user='${wordpress.admin_user}' --admin_password='${wordpress.admin_pass}' --admin_email='${wordpress.admin_email}'" passthru="true" />
        <exec command="bin/wp theme activate starter" passthru="true" />
        <exec command="bin/wp rewrite structure "/%postname%/"" passthru="true" />
        <exec command="bin/wp plugin activate wordpress-seo" passthru="true" />
        <exec command="bin/wp plugin activate comet-cache" passthru="true" />

        <echo msg="...installation complete. Access your site at http://${build.url}/" />
    </target>

</project>


text:
blog
======
Jekyll blog for Blee | blog.getblee.com


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Public Class InterpolatedStringParsingTests
    Inherits BasicTestBase

    <Fact>
    Public Sub EmptyString()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($"""")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub NoInterpolations()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, World!"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub OnlyInterpolation()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""{""Hello, World!""}"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub SimpleInterpolation()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {name}!"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub ParenthesizedInterpolation()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {(firstName & lastName)}!"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub ComplexInterpolation_QueryExpression()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {From name In names Select name.Length}!"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub EscapedBraces()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""{{ {x}, {y} }}"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub EmbeddedBracesWorkaround()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""{""{""}{x}, {y}{""}""}"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub AlignmentClause()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine(""Header 1 | Header 2 | Header 3"")
        Console.WriteLine($""{items(0),9}|{items(1),9}|{items(2),9}"")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub FormatStringClause()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""You owe: {balanceDue:C02}."")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub FormatStringClause_WithTwoColons()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""You owe: {balanceDue::C02}."")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub AlignmentClauseAndFormatClause()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine($""You owe: {balanceDue,10:C02}."")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub MultilineText()

        ParseAndVerify(
"Module Program
    Sub Main()
        Console.WriteLine(
$""Name:
    {name}
Age:
    {age}
====="")
    End Sub
End Module")

    End Sub

    <Fact>
    Public Sub ERR_InterpolationFormatWhitespace()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {EventArgs.Empty:C02 }!"")
    End Sub
End Module"
        ).AssertTheseDiagnostics(
<expected>
BC37249: Format specifier may not contain trailing whitespace.
        Console.WriteLine($"Hello, {EventArgs.Empty:C02 }!")
                                                    ~~~
</expected>)

    End Sub

    <Fact>
    Public Sub Error_NewLineAfterAfterOpenBraceAndBeforeCloseBraceWithoutFormatClause()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {
EventArgs.Empty
}!"")
    End Sub
End Module"
        ).AssertTheseDiagnostics(
<expected>
BC30625: 'Module' statement must end with a matching 'End Module'.
Module Program
~~~~~~~~~~~~~~
BC30026: 'End Sub' expected.
    Sub Main()
    ~~~~~~~~~~
BC30198: ')' expected.
        Console.WriteLine($"Hello, {
                                    ~
BC30201: Expression expected.
        Console.WriteLine($"Hello, {
                                    ~
BC30370: '}' expected.
        Console.WriteLine($"Hello, {
                                    ~
BC30648: String constants must end with a double quote.
}!")
  ~~~
</expected>)

    End Sub

    <Fact>
    Public Sub Error_NewLineAfterAlignmentClause()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {EventArgs.Empty,-10
:C02}!"")
    End Sub
End Module"
        ).AssertTheseDiagnostics(
<expected>
BC30625: 'Module' statement must end with a matching 'End Module'.
Module Program
~~~~~~~~~~~~~~
BC30026: 'End Sub' expected.
    Sub Main()
    ~~~~~~~~~~
BC30198: ')' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty,-10
                                                       ~
BC30370: '}' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty,-10
                                                       ~
BC30201: Expression expected.
:C02}!")
    ~
BC30800: Method arguments must be enclosed in parentheses.
:C02}!")
    ~
BC30648: String constants must end with a double quote.
:C02}!")
      ~~~
</expected>)
    End Sub

    <Fact>
    Public Sub Error_NewLineAfterAlignmentClauseCommaToken()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {EventArgs.Empty,
-10:C02}!"")
    End Sub
End Module"
        ).AssertTheseDiagnostics(
<expected>
BC30625: 'Module' statement must end with a matching 'End Module'.
Module Program
~~~~~~~~~~~~~~
BC30026: 'End Sub' expected.
    Sub Main()
    ~~~~~~~~~~
BC30198: ')' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty,
                                                    ~
BC30204: Integer constant expected.
        Console.WriteLine($"Hello, {EventArgs.Empty,
                                                    ~
BC30370: '}' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty,
                                                    ~
BC30035: Syntax error.
-10:C02}!")
~
BC30201: Expression expected.
-10:C02}!")
       ~
BC30800: Method arguments must be enclosed in parentheses.
-10:C02}!")
       ~
BC30648: String constants must end with a double quote.
-10:C02}!")
         ~~~
</expected>)
    End Sub

    <Fact>
    Public Sub Error_NewLineAfterFormatClause()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {EventArgs.Empty:C02
}!"")
    End Sub
End Module"
        ).AssertTheseDiagnostics(
<expected>
BC30625: 'Module' statement must end with a matching 'End Module'.
Module Program
~~~~~~~~~~~~~~
BC30026: 'End Sub' expected.
    Sub Main()
    ~~~~~~~~~~
BC30198: ')' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty:C02
                                                       ~
BC30370: '}' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty:C02
                                                       ~
BC30648: String constants must end with a double quote.
}!")
  ~~~
</expected>)
    End Sub

    <Fact>
    Public Sub Error_NewLineAfterFormatClauseColonToken()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""Hello, {EventArgs.Empty:
C02}!"")
    End Sub
End Module"
        ).AssertTheseDiagnostics(
<expected>
BC30625: 'Module' statement must end with a matching 'End Module'.
Module Program
~~~~~~~~~~~~~~
BC30026: 'End Sub' expected.
    Sub Main()
    ~~~~~~~~~~
BC30198: ')' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty:
                                                    ~
BC30370: '}' expected.
        Console.WriteLine($"Hello, {EventArgs.Empty:
                                                    ~
BC30201: Expression expected.
C02}!")
   ~
BC30800: Method arguments must be enclosed in parentheses.
C02}!")
   ~
BC30648: String constants must end with a double quote.
C02}!")
     ~~~
</expected>)
    End Sub

    <Fact>
    Public Sub ErrorRecovery_DollarSignMissingDoubleQuote()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($)
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingClosingDoubleQuote()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingCloseBrace()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpressionWithAlignment()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{,5}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpressionWithFormatString()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{:C02}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpressionWithAlignmentAndFormatString()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{,5:C02}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpressionAndAlignment()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{,}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpressionAndAlignmentAndFormatString()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{,:}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionKeyword()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{For}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionCharacter()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{`}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_IncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{(1 +}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingAlignment()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_BadAlignment()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,&}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingFormatString()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentWithMissingFormatString()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,5:}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentAndFormatStringOutOfOrder()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:C02,-5}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingOpenBrace()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_DollarSignMissingDoubleQuote_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingClosingDoubleQuote_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingCloseBrace_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingExpression_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionKeyword_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{For}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionCharacter_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{`}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_IncompleteExpression_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{(1 +}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingAlignment_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_BadAlignment_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,&}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingFormatString_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentWithMissingFormatString_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,5:}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentAndFormatStringOutOfOrder_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:C02,-5}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingOpenBrace_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""}""
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionKeyword_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{For"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionCharacter_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{`"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_IncompleteExpression_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{(1 +"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingAlignment_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_BadAlignment_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,&"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingFormatString_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentWithMissingFormatString_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,5:"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentAndFormatStringOutOfOrder_InUnclosedInterpolation()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:C02,-5"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionKeyword_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{For
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_NonExpressionCharacter_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{`
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_IncompleteExpression_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{(1 +
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingAlignment_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_BadAlignment_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,&
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_MissingFormatString_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentWithMissingFormatString_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1,5:
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_AlignmentAndFormatStringOutOfOrder_InUnclosedInterpolation_NestedInIncompleteExpression()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1:C02,-5
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_IncompleteExpression_FollowedByAColon()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{CStr(:C02}"")
        Console.WriteLine($""{CStr(1:C02}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_IncompleteExpression_FollowedByATwoColons()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{CStr(::C02}"")
        Console.WriteLine($""{CStr(1::C02}"")
    End Sub
End Module")
    End Sub

    <Fact>
    Public Sub ErrorRecovery_ExtraCloseBraceFollowingInterpolationWithNoFormatClause()
        Parse(
"Module Program
    Sub Main()
        Console.WriteLine($""{1}}"")
    End Sub
End Module")
    End Sub

End Class


text:
<eveapi version="2">
    <currentTime>2015-05-28 12:45:20</currentTime>
    <result>
        <rowset name="messages" key="messageID"
                columns="messageID,senderID,senderName,sentDate,title,toCorpOrAllianceID,toCharacterIDs,toListID">
            <row messageID="350486872" senderID="1109604843" senderName="wheniaminspace" sentDate="2015-05-25 19:21:00"
                 title="FW: blah" toCorpOrAllianceID="" toCharacterIDs=""
                 toListID="145135833" senderTypeID="1379"/>
            <row messageID="350462190" senderID="1109604843" senderName="wheniaminspace" sentDate="2015-05-25 00:45:00"
                 title="reminder: cloaky camping pays off" toCorpOrAllianceID="99001561" toCharacterIDs="" toListID=""
                 senderTypeID="1379"/>
        </rowset>
    </result>
    <cachedUntil>2015-05-28 13:00:20</cachedUntil>
</eveapi>


text:
package config

import (
	"fmt"
	"net/url"
)

type SourceOptions struct {
	Etcd EtcdOptions `group:"Config etcd://"`
}

// A single Config may contain Nodes from different Sources
type Source interface {
	// uniquely identifying
	String() string
}

func (options SourceOptions) openURL(sourceURL string) (Source, error) {
	url, err := url.Parse(sourceURL)
	if err != nil {
		return nil, err
	}

	switch url.Scheme {
	case "etcd", "etcd+http", "etcd+https":
		return options.Etcd.OpenURL(url)

	case "file":
		return openFileSource(url)

	default:
		return nil, fmt.Errorf("Invalid config URL Scheme=%v: %v\n", url.Scheme, url)
	}
}

type scanSource interface {
	Source

	Scan() ([]Node, error)
}

type syncSource interface {
	Source

	Sync(chan Node) error
}

type writeSource interface {
	Source

	// Update the set of written nodes, adding any new nodes, setting any changed nodes, and removing any missing nodes
	//
	// If source has a TTL mechanism, also refreshes the nodes.
	//
	// The map must be safe for reading from a different goroutine until the next Write() completes
	Write(nodes map[string]Node) error

	// Remove any written nodes
	Flush() error
}


text:
/**
 * @author André König <andre.koenig@gmail.com>
 *
 */

import xs from "xstream";
import {
  compose,
  lifecycle,
  withProps,
  withState,
  setDisplayName
} from "recompose";

const withStreams = (blueprints, test = false) => {
  let dispatcher;

  const propPrefix = `${test ? "data-" : ""}`;

  const producer = {
    start: listener => (dispatcher = value => listener.next(value)),
    stop: () => (dispatcher = null)
  };

  const uberStream = xs.create(producer);

  //
  // Use the names of the stream creator identifiers
  // as prop names.
  //
  const streamNames = Object.keys(blueprints);

  const withStates = streamNames.map(streamName =>
    withState(`${propPrefix}${streamName}`, `${propPrefix}set${streamName}`, "")
  );

  const dispatch = action => dispatcher(action);

  return compose(
    setDisplayName("withStreams"),
    ...withStates,
    withProps({
      [`${propPrefix}dispatch`]: dispatch
    }),
    lifecycle({
      componentDidMount() {
        //
        // Activate each stream, pass the own props and subscribe to changes
        // so that the respective props gets updated.
        //
        streamNames
          .map(streamName => ({
            name: streamName,
            stream: blueprints[streamName]
          }))
          .forEach(({ name, stream }) =>
            stream(uberStream, this.props).subscribe({
              next: value => this.props[`${propPrefix}set${name}`](value)
            })
          );
      }
    })
  );
};

export { withStreams };


text:
module TaskMapper::Provider
  # This is the Bugherd Provider for taskmapper
  module Bugherd
    include TaskMapper::Provider::Base
    TICKET_API = Bugherd::Ticket # The class to access the api's tickets
    PROJECT_API = BugherdAPI::Project # The class to access the api's projects

    # This is for cases when you want to instantiate using TaskMapper::Provider::Bugherd.new(auth)
    def self.new(auth = {})
      TaskMapper.new(:bugherd, auth)
    end

    # Providers must define an authorize method. This is used to initialize and set authentication
    # parameters to access the API
    def authorize(auth = {})
      @authentication ||= TaskMapper::Authenticator.new(auth)
      auth = @authentication
      if (auth.email.empty? || auth.password.empty?)
        raise "You must provide email and password for authentication"
      end
      BugherdAPI.authenticate(auth.email, auth.password)
      # Set authentication parameters for whatever you're using to access the API
    end

    # declare needed overloaded methods here
    def valid?
      begin
        !BugherdAPI::User.find(:all).nil?
      rescue
        false
      end
    end

  end
end


text:
export default () => {
  const { protocol, host, pathname } = window.location;
  const shareBtn = document.querySelector('.js-share-btn');
  const embedBtn = document.querySelector('.js-embed-btn');
  const snippetUrlArea = document.querySelector('.js-snippet-url-area');
  const embedAction = document.querySelector('.js-embed-action');
  const url = `${protocol}//${host + pathname}`;

  shareBtn.addEventListener('click', () => {
    shareBtn.classList.add('is-active');
    embedBtn.classList.remove('is-active');
    snippetUrlArea.value = url;
    embedAction.innerText = 'Share';
  });

  embedBtn.addEventListener('click', () => {
    embedBtn.classList.add('is-active');
    shareBtn.classList.remove('is-active');
    const scriptTag = `<script src="${url}.js"></script>`;
    snippetUrlArea.value = scriptTag;
    embedAction.innerText = 'Embed';
  });
};


text:
from swgpy.object import *

def create(kernel):
	result = Tangible()

	result.template = "object/tangible/loot/misc/shared_loot_skull_bol.iff"
	result.attribute_template_id = -1
	result.stfName("item_n","bol_skull")

	#### BEGIN MODIFICATIONS ####
	####  END MODIFICATIONS  ####

	return result


text:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Linq;
using System.Web;

namespace BikeTracker.Helpers
{
	public class ImageHelper
	{
		public static Image CropToCircle(Image srcImage, Color backGround)
		{
			Image dstImage = new Bitmap(60, 60, PixelFormat.Format32bppArgb);
			Graphics g = Graphics.FromImage(dstImage);
			using (Brush br = new SolidBrush(backGround))
			{
				g.FillRectangle(br, 0, 0, dstImage.Width, dstImage.Height);
			}
			GraphicsPath path = new GraphicsPath();
			path.AddEllipse(0, 0, dstImage.Width, dstImage.Height);
			g.SetClip(path);
			g.DrawImage(srcImage, 0, 0);

			return dstImage;
		}
	}
}


text:
package com.vaadin.pontus.vizcomponent.client;

public class ZoomSettings {

	boolean panEnabled =  true;
	boolean controlIconsEnabled  = false;
	boolean zoomEnabled = true;
	boolean dblClickZoomEnabled = true;
	boolean mouseWheelZoomEnabled = true;
	boolean preventMouseEventsDefault = false;
	float zoomScaleSensitivity = 0.2f;
	float minZoom = 0.1f;
	float maxZoom = 10;
	boolean fit = true;
	boolean contain = false;
	boolean center = true;
	//String refreshRate = AUTO; // TODO: according to the docu this  ist 'auto' or a number

	public boolean isPanEnabled() {
		return panEnabled;
	}
	public void setPanEnabled(boolean panEnabled) {
		this.panEnabled = panEnabled;
	}
	public boolean isControlIconsEnabled() {
		return controlIconsEnabled;
	}
	public void setControlIconsEnabled(boolean controlIconsEnabled) {
		this.controlIconsEnabled = controlIconsEnabled;
	}
	public boolean isZoomEnabled() {
		return zoomEnabled;
	}
	public void setZoomEnabled(boolean zoomEnabled) {
		this.zoomEnabled = zoomEnabled;
	}
	public boolean isDblClickZoomEnabled() {
		return dblClickZoomEnabled;
	}
	public void setDblClickZoomEnabled(boolean dblClickZoomEnabled) {
		this.dblClickZoomEnabled = dblClickZoomEnabled;
	}
	public boolean isMouseWheelZoomEnabled() {
		return mouseWheelZoomEnabled;
	}
	public void setMouseWheelZoomEnabled(boolean mouseWheelZoomEnabled) {
		this.mouseWheelZoomEnabled = mouseWheelZoomEnabled;
	}
	public boolean isPreventMouseEventsDefault() {
		return preventMouseEventsDefault;
	}
	public void setPreventMouseEventsDefault(boolean preventMouseEventsDefault) {
		this.preventMouseEventsDefault = preventMouseEventsDefault;
	}
	public float getZoomScaleSensitivity() {
		return zoomScaleSensitivity;
	}
	public void setZoomScaleSensitivity(float zoomScaleSensitivity) {
		this.zoomScaleSensitivity = zoomScaleSensitivity;
	}
	public float getMinZoom() {
		return minZoom;
	}
	public void setMinZoom(float minZoom) {
		this.minZoom = minZoom;
	}
	public float getMaxZoom() {
		return maxZoom;
	}
	public void setMaxZoom(float maxZoom) {
		this.maxZoom = maxZoom;
	}
	public boolean isFit() {
		return fit;
	}
	public void setFit(boolean fit) {
		this.fit = fit;
	}
	public boolean isContain() {
		return contain;
	}
	public void setContain(boolean contain) {
		this.contain = contain;
	}
	public boolean isCenter() {
		return center;
	}
	public void setCenter(boolean center) {
		this.center = center;
	}

}


text:
"""Additional regular expression utilities, to make it easier to sync up
with Java regular expression code.

>>> import re
>>> from .re_util import fullmatch
>>> from .util import u
>>> string = 'abcd'
>>> r1 = re.compile('abcd')
>>> r2 = re.compile('bc')
>>> r3 = re.compile('abc')
>>> fullmatch(r1, string)  # doctest: +ELLIPSIS
<...SRE_Match object...>
>>> fullmatch(r2, string)
>>> fullmatch(r3, string)
>>> r = re.compile('\\d{8}|\\d{10,11}')
>>> m = fullmatch(r, '1234567890')
>>> m.end()
10
>>> r = re.compile(u('[+\uff0b\\d]'), re.UNICODE)
>>> m = fullmatch(r, u('\uff10'))
>>> m.end()
1
"""
import re

def fullmatch(pattern, string, flags=0):
    """Try to apply the pattern at the start of the string, returning a match
    object if the whole string matches, or None if no match was found."""
    # Build a version of the pattern with a non-capturing group around it.
    # This is needed to get m.end() to correctly report the size of the
    # matched expression (as per the final doctest above).
    grouped_pattern = re.compile("^(?:%s)$" % pattern.pattern, pattern.flags)
    m = grouped_pattern.match(string)
    if m and m.end() < len(string):
        # Incomplete match (which should never happen because of the $ at the
        # end of the regexp), treat as failure.
        m = None  # pragma no cover
    return m

if __name__ == '__main__':  # pragma no cover
    import doctest
    doctest.testmod()


text:
package io.github.ageofwar.telejam.methods;

import io.github.ageofwar.telejam.replymarkups.ReplyMarkup;
import io.github.ageofwar.telejam.connection.UploadFile;
import io.github.ageofwar.telejam.messages.*;
import io.github.ageofwar.telejam.chats.Chat;

import java.util.Map;

import static io.github.ageofwar.telejam.methods.Maps.mapOf;

/**
 * Use this method to send .webp stickers.
 * On success, the sent Message is returned.
 *
 * @author Michi Palazzo
 */
public class SendSticker implements TelegramMethod<StickerMessage> {

  public static final String NAME = "sendSticker";

  static final String CHAT_ID_FIELD = "chat_id";
  static final String DISABLE_NOTIFICATION_FIELD = "disable_notification";
  static final String REPLY_TO_MESSAGE_ID_FIELD = "reply_to_message_id";
  static final String REPLY_MARKUP_FIELD = "reply_markup";
  static final String STICKER_FIELD = "sticker";

  /**
   * Unique identifier for the target chat.
   */
  private Long chatId;

  /**
   * Username of the target channel (in the format @channelusername).
   */
  private String chatUsername;

  /**
   * Sends the message silently. Users will receive a notification with no sound.
   */
  private Boolean disableNotification;

  /**
   * If the message is a reply, ID of the original message.
   */
  private Long replyToMessageId;

  /**
   * Additional interface options.
   */
  private ReplyMarkup replyMarkup;

  /**
   * Sticker to send.
   */
  private String sticker;

  /**
   * Sticker not present in Telegram servers.
   */
  private UploadFile newSticker;

  public SendSticker chat(String chatUsername) {
    this.chatUsername = chatUsername;
    chatId = null;
    return this;
  }

  public SendSticker chat(Long chatId) {
    this.chatId = chatId;
    chatUsername = null;
    return this;
  }

  public SendSticker chat(Chat chat) {
    chatId = chat.getId();
    chatUsername = null;
    return this;
  }

  public SendSticker disableNotification(Boolean disableNotification) {
    this.disableNotification = disableNotification;
    return this;
  }

  public SendSticker disableNotification() {
    disableNotification = true;
    return this;
  }

  public SendSticker replyToMessage(Message message) {
    replyToMessageId = message.getId();
    chatId = message.getChat().getId();
    chatUsername = null;
    return this;
  }

  public SendSticker replyToMessage(Long replyToMessageId) {
    this.replyToMessageId = replyToMessageId;
    return this;
  }

  public SendSticker replyMarkup(ReplyMarkup replyMarkup) {
    this.replyMarkup = replyMarkup;
    return this;
  }

  public SendSticker sticker(String sticker) {
    newSticker = null;
    this.sticker = sticker;
    return this;
  }

  public SendSticker sticker(UploadFile newSticker) {
    sticker = null;
    this.newSticker = newSticker;
    return this;
  }

  @Override
  public String getName() {
    return NAME;
  }

  @Override
  public Map<String, Object> getParameters() {
    return mapOf(
        CHAT_ID_FIELD, chatId != null ? chatId : chatUsername,
        DISABLE_NOTIFICATION_FIELD, disableNotification,
        REPLY_TO_MESSAGE_ID_FIELD, replyToMessageId,
        REPLY_MARKUP_FIELD, replyMarkup,
        STICKER_FIELD, sticker
    );
  }

  @Override
  public Map<String, UploadFile> getFiles() {
    return mapOf(STICKER_FIELD, newSticker);
  }

  @Override
  public Class<? extends StickerMessage> getReturnType() {
    return StickerMessage.class;
  }

}


text:
'use strict';

var express = require('express');
var controller = require('./question.controller');

var router = express.Router();

var auth = require('../../auth/auth.service');

router.get('/', controller.index);
router.get('/:id', controller.show);
router.post('/', auth.isAuthenticated(), controller.create);
router.put('/:id', auth.isAuthenticated(), controller.update);
router.patch('/:id', auth.isAuthenticated(), controller.update);
router.delete('/:id', auth.isAuthenticated(), controller.destroy);

router.post('/:id/answers', auth.isAuthenticated(), controller.createAnswer);
router.put('/:id/answers/:answerId', auth.isAuthenticated(), controller.updateAnswer);
router.delete('/:id/answers/:answerId', auth.isAuthenticated(), controller.destroyAnswer);

router.post('/:id/comments', auth.isAuthenticated(), controller.createComment);
router.put('/:id/comments/:commentId', auth.isAuthenticated(), controller.updateComment);
router.delete('/:id/comments/:commentId', auth.isAuthenticated(), controller.destroyComment);

router.post('/:id/answers/:answerId/comments', auth.isAuthenticated(), controller.createAnswerComment);
router.put('/:id/answers/:answerId/comments/:commentId', auth.isAuthenticated(), controller.updateAnswerComment);
router.delete('/:id/answers/:answerId/comments/:commentId', auth.isAuthenticated(), controller.destroyAnswerComment);

router.put('/:id/star', auth.isAuthenticated(), controller.star);
router.delete('/:id/star', auth.isAuthenticated(), controller.unstar);
router.put('/:id/answers/:answerId/star', auth.isAuthenticated(), controller.starAnswer);
router.delete('/:id/answers/:answerId/star', auth.isAuthenticated(), controller.unstarAnswer);
router.put('/:id/comments/:commentId/star', auth.isAuthenticated(), controller.starComment);
router.delete('/:id/comments/:commentId/star', auth.isAuthenticated(), controller.unstarComment);
router.put('/:id/answers/:answerId/comments/:commentId/star', auth.isAuthenticated(), controller.starAnswerComment);
router.delete('/:id/answers/:answerId/comments/:commentId/star', auth.isAuthenticated(), controller.unstarAnswerComment);

module.exports = router;


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { WordLettersComponent } from './word-letters.component';

describe('WordLettersComponent', () => {
  let wordLettersComponent: WordLettersComponent;
  let wordLettersFixture: ComponentFixture<WordLettersComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ WordLettersComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    wordLettersFixture = TestBed.createComponent(WordLettersComponent);
    wordLettersComponent = wordLettersFixture.componentInstance;
  });

  it('should create component', async(() => {
    const component = wordLettersFixture.debugElement.componentInstance;
    expect(component).toBeTruthy();
  }));

  it('should drop letter when it has been pressed', () => {
    wordLettersComponent.letters = ['w', 'o', 'r', 'd'];
    wordLettersComponent.onLetterPressed('o');
    wordLettersFixture.detectChanges();
    expect(wordLettersComponent.letters.includes('o')).toBeFalsy();
    expect(wordLettersComponent.letters.length).toEqual(3);
  });

});


text:
+function($) {
    'use strict';

    // Fade out the blog and let drop the about card of the author and vice versa

    /**
     * AboutCard
     * @constructor
     */
    var AboutCard = function() {
        this.$openBtn   = $("#sidebar, #header").find("a[href*='#about']");
        this.$closeBtn  = $('#about-btn-close');
        this.$blog      = $('#blog');
        this.$about     = $('#about');
        this.$aboutCard = $('#about-card');
    };

    AboutCard.prototype = {

        /**
         * Run AboutCard feature
         */
        run: function() {
            var self = this;
            // Detect click on open button
            self.$openBtn.click(function(e) {
                e.preventDefault();
                self.play();
            });
            // Detect click on close button
            self.$closeBtn.click(function(e) {
                e.preventDefault();
                self.playBack();
            });
        },

        /**
         * Play the animation
         */
        play: function() {
            var self = this;
            // Fade out the blog
            self.$blog.fadeOut();
            // Fade in the about card
            self.$about.fadeIn();
            // Small timeout to drop the about card after that
            // the about card fade in and the blog fade out
            setTimeout(function() {
                self.dropAboutCard();
            }, 300);
        },

        /**
         * Play back the animation
         */
        playBack: function() {
            var self = this;

            // Lift the about card
            self.liftAboutCard();
            // Fade in the blog after that the about card lifted up
            setTimeout(function() {
                self.$blog.fadeIn();
            }, 500);
            // Fade out the about card after that the about card lifted up
            setTimeout(function() {
                self.$about.fadeOut();
            }, 500);
        },

        /**
         * Slide the card to the middle
         */
        dropAboutCard: function() {
            var self            = this;
            var aboutCardHeight = self.$aboutCard.innerHeight();

            self.$aboutCard
                .css('top', '0px')
                .css('top', '-' + aboutCardHeight + 'px')
                .show(500, function() {
                    self.$aboutCard.animate({
                        top: '+=' + (($(window).height() / 2) - (aboutCardHeight / 2) + aboutCardHeight) + 'px'
                    });
                });
        },

        /**
         * Slide the card to the top
         */
        liftAboutCard: function() {
            var self            = this;
            var aboutCardHeight = self.$aboutCard.innerHeight();

            self.$aboutCard.animate({
                top: '-=' + (($(window).height() / 2) - (aboutCardHeight / 2) + aboutCardHeight) + 'px'
            }, 500, function() {
                self.$aboutCard.hide();
            });
        }
    };

    $(document).ready(function() {
        var aboutCard = new AboutCard();
        aboutCard.run();
    });
}(jQuery);;+function($) {
    'use strict';

    // Filter posts by using their date on archives page : `/archives`

    /**
     * ArchivesFilter
     * @param archivesElem
     * @constructor
     */
    var ArchivesFilter = function(archivesElem) {
        this.$form          = $(archivesElem).find('#filter-form');
        this.$searchInput   = $(archivesElem).find('input[name=date]');
        this.$archiveResult = $(archivesElem).find('.archive-result');
        this.$postsYear     = $(archivesElem).find('.archive-year');
        this.$postsMonth    = $(archivesElem).find('.archive-month');
        this.$postsDay      = $(archivesElem).find('.archive-day');
        this.postsYear      = archivesElem + ' .archive-year';
        this.postsMonth     = archivesElem + ' .archive-month';
        this.postsDay       = archivesElem + ' .archive-day';
    };

    ArchivesFilter.prototype = {

        /**
         * Run ArchivesFilter feature
         */
        run: function() {
            var self = this;

            self.$searchInput.keyup(function() {
                self.filter(self.sliceDate(self.getSearch()));
            });

            // Block submit action
            self.$form.submit(function(e) {
                e.preventDefault();
            });
        },

        /**
         * Get Filter entered by user
         * @returns {string} The date entered by the user
         */
        getSearch: function() {
            return this.$searchInput.val().replace(/([\/|.|-])/g, '').toLowerCase();
        },

        /**
         * Slice the date by year, month and day
         * @param {string} date - The date of the post
         * @returns {*[]} The date of the post splitted in a list
         */
        sliceDate: function(date) {
            return [
                date.slice(0, 4),
                date.slice(4, 6),
                date.slice(6)
            ];
        },

        /**
         * Show related posts and hide others
         * @param {string} date - The date of the post
         */
        filter: function(date) {
            var numberPosts;

            // Check if the search is empty
            if (date[0] == '') {
                this.showAll();
                this.showResult(-1);
            }
            else {
                numberPosts = this.countPosts(date);

                this.hideAll();
                this.showResult(numberPosts);

                if (numberPosts > 0) {
                    this.showPosts(date);
                }
            }
        },

        /**
         * Display results
         * @param {number} numbPosts - The number of posts found
         */
        showResult: function(numbPosts) {
            if (numbPosts == 0) {
                this.$archiveResult.html('No posts found').show();
            }
            else if (numbPosts == -1) {
                this.$archiveResult.html('').hide();
            }
            else {
                this.$archiveResult.html(numbPosts + ' post' + ((numbPosts > 1) ? 's' : '') + ' found').show();
            }
        },

        /**
         * Count number of posts
         * @param {string} date - The date of the post
         * @returns {number} The number of posts found
         */
        countPosts: function(date) {
            return $(this.postsDay + '[data-date^=' + date[0] + date[1] + date[2] + ']').length;
        },

        /**
         * Show all posts from a date
         * @param {string} date - The date of the post
         */
        showPosts: function(date) {
            $(this.postsYear + '[data-date^=' + date[0] + ']').show();
            $(this.postsMonth + '[data-date^=' + date[0] + date[1] + ']').show();
            $(this.postsDay + '[data-date^=' + date[0] + date[1] + date[2] + ']').show();
        },

        /**
         * Show all posts
         */
        showAll: function() {
            this.$postsYear.show();
            this.$postsMonth.show();
            this.$postsDay.show();
        },

        /**
         * Hide all posts
         */
        hideAll: function() {
            this.$postsYear.hide();
            this.$postsMonth.hide();
            this.$postsDay.hide();
        }
    };

    $(document).ready(function() {
        if ($('#archives').length) {
            var archivesFilter = new ArchivesFilter('#archives');
            archivesFilter.run();
        }
    })
}(jQuery);;+function($) {
    'use strict';

    // Filter posts by using their categories on categories page : `/categories`

    /**
     * CategoriesFilter
     * @param categoriesArchivesElem
     * @constructor
     */
    var CategoriesFilter = function(categoriesArchivesElem) {
        this.$form = $(categoriesArchivesElem).find('#filter-form');
        this.$inputSearch = $(categoriesArchivesElem).find('input[name=category]');
        // Element where result of the filter are displayed
        this.$archiveResult = $(categoriesArchivesElem).find('.archive-result');
        this.$posts = $(categoriesArchivesElem).find('.archive');
        this.$categories = $(categoriesArchivesElem).find('.category-anchor');
        this.posts = categoriesArchivesElem + ' .archive';
        this.categories = categoriesArchivesElem + ' .category-anchor';
        // Html data attribute without `data-` of `.archive` element which contains the name of category
        this.dataCategory = 'category';
        // Html data attribute without `data-` of `.archive` element which contains the name of parent's categories
        this.dataParentCategories = 'parent-categories';
    };

    CategoriesFilter.prototype = {

        /**
         * Run CategoriesFilter feature
         */
        run: function() {
            var self = this;

            self.$inputSearch.keyup(function() {
                self.filter(self.getSearch());
            });

            // Block submit action
            self.$form.submit(function(e) {
                e.preventDefault();
            });
        },

        /**
         * Get the search entered by user
         * @returns {string} The name of the category
         */
        getSearch: function() {
            return this.$inputSearch.val().toLowerCase();
        },

        /**
         * Show related posts form a category and hide the others
         * @param {string} category - The name of the category
         */
        filter: function(category) {
            if (category == '') {
                this.showAll();
                this.showResult(-1);
            }
            else {
                this.hideAll();
                this.showPosts(category);
                this.showResult(this.countCategories(category));
            }
        },

        /**
         * Display results of the search
         * @param {Number} numbCategories - The number of categories found
         */
        showResult: function(numbCategories) {
            if (numbCategories == 0) {
                this.$archiveResult
                    .html('No categories found')
                    .show();
            }
            else if (numbCategories == -1) {
                this.$archiveResult
                    .html('')
                    .hide();
            }
            else {
                this.$archiveResult
                    .html(numbCategories + ' categor' + ((numbCategories > 1) ? 'ies' : 'y') + ' found')
                    .show();
            }
        },

        /**
         * Count number of categories
         * @param {string} category - The name of theThe date of the post category
         * @returns {Number} The number of categories found
         */
        countCategories: function(category) {
            return $(this.posts + '[data-' + this.dataCategory + '*=\'' + category + '\']').length;
        },

        /**
         * Show all posts from a category
         * @param {string} category - The name of the category
         */
        showPosts: function(category) {
            var self = this;
            var parents;

            if (self.countCategories(category) > 0) {
                // Check if selected categories have parents
                if ($(self.categories + '[data-' + this.dataCategory + '*=\'' + category + '\'][data-' + self.dataParentCategories + ']').length) {
                    // Get all categories that matches search
                    $(self.categories + '[data-' + self.dataCategory + '*=\'' + category + '\']').each(function() {
                        // Get all its parents categories name
                        parents = $(this).attr('data-' + self.dataParentCategories).split(',');
                        // Show only the title of the parents's categories and hide their posts
                        parents.forEach(function(parent) {
                            $(self.categories + '[data-' + self.dataCategory + '=\'' + parent + '\']').show();
                            $(self.posts + '[data-' + self.dataCategory + '=\'' + parent + '\']').show();
                            $(self.posts + '[data-' + self.dataCategory + '=\'' + parent + '\'] > .archive-posts > .archive-post').hide();
                        });
                    });

                }
            }
            // Show categories and related posts found
            $(self.categories + '[data-' + self.dataCategory + '*=\'' + category + '\']').show();
            $(self.posts + '[data-' + self.dataCategory + '*=\'' + category + '\']').show();
            $(self.posts + '[data-' + self.dataCategory + '*=\'' + category + '\'] > .archive-posts > .archive-post').show();
        },

        /**
         * Show all categories and all posts
         */
        showAll: function() {
            this.$categories.show();
            this.$posts.show();
            $(this.posts + ' > .archive-posts > .archive-post').show();
        },

        /**
         * Hide all categories and all posts
         */
        hideAll: function() {
            this.$categories.hide();
            this.$posts.hide();
        }
    };
    $(document).ready(function() {
        if ($('#categories-archives').length) {
            var categoriesFilter = new CategoriesFilter('#categories-archives');
            categoriesFilter.run();
        }
    });
}(jQuery);;+function($) {
    'use strict';

    // Resize codeblocks to fit the screen width

    var CodeBlockResizer = function(elem) {
        this.$codeBlocks = $(elem);
    };

    CodeBlockResizer.prototype = {
        /**
         * Run main feature
         */
        run: function() {
            var self = this;
            // resize all codeblocks
            self.resize();
            // resize codeblocks when window is resized
            $(window).smartresize(function() {
                self.resize();
            });
        },

        /**
         * Resize codeblocks
         */
        resize: function() {
            var self = this;
            self.$codeBlocks.each(function() {
                var $gutter = $(this).find('.gutter');
                var $code = $(this).find('.code');
                // get padding of code div
                var codePaddings = $code.width() - $code.innerWidth();
                // codeblock div width with padding - gutter div with padding + code div padding
                var width = $(this).outerWidth() - $gutter.outerWidth() + codePaddings;
                // apply new width
                $code.css('width', width);
                $code.children('pre').css('width', width);
            });
        }
    };

    $(document).ready(function() {
        var resizer = new CodeBlockResizer('figure.highlight');
        resizer.run();
    });
}(jQuery);;+function($) {

    // Run fancybox feature

    $(document).ready(function() {
        $(".fancybox").fancybox({
            maxWidth:    900,
            maxHeight:   800,
            fitToView:   true,
            width:       '50%',
            height:      '50%',
            autoSize:    true,
            closeClick:  false,
            openEffect:  'elastic',
            closeEffect: 'elastic',
            prevEffect:  'none',
            nextEffect:  'none',
            padding:     '0',
            helpers:     {
                thumbs:  {
                    width:  70,
                    height: 70
                },
                overlay: {
                    css: {
                        'background': 'rgba(0, 0, 0, 0.85)'
                    }
                }
            }
        });
    });
}(jQuery);;+function($) {
    'use strict';

    // Hide the header when the user scrolls down, and show it when he scrolls up

    /**
     * Header
     * @constructor
     */
    var Header = function() {
        this.$header      = $('#header');
        this.headerHeight = this.$header.height();
        // CSS class located in `source/_css/layout/_header.scss`
        this.headerUpCSSClass = 'header-up';
        this.delta            = 5;
        this.lastScrollTop    = 0;
        this.scrollTop;
    };

    Header.prototype = {

        /**
         * Run Header feature
         */
        run: function() {
            var self = this;
            var didScroll;

            // Detect if the user is scrolling
            $(window).scroll(function() {
                self.didScroll = true;
            });

            // Check if the user scrolled every 250 milliseconds
            setInterval(function() {
                if (self.didScroll) {
                    self.animate();
                    self.didScroll = false;
                }
            }, 250);
        },

        /**
         * Animate the header
         */
        animate: function() {
            this.scrollTop = $(window).scrollTop();

            // Check if the user scrolled more than `delta`
            if (Math.abs(this.lastScrollTop - this.scrollTop) <= this.delta) {
                return;
            }

            // Checks if the user has scrolled enough down and has past the navbar
            if ((this.scrollTop > this.lastScrollTop) && (this.scrollTop > this.headerHeight)) {
                this.$header.addClass(this.headerUpCSSClass);
            }
            else {
                // Check if the user has scrolled to the top of the page
                if (this.scrollTop + $(window).height() < $(document).height()) {
                    this.$header.removeClass(this.headerUpCSSClass);
                }
            }

            this.lastScrollTop = this.scrollTop;
        }
    };

    $(document).ready(function() {
        var header = new Header();
        header.run();
    });
}(jQuery);;+function($) {
    'use strict'

    // Resize all images of an image-gallery

    /**
     * ImageGallery
     * @constructor
     */
    var ImageGallery       = function() {
        // CSS class located in `source/_css/components/_image-gallery.scss`
        this.photosBox = '.photo-box';
        this.$images   = $(this.photosBox + ' img');
    };
    ImageGallery.prototype = {

        /**
         * Run ImageGallery feature
         */
        run: function() {
            var self = this;

            // Resize all images at the loading of the page
            self.resizeImages();

            // Resize all images when the user is resizing the page
            $(window).smartresize(function() {
                self.resizeImages();
            });
        },

        /**
         * Resize all images of an image gallery
         */
        resizeImages: function() {
            var photoBoxWidth;
            var photoBoxHeight;
            var imageWidth;
            var imageHeight;
            var imageRatio;
            var $image;

            this.$images.each(function() {
                $image         = $(this);
                photoBoxWidth  = $image.parent().parent().width();
                photoBoxHeight = $image.parent().parent().innerHeight();
                imageWidth     = $image.width();
                imageHeight    = $image.height();

                // Checks if image height is smaller than his box
                if (imageHeight < photoBoxHeight) {
                    imageRatio = (imageWidth / imageHeight);
                    // Resize image with the box height
                    $image.css({
                        'height': photoBoxHeight,
                        'width':  (photoBoxHeight * imageRatio)
                    });
                    // Center image in his box
                    $image.parent().css({
                        'left': '-' + (((photoBoxHeight * imageRatio) / 2) - (photoBoxWidth / 2)) + 'px'
                    });
                }

                // Update new values of height and width
                imageWidth  = $image.width();
                imageHeight = $image.height();

                // Checks if image width is smaller than his box
                if (imageWidth < photoBoxWidth) {
                    imageRatio = (imageHeight / photoBoxWidth);

                    $image.css({
                        'width':  photoBoxWidth,
                        'height': (photoBoxWidth * imageRatio)
                    });
                    // Center image in his box
                    $image.parent().css({
                        'top': '-' + (((imageHeight) / 2) - (photoBoxHeight / 2)) + 'px'
                    });
                }

                // Checks if image height is larger than his box
                if (imageHeight > photoBoxHeight) {
                    // Center image in his box
                    $image.parent().css({
                        'top': '-' + (((imageHeight) / 2) - (photoBoxHeight / 2)) + 'px'
                    });
                }
            });
        }
    };

    $(document).ready(function() {
        if ($('.image-gallery').length) {
            var imageGallery = new ImageGallery();

            // Small timeout to wait the loading of all images.
            setTimeout(function() {
                imageGallery.run();
            }, 500);
        }
    });
}(jQuery);;+function($) {
    'use strict';

    // Hide the post bottom bar when the post footer is visible by the user,
    // and show it when the post footer isn't visible by the user

    /**
     * PostBottomBar
     * @constructor
     */
    var PostBottomBar = function() {
        this.$postBottomBar = $('.post-bottom-bar');
        this.$postFooter    = $('.post-footer');
        this.delta            = 5;
        this.lastScrollTop    = 0;
        this.scrollTop;
    };

    PostBottomBar.prototype = {

        /**
         * Run PostBottomBar feature
         */
        run: function() {
            var self = this;
            var didScroll;
            // Run animation for first time
            self.swipePostBottomBar();
            // Detects if the user is scrolling
            $(window).scroll(function() {
                didScroll = true;
            });
            // Check if the user scrolled every 250 milliseconds
            setInterval(function() {
                if (didScroll) {
                    self.swipePostBottomBar();
                    didScroll = false;
                }
            }, 250);
        },

        /**
         * Animate the post bottom bar
         */
        swipePostBottomBar: function() {
            this.scrollTop = $(window).scrollTop();
            var postFooterElemPos = (this.$postFooter.offset().top + this.$postFooter.height() + this.$postBottomBar.height() / 2);
            // show bottom bar
            // if the user scrolled upwards more than `delta`
            // and `post-footer` div isn't visible
            if ((this.scrollTop < this.lastScrollTop) &&
                ($(window).scrollTop() + $(window).height()) < (postFooterElemPos)) {
                this.$postBottomBar.slideDown();
            }
            else {
                this.$postBottomBar.slideUp();
            }
            this.lastScrollTop = this.scrollTop;
        }
    };

    $(document).ready(function() {
        if ($('.post-bottom-bar').length) {
            var postBottomBar = new PostBottomBar();
            postBottomBar.run();
        }
    });
}(jQuery);;+function($) {
    'use strict';

    // Open and close the share options bar

    /**
     * ShareOptionsBar
     * @constructor
     */
    var ShareOptionsBar = function() {
        this.$shareOptionsBar = $('#share-options-bar');
        this.$openBtn      = $('.btn-open-shareoptions');
        this.$closeBtn     = $('#share-options-mask');
    };

    ShareOptionsBar.prototype = {

        /**
         * Run ShareOptionsBar feature
         */
        run: function() {
            var self = this;

            // Detect the click on the open button
            self.$openBtn.click(function() {
                if (!self.$shareOptionsBar.hasClass('opened')) {
                    self.openShareOptions();
                    self.$closeBtn.show();

                }
            });

            // Detect the click on the close button
            self.$closeBtn.click(function() {
                if (self.$shareOptionsBar.hasClass('opened')) {
                    self.closeShareOptions();
                    self.$closeBtn.hide();
                }
            });
        },

        /**
         * Open share options bar
         */
        openShareOptions: function() {
            var self = this;

            // Check if the share option bar isn't opened and prevent multiple click on the open button with `.processing` class
            if (!self.$shareOptionsBar.hasClass('opened') && !this.$shareOptionsBar.hasClass('processing')) {
                // Open the share option bar
                self.$shareOptionsBar.addClass('processing opened');

                setTimeout(function() {
                    self.$shareOptionsBar.removeClass('processing');
                }, 250);
            }
        },

        /**
         * Close share options bar
         */
        closeShareOptions: function() {
            var self = this;

            // Check if the share options bar is opened and prevent multiple click on the close button with `.processing` class
            if (self.$shareOptionsBar.hasClass('opened') && !this.$shareOptionsBar.hasClass('processing')) {
                // Close the share option bar
                self.$shareOptionsBar
                    .addClass('processing')
                    .removeClass('opened');

                setTimeout(function() {
                    self.$shareOptionsBar.removeClass('processing');
                }, 250);
            }
        }
    };

    $(document).ready(function() {
        var shareOptionsBar = new ShareOptionsBar();
        shareOptionsBar.run();
    });
}(jQuery);;+function($) {
    'use strict';

    // Open and close the sidebar by swiping the sidebar and the blog and vice versa

    /**
     * Sidebar
     * @constructor
     */
    var Sidebar = function() {
        this.$sidebar = $('#sidebar');
        this.$openBtn = $('#btn-open-sidebar');
        // Elements where the user can click to close the sidebar
        this.$closeBtn = $('#header, #main, .post-header-cover');
        // Elements affected by the swipe of the sidebar
        // The `pushed` class is added to each elements
        // Each element has a different behavior when the sidebar is opened
        this.$blog = $('.post-bottom-bar, #header, #main, .post-header-cover');
        // If you change value of `mediumScreenWidth`,
        // you have to change value of `$screen-min: (md-min)` too in `source/_css/utils/variables.scss`
        this.mediumScreenWidth = 768;
    };

    Sidebar.prototype = {

        /**
         * Run Sidebar feature
         */
        run: function() {
            var self = this;
            // Detect the click on the open button
            self.$openBtn.click(function() {
                if (!self.$sidebar.hasClass('pushed')) {
                    self.openSidebar();
                }
            });
            // Detect the click on close button
            self.$closeBtn.click(function() {
                if (self.$sidebar.hasClass('pushed')) {
                    self.closeSidebar();
                }
            });
            // Detect resize of the windows
            $(window).resize(function() {
                // Check if the window is larger than the minimal medium screen value
                if ($(window).width() > self.mediumScreenWidth) {
                    self.resetSidebarPosition();
                    self.resetBlogPosition();
                }
                else {
                    self.closeSidebar();
                }
            });
        },

        /**
         * Open the sidebar by swiping to the right the sidebar and the blog
         */
        openSidebar: function() {
            this.swipeBlogToRight();
            this.swipeSidebarToRight();
        },

        /**
         * Close the sidebar by swiping to the left the sidebar and the blog
         */
        closeSidebar: function() {
            this.swipeSidebarToLeft();
            this.swipeBlogToLeft();
        },

        /**
         * Reset sidebar position
         */
        resetSidebarPosition: function() {
            this.$sidebar.removeClass('pushed');
        },

        /**
         * Reset blog position
         */
        resetBlogPosition: function() {
            this.$blog.removeClass('pushed');
        },

        /**
         * Swipe the sidebar to the right
         */
        swipeSidebarToRight: function() {
            var self = this;
            // Check if the sidebar isn't swiped and prevent multiple click on the open button with `.processing` class
            if (!self.$sidebar.hasClass('pushed') && !this.$sidebar.hasClass('processing')) {
                // Swipe the sidebar to the right
                self.$sidebar.addClass('processing pushed');

                setTimeout(function() {
                    self.$sidebar.removeClass('processing');
                }, 250);
            }
        },

        /**
         * Swipe the sidebar to the left
         */
        swipeSidebarToLeft: function() {
            var self = this;
            // Check if the sidebar is swiped and prevent multiple click on the close button with `.processing` class
            if (self.$sidebar.hasClass('pushed') && !this.$sidebar.hasClass('processing')) {
                // Swipe the sidebar to the left
                self.$sidebar
                    .addClass('processing')
                    .removeClass('pushed processing');
            }
        },

        /**
         * Swipe the blog to the right
         */
        swipeBlogToRight: function() {
            var self = this;
            // Check if the blog isn't swiped and prevent multiple click on the open button with `.processing` class
            if (!self.$blog.hasClass('pushed') && !this.$blog.hasClass('processing')) {
                // Swipe the blog to the right
                self.$blog.addClass('processing pushed');

                setTimeout(function() {
                    self.$blog.removeClass('processing');
                }, 250);
            }
        },

        /**
         * Swipe the blog to the left
         */
        swipeBlogToLeft: function() {
            var self = this;
            // Check if the blog is swiped and prevent multiple click on the close button with `.processing` class
            if (self.$blog.hasClass('pushed') && !this.$blog.hasClass('processing')) {
                // Swipe the blog to the left
                self.$blog
                    .addClass('processing')
                    .removeClass('pushed');

                setTimeout(function() {
                    self.$blog.removeClass('processing');
                }, 250);
            }
        }
    };

    $(document).ready(function() {
        var sidebar = new Sidebar();
        sidebar.run();
    });
}(jQuery);;+(function($, sr) {
    // debouncing function from John Hann
    // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
    var debounce = function(func, threshold, execAsap) {
        var timeout;

        return function debounced() {
            var obj = this, args = arguments;

            function delayed() {
                if (!execAsap) {
                    func.apply(obj, args);
                }

                timeout = null;
            };

            if (timeout) {
                clearTimeout(timeout);
            }
            else if (execAsap) {
                func.apply(obj, args);
            }

            timeout = setTimeout(delayed, threshold || 100);
        };
    };

    jQuery.fn[sr] = function(fn) {
        return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
    };
})(jQuery, 'smartresize');;+function($) {
    'use strict';

    // Filter posts by using their categories on categories page : `/categories`

    /**
     * TagsFilter
     * @param tagsArchivesElem
     * @constructor
     */
    var TagsFilter = function(tagsArchivesElem) {
        this.$form = $(tagsArchivesElem).find('#filter-form');
        this.$inputSearch = $(tagsArchivesElem + ' #filter-form input[name=tag]');
        this.$archiveResult = $(tagsArchivesElem).find('.archive-result');
        this.$tags = $(tagsArchivesElem).find('.tag');
        this.$posts = $(tagsArchivesElem).find('.archive');
        this.tags = tagsArchivesElem + ' .tag';
        this.posts = tagsArchivesElem + ' .archive';
        // Html data attribute without `data-` of `.archive` element which contains the name of tag
        this.dataTag = 'tag';
    };

    TagsFilter.prototype = {

        /**
         * Run TagsFilter feature
         */
        run: function() {
            var self = this;

            // Detect keystroke of the user
            self.$inputSearch.keyup(function() {
                self.filter(self.getSearch());
            });

            // Block submit action
            self.$form.submit(function(e) {
                e.preventDefault();
            });
        },

        /**
         * Get the search entered by user
         * @returns {string} the name of tag entered by the user
         */
        getSearch: function() {
            return this.$inputSearch.val().toLowerCase();
        },

        /**
         * Show related posts form a tag and hide the others
         * @param {string} tag - name of a tag
         */
        filter: function(tag) {
            if (tag === '') {
                this.showAll();
                this.showResult(-1);
            }
            else {
                this.hideAll();
                this.showPosts(tag);
                this.showResult(this.countTags(tag));
            }
        },

        /**
         * Display results of the search
         * @param {Number} numbTags - Number of tags found
         */
        showResult: function(numbTags) {
            if (numbTags === 0) {
                this.$archiveResult
                    .html('No tags found')
                    .show();
            }
            else if (numbTags === -1) {
                this.$archiveResult
                    .html('')
                    .hide();
            }
            else {
                this.$archiveResult
                    .html(numbTags + ' tag' + ((numbTags > 1) ? 's' : '') + ' found')
                    .show();
            }
        },

        /**
         * Count number of tags
         * @param {string} tag
         * @returns {Number}
         */
        countTags: function(tag) {
            return $(this.posts + '[data-' + this.dataTag + '*=\'' + tag + '\']').length;
        },

        /**
         * Show all posts from a tag
         * @param {string} tag - name of a tag
         */
        showPosts: function(tag) {
            $(this.tags + '[data-' + this.dataTag + '*=\'' + tag + '\']').show();
            $(this.posts + '[data-' + this.dataTag + '*=\'' + tag + '\']').show();
        },

        /**
         * Show all tags and all posts
         */
        showAll: function() {
            this.$tags.show();
            this.$posts.show();
        },

        /**
         * Hide all tags and all posts
         */
        hideAll: function() {
            this.$tags.hide();
            this.$posts.hide();
        }
    };

    $(document).ready(function() {
        if ($('#tags-archives').length) {
            var tagsFilter = new TagsFilter('#tags-archives');
            tagsFilter.run();
        }
    });
}(jQuery);


text:
var fs = require('fs');
var path = require('path');

class BundleClean {
    constructor(options) {
        this.path = options.path || '.';
        this.filename = options.filename;
        if (!this.filename) {
            throw new Error('Require filename option');
        }
    }
    apply(compiler) {
        compiler.plugin('compile', function(factory, callback) {
            let filename = path.join(this.path, this.filename);
            try {
                fs.accessSync(filename, fs.constants.R_OK);
            } catch(e) {
                console.log(e.message);
                return;
            }
            try {
                let stats = JSON.parse(fs.readFileSync(filename));

                if (stats.chunks) {
                    Object.keys(stats.chunks).forEach(function(name) {
                        let chunk = stats.chunks[name];
                        if (chunk && chunk[0] && chunk[0].path) {
                            console.log('removing', chunk[0].path);
                            try {
                                fs.unlinkSync(chunk[0].path);
                            } catch(e) {
                                console.log(e.message);
                            }
                        }
                    })
                }
            } catch(e) {
                console.log(e.message)
            }
        }.bind(this));
    }
}

module.exports = BundleClean;


text:
//
//  AppDelegate.m
//  百思不得姐
//
//  Created by evestorm on 16/12/26.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "AppDelegate.h"
#import "TabBarController.h"

@interface AppDelegate ()<UITabBarControllerDelegate>
/** 记录上一次选中的子控制器的索引 */
@property (nonatomic, assign) NSUInteger lastSelectedIndex;
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // 创建窗口
    self.window = [[UIWindow alloc] init];
    self.window.frame = [UIScreen mainScreen].bounds;

    // 设置根控制器
    TabBarController *tabBarVC = [[TabBarController alloc] init];
    tabBarVC.delegate = self;
    self.window.rootViewController = tabBarVC;

    // 显示窗口
    [self.window makeKeyAndVisible];

    // 添加一个最高级别的顶层window
//    [EVETopWindow show];
    return YES;
}

#pragma mark - <UITabBarControllerDelegate>
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
    if (tabBarController.selectedIndex == self.lastSelectedIndex) {
        // 发出通知
        [[NSNotificationCenter defaultCenter] postNotificationName:EVETabBarButtonDidRepeatClickNotification object:nil];
    }

    // 记录目前选中的索引
    self.lastSelectedIndex = tabBarController.selectedIndex;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end


text:
using System;

namespace Sniper.Tests.Conventions.Exception
{
    public class MissingPublicParameterlessCtorException : System.Exception
    {
        public MissingPublicParameterlessCtorException(Type modelType)
            : base(string.Format("Model type '{0}' is missing a Public Parameterless Constructor required by SimpleJson Deserializer.", modelType.FullName))
        { }
    }
}


text:
package org.scriptonbasestar.tool.core.exception;

/**
 * @author archmagece
 * @since 2017-09-07
 * <p>
 * 서비스의 금지항목 접근시
 */
public class SBDisabledException
	extends SBRuntimeBaseException {
	public SBDisabledException(String code, String message) {
		super(code, message);
	}

	public SBDisabledException(String message) {
		super(message);
	}

	public SBDisabledException(String code, String message, Throwable e) {
		super(code, message, e);
	}

	public SBDisabledException(String message, Throwable e) {
		super(message, e);
	}
}


text:
"""Feature for scalars values which can only take discrete values.

"""
from typing import Any, Optional, Union, Tuple, Dict

from ..abstracts import AbstractHasFeatures
from .feature import Feature
from ..utils import validate_in

class Enumerable(Feature):
    """ Validate the set value against a finite set of allowed ones.

    Parameters
    ----------
    values : iterable, optional
        Permitted values for the property.

    """
    def __init__(self,
                 getter: Any=None,
                 setter: Any=None,
                 values: tuple=(),
                 extract: str='',
                 retries: int=0,
                 checks: Optional[str]=None,
                 discard: Optional[Union[Tuple[str, ...],
                                         Dict[str, Tuple[str, ...]]]]=None,
                 options: Optional[str]=None) -> None:
        super(Enumerable, self).__init__(getter, setter, extract, retries,
                                         checks, discard, options)
        self.values = set(values)
        self.creation_kwargs['values'] = values

        if values:
            self.modify_behavior('pre_set', self.validate_in.__func__,
                                 ('append',), 'validate',  True)

    def validate_in(self, driver: AbstractHasFeatures, value: Any):
        """Check the provided values is in the supported values.

        """
        return validate_in(driver, value, self.values, self.name)


text:
__author__ = 'Andreas M. Wahl'

import yaml
import itertools
import logging
from configurator.util.util import strip_unit

logging.basicConfig(level=logging.INFO)
LOG = logging.getLogger(__name__)

class RangeGenerator:

    def __init__(self, config):
        #yaml_config = yaml.load(file(config, "r"))
        self.static_fields = config["static_parameters"]
        self.dynamic_fields = config["dynamic_parameters"]
        self.dependent_fields = config["dependent_parameters"]

    def generate_file(self, file_path):
        stream = file(file_path, 'w')
        yaml.dump(self.generate_memory(), stream)

    def generate_memory(self):
        output = list()
        cross_product = self._generate_cross_product_dict()

        if cross_product is None:
            return output

        for dynamic_field in cross_product:
            output_fields = dict()

            # process static fields
            if not self.static_fields is None:
                for field in self.static_fields:
                    output_fields[field] = self.static_fields[field]

            # process dynamic fields
            if not self.dynamic_fields is None:
                field_count = 0
                for field in self.dynamic_fields:
                    #print dynamic_field, field, dynamic_field[field_count]
                    output_fields[field] = dynamic_field[field_count]
                    field_count += 1

            # process dependent fields
            if not self.dependent_fields is None:
                for field in self.dependent_fields:
                    field_description = self.dependent_fields[field]
                    if "unit" in field_description:
                        field_unit = field_description["unit"]
                    else:
                        field_unit = ""

                    if "dependency" in field_description:
			dependency_type = field_description["type"]
			if dependency_type == "sum":
	                        value = 0
        	                for dependency in field_description["dependency"]:
	                            value += strip_unit([output_fields[dependency]])[0]
        	                output_fields[field] = str(value) + str(field_unit)
			if dependency_type == "min":
				minimum = float("infinity")
				for dependency in field_description["dependency"]:
			            value = strip_unit([output_fields[dependency]])[0]
				    minimum = min(minimum, value)
				output_fields[field] = str(minimum) + str(field_unit)
                    else:
                        LOG.warning("Malformed field found: " + field)
                        return None
            output.append(output_fields)

	output = [dict(t) for t in set([tuple(d.items()) for d in output])]

        return output

    def _generate_cross_product_dict(self):

        field_ranges = []

        if self.dynamic_fields is None:
            return None

        for field in self.dynamic_fields:

            field_description = self.dynamic_fields[field]

            # process implicit range field
            if all(k in field_description for k in ("min", "max")):
                field_range = []
                range_from = field_description["min"]
                range_to = field_description["max"]
                range_element = range_from
                field_unit = field_description["unit"]

                field_range.append(range_element)
                while range_element < range_to:
                    if "step" in field_description:
                        eval_result = eval(field_description["step"]["function"], dict({"PREVIOUS": range_element}, **field_description["step"]["parameters"]))
                        if eval_result <= range_to:
                            range_element = eval_result
                            field_range.append(str(range_element) + str(field_unit))
                        else:
                            break
                    else:
                        eval_result = range_element + 1
                        if eval_result <= range_to:
                            range_element = eval_result
                            field_range.append(str(range_element) + str(field_unit))
                        else:
                            break
                field_ranges.append(field_range)

            # process explicit range field
            elif "values" in field_description:
                field_unit = field_description["unit"]
                values = field_description["values"]
                value_list = []
                for value in values:
                    if not field_unit is None:
                        value_list.append(str(value) + str(field_unit))
                    else:
                        value_list.append(value)

                field_ranges.append(value_list)

            # abort on malformed fields
            else:
                LOG.warning("Malformed field found: " + field)
                return None

        output = itertools.product(*field_ranges)
        return list(output)


text:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "sentence.h"

#include <assert.h>
#include <string.h>

#define PRIMARY "This is a primary sentence"
#define SECONDARY "This is a secondary sentence"

#define SIZEOF(x) (sizeof (x) / sizeof (*x))

struct data
{
  int required_spaces;
  const char *input;

  const char *expected_prefix;
  ucs4_t expected_ending_char;
};

const struct data data[] =
  {
    { 1, PRIMARY, PRIMARY, 0xfffd },
    { 1, PRIMARY ".", PRIMARY, '.' },
    { 1, PRIMARY ".x", PRIMARY ".x", 0xfffd },
    { 2, PRIMARY ".  " SECONDARY, PRIMARY, '.' },
    { 1, PRIMARY ".  " SECONDARY, PRIMARY, '.' },
    { 1, PRIMARY ".' " SECONDARY, PRIMARY, '.' },
    { 3, PRIMARY ".  " SECONDARY, PRIMARY ".  " SECONDARY, 0xfffd },
    { 2, PRIMARY ".'  " SECONDARY, PRIMARY, '.' },
    { 2, PRIMARY ".'x  " SECONDARY, PRIMARY ".'x  " SECONDARY, 0xfffd },
    { 2, PRIMARY ".''x  " SECONDARY, PRIMARY ".''x  " SECONDARY, 0xfffd },
    { 2, PRIMARY ".\n" SECONDARY, PRIMARY, '.' },
    { 2, PRIMARY ". \n" SECONDARY, PRIMARY, '.' },
    { 2, PRIMARY ".\xc2\xa0\n" SECONDARY, PRIMARY, '.' },
    { 2, PRIMARY ".\t" SECONDARY, PRIMARY, '.' },
    { 2, PRIMARY ".'\t" SECONDARY, PRIMARY, '.' },
    { 2, PRIMARY ".'\n" SECONDARY, PRIMARY, '.' }
  };

static void
check_sentence_end (const struct data *d)
{
  int saved_required_spaces = sentence_end_required_spaces;
  const char *result;
  ucs4_t ending_char;

  sentence_end_required_spaces = d->required_spaces;
  result = sentence_end (d->input, &ending_char);
  sentence_end_required_spaces = saved_required_spaces;

  assert (result == d->input + strlen (d->expected_prefix));
  assert (ending_char == d->expected_ending_char);
}

int
main (int argc, char **argv)
{
  int i;

  for (i = 0; i < SIZEOF (data); i++)
    check_sentence_end (&data[i]);

  return 0;
}