text:
/**
 * @jest-environment jsdom
 */
/** @jsx h */
import { Fragment, h } from 'preact';

import { createSearchClient } from '@instantsearch/mocks/createSearchClient';
import instantsearch from '../../../index.es';
import { wait } from '@instantsearch/testutils/wait';
import hits from '../hits';
import {
  createMultiSearchResponse,
  createSingleSearchResponse,
} from '@instantsearch/mocks/createAPIResponse';
import type { SearchResponse } from '../../../../src/types';
import searchBox from '../../search-box/search-box';
import { within, fireEvent } from '@testing-library/dom';

beforeEach(() => {
  document.body.innerHTML = '';
});

describe('hits', () => {
  describe('templates', () => {
    test('renders default templates', async () => {
      const container = document.createElement('div');
      const searchBoxContainer = document.createElement('div');
      const searchClient = createMockedSearchClient();

      const search = instantsearch({ indexName: 'indexName', searchClient });

      search.addWidgets([
        searchBox({ container: searchBoxContainer }),
        hits({ container }),
      ]);

      // @MAJOR Once Hogan.js and string-based templates are removed,
      // `search.start()` can be moved to the test body and the following
      // assertion can go away.
      expect(async () => {
        search.start();

        await wait(0);
      }).not.toWarnDev();

      await wait(0);

      expect(container).toMatchInlineSnapshot(`

          {
  "objectID": "1",
  "name": "Apple iPhone smartphone",
  "description": "A smartphone by Apple.",
  "_highlightResult": {
    "name": {
      "value": "Apple iPhone <mark>smartphone</mark>",
      "matchLevel": "full",
      "matchedWords": [
        "smartphone"
      ]
    }
  },
  "_snippetResult": {
    "name": {
      "value": "Apple iPhone <mark>smartphone</mark>",
      "matchLevel": "full"
    },
    "description": {
      "value": "A <mark>smartphone</mark> by Apple.",
      "matchLevel": "full"
    }
  },
  "__position": 1,
  "__hitIndex": 0
}

          {
  "objectID": "2",
  "name": "Samsung Galaxy smartphone",
  "description": "A smartphone by Samsung.",
  "_highlightResult": {
    "name": {
      "value": "Samsung Galaxy <mark>smartphone</mark>",
      "matchLevel": "full",
      "matchedWords": [
        "smartphone"
      ]
    }
  },
  "_snippetResult": {
    "name": {
      "value": "Samsung Galaxy <mark>smartphone</mark>",
      "matchLevel": "full"
    },
    "description": {
      "value": "A <mark>smartphone</mark> by Samsung.",
      "matchLevel": "full"
    }
  },
  "__position": 2,
  "__hitIndex": 1
}

`);

      fireEvent.input(within(searchBoxContainer).getByRole('searchbox'), {
        target: { value: 'query with no results' },
      });

      await wait(0);

      expect(container).toMatchInlineSnapshot(`

      No results

`);
    });

    test('renders with templates using `html`', async () => {
      const container = document.createElement('div');
      const searchBoxContainer = document.createElement('div');
      const searchClient = createMockedSearchClient();

      const search = instantsearch({ indexName: 'indexName', searchClient });

      search.addWidgets([
        searchBox({ container: searchBoxContainer }),
        hits({
          container,
          templates: {
            item(hit, { html, components }) {
              return html`

${components.Highlight({ hit, attribute: 'name' })}

                  ${components.ReverseHighlight({ hit, attribute: 'name' })}

${components.Snippet({ hit, attribute: 'description' })}

                  ${components.ReverseSnippet({
                    hit,
                    attribute: 'description',
                  })}

              `;
            },
            empty({ query }, { html }) {
              return html`<p>No results for <q>${query}</q></p>`;
            },
          },
        }),
      ]);

      search.start();

      await wait(0);

      expect(container).toMatchInlineSnapshot(`

                Apple iPhone

                smartphone

                Apple iPhone

                smartphone

                A

                smartphone

                 by Apple.

                A

                smartphone

                 by Apple.

                Samsung Galaxy

                smartphone

                Samsung Galaxy

                smartphone

                A

                smartphone

                 by Samsung.

                A

                smartphone

                 by Samsung.

`);

      fireEvent.input(within(searchBoxContainer).getByRole('searchbox'), {
        target: { value: 'query with no results' },
      });

      await wait(0);

      expect(container).toMatchInlineSnapshot(`

        No results for
        <q>
          query with no results
        </q>

`);
    });

    test('renders with templates using JSX', async () => {
      const container = document.createElement('div');
      const searchBoxContainer = document.createElement('div');
      const searchClient = createMockedSearchClient();

      const search = instantsearch({ indexName: 'indexName', searchClient });

      search.addWidgets([
        searchBox({ container: searchBoxContainer }),
        hits({
          container,
          templates: {
            item(hit, { components }) {
              return (
                <Fragment>

                    <components.Highlight hit={hit} attribute="name" />

                    <components.ReverseHighlight hit={hit} attribute="name" />

                    <components.Snippet hit={hit} attribute="description" />

                    <components.ReverseSnippet
                      hit={hit}
                      attribute="description"
                    />

                </Fragment>
              );
            },
            empty({ query }) {
              return (

                  No results for <q>{query}</q>

              );
            },
          },
        }),
      ]);

      search.start();

      await wait(0);

      expect(container).toMatchInlineSnapshot(`

                Apple iPhone

                smartphone

                Apple iPhone

                smartphone

                A

                smartphone

                 by Apple.

                A

                smartphone

                 by Apple.

                Samsung Galaxy

                smartphone

                Samsung Galaxy

                smartphone

                A

                smartphone

                 by Samsung.

                A

                smartphone

                 by Samsung.

`);

      fireEvent.input(within(searchBoxContainer).getByRole('searchbox'), {
        target: { value: 'query with no results' },
      });

      await wait(0);

      expect(container).toMatchInlineSnapshot(`

        No results for
        <q>
          query with no results
        </q>

`);
    });

    type CustomHit = { name: string; description: string };

    function createMockedSearchClient(
      subset: Partial<SearchResponse<CustomHit>> = {}
    ) {
      return createSearchClient({
        search: jest.fn((requests) => {
          return Promise.resolve(
            createMultiSearchResponse(
              ...requests.map((request) => {
                return createSingleSearchResponse<any>({
                  index: request.indexName,
                  query: request.params?.query,
                  hits:
                    request.params?.query === 'query with no results'
                      ? []
                      : [
                          {
                            objectID: '1',
                            name: 'Apple iPhone smartphone',
                            description: 'A smartphone by Apple.',
                            _highlightResult: {
                              name: {
                                value: `Apple iPhone <mark>smartphone</mark>`,
                                matchLevel: 'full' as const,
                                matchedWords: ['smartphone'],
                              },
                            },
                            _snippetResult: {
                              name: {
                                value: `Apple iPhone <mark>smartphone</mark>`,
                                matchLevel: 'full' as const,
                              },
                              description: {
                                value: `A <mark>smartphone</mark> by Apple.`,
                                matchLevel: 'full' as const,
                              },
                            },
                          },
                          {
                            objectID: '2',
                            name: 'Samsung Galaxy smartphone',
                            description: 'A smartphone by Samsung.',
                            _highlightResult: {
                              name: {
                                value: `Samsung Galaxy <mark>smartphone</mark>`,
                                matchLevel: 'full' as const,
                                matchedWords: ['smartphone'],
                              },
                            },
                            _snippetResult: {
                              name: {
                                value: `Samsung Galaxy <mark>smartphone</mark>`,
                                matchLevel: 'full' as const,
                              },
                              description: {
                                value: `A <mark>smartphone</mark> by Samsung.`,
                                matchLevel: 'full' as const,
                              },
                            },
                          },
                        ],
                  ...subset,
                });
              })
            )
          );
        }),
      });
    }
  });
});


text:
<?php
namespace app\components\grid;

use yii\grid\DataColumn;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;

class SetColumn extends DataColumn
{
    /**
     * @var callable
     */
    public $name;
    /**
     * Array of status classes
     * ```
     * [
     *     User::STATUS_ACTIVE => 'success',
     *     User::STATUS_WAIT => 'warning',
     *     User::STATUS_BLOCKED => 'default',
     * ]
     * ```
     * @var array
     */
    public $cssCLasses = [];

    protected function renderDataCellContent($model, $key, $index)
    {
        $value = $this->getDataCellValue($model, $key, $index);
        $name = $this->getStatusName($model, $key, $index, $value);
        $class = ArrayHelper::getValue($this->cssCLasses, $value, 'default');
        $html = Html::tag('span', Html::encode($name), ['class' => 'label label-' . $class]);
        return $value === null ? $this->grid->emptyCell : $html;
    }

    /**
     * @param mixed $model
     * @param mixed $key
     * @param integer $index
     * @param mixed $value
     * @return string
     */
    private function getStatusName($model, $key, $index, $value)
    {
        if ($this->name !== null) {
            if (is_string($this->name)) {
                $name = ArrayHelper::getValue($model, $this->name);
            } else {
                $name = call_user_func($this->name, $model, $key, $index, $this);
            }
        } else {
            $name = null;
        }
        return $name === null ? $value : $name;
    }
}

redpajama_set_name: RedPajamaGithub


text:
a: ddd_d
audio: shot
return_link: 'bbb_bbb_b'
type: balloon
---
Jesus is the<br>
big faith


