text:
package de.tudarmstadt.ukp.jwktl.parser.de.components;

import de.tudarmstadt.ukp.jwktl.api.entry.WiktionaryEntry;
import de.tudarmstadt.ukp.jwktl.parser.util.ParsingContext;

/**
 * Parser component for extracting entry links from the German Wiktionary.
 * Entry links are defined to refer to the information of another dictionary
 * article (e.g., for alternative spellings).
 */
public class DEEntryLinkHandler extends DEBlockHandler {

	static final String[] ENTRY_LINK_TEMPLATES = new String[]{
		"Lemmaverweis",
		"Grundformverweis",
		"Grundformverweis Dekl",
		"Grundformverweis Konj",
		"Alte Schreibweise",
		"Schweizer und Liechtensteiner Schreibweise"
	};

	protected String entryLink;
	protected String entryLinkType;

	/** Initalizes the handler. */
	public DEEntryLinkHandler() {
		entryLink = null;
	}

	@Override
	public boolean canHandle(final String blockHeader) {
		if (blockHeader == null || blockHeader.isEmpty())
			return false;
		if (!blockHeader.startsWith("{{"))
			return false;

		for (int i = 0; i < ENTRY_LINK_TEMPLATES.length; i++) {
			String entryLinkTemplate = "{{" + ENTRY_LINK_TEMPLATES[i] + "|";
			if (blockHeader.startsWith(entryLinkTemplate)) {
				entryLink = blockHeader.substring(entryLinkTemplate.length(),
						blockHeader.length() - 2);
				int idx = entryLink.indexOf('|');
				if (idx >= 0)
					entryLink = entryLink.substring(0, idx);
				entryLinkType = ENTRY_LINK_TEMPLATES[i];
				return true;
			}
		}

		return false;
	}

	@Override
	public boolean processHead(final String textLine, final ParsingContext context) {
		if (entryLink != null) {
			WiktionaryEntry entry = context.findEntry();
			entry.setEntryLink(entryLink, entryLinkType);
		}
		return false;
	}

}


text:
package edu.uci.ics.pregelix.runtime.converter;

import java.io.DataInput;
import java.io.DataInputStream;

import org.apache.asterix.builders.RecordBuilder;
import org.apache.asterix.om.types.ARecordType;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
import org.apache.hyracks.hdfs.ContextFactory;

import edu.uci.ics.external.connector.asterixdb.api.IWriteConverter;
import edu.uci.ics.external.connector.asterixdb.api.IWriteConverterFactory;
import edu.uci.ics.pregelix.api.converter.VertexOutputConverter;
import edu.uci.ics.pregelix.api.graph.Vertex;
import edu.uci.ics.pregelix.api.util.BspUtils;
import edu.uci.ics.pregelix.api.util.ResetableByteArrayInputStream;
import edu.uci.ics.pregelix.dataflow.base.IConfigurationFactory;
import edu.uci.ics.pregelix.dataflow.util.IterationUtils;

public class WriteConverterFactory implements IWriteConverterFactory {
    private static final long serialVersionUID = 1L;
    private final IConfigurationFactory confFactory;

    public WriteConverterFactory(IConfigurationFactory confFactory) {
        this.confFactory = confFactory;
    }