text:
layout: page
title: "Thomas Pearson Wadsworth"
comments: true
description: "blanks"
keywords: "Thomas Pearson Wadsworth,CU,Boulder"
---
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script>
<!-- <script src="../assets/js/highcharts.js"></script> -->
<style type="text/css">@font-face {
	font-family: "Bebas Neue";
	src: url(https://www.filehosting.org/file/details/544349/BebasNeue Regular.otf) format("opentype");
	}
	h1.Bebas {
		font-family: "Bebas Neue", Verdana, Tahoma;
	}
</style>
</head>

#### TEACHING INFORMATION

**College**: College of Arts and Sciences

**Classes taught**: SOCY 1001, SOCY 1004, SOCY 2044, SOCY 4004, SOCY 4014, SOCY 5031, SOCY 6111

#### SOCY 1001: Introduction to Sociology

**Terms taught**: Fall 2010, Fall 2011, Fall 2012, Fall 2013, Fall 2014, Spring 2016, Spring 2017

**Instructor rating**: 4.86

**Standard deviation in instructor rating**: 0.11

**Average grade** (4.0 scale): 2.7

**Standard deviation in grades** (4.0 scale): 0.25

**Average workload** (raw): 2.39

**Standard deviation in workload** (raw): 0.09

#### SOCY 1004: Deviance in U.S. Society

**Terms taught**: Spring 2015, Fall 2016

**Instructor rating**: 5.08

**Standard deviation in instructor rating**: 0.07

**Average grade** (4.0 scale): 2.85

**Standard deviation in grades** (4.0 scale): 0.07

**Average workload** (raw): 2.36

**Standard deviation in workload** (raw): 0.11

#### SOCY 2044: Crime and Society

**Terms taught**: Fall 2007, Fall 2008, Fall 2009, Spring 2010, Fall 2010, Spring 2011, Fall 2011

**Instructor rating**: 5.31

**Standard deviation in instructor rating**: 0.22

**Average grade** (4.0 scale): 2.56

**Standard deviation in grades** (4.0 scale): 0.43

**Average workload** (raw): 2.5

**Standard deviation in workload** (raw): 0.33

#### SOCY 4004: TPC-MEDIA/POLITICS/CRIME

**Terms taught**: Fall 2007, Fall 2008

**Instructor rating**: 5.1

**Standard deviation in instructor rating**: 0.3

**Average grade** (4.0 scale): 2.76

**Standard deviation in grades** (4.0 scale): 0.23

**Average workload** (raw): 2.13

**Standard deviation in workload** (raw): 0.27

#### SOCY 4014: CRIMINOLOGY

**Terms taught**: Fall 2009, Spring 2010

**Instructor rating**: 5.13

**Standard deviation in instructor rating**: 0.25

**Average grade** (4.0 scale): 2.58

**Standard deviation in grades** (4.0 scale): 0.1

**Average workload** (raw): 2.76

**Standard deviation in workload** (raw): 0.45

#### SOCY 5031: Research Design

**Terms taught**: Spring 2009, Spring 2011, Spring 2012

**Instructor rating**: 5.36

**Standard deviation in instructor rating**: 0.34

**Average grade** (4.0 scale): 3.54

**Standard deviation in grades** (4.0 scale): 0.16

**Average workload** (raw): 3.26

**Standard deviation in workload** (raw): 0.31

#### SOCY 6111: Data 2: Data Analysis

**Terms taught**: Spring 2013

**Instructor rating**: 5.23

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 3.28

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 3.64

**Standard deviation in workload** (raw): 0.0


text:
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace Leap.Unity.Attributes {

  public class EnumFlags : CombinablePropertyAttribute, IFullPropertyDrawer {
    public EnumFlags() { }

#if UNITY_EDITOR
    public void DrawProperty(Rect rect, SerializedProperty property, GUIContent label) {
      property.intValue = EditorGUI.MaskField(rect, label, property.intValue, property.enumNames);
    }
#endif
  }
}


text:
    <title>Girls Rule</title>

Home
        Resources
        Statistics
        History

Girl Power

Let's get some facts straight. Girls rule. So then why do they make up a mere 20% of the
    technology and computer science job force? Why are the lines for the lady's room at technology
    conferences so short? Any woman can testify the agony of having to stand in the long
    bathroom line at the airport, sporting events, and amusement parks. Sadly, the same does not
    apply to the non-existent lines at events like the Worldwide Developers Conference in San Francisco and other
    technology conferences.This shows the gender gap associated with technology based careers. Women
    are outnumbered in a growing field that is high paying, transferable, and in high demand. As the
    world moves into an even denser information age, new jobs will come about while others become
    obsolete. So why are women so underrepresented in this job industry? I have no idea. Women have
    everything it takes to become successful in computer science and technology careers. We hope this
    website inspires current and aspiring women to become a strong driving force behind up and coming
    technology related careers.

Tech Women in Action

Quotes from Real Tech Women

We asked real women just like you about what made them join the world of tech and if they
    had advice for women who are interested in getting into the field.

<q>Throughout
    middle school and high school, I was really interested in mathematics, and I was constantly on the
    lookout for an interesting way to incorporate math into a fun career. Then, I found the field of computer
    science and it was a perfect match. Computer science is a great way to incorporate mathematics into a career
- IBM Employee</q>

    <q>In high school, I was really interested in graphic design, and during college, I figured out that coding
    was such an efficient and effective way to work with graphics. It changed the way I thought about design
    and it made my work much easier. If I had to give any words of wisdom to anybody interested in the field,
    I would say that it is so important to work with code as much as possible. At the end of the day, coding
    is so beneficial in all areas of work and it can make many tasks easier and more efficient.</q>
- Pearl Hacker

    <q>As a teenager, I was obsessed with anything related to robotics, gaming, and anything of the likes.
    I was a really detail-oriented person, and working with technology has a lot to do with detail.
    In my job, I get to work with customers a lot, but I also get to work with hardware. Technology is a profession
    that makes work not seem like a task.</q>
- Katherine McAuliffe, Event Engineer at Pebble

    <q>Women are so crucial right now in the field of technology. I didn't grow up with tech parents, but in high
    school, I began to explore technology, and it was great. It is so important to get women in the profession
    of technology, and it is such a rewarding job.</q>
- Niharika Bedekar, Developer Events Coordinator at Pebble


text:
class StreamPosition {
	static start: number = 0;
	static end: number = -1;
}

export = StreamPosition;


text:
<!doctype html>

    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'>
    <meta name='mobile-web-app-capable' content='yes'>
    <meta name='apple-mobile-web-app-capable' content='yes'>

    <title>Unresponsive Page</title>

    <link href='../css/common.css' rel='stylesheet'></link>

        Unresponsive Page

          This page mimics a poorly behaved page which requests a session but
          never begins requesting or processing frames.
          Back

Click 'Enter XR' to see content


text:
#ifndef JUCE_MIDITEST_MAINCOMPONENT_H
#define JUCE_MIDITEST_MAINCOMPONENT_H

#include "JuceHeader.h"

//==============================================================================

class MidiDeviceListBox;
struct MidiDeviceListEntry;

//==============================================================================
class MainContentComponent  : public Component,
                              private Timer,
                              private MidiKeyboardStateListener,
                              private MidiInputCallback,
                              private MessageListener,
                              private ButtonListener
{
public:
    //==========================================================================
    MainContentComponent ();
    ~MainContentComponent();

    //==========================================================================
    void timerCallback () override;
    void handleNoteOn (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity) override;
    void handleNoteOff (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity) override;
    void handleMessage (const Message& msg) override;

    void paint (Graphics& g) override;
    void resized() override;
    void buttonClicked (Button* buttonThatWasClicked) override;

    void openDevice (bool isInput, int index);
    void closeDevice (bool isInput, int index);

    int getNumMidiInputs() const noexcept;
    int getNumMidiOutputs() const noexcept;

    ReferenceCountedObjectPtr<MidiDeviceListEntry> getMidiDevice (int index, bool isInputDevice) const noexcept;
private:
    //==========================================================================
    void handleIncomingMidiMessage (MidiInput *source, const MidiMessage &message) override;
    void sendToOutputs(const MidiMessage& msg);

    //==========================================================================
    bool hasDeviceListChanged (const StringArray& deviceNames, bool isInputDevice);
    ReferenceCountedObjectPtr<MidiDeviceListEntry> findDeviceWithName (const String& name, bool isInputDevice) const;
    void closeUnpluggedDevices (StringArray& currentlyPluggedInDevices, bool isInputDevice);
    void updateDeviceList (bool isInputDeviceList);

    //==========================================================================
    void addLabelAndSetStyle (Label& label);

    //==========================================================================
    Label midiInputLabel;
    Label midiOutputLabel;
    Label incomingMidiLabel;
    Label outgoingMidiLabel;
    MidiKeyboardState keyboardState;
    MidiKeyboardComponent midiKeyboard;
    TextEditor midiMonitor;
    TextButton pairButton;

    ScopedPointer<MidiDeviceListBox> midiInputSelector;
    ScopedPointer<MidiDeviceListBox> midiOutputSelector;

    ReferenceCountedArray<MidiDeviceListEntry> midiInputs;
    ReferenceCountedArray<MidiDeviceListEntry> midiOutputs;

    //==========================================================================
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};

#endif   // JUCE_MIDITEST_MAINCOMPONENT_H


text:
using System;
using UnityEngine;
#if UNITY_EDITOR
using System.Xml;
#endif

[ExecuteInEditMode]
public class CameraPathFOVList : CameraPathPointList
{
        public enum Interpolation
        {
            None,
            Linear,
            SmoothStep
        }

        public Interpolation interpolation = Interpolation.SmoothStep;

    private const float DEFAULT_FOV = 60;

    public bool listEnabled = true;

    private void OnEnable()
    {
        hideFlags = HideFlags.HideInInspector;
    }

    public override void Init(CameraPath _cameraPath)
    {
        if(initialised)
            return;
        base.Init(_cameraPath);
        cameraPath.PathPointAddedEvent += AddFOV;
        pointTypeName = "FOV";
        initialised = true;
    }

    public override void CleanUp()
    {
        base.CleanUp();
        cameraPath.PathPointAddedEvent -= AddFOV;
        initialised = false;
    }

    public new CameraPathFOV this[int index]
    {
        get { return ((CameraPathFOV)(base[index])); }
    }

    public void AddFOV(CameraPathControlPoint atPoint)
    {
        CameraPathFOV point = gameObject.AddComponent<CameraPathFOV>();//CreateInstance<CameraPathFOV>();
        point.FOV = defaultFOV;
        point.hideFlags = HideFlags.HideInInspector;
        AddPoint(point,atPoint);
        RecalculatePoints();
    }

    public CameraPathFOV AddFOV(CameraPathControlPoint curvePointA, CameraPathControlPoint curvePointB, float curvePercetage, float fov)
    {
        CameraPathFOV fovpoint = gameObject.AddComponent<CameraPathFOV>();//CreateInstance<CameraPathFOV>();
        fovpoint.hideFlags = HideFlags.HideInInspector;
        fovpoint.FOV = fov;
        AddPoint(fovpoint, curvePointA, curvePointB, curvePercetage);
        RecalculatePoints();
        return fovpoint;
    }

    public float GetFOV(float percentage)
    {
        if (realNumberOfPoints < 2)
        {
            if (realNumberOfPoints == 1)
                return (this[0]).FOV;
            return 60;
        }

//        if (percentage >= 1)
//            return ((CameraPathFOV)GetPoint(realNumberOfPoints - 1)).FOV;

        percentage = Mathf.Clamp(percentage, 0.0f, 1.0f);

        switch(interpolation)
        {
            case Interpolation.SmoothStep:
            return SmoothStepInterpolation(percentage);

            case Interpolation.Linear:
            return LinearInterpolation(percentage);

            default:
            return LinearInterpolation(percentage);
        }
    }

    private float LinearInterpolation(float percentage)
    {
        int index = GetLastPointIndex(percentage);
        CameraPathFOV pointP = (CameraPathFOV)GetPoint(index);
        CameraPathFOV pointQ = (CameraPathFOV)GetPoint(index + 1);

//        if (percentage < pointP.percent)
//            return pointP.FOV;
//        if (percentage > pointQ.percent)
//            return pointQ.FOV;

        float startPercentage = pointP.percent;
        float endPercentage = pointQ.percent;

        if (startPercentage > endPercentage)
            endPercentage += 1;

        float curveLength = endPercentage - startPercentage;
        float curvePercentage = percentage - startPercentage;
        float ct = curvePercentage / curveLength;
        return Mathf.Lerp(pointP.FOV, pointQ.FOV, ct);
    }

    private float SmoothStepInterpolation(float percentage)
    {
        int index = GetLastPointIndex(percentage);
        CameraPathFOV pointP = (CameraPathFOV)GetPoint(index);
        CameraPathFOV pointQ = (CameraPathFOV)GetPoint(index + 1);

//        if (percentage < pointP.percent)
//            return pointP.FOV;
//        if (percentage > pointQ.percent)
//            return pointQ.FOV;

        float startPercentage = pointP.percent;
        float endPercentage = pointQ.percent;

        if (startPercentage > endPercentage)
            endPercentage += 1;

        float curveLength = endPercentage - startPercentage;
        float curvePercentage = percentage - startPercentage;
        float ct = curvePercentage / curveLength;

//        Debug.DrawLine(cameraPath.GetPathPosition(percentage, true), pointP.worldPosition, Color.blue);
//        Debug.DrawLine(cameraPath.GetPathPosition(percentage, true), pointQ.worldPosition, Color.red);

        return Mathf.Lerp(pointP.FOV, pointQ.FOV, CPMath.SmoothStep(ct));
    }

    /// <summary>
    /// Attempt to find the camera in use for this scene and apply the field of view as default
    /// </summary>
    private float defaultFOV
    {
        get
        {
            if(Camera.current)
                return Camera.current.fieldOfView;

            Camera[] cams = Camera.allCameras;
            bool sceneHasCamera = cams.Length > 0;
            if(sceneHasCamera)
                return cams[0].fieldOfView;
            return DEFAULT_FOV;
        }
    }

#if UNITY_EDITOR
    public override void FromXML(XmlNodeList nodes)
    {
        Clear();
        foreach (XmlNode node in nodes)
        {
            CameraPathFOV newCameraPathPoint = gameObject.AddComponent<CameraPathFOV>();//CreateInstance<CameraPathFOV>();
            newCameraPathPoint.hideFlags = HideFlags.HideInInspector;
            CameraPathPoint.PositionModes positionModes = (CameraPathPoint.PositionModes)Enum.Parse(typeof(CameraPathPoint.PositionModes), node["positionModes"].FirstChild.Value);
            switch (positionModes)
            {
                case CameraPathPoint.PositionModes.Free:
                    CameraPathControlPoint cPointA = cameraPath[int.Parse(node["cpointA"].FirstChild.Value)];
                    CameraPathControlPoint cPointB = cameraPath[int.Parse(node["cpointB"].FirstChild.Value)];
                    float curvePercentage = float.Parse(node["curvePercentage"].FirstChild.Value);
                    AddPoint(newCameraPathPoint, cPointA, cPointB, curvePercentage);
                    break;

                case CameraPathPoint.PositionModes.FixedToPoint:
                    CameraPathControlPoint point = cameraPath[int.Parse(node["point"].FirstChild.Value)];
                    AddPoint(newCameraPathPoint, point);
                    break;
            }
            newCameraPathPoint.FromXML(node, cameraPath);
        }
    }
#endif
}


text:
// expose test function names
function exposeTestFunctionNames()
{
return ['XPathEvaluator_evaluate_documentElement'];
}

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", "staffNS");

       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';
    }
}

/**
*
      Retrieve the XPathEvaluator on which the
      "evaluate("/", documentElement, null, 0, null)" method is invoked with the document
      element. The method should return an XPathResult.

* @author Philippe Le Hégaret
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator-evaluate
*/
function XPathEvaluator_evaluate_documentElement() {
   var success;
    if(checkInitialization(builder, "XPathEvaluator_evaluate_documentElement") != null) return;
    var doc;
      var xpEvaluator;
      var nullNSResolver = null;

      var root;
      var result;
      var nullResult = null;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      doc = load(docRef, "doc", "staffNS");
      xpEvaluator = createXPathEvaluator(doc);
root = doc.documentElement;

      result = xpEvaluator.evaluate("/",root,nullNSResolver,0,nullResult);
      assertNotNull("notnull",result);

}

function runTest() {
   XPathEvaluator_evaluate_documentElement();
}


text:
define([
    'jquery',
    'underscore',
    'backbone',
    'app',
    'text!../../templates/menu.html'
],
function($, _, Backbone, app, menuTemplate){
    var MenuView = Backbone.View.extend({
        parent: $('#menu-container'),
        id: 'menu',
        className: 'nav-inner',
        events: {
            'click li a': 'logPageSwitch'
        },

        initialize: function(options){
            var self = this;

            this.el = $(this.el);
            this.parent.append(this.el);

            this.model.on('change:user', this.setActiveUser, this);

            this.active_item = null;
        },

        render: function(){
            if (DEBUG) console.log('MenuView:render');

            this.$el.html(_.template(menuTemplate));
            this.setActiveUser();

            return this;
        },

        setActiveItem: function(url){
            if(this.active_item){
                this.active_item.removeClass('active');
            }

            this.active_item = this.$el.find('a[href="' + url + '"]');
            this.active_item.addClass('active');
        },

        setActiveUser: function(){
            if (DEBUG) console.log('MenuView:setActiveUser');

            var user = this.model.get('user');
            var name = '';
            if(user){
                name = user.name;
            }
            this.$el.find('.username').html(name);
        },

        openItem: function(e){
            var clicked_link = $(e.target);

            // Return if an already active link is clicked
            if(clicked_link.hasClass('active')){
                return;
            }

            this.active_item.removeClass('active');
            clicked_link.addClass('active');
            this.active_item = clicked_link;
        },

        logPageSwitch: function(e){
            app.vent.trigger('Logging:clicks', {
                action: 'page_switch',
                fromPage: this.active_item[0].dataset.name,
                toPage: e.target.dataset.name
            });
        }
    });

    return MenuView;

});


text:
using BeYourMarket.Model.Models;
using Repository.Pattern.Repositories;
using Service.Pattern;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BeYourMarket.Service
{
    public interface IItemStatService : IService<ItemStat>
    {
    }

    public class ItemStatService : Service<ItemStat>, IItemStatService
    {
        public ItemStatService(IRepositoryAsync<ItemStat> repository)
            : base(repository)
        {
        }
    }
}


text:
__author__ = 'Michael Meisinger'

from nose.plugins.attrib import attr

from pyon.public import BadRequest
from pyon.util.unit_test import UnitTestCase

from ion.util.parse_utils import get_typed_value