    @SuppressWarnings("rawtypes")
    @Override
    public IWriteConverter getFieldWriteConverter(IHyracksTaskContext ctx, int partitionId)
            throws HyracksDataException {
        final Configuration conf = confFactory.createConfiguration();
        // Set context properly
        ContextFactory ctxFactory = new ContextFactory();
        TaskAttemptContext mapperContext = ctxFactory.createContext(conf, partitionId);
        mapperContext.getConfiguration().setClassLoader(ctx.getJobletContext().getClassLoader());
        conf.setClassLoader(ctx.getJobletContext().getClassLoader());
        IterationUtils.setJobContext(BspUtils.getJobId(conf), ctx, mapperContext);
        Vertex.taskContext = mapperContext;

        final Vertex vertex = BspUtils.createVertex(conf);
        vertex.setVertexContext(IterationUtils.getVertexContext(BspUtils.getJobId(conf), ctx));

        final VertexOutputConverter outputConverter = BspUtils.createVertexOutputConverter(conf);
        final ResetableByteArrayInputStream inputStream = new ResetableByteArrayInputStream();
        final DataInput dataInput = new DataInputStream(inputStream);
        final RecordBuilder recordBuilder = new RecordBuilder();

        return new IWriteConverter() {

            @Override
            public void open(ARecordType recordType) throws HyracksDataException {
                recordBuilder.reset(recordType);
                outputConverter.open(recordType);
            }

            @Override
            public void convert(byte[] data, int start, int len, ArrayTupleBuilder outputTb)
                    throws HyracksDataException {
                try {
                    inputStream.setByteArray(data, start);
                    vertex.readFields(dataInput);
                    recordBuilder.init();
                    outputTb.reset();
                    outputConverter.convert(vertex.getVertexId(), outputTb.getDataOutput());
                    outputTb.addFieldEndOffset();
                    outputConverter.convert(vertex, recordBuilder);
                    // By default, the record type tag is stored in AsterixDB.
                    recordBuilder.write(outputTb.getDataOutput(), true);
                    outputTb.addFieldEndOffset();
                } catch (Exception e) {
                    throw new HyracksDataException(e);
                }
            }

            @Override
            public void close() throws HyracksDataException {
                outputConverter.close();
            }
        };
    }
}

redpajama_set_name: RedPajamaGithub


text:
using TicketPurchaseDemo.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TicketPurchaseDemo
{
  public class Mappings
  {
    public static void Init()
    {
      AutoMapper.Mapper.CreateMap<OrderRequest, Order>()
        .ForMember(src => src.TicketValue, opts => opts.MapFrom(a => GetTicketValueFromProductCode(a.TicketValue)));
    }

    private static int GetTicketValueFromProductCode(string productCode)
    {
      switch(productCode)
      {
        case "T5":
          return 5;
        case "T10":
          return 10;
        case "T20":
          return 20;
        case "T50":
          return 50;
        case "T100":
          return 100;
        default:
          throw new ArgumentException("Invalid Product Code provided");
      }
    }
  }
}


text:
id: bad87fee1348bd9aedf08808
title: Specificare in che modo i caratteri devono degradare
challengeType: 0
videoUrl: 'https://scrimba.com/c/cpVKBfQ'
forumTopicId: 18304
dashedName: specify-how-fonts-should-degrade
---

# --description--

Esistono diversi caratteri predefiniti disponibili in tutti i browser. Queste famiglie generiche di caratteri includono `monospace`, `serif` e `sans-serif`.

Quando un carattere non è disponibile, puoi dire al browser di "degradare" a un altro carattere.

Ad esempio, se desideri che un elemento utilizzi il carattere `Helvetica`, ma degradi al carattere `sans-serif` quando `Helvetica` non è disponibile, lo specificherai come segue:

```css
p {
  font-family: Helvetica, sans-serif;
}
```

I nomi delle famiglie di caratteri generici non fanno distinzione tra maiuscole e minuscole. Inoltre, non hanno bisogno di virgolette perché sono parole chiave CSS.

# --instructions--

Per iniziare, applica il carattere `monospace` all'elemento `h2`, in modo che ora abbia due caratteri: `Lobster` e `monospace`.

Nell'ultima sfida, hai importato il carattere `Lobster` utilizzando il tag `link`. Ora commenta l'importazione del carattere `Lobster` (utilizzando i commenti HTML che hai imparato in precedenza) da Google Fonts in modo che non sia più disponibile. Nota come il tuo elemento `h2` degrada al carattere `monospace`.

**Nota:** se hai il carattere `Lobster` installato sul tuo computer, non vedrai il degrado perché il tuo browser sarà comunque in grado di trovare il carattere.

# --hints--

Il tuo elemento h2 dovrebbe usare il carattere `Lobster`.

```js
assert(
  $('h2')
    .css('font-family')
    .match(/^"?lobster/i)
);
```