@attr('UNIT')
class TestParseUtils(UnitTestCase):

    def test_get_typed_value(self):
        # TEST: Integers
        ret_val = get_typed_value(999, targettype="int", strict=True)
        self.assertEqual(ret_val, 999)
        with self.assertRaises(BadRequest):
            get_typed_value("999", targettype="int", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value("999.9", targettype="int", strict=False)
        with self.assertRaises(BadRequest):
            get_typed_value(None, targettype="int", strict=False)
        with self.assertRaises(BadRequest):
            get_typed_value("", targettype="int", strict=False)
        ret_val = get_typed_value("999", targettype="int", strict=False)
        self.assertEqual(ret_val, 999)
        long_val = 9999999999999999999
        self.assertEqual(type(long_val), long)
        ret_val = get_typed_value(long_val, targettype="int", strict=True)
        self.assertEqual(ret_val, long_val)

        schema_entry = dict(type="int")
        ret_val = get_typed_value(999, schema_entry=schema_entry, strict=True)
        self.assertEqual(ret_val, 999)

        # TEST: Float
        ret_val = get_typed_value(999.9, targettype="float", strict=True)
        self.assertEqual(ret_val, 999.9)
        with self.assertRaises(BadRequest):
            get_typed_value("999.9", targettype="float", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value(None, targettype="float", strict=False)
        with self.assertRaises(BadRequest):
            get_typed_value("", targettype="float", strict=False)
        ret_val = get_typed_value("999.9", targettype="float", strict=False)
        self.assertEqual(ret_val, 999.9)

        # TEST: String
        ret_val = get_typed_value("foo", targettype="str", strict=True)
        self.assertEqual(ret_val, "foo")
        with self.assertRaises(BadRequest):
            get_typed_value(999, targettype="str", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value(None, targettype="str", strict=True)
        ret_val = get_typed_value(999, targettype="str", strict=False)
        self.assertEqual(ret_val, "999")
        ret_val = get_typed_value(True, targettype="str", strict=False)
        self.assertEqual(ret_val, "True")
        unicode_val = u'foo \u20ac foo'
        ret_val = get_typed_value(unicode_val, targettype="str", strict=True)
        self.assertEqual(type(ret_val), str)
        self.assertEqual(ret_val, "foo \xe2\x82\xac foo")

        # TEST: Bool
        ret_val = get_typed_value(True, targettype="bool", strict=True)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value(False, targettype="bool", strict=True)
        self.assertEqual(ret_val, False)
        with self.assertRaises(BadRequest):
            get_typed_value("True", targettype="bool", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value(None, targettype="bool", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value("", targettype="bool", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value(123, targettype="bool", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value(0, targettype="bool", strict=True)
        ret_val = get_typed_value("True", targettype="bool", strict=False)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value("true", targettype="bool", strict=False)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value("TRUE", targettype="bool", strict=False)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value("1", targettype="bool", strict=False)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value(1, targettype="bool", strict=False)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value("False", targettype="bool", strict=False)
        self.assertEqual(ret_val, False)
        ret_val = get_typed_value("FALSE", targettype="bool", strict=False)
        self.assertEqual(ret_val, False)
        ret_val = get_typed_value("false", targettype="bool", strict=False)
        self.assertEqual(ret_val, False)
        ret_val = get_typed_value("0", targettype="bool", strict=False)
        self.assertEqual(ret_val, False)
        ret_val = get_typed_value("", targettype="bool", strict=False)
        self.assertEqual(ret_val, False)
        ret_val = get_typed_value(None, targettype="bool", strict=False)
        self.assertEqual(ret_val, False)
        with self.assertRaises(BadRequest):
            get_typed_value("F", targettype="bool", strict=False)
        with self.assertRaises(BadRequest):
            get_typed_value("Falsy", targettype="bool", strict=False)
        with self.assertRaises(BadRequest):
            get_typed_value("Truey", targettype="bool", strict=False)
        with self.assertRaises(BadRequest):
            get_typed_value(" True", targettype="bool", strict=False)

        # TEST: List
        list_val = [1, True, "foo"]
        ret_val = get_typed_value(list_val, targettype="list", strict=True)
        self.assertEqual(ret_val, list_val)
        ret_val = get_typed_value([], targettype="list", strict=True)
        self.assertEqual(ret_val, [])
        with self.assertRaises(BadRequest):
            get_typed_value(None, targettype="list", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value("[]", targettype="list", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value("", targettype="list", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value(tuple(), targettype="list", strict=True)

        ret_val = get_typed_value(1, targettype="list", strict=False)
        self.assertEqual(ret_val, [1])
        ret_val = get_typed_value(tuple(list_val), targettype="list", strict=False)
        self.assertEqual(ret_val, list_val)
        ret_val = get_typed_value(set(list_val), targettype="list", strict=False)
        self.assertEqual(type(ret_val), list)
        self.assertEqual(set(ret_val), set(list_val))
        ret_val = get_typed_value("1", targettype="list", strict=False)
        self.assertEqual(ret_val, ["1"])
        ret_val = get_typed_value("a,b,c", targettype="list", strict=False)
        self.assertEqual(ret_val, ["a", "b", "c"])
        ret_val = get_typed_value("[a,b,c]", targettype="list", strict=False)
        self.assertEqual(ret_val, ["a", "b", "c"])
        ret_val = get_typed_value("['a','b',3]", targettype="list", strict=False)
        self.assertEqual(ret_val, ["a", "b", 3])
        ret_val = get_typed_value("[]", targettype="list", strict=False)
        self.assertEqual(ret_val, [])
        ret_val = get_typed_value(None, targettype="list", strict=False)
        self.assertEqual(ret_val, [None])
        ret_val = get_typed_value(True, targettype="list", strict=False)
        self.assertEqual(ret_val, [True])

        # TEST: Simplelist
        ret_val = get_typed_value("a,b,c", targettype="simplelist")
        self.assertEqual(ret_val, ["a", "b", "c"])

        # TEST: Dict
        dict_val = {'a': 1, 'b': True}
        ret_val = get_typed_value(dict_val, targettype="dict", strict=True)
        self.assertEqual(ret_val, dict_val)
        ret_val = get_typed_value({}, targettype="dict", strict=True)
        self.assertEqual(ret_val, {})
        with self.assertRaises(BadRequest):
            get_typed_value(None, targettype="dict", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value("{}", targettype="dict", strict=True)
        with self.assertRaises(BadRequest):
            get_typed_value("", targettype="dict", strict=True)

        ret_val = get_typed_value("{}", targettype="dict", strict=False)
        self.assertEqual(ret_val, {})
        ret_val = get_typed_value("{'a': 1, 'b': True}", targettype="dict", strict=False)
        self.assertEqual(ret_val, dict_val)
        ret_val = get_typed_value("a: 1, b: c, c: True", targettype="dict", strict=False)
        self.assertEqual(ret_val, {'a': 1, 'b': 'c', 'c': True})
        ret_val = get_typed_value("a.x: 1, a.y: 2.2, b: false", targettype="dict", strict=False)
        self.assertEqual(ret_val, {'a': {'x': 1, 'y': 2.2}, 'b': 'false'})

        # TEST: None
        ret_val = get_typed_value(None, targettype="NoneType", strict=True)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value(1, targettype="NoneType", strict=True)
        self.assertEqual(ret_val, 1)
        ret_val = get_typed_value(True, targettype="NoneType", strict=True)
        self.assertEqual(ret_val, True)
        ret_val = get_typed_value("foo", targettype="NoneType", strict=True)
        self.assertEqual(ret_val, "foo")
        ret_val = get_typed_value("None", targettype="NoneType", strict=True)
        self.assertEqual(ret_val, "None")

        ret_val = get_typed_value("None", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value("NONE", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value("none", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value("Null", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value("NULL", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value("null", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)
        ret_val = get_typed_value("", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, None)

        ret_val = get_typed_value(1, targettype="NoneType", strict=False)
        self.assertEqual(ret_val, 1)
        ret_val = get_typed_value("1", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, 1)
        ret_val = get_typed_value(1.1, targettype="NoneType", strict=False)
        self.assertEqual(ret_val, 1.1)
        ret_val = get_typed_value("1.1", targettype="NoneType", strict=False)
        self.assertEqual(ret_val, 1.1)

        # TEST: Enum
        from interface.objects import SampleEnum
        schema_entry = dict(type="int", enum_type="SampleEnum")
        ret_val = get_typed_value(SampleEnum.MONDAY, schema_entry=schema_entry, strict=True)
        self.assertEqual(ret_val, SampleEnum.MONDAY)
        ret_val = get_typed_value("MONDAY", schema_entry=schema_entry, strict=True)
        self.assertEqual(ret_val, SampleEnum.MONDAY)
        with self.assertRaises(BadRequest):
            get_typed_value("Monday", schema_entry=schema_entry, strict=True)

        ret_val = get_typed_value("MONDAY", schema_entry=schema_entry, strict=False)
        self.assertEqual(ret_val, SampleEnum.MONDAY)
        ret_val = get_typed_value("Monday", schema_entry=schema_entry, strict=False)
        self.assertEqual(ret_val, SampleEnum.MONDAY)
        with self.assertRaises(BadRequest):
            get_typed_value("HOLIDAY", schema_entry=schema_entry)

        # TEST: Error conditions
        with self.assertRaises(BadRequest):
            get_typed_value(1)
        with self.assertRaises(BadRequest):
            get_typed_value(1, targettype="FOO")


text:
namespace kit {
namespace graphics {

static void appendPolyline(ci::cairo::Context &context, const ci::PolyLine2f &polyline) {
	if (!polyline.getPoints().empty()) {
		context.moveTo(polyline.getPoints()[0]);

		for (size_t p = 1; p < polyline.getPoints().size(); ++p) {
			context.lineTo(polyline.getPoints()[p]);
		}

		if (polyline.isClosed()) {
			context.closePath();
		}
	}
}

} // namespace graphics
} // namespace kit


text:
<?php header('Content-Type: text/html; charset=utf-8'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<title>OpenPNE3 セットアップ</title>
<link rel="stylesheet" type="text/css" media="screen" href="opSkinBasicPlugin/css/main.css" />

OpenPNE3


text:
var concat = require("array-concat-stream");

module.exports = function(node, cb) {
	var initial = JSON.parse(node.initial || "[]")
	cb(null, concat(initial));
}


text:
package tivitbvf.model;

public class Relatorio {

}


text:
.. title: P2L1 Review of UML
.. slug: P2L1 Review of UML
.. date: 2016-05-27 23:37:20 UTC-08:00
.. tags: notes, mathjax
.. category:
.. link:
.. description:
.. type: text

P2L1 Review of UML
==================

Student Provided Notes
----------------------

* `All UML Diagrams in a single pdf`_

.. _All UML Diagrams in a single pdf: https://d1b10bmlvqabco.cloudfront.net/attach/io7x94vh5gz42w/idfwkbgtu6i3ff/iostzz8hjr24/P2L1UMLDiagramTypes.pdf

01 - Diagrams
-------------

Doing design you need to be able to represent those designs and a very popular way of doing that is with diagrams. This
course focused on UML, using UML and constructing those diagrams and the purpose of this lesson is to review for you
some of the different kinds of diagrams that are there. There's lots of diagrams, we're not going to be using them all.
But I'd like you to be at least familiar with what ones are there. So lets step back a little bit in history.

Diagrams have been a popular part of software development from the beginning.

I still have a flow chart template that you use for writing out the control logic of an algorithm. Over the years,
various sophisticated diagramming techniques have developed. Okay.

Among those are SADT, Jackson Design, Structure Design and so on.

Each with their own particular approach to diagramming. In the 1980s, object oriented tech, techniques began to emerge,
and with them. Various techniques for diagramming [UNKNOWN] solutions. The first one we want to look at is called OMT.

02 - OMT
--------

OMT was developed at General Electric corporation by James Rumbaugh and others that were there. It resulted in a book, a
cover of a book as a, a die on which there are three visible faces. And one face has a class model diagram, one face has
a state chart diagram, and one face has a data flow diagram. The class model gave you the structural aspects, the state
chart gave you the behavioral aspects, and the data flow diagram gave you the functional aspects.

That is OMT was a way of putting together three views of a system into a cohesive view. As OMT was coming along other
competitive, object-oriented methods and diagrams were also being developed.

03 - UML
--------

This led to the natural development where there was a goal of trying to unify these various techniques together, which
led to the Unified Modeling Language,

UML. There's a, an industry group called the Object Management Group, called OMG. That is the home for this
standardization effort.

It's where you can find the specification documents, which I referred to you refer you to during the term.

UML has also been championed by IBM. They acquired a company called Rational, which had developed a development
environment called Rational Rose, which supported directly UML. There's lots of such case tools now.

Aside from Rational Rose, one that we've used is Enterprise Architect.

These are commercial tools. There are also all kinds of drawing tools out there, which you can get for free. UML,
itself, had three main architects.

One was Rumbaugh, one was Grady Booch, and the other was Ivar Jacobson. Okay.

They're sometimes called the three amigos. They produced, in addition to a unified modeling language itself, three
books, a reference manual, a user's guide and so on. That had its main author as each one of the three, and then
together. Conveyed the overall approach to UML. It's important to note at this state the UML diagrams can be used both
for design but also for analysis. I'll try to distinguish as we go forward whether we're talking about an analysis
diagram or a design diagram. The main distinction is, analysis is concerned with the problem being solved and design is
concerned with the solution to that problem. I've taken some of these diagrams you're about to see from the UML
reference manual and from the UML users guide.

04 - Diagram Types
------------------

We're now into version two of UML. Which has as a total 14 different kinds of diagrams. We're going to go over those
quickly here but in the course we're not going to be using all of them. We're going to concentrate on just three or four
of them. And we'll have special lessons devoted to those but I wanted you to at least be aware of the different kinds of
diagrams that are there.

That said, on a particular project, you're unlikely to use all the diagrams.

You're going to use the ones appropriate to the particular project.

In particular, determine what is the trickiest part of the project and use the diagram that helps you best understand
that tricky part.

The two main categories of diagrams are structural and behavioral.

Structural diagrams give you the pieces of the system that are always there and the relationships among them. Behavioral
diagrams on the other hand, are concerned with the executions of the system. And the particular diagram may only convey
one execution. That is, you may have to have multiple sequence diagrams in order to get a good feel for all of the
behaviors of the system

05 - Diagram Quiz
-----------------

Imagine you're in a development shop.

And this development shop is old school and don't know anything about diagrams.

And you have to convince them of the value of having design diagrams.

06 - Diagram Quiz Solution
--------------------------

1

One major use of diagrams is that you can use them to convey information to

2 others in the group.

3

The others might be your teammates, but they also might be

4 people on other parts of the project which you don't normally communicate with.

5

They might even be persons down the line time-wise.

6

That is, the maintainers who are going to deal with the system

7 five years from now.

8

Communication is the first answer.

9

Second, we're talking about, in the case of UML object-oriented development, and

10 object oriented development has a particular process often used in

11 association with it.

12

That is, the diagramming technique can support a process that you're using.

13

For example, your process is likely to have some kind of

14 validation step associated with it, maybe a design review, and

15 using a particular design diagram can help you structure that review.

16

Also, by using a particular kind of diagram, there,

17 you may be able to find some tool support for that diagram.

18

The tool support might inform the user when a violation of

19 the visual syntax occurs, or inform the user that a piece is missing.

20

As far as the disadvantages are concerned, just like source code, any time that

21 you build a diagram, you have to worry about it getting it out of date, that is,

22 keeping it up to date with respect to changes in the rest of the system.

07 - Class Models
-----------------

Let's start with the most popular diagram. The Class Model Diagram. This is also sometimes called the static model or
the class structure diagram and it is an example of a structured diagram. It is showing the structure of the system.

In particular, it has classes and the relationships among those classes. And there are numerous embellishments. Class
Model Diagrams have many, many different affordances on them, icons on them and so on that you can use.

And we'll be devoting a lesson later to looking at those, and, how, what, what the meaning of those particular
affordances are

08 - UML Classes
----------------

As a quick reminder, UML classes are depicted as having up to three compartments, separated by horizontal lines.

The top compartment, typically, has the name of the class in it.

The middle compartment has the attributes of that class; the instance variables.

And the bottom compartment has the methods or operations that class provides.

09 - UML Relationships
----------------------

As far as relationships are concerned, there's three main categories of relationships in UML.

There are dependencies, depicted by dashed lines with an arrowhead, indicating that the class at one end uses the class
as the other end.

The solid lines without arrowheads are associations.

And that says that class at one end affects or has a instance of the class at the other end.

The solid line can be adorned with a diamond.

The diamond is used indicate this has a or aggregation embellishment to the association.

Third main category relationship is the generalization relationship.

The class at one end is a kind of a class at the other end.

In this case there is a solid line but it has that triangle at the end of it.

10 - Example Class Diagram
--------------------------

Here's a typical class diagram. It has some examples and associations. The associations don't have labels on them.
There's also couple of places where there are generalizations. As I said, the class model diagrams can have a lot more
adornments to them and we'll see those later on.

11 - Object Diagram
-------------------

Related visually to the class model diagram is the object diagram.

In fact they're the same with one major exception.

Instead of mentioning classes, they mention instances.

The label compartment at the top of the boxes has an underlined text line.

A text line has two parts.

One is the class name, just like in the class model diagram, but it also has the name of a specific instance, and those
two are separated by a colon.

So for example here, we have the company class, and in particular we have the c instance of a company class.

Optic diagrams are obviously used to convey the specific use of the classes involved in a class model diagram.

As you can see, for this particular instances here, many of the attribute fields have attribute values filled in for
them, as they would be for a particular instance.

12 - Composite Structure Diagram
--------------------------------

1

A less popular,

2 less frequently used structural diagram is the composite structure diagram.

3

This one is used for showing the internal structure of a class.

4

Of particular interest to us are its interfaces.

5

So on the left side of the interior class here are two

6 horizontal lines coming out.

7

The top one with the circle on the edge of it is a Provides Interface.

8

That's saying that this class provides some capabilities to

9 the rest of the world.

10

Under it is another line coming out and this one with a semicircle that's open.

11

This is a Requires Interface, that is,

12 what does this class require from the rest of the world?

13

You can then imagine having a variety of classes that plug into each other.

14

That is, a provides from one class plugs into a requires from another class.

15

This is one way of putting together the pieces of a software architecture.

13 - Component Diagram
----------------------

In fact, that's exactly what a component diagram does.

It's a static implementation view of how the components of a system fit together. As far as UML is concerned, a, a
component is a physical, replaceable part of a system that packages implementation and conforms to and provides a
realization of the set of interfaces. It's usually used to model code entities such as binaries, okay, that might
perhaps come from a library.

And relationships in the diagram are meant intended to specify that one of the components uses the services of another
component.

This particular type of diagram can also be used to convey architecture.

14 - Example Component Diagram
------------------------------

Here's an example component diagram.

The rectangles with the two sub-rectangles on their side indicate components.

This is one of Bouche's contributions to UML. He had a diagramming type called Bouchegrams in which these particular
icons were used.

The stick figures represent in this case people or actors of the system, and the dashed line indicates where components
plug into other components.

15 - Deployment Diagram
-----------------------

If we're talking about complex systems, these systems may run on different processing units. And we'd like to convey the
configuration of the run-time processing units, and their component instances in a way, that sees how they can interact.
And this is, included inside a UML deployment diagram.

A node in the diagram will correspond to a computational device, and the arcs indicate some kind of communication.

16 - Example Deployment Diagram
-------------------------------

In this example, there's two major processing units indicated by the shadowed rectangles. Inside rectangles are some
components, and then there are lines indicating the communications between the physical components, but also have
interfaces plugged into each other.

17 - Packages
-------------

UML also supports packages, in the sense of Java packages.

These are general purpose organizing mechanisms. Before UML 2, you could use packages as parts of other diagrams. In UML
2 there was a separate package diagram. Essentially this is providing namespace scoping so that each package can have
its own set of names without worrying about collisions. And that there's dependency arrows between two packages if some
piece of one package has a dependency arrow with some piece of another package. That is, it's an abstraction of that
particular dependency at, to the package level.

18 - Example Class Diagram with Packages
----------------------------------------

Here's a use of packages in UML 1.5.

In general, the indication that something is a package is it had a little tab in its upper left-hand corner, with a
label on it.

You see in this particular example there are also interpackage dependencies.

The dashed line ending in an arrowhead.

19 - Example Package Diagram
----------------------------

In UML 2.0 there's a separate package diagram, but it's conveying the same kinds of information.

20 - Profile Diagram
--------------------

The final structural type of UML diagram that I'd like to mention is the Profile Diagram. But this requires taking a
step back.

UML itself is a language, that has various pieces to it, such as classes and associations and so on. Those pieces.

Essentially provide a, describe a system and therefore you could have a UML description of UML.

That UML description or UML is called the UML meta model and in fact you can have, a UML class model diagram of a UML
meta model.

Even, more abstract is the fact that you, as a user, a designer, can extend the UML middle model.

You can add new kinds of icons. You can give, special labels.

To particular elements in the model. You do that extension in what's called a UML profile. And there's a UML Profile
Diagram in which you can convey it

21 - Example Profile Diagram
----------------------------

So here are three UML profile diagrams. Notice that above the class names are some stereotypes. Those are the things in
the double angle brackets.

And the particular stereotypes here are metaclass and stereotype.

So we're talking at the meta level. There's also some inheritance going on here.

The overall purpose of these particular examples has to do with extending the UML language to deal with describing
certain kinds of systems.

22 - UML Structure Diagram Quiz
-------------------------------

Okay. Well, here is a quiz for you to test your knowledge of these different diagram types. In column one I have the
names of the diagrams, in column two I have some definitions, and I'd like you to match them together.

As a review that particular diagram types of the class diagram, the composite structure, the component diagram,
deployment diagram, object diagram, package diagram, and profile diagram.

And then the definitions are in the right column. The static structure at a particular time. The organization of
physical software components.

Three is the logical groupings and dependencies. Four is the components and structural properties. Five extensions to
the UML metal model. Six internal structure and possible interactions. And the seventh choice is the physical system
resources and how they map to the hardware. Try to match those together.

23 - UML Structure Diagram Quiz Solution
----------------------------------------

Well the class model diagram is the components and their structural properties.

The composite structure diagram is the internal structure and the possible interactions among them.

The component diagram is the organization of the physical software components in the system.

Deployment diagram, that's the physical system resources and how they map the hardware.

The object diagram, that's the static structure at a particular point in time.

The package diagram, well, that's the one with the logical groupings and dependencies.

And finally, the profile diagram, that's extensions to the UML meta model.

Notice that there's a lot of overlap among these terms, which say, that the different diagram types have a lot of
overlapping themselves.

24 - UML Quiz
-------------

Another quick quiz for you on this material is, which of these particular UML structural diagram types could be used to
convey system architecture?

25 - UML Quiz Solution
----------------------

Well, the component diagram, deployment diagram, package diagram, and class diagram, more likely so, some of the other
ones less likely so.

26 - Behavior Diagrams
----------------------

The second main category of UML, Diagram Systems Behavioral Diagrams.

In contrast with the structural diagrams, which describe the system as a whole, the behavioral diagrams are concerned
with a particular instance of behavior of that system. That is, you may have to have multiple sequence diagrams,
multiple collaboration diagrams, to convey, to give an idea of overall system behavior. We're going to now survey these
so you get a feel for what's available to you. Once again, it's unlikely that for a given system you'll use all of these
diagram types.

27 - Use Case Diagram
---------------------

Let's start with use case diagrams. UML does not include OMT's data flow diagram. Instead, it includes Jacobson's use
case diagrams.

A use case is a sequence of user-visible actions along with system responses.

It's a story of how the system deals with a particular user interaction.

Use cases are particularly useful for eliciting requirements.

You lay out different stories of how the system is going to be used, and then explore ramifications. What happens if
something goes wrong, what are some intermediate steps that maybe you didn't make explicit.

28 - Use Case Diagrams
----------------------

Use case diagrams will have two major icons. One are some stick figures and these denote external actors. Typically,
these are system users, but they may also stand for other systems or external devices. In the use case diagram, ovals
are use cases. That is, this is, a use case diagram is not a system story.

It's a description of the set of system stories. Lines in the diagram without annotations indicate participation. That
means that the actor at one end is involved in the use case oval at the other end. There're two annotations available in
use case diagrams. One is the extends annotation and the other is the uses annotation. Extends mean that you have one
story and you'd like to extend it by some other contingencies, essentially getting two for the price of one. The uses
stereotype is like a subroutine or, or function call.

That is, a common piece of behavior that might used by several other use cases.

29 - Example of Use Case Diagrams
---------------------------------

Here's a Use Case diagram. It's got six ovals. It's got four actors. Three of which are human. And one of which is a
separate system. There's annotations on through the lines. One situation involves reusing a particular use case and more
than one other use case. And the other is an extension situation.

30 - Individual Use Cases
-------------------------

1

The use case diagram lays out the set of use cases.

2

But, what's an individual use case?

3

Well, it's a story,

4 and the story can appear as unstructured text or in a tabular form.

5

The unstructured text might tell the story about an individual user

6 named Foster who wants to buy something at Amazon.

7

Foster goes to the Amazon web site,

8

Foster browses until he finds the particular item that he wants,

9 he adds it to the shopping cart, he then goes to the check-out page,

10 he provides information about his billing, and then submits a purchase request.

31 - Tabular Version of Example
-------------------------------

As an alternative formulation of the same story, we could have a table. And typically the table will have three columns.
One column is the agent or actor involved in that particular step of the story, and this is going to be Foster. And it's
going to be the Amazon web server.

The second column indicates the action that's taking place.

This might be the user action it might be the system response and the third column, contains information about any
object, that, is conveyed, in that particular step. So it might be for example credit card information.

Same information in the unstructured version and the tabular version. They're both examples of use cases, and they would
represent the content of one of the ovals used in this diagram.

32 - Context Diagrams
---------------------

The top level dataflow diagram is called the context diagram.

The context diagram has a single oval. Which is the system as a whole.

There are rectangles there that indicate the system actors. And then the lines indicate the flow of data between them.

33 - Example Context Diagrams
-----------------------------

Here's an example context diagram for a system that plays chess with the user.

The rectangle is the human player, the oval is the chess-playing program, and there are three lines between them. One
line indicates that the human player is supplying a move to the chess-playing program. Another line from the chess
playing program back to the user is the computer's move. And the third line indicates that the computer can also put out
a diagram describing the board.

34 - Sequence Diagram
---------------------

Another one of the most popular UML behavior diagrams is the sequence diagram.

This can be used to convey a single use case.

35 - Example Sequence Diagram
-----------------------------

The sequence diagram has columns corresponding to individual participants, usually objects, in the system.

Time marches down the sequence diagram, and horizontal lines between columns indicate the passing of a message from one
object to another object.

Historically, these sequence diagrams evolved from message sequence charts which had been used in the telephony industry
for many years.

These diagrams will be semantically equivalent to communication diagrams which we'll look at in a minute, but from a
slightly different point of view.

36 - Communication Diagram
--------------------------

An alternative view of a use case to that provided by a sequence diagram, would be a communication diagram. In the
communication diagram, it looks like a class model diagram. That is, there are rectangles corresponding to classes, and
there's lines between them. However, in this case the lines correspond to instances of communication, likely operation
calls.

37 - Example Communication Diagram
----------------------------------

Here's the same information that we saw in the sequence diagram.

There are three particular objects. One is a client, one is a transaction and one is a proxy. There are lines between
these particular objects.

Notice that the lines are annotated with numbered message indicators.

The numbers indicate the orders in which those messages take place.

And it's using a kind of, Dewey Decimal notation. So, first step is number 1, then number 2. And then 2.1, 2.2 and then
step 3.

38 - Activity Diagram
---------------------

The sequence diagram and the communication diagram that we've seen aren't particularly designed to deal with
synchronization. UML has a separate diagram, called an activity diagram, designed for this purpose.

In this diagram it's a variant of a state machine in which.

Multiple states may be simultaneously active. That is have their own threads of control. This activity diagrams are
derived from petri nets.

Petri net diagrams that have been around for many years. In the diagrams trans, transitions are typically triggered by
activity completion.

That is you finished with one state. Rather than by external events. You can use these diagrams to model workflows,
process synchronization, and concurrency.

39 - Example Activity Diagram
-----------------------------

Here's an activity diagram you can think of it executing as follows.

Imagine that you had some token that you could lay on top of any of the states on the diagram.

It would come in at the start at the top where there's the filled in circle, and it would move along the horizontal line
to get to the first state.

And then it would move downward to the diamond. At which point it would split.

That is, we'd have two tokens. One going over to the right and one going downward. The one on the right can continue
downward again and finally coming into the diamond near the bottom. The second token from the top goes straight downward
and is thwarted by the horizontal, the heavy, black horizontal bar that's there. This is a synchronization point.

In this case there's nothing to synchronize with, but there are two lines coming out of the bottom. Those two lines will
themselves both have a copy of the token on them, one will go over to the left into the two activities that are there,
the second will go straight downward, and eventually those two paths will merge into the second horizontal line which is
a synchronization point. You can think of those two paths, each having their own tokens, as running independently, and
the horizontal bar at the bottom being a kind of a gate which only opens with both tokens have arrived from the top,
hence synchronizing those activities.

At the point at which the gate opens the two tokens are merged together, the single token goes out of the bottom into
the diamond, and the diamond is essentially a joint point, which, once again, combines the two tokens and proceeds on
then to the last state, and the final state at the very bottom of the screen.

40 - Interaction Overview Diagram
---------------------------------

Now I want to mention two less frequently used UML diagram types.

One is the interaction overview diagram. It's a kind of activity diagram, where the nodes in the diagram correspond to
lower level interaction diagrams which could be of any sort, sequence, communication, interaction overview, and timing
diagrams.

In the diagram example, the term ref denotes a specific interaction occurrence.

41 - Timing Diagram
-------------------

Here's a example of the UML timing diagram.

If your familiar with the design of digital chips, it should look very similar.

In digital chips obviously you're worried about electrical signals arriving at a certain time in response of the silicon
and germanium in that chip, how long it's going to take to happen. If you need, in fact, to diagram out specific timing
of situations in your system you can use the UML timing diagram to do that. Time marches from left to right and arrows
indicate the places where timing has to be synchronized.

42 - State Diagrams
-------------------

Final behavioral diagram I'd like to mention is the state diagram.

This is the most powerful, the most complex of the behavioral diagrams.

They're also sometimes called state charts. These diagrams convey extended finite state machines extended with the
ability to represent aggregation, concurrency, history, broadcasting events and so on. We're going to devote a whole
lesson to them, but let me give you one example diagram here.

43 - Example State Machine Diagrams
-----------------------------------

In this diagram there are two external states. There's an idle state and a maintenance state. And there's transitions
between the two indicating the lines at the top of the screen. The maintenance state itself has sub-state machines
separated by the horizontal dash line. These two machines, one called testing and one called commanding, are running
concurrently. Each of them as a simple machine starting at, at its left in the initial state and moving towards right.
And the commanding machine has a back loop from its command state to its rating state indicating that, that particular
machine can execute several times before finally getting to its final state.

44 - Behavior Diagram Quiz
--------------------------

Here's a quiz for you on the behavioral diagrams. Once again,

I'd like you to match between the diagram type and its definition. As far as diagram types are concerned there on the
left, there's the Activity Diagram, the Sequence Diagram, Communication Diagram, Interaction Overview Diagram,

Timing Diagram, Use Case Diagram, and State Diagram. Definitions, number 1, system functionality provided to external
actors. Possibility 2, dynamic behavior in response to stimuli. 3 is flow of control from activity to activity.

4, synthesis of lower-level Activity Diagrams. 5, interaction of classes in terms of message exchanges. The next one is
object interaction in terms of numbered messages. And the last one is a rotated sequence diagram.

45 - Behavior Diagram Quiz Solution
-----------------------------------

Activity diagram. Well that's the one that's, of course, there's a flow of control from activity to activity. As far as
the sequence diagram, that's an interaction of classes in terms of message exchanges. Communication diagram.

That's object interaction in terms of numbered messages. Interaction overview.

Synthesis of lower level behavioral diagrams. Timing diagram.

Well that's the rotated sequence diagram.

That's also going to have specific time laid out on it. The use case diagram, well that system functionality provided to
its external actors.

And the state diagram, that's dynamic behavior in response to stimuli. [BLANK_AUDIO]

46 - Object Constraint Language
-------------------------------

Well, those are the diagrams types. I just wanted to repeat that no particular system that you develop is going to use
all of them. And, in fact, you're probably going to concentrate on the most popular ones. But they're there in case you
need them.

I also want to mention two other features of UML that don't involve diagrams. [COUGH] One is the Object Constraint
Language and the other one,

I hinted tthat a few minutes ago, the Metamodel. The Object Constraint Language, and we'll devote a whole lesson to
this, is a textual extension to UML's vis, visual notation. Its purpose is to provide a more precise specification, to
be able to specify things which you can't specify in the diagrams themselves.

You can use this textural extension as annotations to class model diagrams, and statechart diagrams. Essentially, the
Object Constraint Language, this first-order predicate logic, plus the ability to navigate around the diagrams and some
collection classes, like sets and, and bags and sequences.

The overall purpose of the Constraint Language, Object Constraint Language, is to be very precise, if you need to, in
the specifications of your system.

47 - Example OCL
----------------

Here's an example of OCL. In this case, we're talking about using the OCL as an extension to a class model diagram.

In the class model diagram, there's an account class. The account class has a deposit operation. That operation takes in
a real number called amount.

The pre keyword indicates the precondition, in this case, that the amount being provided in this deposit is greater than
zero.

The postcondition, indicated by the post keyword is indicating what must be true after the execution of this particular
operation.

In particular, the balance afterwards must be equal to the balance before plus the amount that was deposited.

48 - UML MetaModel
------------------

The second non textual part of UML to be aware of is the Metamodel.

I mentioned this before, it's UML defined in terms of UML. The UML Metamodel, is a UML description of the UML language.
More over, you can extend the Metamodel. You as a designer can extend the Metamodel.

Using UML profiles and we saw the profile diagram.

Those extensions are more stereotypes, more tag values and you can add the constraints. These are constraints on the
diagrams now, not on the models

49 - Class Model of UML MetaModel
---------------------------------

Here's an example of a UML class model diagram describing UML.

You notice there are classes for class, there's also class for attribute, there's a class for association, and there are
associations among these classes.

You should study this diagram, to make sure that you understand how the various pieces that comprise UML [UNKNOWN]
together.

50 - Summary
------------

Bottomline is you can't design an complex system with having, without having some idea of what it's supposed to do.

That is what problems is it trying to solve. Diagrams can help you express that understanding and express your solution
to that problem.

UML provides a wealth of diagram types for you as well as OCL and the meta model. In general, the more precisely you
understand problem the fewer subsequent problems you will have with that system's history.


text:
<?php $this->load->view('partials/header'); ?>

<?php $this->load->view('partials/sidebar'); ?>

            <?php echo $acteur->firstname; ?> <?php echo $acteur->lastname; ?>
             / <?php echo $acteur->age; ?> ans / <?php echo $acteur->city; ?>

                <a href="<?php echo site_url('acteur/lister'); ?>"><button class="btn btn-outline btn-sm btn-labeled btn-primary">Retour</button>

                <img class="img-thumbnail" src="<?php echo $acteur->image; ?>" alt="<?php echo $acteur->firstname; ?> <?php echo $acteur->lastname; ?>">

Biographie :

                        <?php echo substr(strip_tags($acteur->biography), 0, strrpos(substr(strip_tags($acteur->biography), 0, 400), ' ')); ?>
                        <?php
                        if (strlen(strip_tags($acteur->biography)) >=400) { ?>
                            ... en savoir +

                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

 Biographie de l'acteur "<?php echo $acteur->firstname; ?> <?php echo $acteur->lastname; ?>"

                                            <?php echo strip_tags($acteur->biography) ?>

                        <?php } ?>

 Récompenses :

                        <?php echo substr(strip_tags($acteur->recompenses), 0, strrpos(substr(strip_tags($acteur->recompenses), 0, 300), ' ')); ?>
                        <?php
                        if (strlen(strip_tags($acteur->recompenses)) >=300) { ?>
                            ... en savoir +

                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

 Récompenses de l'acteur "<?php echo $acteur->firstname; ?> <?php echo $acteur->lastname; ?>"

                                            <?php echo strip_tags($acteur->recompenses) ?>

                        <?php } elseif (empty(strlen(strip_tags($acteur->recompenses)))) { ?>
                            Aucune récompense
                        <?php } ?>

            Les films joués par <?php echo $acteur->firstname; ?> <?php echo $acteur->lastname; ?>

            <?php
            if (!empty($moviesfromactor)) {

            foreach($moviesfromactor AS $moviefromactor) { ?>

                    <img class="img-responsive" src="<?php echo $moviefromactor->image ?>" alt="<?php echo $moviefromactor->title ?>">
                    <a href="<?php echo site_url('movie/voir/' . $moviefromactor->id); ?>" class="text-bg text-bold"><?php echo $moviefromactor->title; ?>

                    <a href="<?php echo site_url('movie/voir/' . $moviefromactor->id); ?>"><button class="btn btn-flat btn-sm btn-labeled btn-info">voir</button>

            <?php } ?>

            <?php } else { ?>

                            <button type="button" class="close" data-dismiss="alert"></button>
                            Aucun film joué

            <?php  } ?>

<?php $this->load->view('partials/footer'); ?>


text:
![Boilerplates Logo](logo.png "No jQuery")

A ideia inicial é mostrar de forma simples e direta como trabalhar com __javascript__ puro. Sem a necessidade de carregar uma biblioteca como jQuery e etc.

> Use [polyfill](https://cdn.polyfill.io/) para resolver problemas de incompatibilidade de navegodres

> ```html
<script src="https://cdn.polyfill.io/v1/polyfill.min.js"></script>
```

## Guia básico para iniciantes

Se você quiser ajudar a melhorar este guia, escrevendo, corrigindo ou aprimorando a experiência de utilização, por favor, faça um FORK do projeto e mãos à obra.

## Indice

- [ ] [Seletores](https://github.com/renanmpimentel/no-jquery/blob/master/docs/selector.md)
- [ ] Utilidade
- [x] [Ajax](https://github.com/renanmpimentel/no-jquery/blob/master/docs/ajax.md)
- [x] [Efeitos](https://github.com/renanmpimentel/no-jquery/blob/master/docs/effects.md)
- [ ] Elementos
- [ ] Eventos
- [x] [Plugins](https://github.com/renanmpimentel/no-jquery/blob/master/docs/plugins.md)


text:
namespace HomieInternals {
struct ConfigValidationResult {
  bool valid;
  String reason;
};

class Validation {
 public:
  static ConfigValidationResult validateConfig(const JsonObject object);

 private:
  static ConfigValidationResult _validateConfigRoot(const JsonObject object);
  static ConfigValidationResult _validateConfigWifi(const JsonObject object);
  static ConfigValidationResult _validateConfigMqtt(const JsonObject object);
  static ConfigValidationResult _validateConfigOta(const JsonObject object);
  static ConfigValidationResult _validateConfigSettings(const JsonObject object);
};
}  // namespace HomieInternals


text:
/* --------------------------------------------------------------------------
 *    Name: image-observer.c
 * Purpose: Informs clients when Image objects change
 * ----------------------------------------------------------------------- */

#include <stdlib.h>

#include "fortify/fortify.h"

#include "appengine/graphics/image.h"

#include "appengine/graphics/image-observer.h"

/* ----------------------------------------------------------------------- */

// FIXME: Used linked list library?
/* (image,callback,opaque) pairs are unique to an element. */
typedef struct element
{
  struct element         *next;
  image_t                *image; /* NULL => interested in all images */
  imageobserver_callback *callback;
  void                   *opaque;
  int                     nrefs;
}
element;

/* ----------------------------------------------------------------------- */

/* There's just one list of observers which is scanned when an event
 * arrives. */
static element *first = NULL;

/* ----------------------------------------------------------------------- */

int imageobserver_register(image_t                *image,
                           imageobserver_callback *callback,
                           void                   *opaque)
{
  element *e;

  /* Find existing matching element, if any */

  for (e = first; e != NULL; e = e->next)
    if (e->image == image && e->callback == callback && e->opaque == opaque)
      break;

  if (e) /* exists */
  {
    e->nrefs++;
    return 0; /* ok */
  }

  e = malloc(sizeof(*e));
  if (e == NULL)
    return 1; /* oom */

  e->image    = image;
  e->callback = callback;
  e->opaque   = opaque;
  e->nrefs    = 1;

  /* Insert at the start of the list */

  e->next     = first;
  first       = e;

  return 0; /* ok */
}

int imageobserver_deregister(image_t                *image,
                             imageobserver_callback *callback,
                             void                   *opaque)
{
  element *prev;
  element *e;
  element *next;

  /* Find existing matching element, if any */

  prev = NULL;
  next = NULL; /* shuts the compiler up - have I missed something here? */
  for (e = first; e != NULL; e = next)
  {
    next = e->next;

    if (e->image == image && e->callback == callback && e->opaque == opaque)
      break;

    prev = e;
  }

  /* {prev} -> {e} -> {next} */

  if (e == NULL)
    return 0; /* ok */

  if (--e->nrefs)
    return 0; /* there are more references remaining */

  if (prev == NULL)
    first = next;
  else
    prev->next = next;

  free(e);

  return 0; /* ok */
}

int imageobserver_register_greedy(imageobserver_callback *callback,
                                  void                   *opaque)
{
  element *e;

  /* Find existing matching element, if any */

  for (e = first; e != NULL; e = e->next)
    if (e->callback == callback && e->opaque == opaque)
      break;

  if (e) /* exists */
  {
    e->nrefs++;
    return 0; /* ok */
  }

  e = malloc(sizeof(*e));
  if (e == NULL)
    return 1; /* oom */

  e->image    = NULL;
  e->callback = callback;
  e->opaque   = opaque;
  e->nrefs    = 1;

  /* Insert at the start of the list */

  e->next     = first;
  first       = e;

  return 0; /* ok */
}

int imageobserver_deregister_greedy(imageobserver_callback *callback,
                                    void                   *opaque)
{
  element *prev;
  element *e;
  element *next;

  /* Find existing matching element, if any */

  prev = NULL;
  next = NULL; /* shuts the compiler up - have I missed something here? */
  for (e = first; e != NULL; e = next)
  {
    next = e->next;

    if (e->callback == callback && e->opaque == opaque)
      break;

    prev = e;
  }

  /* {prev} -> {e} -> {next} */

  if (e == NULL)
    return 0; /* ok */

  if (--e->nrefs)
    return 0; /* there are more references remaining */

  if (prev == NULL)
    first = next;
  else
    prev->next = next;

  free(e);

  return 0; /* ok */
}

int imageobserver_event(image_t              *image,
                        imageobserver_change  change,
                        imageobserver_data   *data)
{
  element *e;
  element *next;

  /* Event handlers can deregister whilst the list is being walked, so be
   * careful to always take the next pointer. Of course, if they happen to
   * delete any 'future' handlers too then we'll explode.
   */

  for (e = first; e != NULL; e = next)
  {
    next = e->next;

    if (e->image == NULL || e->image == image)
      e->callback(image, change, data, e->opaque);
  }

  return 0; /* ok */
}


text:
/**
 * @jsx React.DOM
 */

var React = require('../public/vendor/react'),
    MonsterForm = require('./monsterForm'),
    MonsterList = require('./monsterList');

var monsters = [
  {name: 'Goblin', hp: '8', ac: '15', damage: '1d6+2'},
  {name: 'Bug Bear', hp: '15', ac: '18', damage: '1d10+4'},
];

var App = React.createClass({

  getInitialState: function () {
    return {
      monsters: monsters
    }
  },

  addMonster: function (monster) {
    monsters.push(monster);
    this.setState({
      monsters: monsters
    });
  },

  render: function() {
    return (

{this.props.title}

Create a Monster

          <MonsterForm addMonster={this.addMonster}/>

Current Monsters

          <MonsterList monsters={this.state.monsters}/>

    )
  }
});

React.renderComponent(
  <App title="Monster Vault" />,
  document.getElementById('wrapper')
);


text:
import * as fs from "fs"
import * as path from "path"
import * as resolve from "resolve"
import * as through from "through2"
import * as gutil from "gulp-util"
import {argv} from "yargs"
const rootRequire = require("root-require") // XXX: no typings
import * as paths from "./paths"

const pkg = rootRequire("./package.json")

type Bundle = {pipeline: any}
export type Labels = {[key: string]: string}

function customLabeler(bundle: Bundle, parentLabels: Labels, fn: (row: any) => string): Labels {
  const labels: Labels = {}

  const namer = through.obj(function(this: any, row, _enc, next) {
    labels[row.id] = fn(row)
    this.push(row)
    next()
  })

  const labeler = through.obj(function(this: any, row, _enc, next) {
    row.id = labels[row.id]

    const opts = {
      basedir: path.dirname(row.file),
      extensions: ['.js', '.coffee'],
      paths: ['./node_modules', paths.buildDir.jsTree],
    }

    for (const name in row.deps) {
      let dep = row.deps[name]

      if (dep == null) {
        dep = pkg.browser[name]

        if (dep != null)
          dep = path.resolve(dep)
        else
          dep = resolve.sync(name, opts)
      }

      row.deps[name] = labels[dep] || parentLabels[dep]
    }

    this.push(row)
    next()
  })

  bundle.pipeline.get('deps').push(namer)
  bundle.pipeline.get('label').splice(0, 1, labeler)

  return labels
}

export function namedLabeler(bundle: Bundle, parentLabels: Labels) {
  return customLabeler(bundle, parentLabels, (row) => {
    const cwd = process.cwd()
    const revModMap: {[key: string]: string} = {}
    const depModMap: {[key: string]: string} = {}

    for (const key in pkg.browser) {
      const val = pkg.browser[key]
      revModMap[path.resolve(val)] = key
    }

    for (const dep in pkg.dependencies) {
      const depPkg = rootRequire(path.join("node_modules", dep, "package.json"))
      if (depPkg.main != null) {
        let depPath = path.resolve(path.join("node_modules", dep, depPkg.main))
        if (!fs.existsSync(depPath)) {
          depPath = `${depPath}.js`
        }
        depModMap[depPath] = dep
      }
    }

    const modPath = row.id
    let modName  = revModMap[modPath]

    if (modName == null)
      modName = depModMap[modPath]

    if (modName == null)
      modName = path
        .relative(cwd, modPath)
        .replace(/\.(coffee|js)$/, "")
        .split(path.sep).join("/")
        .replace(/^(src\/(coffee|vendor)|node_modules|build\/js\/tree)\//, "")

    if (modName.indexOf("process/browser") != -1)
      modName = "_process"

    if (argv.verbose)
      gutil.log(`Processing ${modName}`)

    return modName
  })
}


text:
YUI.add('gallery-history-lite', function(Y) {

/**
 * The History Lite utility is similar in purpose to the YUI Browser History
 * utility, but with a more flexible API, no initialization or markup
 * requirements, limited IE6/7 support, and a much smaller footprint.
 *
 * @module gallery-history-lite
 */

/**
 * @class HistoryLite
 * @static
 */

var w       = Y.config.win,
    docMode = Y.config.doc.documentMode,
    encode  = encodeURIComponent,
    loc     = w.location,

    // IE8 supports the hashchange event, but only in IE8 Standards
    // Mode. However, IE8 in IE7 compatibility mode still defines the
    // event (but never fires it), so we can't just sniff for the event. We
    // also can't just sniff for IE8, since other browsers will eventually
    // support this event as well. Thanks Microsoft!
    supportsHashChange = w.onhashchange !== undefined &&
            (docMode === undefined || docMode > 7),

    lastHash,
    pollInterval,
    HistoryLite,

    /**
     * Fired when the history state changes.
     *
     * @event history-lite:change
     * @param {EventFacade} Event facade with the following additional
     *     properties:
     *

     *
changed

     *

     *     name:value pairs of history parameters that have been added or
     *     changed
     *

     *
removed

     *

     *     name:value pairs of history parameters that have been removed
     *     (values are the old values)
     *

     *

     */
    EV_HISTORY_CHANGE = 'history-lite:change';

// -- Private Methods ------------------------------------------------------

/**
 * Creates a hash string from the specified object of name/value parameter
 * pairs.
 *
 * @method createHash
 * @param {Object} params name/value parameter pairs
 * @return {String} hash string
 * @private
 */
function createHash(params) {
    var hash = [];

    Y.each(params, function (value, name) {
        if (Y.Lang.isValue(value)) {
            hash.push(encode(name) + '=' + encode(value));
        }
    });

    return '#' + hash.join('&');
}

/**
 * Wrapper around decodeURIComponent() that also converts +
 * chars into spaces.
 *
 * @method decode
 * @param {String} string string to decode
 * @return {String} decoded string
 * @private
 */
function decode(string) {
    return decodeURIComponent(string.replace(/\+/g, ' '));
}

/**
 * Gets the current URL hash.
 *
 * @method getHash
 * @return {String}
 * @private
 */
var getHash;

if (Y.UA.gecko) {
    // We branch at runtime for Gecko since window.location.hash in Gecko
    // returns a decoded string, and we want all encoding untouched.
    getHash = function () {
        var matches = /#.*$/.exec(loc.href);
        return matches && matches[0] ? matches[0] : '';
    };
} else {
    getHash = function () {
        return loc.hash;
    };
}

/**
 * Sets the browser's location hash to the specified string.
 *
 * @method setHash
 * @param {String} hash
 * @private
 */
function setHash(hash) {
    loc.hash = hash;
}

// -- Private Event Handlers -----------------------------------------------

/**
 * Handles changes to the location hash and fires the history-lite:change
 * event if necessary.
 *
 * @method handleHashChange
 * @param {String} newHash new hash value
 * @private
 */
function handleHashChange(newHash) {
    var lastParsed    = HistoryLite.parseQuery(lastHash),
        newParsed     = HistoryLite.parseQuery(newHash),
        changedParams = {},
        removedParams = {},
        isChanged;

    // Figure out what changed.
    Y.each(newParsed, function (value, name) {
        if (value !== lastParsed[name]) {
            changedParams[name] = value;
            isChanged = true;
        }
    });

    // Figure out what was removed.
    Y.each(lastParsed, function (value, name) {
        if (!newParsed.hasOwnProperty(name)) {
            removedParams[name] = value;
            isChanged = true;
        }
    });

    if (isChanged) {
        HistoryLite.fire(EV_HISTORY_CHANGE, {
            changed: changedParams,
            newVal : newHash,
            prevVal: lastHash,
            removed: removedParams
        });
    }
}

/**
 * Default handler for the history-lite:change event. Stores the new hash
 * for later comparison and event triggering.
 *
 * @method defaultChangeHandler
 * @param {EventFacade} e
 * @private
 */
function defaultChangeHandler(e) {
    lastHash = e.newVal;
}

Y.HistoryLite = HistoryLite = {
    // -- Public Methods ---------------------------------------------------

    /**
     * Adds a history entry with changes to the specified parameters. Any
     * parameters with a null or undefined value
     * will be removed from the new history entry.
     *
     * @method add
     * @param {String|Object} params query string, hash string, or object
     *     containing name/value parameter pairs
     * @param {Boolean} silent if true, a history change event will
     *     not be fired for this change
     */
    add: function (params, silent) {
        var newHash = createHash(Y.merge(HistoryLite.parseQuery(getHash()),
                Y.Lang.isString(params) ? HistoryLite.parseQuery(params) : params));

        if (silent) {
            defaultChangeHandler({newVal: newHash});
        }

        setHash(newHash);
    },

    /**
     * Gets the current value of the specified history parameter, or an
     * object of name/value pairs for all current values if no parameter
     * name is specified.
     *
     * @method get
     * @param {String} name (optional) parameter name
     * @return {Object|mixed}
     */
    get: function (name) {
        var params = HistoryLite.parseQuery(getHash());
        return name ? params[name] : params;
    },

    /**
     * Parses a query string or hash string into an object of name/value
     * parameter pairs.
     *
     * @method parseQuery
     * @param {String} query query string or hash string
     * @return {Object}
     */
    parseQuery: function (query) {
        var matches = query.match(/([^\?#&]+)=([^&]+)/g) || [],
            params  = {},
            i, len, param;

        for (i = 0, len = matches.length; i < len; ++i) {
            param = matches[i].split('=');
            params[decode(param[0])] = decode(param[1]);
        }

        return params;
    }
};

// Make HistoryLite an event target and publish the change event.
Y.augment(HistoryLite, Y.EventTarget, true, null, {emitFacade: true});

HistoryLite.publish(EV_HISTORY_CHANGE, {
    broadcast: 2,
    defaultFn: defaultChangeHandler
});

// Start watching for hash changes.
lastHash = getHash();

if (supportsHashChange) {
    Y.Node.DOM_EVENTS.hashchange = true;

    Y.on('hashchange', function () {
        handleHashChange(getHash());
    }, w);
} else {
    pollInterval = pollInterval || Y.later(50, HistoryLite, function () {
        var hash = getHash();

        if (hash !== lastHash) {
            handleHashChange(hash);
        }
    }, null, true);
}

}, 'gallery-2009.12.15-22' ,{requires:['event-custom','event-custom-complex','node']});