Il tuo elemento h2 dovrebbe degradare al carattere `monospace` quando `Lobster` non è disponibile.

```js
assert(
  /\s*h2\s*\{\s*font-family\s*\:\s*(\'|"|)Lobster\1\s*,\s*monospace\s*;?\s*\}/gi.test(
    code
  )
);
```

Dovresti commentare la tua chiamata a Google per il carattere `Lobster` inserendo `<!--` davanti.

```js
assert(new RegExp('<!--[^fc]', 'gi').test(code));
```

Dovresti chiudere il tuo commento aggiungendo `-->`.

```js
assert(new RegExp('[^fc]-->', 'gi').test(code));
```

# --seed--

## --seed-contents--

```html
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster;
  }

  p {
    font-size: 16px;
    font-family: monospace;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>

  <a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>

  <div>
    <p>Things cats love:</p>
    <ul>
      <li>cat nip</li>
      <li>laser pointers</li>
      <li>lasagna</li>
    </ul>
    <p>Top 3 things cats hate:</p>
    <ol>
      <li>flea treatment</li>
      <li>thunder</li>
      <li>other cats</li>
    </ol>
  </div>

  <form action="https://freecatphotoapp.com/submit-cat-photo">
    <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
    <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
    <label><input type="checkbox" name="personality" checked> Loving</label>
    <label><input type="checkbox" name="personality"> Lazy</label>
    <label><input type="checkbox" name="personality"> Energetic</label><br>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>
```

# --solutions--

```html
<!--<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">-->
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, monospace;
  }

  p {
    font-size: 16px;
    font-family: monospace;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>

  <a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>

  <div>
    <p>Things cats love:</p>
    <ul>
      <li>cat nip</li>
      <li>laser pointers</li>
      <li>lasagna</li>
    </ul>
    <p>Top 3 things cats hate:</p>
    <ol>
      <li>flea treatment</li>
      <li>thunder</li>
      <li>other cats</li>
    </ol>
  </div>

  <form action="https://freecatphotoapp.com/submit-cat-photo">
    <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
    <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
    <label><input type="checkbox" name="personality" checked> Loving</label>
    <label><input type="checkbox" name="personality"> Lazy</label>
    <label><input type="checkbox" name="personality"> Energetic</label><br>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>
```


text:
/**
 * @ngdoc directive
 * @name ionSideMenuContent
 * @module meteoric
 *
 * @description
 * A container for the main visible content, sibling to one or more
 * {@link meteoric.directive:ionSideMenu} directives.
 *
 * @usage
 * ```handlebars
 {{#ionSideMenuContent}}
   <!-- content goes here -->
 {{/ionSideMenuContent}}
 * ```
 * For a complete side menu example, see the
 * {@link meteoric.directive:ionSideMenus} documentation.
 *
 * @param {boolean=} dragContent Whether the content can be dragged. Default true.
 * @param {boolean|number=} edgeDragThreshold Whether the content drag can only start if it is below a certain threshold distance from the edge of the screen.  Default false. Accepts three types of values:
 *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.
 *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.
 *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.
 *
 */
Template.ionSideMenuContent.onCreated(function() {
    this.new_scope = true;

    this.dragContent = new ReactiveVar(true);
    this.edgeDragThreshold = new ReactiveVar(false);

    this.autorun(() => {
        let td = Template.currentData();
        if (!td) return;
        this.dragContent.set(!_.isUndefined(td.dragContent) ? td.dragContent : true);
        this.edgeDragThreshold.set(!td.edgeDragThreshold);
    });
});

Template.ionSideMenuContent.onRendered(function() {
    this.assertParent(Template.ionSideMenus);

    let $element = jqLite(this.firstNode),
        element = $element,
        $scope = this.$scope,
        attr = {
            dragContent: this.dragContent,
            edgeDragThreshold: this.edgeDragThreshold
        };
    element.addClass('menu-content pane');

    $(this).on('$preLink', () => {
        let sideMenuCtrl = $scope.$parent.$sideMenuCtrl;

        var startCoord = null;
        var primaryScrollAxis = null;

        if (isDefined(attr.dragContent.get())) {
            this.autorun(() => {
                let value = attr.dragContent.get();
                sideMenuCtrl.canDragContent(value);
            });
        } else {
            sideMenuCtrl.canDragContent(true);
        }

        if (isDefined(attr.edgeDragThreshold.get())) {
            this.autorun(() => {
                let value = attr.edgeDragThreshold.get();
                sideMenuCtrl.edgeDragThreshold(value);
            });
        }

        // Listen for taps on the content to close the menu
        function onContentTap(gestureEvt) {
            if (sideMenuCtrl.getOpenAmount() !== 0) {
                sideMenuCtrl.close();
                gestureEvt.gesture.srcEvent.preventDefault();
                startCoord = null;
                primaryScrollAxis = null;
            } else if (!startCoord) {
                startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);
            }
        }

        function onDragX(e) {
            if (!sideMenuCtrl.isDraggableTarget(e)) return;

            if (getPrimaryScrollAxis(e) == 'x') {
                sideMenuCtrl._handleDrag(e);
                e.gesture.srcEvent.preventDefault();
            }
        }

        function onDragY(e) {
            if (getPrimaryScrollAxis(e) == 'x') {
                e.gesture.srcEvent.preventDefault();
            }
        }

        function onDragRelease(e) {
            sideMenuCtrl._endDrag(e);
            startCoord = null;
            primaryScrollAxis = null;
        }

        function getPrimaryScrollAxis(gestureEvt) {
            // gets whether the user is primarily scrolling on the X or Y
            // If a majority of the drag has been on the Y since the start of
            // the drag, but the X has moved a little bit, it's still a Y drag

            if (primaryScrollAxis) {
                // we already figured out which way they're scrolling
                return primaryScrollAxis;
            }

            if (gestureEvt && gestureEvt.gesture) {

                if (!startCoord) {
                    // get the starting point
                    startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);

                } else {
                    // we already have a starting point, figure out which direction they're going
                    var endCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);

                    var xDistance = Math.abs(endCoord.x - startCoord.x);
                    var yDistance = Math.abs(endCoord.y - startCoord.y);

                    var scrollAxis = (xDistance < yDistance ? 'y' : 'x');

                    if (Math.max(xDistance, yDistance) > 30) {
                        // ok, we pretty much know which way they're going
                        // let's lock it in
                        primaryScrollAxis = scrollAxis;
                    }

                    return scrollAxis;
                }
            }
            return 'y';
        }

        var content = {
            element: element[0],
            onDrag: function() {},
            endDrag: function() {},
            setCanScroll: function(canScroll) {
                var c = $element[0].querySelector('.scroll');

                if (!c) {
                    return;
                }

                var content = jqLite(c.parentElement);
                if (!content) {
                    return;
                }

                // freeze our scroll container if we have one
                var scrollScope = content.scope();
                scrollScope.scrollCtrl && scrollScope.scrollCtrl.freezeScrollShut(!canScroll);
            },
            getTranslateX: function() {
                return $scope.sideMenuContentTranslateX || 0;
            },
            setTranslateX: ionic.animationFrameThrottle(function(amount) {
                var xTransform = content.offsetX + amount;
                $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';
                $timeout(function() {
                    $scope.sideMenuContentTranslateX = amount;
                });
            }),
            setMarginLeft: ionic.animationFrameThrottle(function(amount) {
                if (amount) {
                    amount = parseInt(amount, 10);
                    $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amount + 'px,0,0)';
                    $element[0].style.width = ($window.innerWidth - amount) + 'px';
                    content.offsetX = amount;
                } else {
                    $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
                    $element[0].style.width = '';
                    content.offsetX = 0;
                }
            }),
            setMarginRight: ionic.animationFrameThrottle(function(amount) {
                if (amount) {
                    amount = parseInt(amount, 10);
                    $element[0].style.width = ($window.innerWidth - amount) + 'px';
                    content.offsetX = amount;
                } else {
                    $element[0].style.width = '';
                    content.offsetX = 0;
                }
                // reset incase left gets grabby
                $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
            }),
            setMarginLeftAndRight: ionic.animationFrameThrottle(function(amountLeft, amountRight) {
                amountLeft = amountLeft && parseInt(amountLeft, 10) || 0;
                amountRight = amountRight && parseInt(amountRight, 10) || 0;

                var amount = amountLeft + amountRight;

                if (amount > 0) {
                    $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amountLeft + 'px,0,0)';
                    $element[0].style.width = ($window.innerWidth - amount) + 'px';
                    content.offsetX = amountLeft;
                } else {
                    $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
                    $element[0].style.width = '';
                    content.offsetX = 0;
                }
                // reset incase left gets grabby
                //$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
            }),
            enableAnimation: function() {
                $scope.animationEnabled = true;
                $element[0].classList.add('menu-animated');
            },
            disableAnimation: function() {
                $scope.animationEnabled = false;
                $element[0].classList.remove('menu-animated');
            },
            offsetX: 0
        };

        sideMenuCtrl.setContent(content);

        // add gesture handlers
        var gestureOpts = { stop_browser_behavior: false };
        gestureOpts.prevent_default_directions = ['left', 'right'];
        var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element, gestureOpts);
        var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element, gestureOpts);
        var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element, gestureOpts);
        var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element, gestureOpts);
        var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element, gestureOpts);
        var releaseGesture = $ionicGesture.on('release', onDragRelease, $element, gestureOpts);

        // Cleanup
        $scope.$on('$destroy', function() {
            if (content) {
                content.element = null;
                content = null;
            }
            $ionicGesture.off(dragLeftGesture, 'dragleft', onDragX);
            $ionicGesture.off(dragRightGesture, 'dragright', onDragX);
            $ionicGesture.off(dragUpGesture, 'dragup', onDragY);
            $ionicGesture.off(dragDownGesture, 'dragdown', onDragY);
            $ionicGesture.off(releaseGesture, 'release', onDragRelease);
            $ionicGesture.off(contentTapGesture, 'tap', onContentTap);
        });
    });
});


text:
   /**
    *  Gets URI that identifies the test.
    *  @return uri identifier of test
    */
function getTargetURI() {
      return "http://www.w3.org/2001/DOM-Test-Suite/level2/html/object13";
   }

var docsLoaded = -1000000;
var builder = null;

//
//   This function is called by the testing framework before
//      running the test suite.
//
//   If there are no configuration exceptions, asynchronous
//        document loading is started.  Otherwise, the status
//        is set to complete and the exception is immediately
//        raised when entering the body of the test.
//
function setUpPage() {
   setUpPageStatus = 'running';
   try {
     //
     //   creates test document builder, may throw exception
     //
     builder = createConfiguredBuilder();

      docsLoaded = 0;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      docsLoaded += preload(docRef, "doc", "object");

       if (docsLoaded == 1) {
          setUpPageStatus = 'complete';
       }
    } catch(ex) {
    	catchInitializationError(builder, ex);
        setUpPageStatus = 'complete';
    }
}

//
//   This method is called on the completion of
//      each asychronous load started in setUpTests.
//
//   When every synchronous loaded document has completed,
//      the page status is changed which allows the
//      body of the test to be executed.
function loadComplete() {
    if (++docsLoaded == 1) {
        setUpPageStatus = 'complete';
    }
}

/**
*
Vertical space above and below this image, applet, or object.
The value of attribute vspace of the object element is read and checked against the expected value.

* @author Netscape
* @author Sivakiran Tummala
* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-8682483
*/
function object13() {
   var success;
    if(checkInitialization(builder, "object13") != null) return;
    var nodeList;
      var testNode;
      var vvspace;
      var doc;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      doc = load(docRef, "doc", "object");
      nodeList = doc.getElementsByTagName("object");
      assertSize("Asize",2,nodeList);
testNode = nodeList.item(0);
      vvspace = testNode.vspace;

      assertEquals("vspaceLink",0,vvspace);

}

function runTest() {
   object13();
}